diff --git a/.gitignore b/.gitignore index a6c50eec..fa98e411 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ tests/simulation.ini # bifacial_radiance temp folder bifacial_radiance/TEMP/ +TEMP/ # bifacial_radiance other bifacial_radiance/data/source/ diff --git a/bifacial_radiance/main.py b/bifacial_radiance/main.py index 85a1e625..c6f391b3 100644 --- a/bifacial_radiance/main.py +++ b/bifacial_radiance/main.py @@ -379,7 +379,7 @@ def __init__(self, name=None, path=None, hpc=False): #self.nMods = None # number of modules per row #self.nRows = None # number of rows per scene self.hpc = hpc # HPC simulation is being run. Some read/write functions are modified - self.CompiledResults = None # DataFrame of cumulative results, output from self.calculateResults1axis() + self.CompiledResults = None # DataFrame of cumulative results, output from self.calculatePerformance1axis() now = datetime.datetime.now() self.nowstr = str(now.date())+'_'+str(now.hour)+str(now.minute)+str(now.second) @@ -2991,7 +2991,7 @@ def analysis1axisground(self, trackerdict=None, singleindex=None, accuracy='low' return trackerdict - def calculateResults1axis(self, trackerdict=None, module=None, + def calculatePerformance1axis(self, trackerdict=None, module=None, CECMod2=None, agriPV=False): ''' Loops through all results in trackerdict and calculates performance, @@ -3075,7 +3075,7 @@ def _printRow(analysisobj, key): module_local = trackerdict[key]['scenes'][analysis.sceneNum].module else: module_local = module - power_data = analysis.calc_performance(meteo_data=meteo_data, + power_data = analysis.calculatePerformance(meteo_data=meteo_data, module=module_local, cumulativesky=self.cumulativesky, CECMod2=CECMod2, @@ -3103,7 +3103,7 @@ def _printRow(analysisobj, key): module_local = trackerdict[keys_all[0]]['scenes'][analysis.sceneNum].module else: module_local = module - self.CompiledResults = performance.calculateResultsGencumsky1axis(results=self.CompiledResults, + self.CompiledResults = performance.calculatePerformanceGencumsky(results=self.CompiledResults, bifacialityfactor=module_local.bifi, fillcleanedSensors=True, agriPV=False) @@ -4349,7 +4349,7 @@ def __init__(self, octfile=None, name=None, hpc=False): self.modWanted = None self.rowWanted = None self.sceneNum = 0 # should this be 0 or None by default?? - self.power_data = None # results from self.calc_performance() stored here + self.power_data = None # results from self.calculatePerformance() stored here @@ -5400,10 +5400,10 @@ def analysis(self, octfile, name, frontscan, backscan=None, return frontDict, backDict - def calc_performance(self, meteo_data, cumulativesky, module, + def calculatePerformance(self, meteo_data, cumulativesky, module, CECMod2=None, agriPV=False): """ - For a given AnalysisObj, use performance.calculateResults to calculate performance, + For a given AnalysisObj, use performance.calculatePerformance to calculate performance, considering electrical mismatch, using PVLib. Cell temperature is calculated Parameters @@ -5443,17 +5443,17 @@ def calc_performance(self, meteo_data, cumulativesky, module, # If CECMod details aren't passed, use a default Prism Solar value. #if type(module) is not ModuleObj: # not working for some reason.. if str(type(module)) != "": - raise TypeError('ModuleObj input required for AnalysisObj.calc_performance. '+\ + raise TypeError('ModuleObj input required for AnalysisObj.calculatePerformance. '+\ f'type passed: {type(module)}') - self.power_data = performance.calculateResults(module=module, results=self.getResults(), + self.power_data = performance.calculatePerformance(module=module, results=self.getResults(), CECMod2=CECMod2, agriPV=agriPV, **meteo_data) else: # TODO HERE: SUM all keys for rows that have the same rowWanted/modWanted - self.power_data = performance.calculateResultsGencumsky1axis(results=self.getResults(), + self.power_data = performance.calculatePerformanceGencumsky(results=self.getResults(), agriPV=agriPV) #results.to_csv(os.path.join('results', 'Cumulative_Results.csv')) diff --git a/bifacial_radiance/modelchain.py b/bifacial_radiance/modelchain.py index 3e5e1300..381035f8 100644 --- a/bifacial_radiance/modelchain.py +++ b/bifacial_radiance/modelchain.py @@ -241,14 +241,7 @@ def runModelChain(simulationParamsDict, sceneParamsDict, timeControlParamsDict=N print("\n--> Calculating Performance values") - """ - #CEC Module - if CECModParamsDict: - CECMod = pd.DataFrame(CECModParamsDict, index=[0]) - else: - CECMod = None - """ - demo.calculateResults1axis() + demo.calculatePerformance1axis() demo.exportTrackerDict(savefile=os.path.join('results','Final_Results.csv'),reindex=False) # Save example image files diff --git a/bifacial_radiance/module.py b/bifacial_radiance/module.py index 07e38c69..e171a0ec 100644 --- a/bifacial_radiance/module.py +++ b/bifacial_radiance/module.py @@ -54,7 +54,7 @@ def __init__(self, name=None, x=None, y=None, z=None, bifi=1, modulefile=None, y : numeric Length of module (meters) bifi : numeric - Bifaciality of the panel (used for CalculatePerformance). Between 0 (monofacial) + Bifaciality of the panel (used for calculatePerformance). Between 0 (monofacial) and 1, default 1. modulefile : str Existing radfile location in \objects. Otherwise a default value is used diff --git a/bifacial_radiance/performance.py b/bifacial_radiance/performance.py index e94db0c5..1e35f57e 100644 --- a/bifacial_radiance/performance.py +++ b/bifacial_radiance/performance.py @@ -7,88 +7,8 @@ import pvlib import pandas as pd +import numpy as np -""" -def calculatePerformance(effective_irradiance, CECMod, temp_air=None, - wind_speed=1, temp_cell=None, glassglass=False): - ''' - DEPRECATED IN FAVOR OF `module.calculatePerformance` - The module parameters are given at the reference condition. - Use pvlib.pvsystem.calcparams_cec() to generate the five SDM - parameters at your desired irradiance and temperature to use - with pvlib.pvsystem.singlediode() to calculate the IV curve information.: - - Inputs - ------ - effective_irradiance : numeric - Dataframe or single value. Must be same length as temp_cell - CECMod : Dict - Dictionary with CEC Module Parameters for the module selected. Must - contain at minimum alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, - R_s, Adjust - temp_air : numeric - Ambient temperature in Celsius. Dataframe or single value to calculate. - Must be same length as effective_irradiance. Default = 20C - wind_speed : numeric - Wind speed at a height of 10 meters [m/s]. Default = 1 m/s - temp_cell : numeric - Back of module temperature. If provided, overrides temp_air and - wind_speed calculation. Default = None - glassglass : boolean - If module is glass-glass package (vs glass-polymer) to select correct - thermal coefficients for module temperature calculation - - ''' - - from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS - - # Setting temperature_model_parameters - if glassglass: - temp_model_params = ( - TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']) - else: - temp_model_params = ( - TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer']) - - if temp_cell is None: - if temp_air is None: - temp_air = 25 # STC - - temp_cell = pvlib.temperature.sapm_cell(effective_irradiance, temp_air, wind_speed, - temp_model_params['a'], temp_model_params['b'], temp_model_params['deltaT']) - - if isinstance(CECMod, pd.DataFrame): - #CECMod.to_pickle("CECMod.pkl") - if len(CECMod) == 1: - CECMod1 = CECMod.iloc[0] - else: - print("More than one Module passed. Error, using 1st one") - CECMod1 = CECMod.iloc[0] - else: - CECMod1 = CECMod - - IL, I0, Rs, Rsh, nNsVth = pvlib.pvsystem.calcparams_cec( - effective_irradiance=effective_irradiance, - temp_cell=temp_cell, - alpha_sc=float(CECMod1.alpha_sc), - a_ref=float(CECMod1.a_ref), - I_L_ref=float(CECMod1.I_L_ref), - I_o_ref=float(CECMod1.I_o_ref), - R_sh_ref=float(CECMod1.R_sh_ref), - R_s=float(CECMod1.R_s), - Adjust=float(CECMod1.Adjust) - ) - - IVcurve_info = pvlib.pvsystem.singlediode( - photocurrent=IL, - saturation_current=I0, - resistance_series=Rs, - resistance_shunt=Rsh, - nNsVth=nNsVth - ) - - return IVcurve_info['p_mp'] -""" def MBD(meas, model): """ @@ -111,7 +31,7 @@ def MBD(meas, model): data. """ - import pandas as pd + df = pd.DataFrame({'model': model, 'meas': meas}) # rudimentary filtering of modeled irradiance df = df.dropna() @@ -144,8 +64,8 @@ def RMSE(meas, model): """ - import numpy as np - import pandas as pd + + df = pd.DataFrame({'model': model, 'meas': meas}) df = df.dropna() minirr = meas.min() @@ -178,7 +98,6 @@ def MBD_abs(meas, model): """ - import pandas as pd df = pd.DataFrame({'model': model, 'meas': meas}) # rudimentary filtering of modeled irradiance df = df.dropna() @@ -212,8 +131,7 @@ def RMSE_abs(meas, model): """ # - import numpy as np - import pandas as pd + df = pd.DataFrame({'model': model, 'meas': meas}) df = df.dropna() minirr = meas.min() @@ -226,7 +144,6 @@ def RMSE_abs(meas, model): def _cleanDataFrameResults(mattype, rearMat, Wm2Front, Wm2Back, fillcleanedSensors=False, agriPV=False): - import numpy as np if agriPV: matchers = ['sky', 'pole', 'tube', 'bar', '3267', '1540'] @@ -254,7 +171,7 @@ def _cleanDataFrameResults(mattype, rearMat, Wm2Front, Wm2Back, return filledFront, filledBack -def calculateResults(module, csvfile=None, results=None, +def calculatePerformance(module, csvfile=None, results=None, temp_air=None, wind_speed=1, temp_cell=None, CECMod2=None, fillcleanedSensors=False, agriPV=False, **kwargs): @@ -309,9 +226,6 @@ def calculateResults(module, csvfile=None, results=None, from bifacial_radiance import mismatch - import pandas as pd - - dfst = pd.DataFrame() if csvfile is not None: @@ -380,7 +294,7 @@ def calculateResults(module, csvfile=None, results=None, dfst['BGG'] = dfst['Grear_mean']*100*module.bifi/dfst['Gfront_mean'] dfst['BGE'] = ((dfst['Pout_raw'] - dfst['Pout_Gfront']) * 100 / dfst['Pout_Gfront']) - dfst['Mismatch'] = mismatch.mismatch_fit3(POA.T) + dfst['Mismatch'] = mismatch.mismatch_fit2(POA.T) # value in percentage [%] dfst['Pout'] = dfst['Pout_raw']*(1-dfst['Mismatch']/100) dfst['Wind Speed'] = wind_speed if "dni" in kwargs: @@ -394,7 +308,7 @@ def calculateResults(module, csvfile=None, results=None, return dfst -def calculateResultsGencumsky1axis(csvfile=None, results=None, +def calculatePerformanceGencumsky(csvfile=None, results=None, bifacialityfactor=1.0, fillcleanedSensors=True, agriPV=False): ''' @@ -467,7 +381,7 @@ def calculateResultsGencumsky1axis(csvfile=None, results=None, else: - print("Data or file not passed. Ending calculateResults") + print("Data or file not passed. Ending calculatePerformanceGencumsky") return # Data gets cleaned but need to maintain same number of sensors diff --git a/docs/sphinx/source/whatsnew/v0.5.0.rst b/docs/sphinx/source/whatsnew/v0.5.0.rst index 945a49c8..b75f2008 100644 --- a/docs/sphinx/source/whatsnew/v0.5.0.rst +++ b/docs/sphinx/source/whatsnew/v0.5.0.rst @@ -56,7 +56,8 @@ Enhancements ~~~~~~~~~~~~ * :py:class:`~bifacial_radiance.RadianceObj` and :py:class:`~bifacial_radiance.GroundObj` and :py:class:`~bifacial_radiance.MetObj` now have `self.columns` and `self.methods` introspection to list data columsn and methods available. (:pull:`495`) * multiple sceneObjects are tracked by the RadianceObj now. New function :py:class:`~bifacial_radiance.RadianceObj.sceneNames` will return the list of scenes being tracked. (:pull:`487`) -* New function :py:class:`~bifacial_radiance.AnalysisObj.calc_performance` to call CEC performance calculation from within the AnalysisObj +* New function :py:class:`~bifacial_radiance.AnalysisObj.calculatePerformance` and :py:class:`~bifacial_radiance.ModuleObj.calculatePerformance` to call CEC performance calculation from within the AnalysisObj +* New function :py:class:`~bifacial_radiance.RadianceObj.calculatePerformance1axis` to call CEC performance calculation for every entry of a trackerdict * :py:class:`~bifacial_radiance.AnalysisObj` has new attribute `power_data` to store CEC performance data * :py:class:`~bifacial_radiance.AnalysisObj` has new function `getResults` to bundle and return irradiance scan results in dataframe form. * :py:class:`~bifacial_radiance.AnalysisObj` has new function `groundAnalysis` to run a ground scan under the row-row pitch of the scene to support AgriPV applications. (:pull:`499`) diff --git a/docs/tutorials/21 - Weather to Module Performance.ipynb b/docs/tutorials/21 - Weather to Module Performance.ipynb index 77801e42..6c98ddb3 100644 --- a/docs/tutorials/21 - Weather to Module Performance.ipynb +++ b/docs/tutorials/21 - Weather to Module Performance.ipynb @@ -246,7 +246,9 @@ "text": [ "\n", "Module Name: test\n", - "Module test updated in module.json\n" + "Module test updated in module.json\n", + "Pre-existing .rad file objects\\test.rad will be overwritten\n", + "\n" ] } ], @@ -265,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "id": "10e35e7c", "metadata": {}, "outputs": [ @@ -299,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "29c4a111", "metadata": {}, "outputs": [ @@ -317,19 +319,19 @@ "Linescan in process: 1axis_2021-01-13_1100_Scene0_Row1_Module3_Front\n", "Linescan in process: 1axis_2021-01-13_1100_Scene0_Row1_Module3_Back\n", "Saved: results\\irr_1axis_2021-01-13_1100_Scene0_Row1_Module3.csv\n", - "Index: 2021-01-13_1100. Wm2Front: 254.2473666666667. Wm2Back: 39.878330000000005\n", + "Index: 2021-01-13_1100. Wm2Front: 254.07483333333334. Wm2Back: 39.88008333333333\n", "Linescan in process: 1axis_2021-01-13_1200_Scene0_Row1_Module3_Front\n", "Linescan in process: 1axis_2021-01-13_1200_Scene0_Row1_Module3_Back\n", "Saved: results\\irr_1axis_2021-01-13_1200_Scene0_Row1_Module3.csv\n", - "Index: 2021-01-13_1200. Wm2Front: 253.52549999999997. Wm2Back: 38.10270333333333\n", + "Index: 2021-01-13_1200. Wm2Front: 253.1335. Wm2Back: 37.80824666666667\n", "Linescan in process: 1axis_2021-01-13_1100_Scene1_Row1_Module1_Front\n", "Linescan in process: 1axis_2021-01-13_1100_Scene1_Row1_Module1_Back\n", "Saved: results\\irr_1axis_2021-01-13_1100_Scene1_Row1_Module1.csv\n", - "Index: 2021-01-13_1100. Wm2Front: 253.4396. Wm2Back: 52.886446666666664\n", + "Index: 2021-01-13_1100. Wm2Front: 253.54506666666668. Wm2Back: 52.93373666666667\n", "Linescan in process: 1axis_2021-01-13_1200_Scene1_Row1_Module1_Front\n", "Linescan in process: 1axis_2021-01-13_1200_Scene1_Row1_Module1_Back\n", "Saved: results\\irr_1axis_2021-01-13_1200_Scene1_Row1_Module1.csv\n", - "Index: 2021-01-13_1200. Wm2Front: 252.89083333333335. Wm2Back: 50.851236666666665\n" + "Index: 2021-01-13_1200. Wm2Front: 252.43426666666667. Wm2Back: 50.808596666666666\n" ] } ], @@ -350,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "id": "7bbf6db6", "metadata": {}, "outputs": [ @@ -390,16 +392,16 @@ "3 [a0.0.a0.test.6457, a0.0.a0.test.6457, a0.0.a0... \n", "\n", " rearMat ... Pout_raw \\\n", - "0 [a2.0.a0.test-module.2310, a2.0.a0.test-module... ... 91.741892 \n", - "1 [a0.0.a0.test.2310, a0.0.a0.test.2310, a0.0.a0... ... 123.689074 \n", - "2 [a2.0.a0.test-module.2310, a2.0.a0.test-module... ... 90.335684 \n", - "3 [a0.0.a0.test.2310, a0.0.a0.test.2310, a0.0.a0... ... 121.962507 \n", + "0 [a2.0.a0.test-module.2310, a2.0.a0.test-module... ... 91.687503 \n", + "1 [a0.0.a0.test.2310, a0.0.a0.test.2310, a0.0.a0... ... 123.748694 \n", + "2 [a2.0.a0.test-module.2310, a2.0.a0.test-module... ... 90.128038 \n", + "3 [a0.0.a0.test.2310, a0.0.a0.test.2310, a0.0.a0... ... 121.759562 \n", "\n", " Pout_Gfront BGG BGE Mismatch Pout Wind Speed DNI \\\n", - "0 80.304410 14.116369 14.242658 0.017150 91.726159 3.8 144 \n", - "1 106.026011 16.693980 16.659179 0.003706 123.684491 3.8 144 \n", - "2 79.481255 13.526226 13.656590 0.007205 90.329175 3.9 97 \n", - "3 105.082904 16.086384 16.063129 0.002439 121.959532 3.9 97 \n", + "0 80.249342 14.126576 14.253276 0.031298 91.658807 3.8 144 \n", + "1 106.070184 16.701958 16.666804 0.009121 123.737407 3.8 144 \n", + "2 79.356997 13.442481 13.572895 0.019082 90.110840 3.9 97 \n", + "3 104.892870 16.101965 16.079922 0.006176 121.752043 3.9 97 \n", "\n", " DHI GHI \n", "0 149 211 \n", @@ -415,14 +417,13 @@ "#print(trackerdict)\n", "#tracker_dict_sample = {'2021-01-13_1100':trackerdict['2021-01-13_1100']}\n", "#eff_irr = tracker_dict_sample['Wm2Front'] + tracker_dict_sample['Wm2Back']\n", - "Compiled_Results = demo.calculateResults1axis()\n", - "print(Compiled_Results)\n", - "#calculatePerformanceModule -> calculcateResults()" + "Compiled_Results = demo.calculatePerformance1axis()\n", + "print(Compiled_Results)\n" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "id": "fe18ea62", "metadata": { "scrolled": true @@ -492,21 +493,21 @@ " 3\n", " 0\n", " 1axis_2021-01-13_1100_Scene0\n", - " [253.6687 254.6041 254.4693]\n", - " [39.11227 39.6468 40.87592]\n", + " [253.4203 254.3263 254.4779]\n", + " [39.27898 39.55687 40.8044 ]\n", " 144\n", " 149\n", " ...\n", " -44.14\n", " 44.14\n", " 90.0\n", - " 290.137864\n", - " 254.247367\n", - " 39.878330\n", - " 91.741892\n", - " 0.017150\n", - " 91.726159\n", - " 80.304410\n", + " 289.966908\n", + " 254.074833\n", + " 39.880083\n", + " 91.687503\n", + " 0.031298\n", + " 91.658807\n", + " 80.249342\n", " \n", " \n", " 1\n", @@ -516,21 +517,21 @@ " 1\n", " 1\n", " 1axis_2021-01-13_1100_Scene1\n", - " [252.9754 253.764 253.5794]\n", - " [52.61953 53.14808 52.89173]\n", + " [253.0821 253.8797 253.6734]\n", + " [52.66748 53.1945 52.93923]\n", " 144\n", " 149\n", " ...\n", " -44.14\n", " 44.14\n", " 90.0\n", - " 295.748757\n", - " 253.439600\n", - " 52.886447\n", - " 123.689074\n", - " 0.003706\n", - " 123.684491\n", - " 106.026011\n", + " 295.892056\n", + " 253.545067\n", + " 52.933737\n", + " 123.748694\n", + " 0.009121\n", + " 123.737407\n", + " 106.070184\n", " \n", " \n", " 2\n", @@ -540,21 +541,21 @@ " 3\n", " 0\n", " 1axis_2021-01-13_1200_Scene0\n", - " [253.6684 253.7525 253.1556]\n", - " [38.08933 37.6907 38.52808]\n", + " [253.0991 253.2366 253.0648]\n", + " [37.59769 37.44495 38.3821 ]\n", " 97\n", " 200\n", " ...\n", " -21.20\n", " 21.20\n", " 90.0\n", - " 287.817933\n", - " 253.525500\n", - " 38.102703\n", - " 90.335684\n", - " 0.007205\n", - " 90.329175\n", - " 79.481255\n", + " 287.160922\n", + " 253.133500\n", + " 37.808247\n", + " 90.128038\n", + " 0.019082\n", + " 90.110840\n", + " 79.356997\n", " \n", " \n", " 3\n", @@ -564,21 +565,21 @@ " 1\n", " 1\n", " 1axis_2021-01-13_1200_Scene1\n", - " [252.7885 252.8908 252.9932]\n", - " [50.66072 51.01453 50.87846]\n", + " [252.2994 252.4342 252.5692]\n", + " [50.62335 50.9784 50.82404]\n", " 97\n", " 200\n", " ...\n", " -21.20\n", " 21.20\n", " 90.0\n", - " 293.571823\n", - " 252.890833\n", - " 50.851237\n", - " 121.962507\n", - " 0.002439\n", - " 121.959532\n", - " 105.082904\n", + " 293.081144\n", + " 252.434267\n", + " 50.808597\n", + " 121.759562\n", + " 0.006176\n", + " 121.752043\n", + " 104.892870\n", " \n", " \n", "\n", @@ -593,33 +594,33 @@ "3 3 2021-01-13_1200 1 1 1 \n", "\n", " name Wm2Front \\\n", - "0 1axis_2021-01-13_1100_Scene0 [253.6687 254.6041 254.4693] \n", - "1 1axis_2021-01-13_1100_Scene1 [252.9754 253.764 253.5794] \n", - "2 1axis_2021-01-13_1200_Scene0 [253.6684 253.7525 253.1556] \n", - "3 1axis_2021-01-13_1200_Scene1 [252.7885 252.8908 252.9932] \n", + "0 1axis_2021-01-13_1100_Scene0 [253.4203 254.3263 254.4779] \n", + "1 1axis_2021-01-13_1100_Scene1 [253.0821 253.8797 253.6734] \n", + "2 1axis_2021-01-13_1200_Scene0 [253.0991 253.2366 253.0648] \n", + "3 1axis_2021-01-13_1200_Scene1 [252.2994 252.4342 252.5692] \n", "\n", " Wm2Back DNI DHI ... theta surf_tilt surf_azm \\\n", - "0 [39.11227 39.6468 40.87592] 144 149 ... -44.14 44.14 90.0 \n", - "1 [52.61953 53.14808 52.89173] 144 149 ... -44.14 44.14 90.0 \n", - "2 [38.08933 37.6907 38.52808] 97 200 ... -21.20 21.20 90.0 \n", - "3 [50.66072 51.01453 50.87846] 97 200 ... -21.20 21.20 90.0 \n", + "0 [39.27898 39.55687 40.8044 ] 144 149 ... -44.14 44.14 90.0 \n", + "1 [52.66748 53.1945 52.93923] 144 149 ... -44.14 44.14 90.0 \n", + "2 [37.59769 37.44495 38.3821 ] 97 200 ... -21.20 21.20 90.0 \n", + "3 [50.62335 50.9784 50.82404] 97 200 ... -21.20 21.20 90.0 \n", "\n", " POA_eff Gfront_mean Grear_mean Pout_raw Mismatch Pout \\\n", - "0 290.137864 254.247367 39.878330 91.741892 0.017150 91.726159 \n", - "1 295.748757 253.439600 52.886447 123.689074 0.003706 123.684491 \n", - "2 287.817933 253.525500 38.102703 90.335684 0.007205 90.329175 \n", - "3 293.571823 252.890833 50.851237 121.962507 0.002439 121.959532 \n", + "0 289.966908 254.074833 39.880083 91.687503 0.031298 91.658807 \n", + "1 295.892056 253.545067 52.933737 123.748694 0.009121 123.737407 \n", + "2 287.160922 253.133500 37.808247 90.128038 0.019082 90.110840 \n", + "3 293.081144 252.434267 50.808597 121.759562 0.006176 121.752043 \n", "\n", " Pout_Gfront \n", - "0 80.304410 \n", - "1 106.026011 \n", - "2 79.481255 \n", - "3 105.082904 \n", + "0 80.249342 \n", + "1 106.070184 \n", + "2 79.356997 \n", + "3 104.892870 \n", "\n", "[4 rows x 23 columns]" ] }, - "execution_count": 15, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -639,7 +640,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "id": "7cd42dfc", "metadata": {}, "outputs": [ @@ -677,7 +678,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "id": "893d060e", "metadata": {}, "outputs": [ @@ -723,51 +724,51 @@ "Linescan in process: 1axis_-15.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_-15.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_-15.0_Scene0_Row1_Module2.csv\n", - "Index: -15.0. Wm2Front: 628970.8666666666. Wm2Back: 80627.91333333333\n", + "Index: -15.0. Wm2Front: 632958.0333333333. Wm2Back: 80312.74333333333\n", "Linescan in process: 1axis_-15.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_-15.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_-15.0_Scene0_Row1_Module4.csv\n", - "Index: -15.0. Wm2Front: 629100.6333333333. Wm2Back: 74004.94666666667\n", + "Index: -15.0. Wm2Front: 633764.8666666666. Wm2Back: 74485.24333333333\n", "Linescan in process: 1axis_-10.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_-10.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_-10.0_Scene0_Row1_Module2.csv\n", - "Index: -10.0. Wm2Front: 147707.96666666665. Wm2Back: 19605.173333333336\n", + "Index: -10.0. Wm2Front: 146122.36666666667. Wm2Back: 19657.906666666666\n", "Linescan in process: 1axis_-10.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_-10.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_-10.0_Scene0_Row1_Module4.csv\n", - "Index: -10.0. Wm2Front: 148857.30000000002. Wm2Back: 17508.036666666667\n", + "Index: -10.0. Wm2Front: 146927.56666666665. Wm2Back: 17443.046666666665\n", "Linescan in process: 1axis_0.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_0.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_0.0_Scene0_Row1_Module2.csv\n", - "Index: 0.0. Wm2Front: 1020.194. Wm2Back: 151.87096666666665\n", + "Index: 0.0. Wm2Front: 979.5599000000001. Wm2Back: 153.58323333333334\n", "Linescan in process: 1axis_0.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_0.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_0.0_Scene0_Row1_Module4.csv\n", - "Index: 0.0. Wm2Front: 999.1938. Wm2Back: 118.14943333333333\n", + "Index: 0.0. Wm2Front: 988.9038666666667. Wm2Back: 118.99796666666667\n", "Linescan in process: 1axis_5.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_5.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_5.0_Scene0_Row1_Module2.csv\n", - "Index: 5.0. Wm2Front: 149755.56666666665. Wm2Back: 19677.773333333334\n", + "Index: 5.0. Wm2Front: 150893.19999999998. Wm2Back: 19790.783333333336\n", "Linescan in process: 1axis_5.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_5.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_5.0_Scene0_Row1_Module4.csv\n", - "Index: 5.0. Wm2Front: 143861.16666666666. Wm2Back: 17468.406666666666\n", + "Index: 5.0. Wm2Front: 146440.46666666667. Wm2Back: 17374.08\n", "Linescan in process: 1axis_10.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_10.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_10.0_Scene0_Row1_Module2.csv\n", - "Index: 10.0. Wm2Front: 17115.093333333334. Wm2Back: 2382.903333333333\n", + "Index: 10.0. Wm2Front: 17446.04333333333. Wm2Back: 2400.651666666666\n", "Linescan in process: 1axis_10.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_10.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_10.0_Scene0_Row1_Module4.csv\n", - "Index: 10.0. Wm2Front: 17351.12. Wm2Back: 2037.3946666666668\n", + "Index: 10.0. Wm2Front: 17155.37. Wm2Back: 2026.875\n", "Linescan in process: 1axis_15.0_Scene0_Row1_Module2_Front\n", "Linescan in process: 1axis_15.0_Scene0_Row1_Module2_Back\n", "Saved: results\\irr_1axis_15.0_Scene0_Row1_Module2.csv\n", - "Index: 15.0. Wm2Front: 716495.6999999998. Wm2Back: 86140.92666666665\n", + "Index: 15.0. Wm2Front: 721047.2000000001. Wm2Back: 86184.21\n", "Linescan in process: 1axis_15.0_Scene0_Row1_Module4_Front\n", "Linescan in process: 1axis_15.0_Scene0_Row1_Module4_Back\n", "Saved: results\\irr_1axis_15.0_Scene0_Row1_Module4.csv\n", - "Index: 15.0. Wm2Front: 718218.0333333333. Wm2Back: 79305.50333333334\n" + "Index: 15.0. Wm2Front: 712218.8666666667. Wm2Back: 79258.08\n" ] } ], @@ -782,7 +783,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 16, "id": "d6340420", "metadata": {}, "outputs": [ @@ -791,27 +792,27 @@ "output_type": "stream", "text": [ " row module BGG Gfront_mean Grear_mean \\\n", - "0 1 2 12.557396 1.661065e+06 208586.560967 \n", - "1 1 4 11.483591 1.658387e+06 190442.437433 \n", + "0 1 2 11.240246 1.669446e+06 208499.878233 \n", + "1 1 4 10.355119 1.657496e+06 190706.322967 \n", "\n", " POA_eff \\\n", - "0 [1871869.4886333328, 1867017.283133333, 187006... \n", - "1 [1852009.9815333332, 1844897.6626333334, 18495... \n", + "0 [1858883.9889933334, 1854803.3519133334, 18576... \n", + "1 [1831434.8003633332, 1826145.2824733332, 18298... \n", "\n", " Wm2Back \n", - "0 [210804.10129999998, 205951.89580000003, 20900... \n", - "1 [193622.5344, 186510.2155, 191194.56240000002] \n" + "0 [210486.20640000002, 205952.16520000002, 20906... \n", + "1 [193265.28869999998, 187388.04659999997, 19146... \n" ] } ], "source": [ - "demo.calculateResults1axis() # saves to demo.CompiledResults and results/Cumulative_Results.csv\n", + "demo.calculatePerformance1axis() # saves to demo.CompiledResults and results/Cumulative_Results.csv\n", "print(demo.CompiledResults)" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 17, "id": "5d891480", "metadata": {}, "outputs": [ @@ -852,42 +853,42 @@ " 0\n", " 1\n", " 2\n", - " 12.557396\n", - " 1.661065e+06\n", - " 208586.560967\n", - " [1871869.4886333328, 1867017.283133333, 187006...\n", - " [210804.10129999998, 205951.89580000003, 20900...\n", + " 11.240\n", + " 1669446.403\n", + " 208499.878\n", + " [1858883.9889933334, 1854803.3519133334, 18576...\n", + " [210486.20640000002, 205952.16520000002, 20906...\n", " \n", " \n", " 1\n", " 1\n", " 1\n", " 4\n", - " 11.483591\n", - " 1.658387e+06\n", - " 190442.437433\n", - " [1852009.9815333332, 1844897.6626333334, 18495...\n", - " [193622.5344, 186510.2155, 191194.56240000002]\n", + " 10.355\n", + " 1657496.041\n", + " 190706.323\n", + " [1831434.8003633332, 1826145.2824733332, 18298...\n", + " [193265.28869999998, 187388.04659999997, 19146...\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Unnamed: 0 row module BGG Gfront_mean Grear_mean \\\n", - "0 0 1 2 12.557396 1.661065e+06 208586.560967 \n", - "1 1 1 4 11.483591 1.658387e+06 190442.437433 \n", + " Unnamed: 0 row module BGG Gfront_mean Grear_mean \\\n", + "0 0 1 2 11.240 1669446.403 208499.878 \n", + "1 1 1 4 10.355 1657496.041 190706.323 \n", "\n", " POA_eff \\\n", - "0 [1871869.4886333328, 1867017.283133333, 187006... \n", - "1 [1852009.9815333332, 1844897.6626333334, 18495... \n", + "0 [1858883.9889933334, 1854803.3519133334, 18576... \n", + "1 [1831434.8003633332, 1826145.2824733332, 18298... \n", "\n", " Wm2Back \n", - "0 [210804.10129999998, 205951.89580000003, 20900... \n", - "1 [193622.5344, 186510.2155, 191194.56240000002] " + "0 [210486.20640000002, 205952.16520000002, 20906... \n", + "1 [193265.28869999998, 187388.04659999997, 19146... " ] }, - "execution_count": 19, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/tutorials/21 - Weather to Module Performance.py b/docs/tutorials/21 - Weather to Module Performance.py index 1f603eb3..9011bb63 100644 --- a/docs/tutorials/21 - Weather to Module Performance.py +++ b/docs/tutorials/21 - Weather to Module Performance.py @@ -111,7 +111,7 @@ # We're going to set up two scenes, each with a different module type! -# In[12]: +# In[10]: sceneDict = {'tilt': 0, 'azimuth': 180, 'pitch': 5,'hub_height':1.5, 'nMods':5, 'nRows': 2} @@ -123,7 +123,7 @@ # Make a second scene with the other module type -# In[13]: +# In[11]: trackerdict = demo.makeScene1axis(trackerdict, module = mymodule2, sceneDict=sceneDict2, append=True) @@ -134,18 +134,17 @@ # ## Calculating the Performance and Exporting the Results to a CSV -# In[14]: +# In[12]: #print(trackerdict) #tracker_dict_sample = {'2021-01-13_1100':trackerdict['2021-01-13_1100']} #eff_irr = tracker_dict_sample['Wm2Front'] + tracker_dict_sample['Wm2Back'] -Compiled_Results = demo.calculateResults1axis() +Compiled_Results = demo.calculatePerformance1axis() print(Compiled_Results) -#calculatePerformanceModule -> calculcateResults() -# In[15]: +# In[13]: demo.exportTrackerDict(savefile=os.path.join('results','Final_Results.csv'),reindex=False) @@ -154,7 +153,7 @@ # ## Now look at gencumulativesky tracking workflow -# In[16]: +# In[14]: starttime = '01_13_11'; endtime = '12_13_12' @@ -166,7 +165,7 @@ mymodule = demo.makeModule(name='test-module', x=1, y=2, bifi=0.9, CECMod=CECMod) -# In[17]: +# In[15]: sceneDict = {'tilt': 0, 'azimuth': 180, 'pitch': 5,'hub_height':1.5, 'nMods':5, 'nRows': 2} @@ -177,14 +176,14 @@ trackerdict = demo.analysis1axis(modWanted = [2,4], sensorsy=3) -# In[18]: +# In[16]: -demo.calculateResults1axis() # saves to demo.CompiledResults and results/Cumulative_Results.csv +demo.calculatePerformance1axis() # saves to demo.CompiledResults and results/Cumulative_Results.csv print(demo.CompiledResults) -# In[19]: +# In[17]: pd.read_csv(os.path.join('results','Cumulative_Results.csv')) diff --git a/tests/test_bifacial_radiance.py b/tests/test_bifacial_radiance.py index 2202e41f..734d8b96 100644 --- a/tests/test_bifacial_radiance.py +++ b/tests/test_bifacial_radiance.py @@ -266,7 +266,7 @@ def test_1axis_gencumSky(): CECMod = pd.read_csv(os.path.join(TESTDIR, 'Canadian_Solar_Inc__CS5P_220M.csv'), index_col=0).iloc[:,0] module.addCEC(CECMod) - results = demo.calculateResults1axis(module=module) + results = demo.calculatePerformance1axis(module=module) pd.testing.assert_frame_equal(results, demo.CompiledResults) assert results.iloc[0].Grear_mean == pytest.approx(210, abs=30) #gencumsky has lots of variability assert results.__len__() == 4