def threading_helper(lower_bound, upper_bound): writefiletitle = "data/Output/rtr" + str(lower_bound) while lower_bound != upper_bound: simulate( "data/724010TYA.csv", writefiletitle, 10, 180, 1, lower_bound, "interior", 0.013, 6, "glass", "glass", 0.62, False, True, ) lower_bound = lower_bound + 1
# 1-axis tracking instructions (optional) max_angle = 45 # tracker rotation limit angle backtrack = True # backtracking optimization as defined in pvlib #Cv = 0.05 # GroundClearance when panel is in vertical position for tracking simulations (panel slope lengths) #3. Call the function. bifacialvf.simulate(TMYtoread, writefiletitle, beta, sazm, C=C, rowType=rowType, transFactor=transFactor, cellRows=cellRows, PVfrontSurface=PVfrontSurface, PVbackSurface=PVbackSurface, albedo=albedo, tracking=True, backtrack=backtrack, rtr=rtr, max_angle=max_angle) #4. Load the results from the resultfile (data, metadata) = bifacialvf.loadVFresults(writefiletitle) #print data.keys() # calculate average front and back global tilted irradiance across the module chord data['GTIFrontavg'] = data[[ 'No_1_RowFrontGTI', 'No_2_RowFrontGTI', 'No_3_RowFrontGTI', 'No_4_RowFrontGTI', 'No_5_RowFrontGTI', 'No_6_RowFrontGTI'
# bififactor = 1.0 # Tracking instructions tracking=True backtrack=True limit_angle = 65 # Download and Read input TMYtoread=bifacialvf.getEPW(lat=lat,lon=lon, path = testfolder) myTMY3, meta = bifacialvf.readInputTMY(TMYtoread) deltastyle = 'TMY3' #myTMY3 = myTMY3.iloc[0:24].copy() # Simulate just the first 24 hours of the data file for speed on this example bifacialvf.simulate(myTMY3, meta, writefiletitle=writefiletitle, tilt=tilt, sazm=sazm, pitch=pitch, hub_height=hub_height, rowType=rowType, transFactor=transFactor, sensorsy=sensorsy, PVfrontSurface=PVfrontSurface, PVbackSurface=PVbackSurface, albedo=albedo, tracking=tracking, backtrack=backtrack, limit_angle=limit_angle, deltastyle=deltastyle, agriPV=agriPV) #Load the results from the resultfile from bifacialvf import loadVFresults (data, metadata) = loadVFresults(writefiletitle) # In[4]: from bifacialvf import loadVFresults (data, metadata) = loadVFresults(writefiletitle)
def test_endtoend(): ''' end to end test, first 24 hours of VA Richmond ''' #TODO: consolidate and improve this # IO Files TMYtoread = os.path.join(DATADIR, "724010TYA.CSV") # VA Richmond 724010TYA.csv writefiletitle = os.path.join(DATADIR, "_RICHMOND_1.0.csv") # Variables tilt = 10 # PV tilt (deg) sazm = 180 # PV Azimuth(deg) or tracker axis direction albedo = 0.62 # ground albedo clearance_height = 0.4 pitch = 1.5 # row to row spacing in normalized panel lengths. rowType = "interior" # RowType(first interior last single) transFactor = 0.013 # TransmissionFactor(open area fraction) sensorsy = 6 # sensorsy(# hor rows in panel) <--> THIS ASSUMES LANDSCAPE ORIENTATION PVfrontSurface = "glass" # PVfrontSurface(glass or ARglass) PVbackSurface = "glass" # PVbackSurface(glass or ARglass) # Calculate PV Output Through Various Methods #calculateBilInterpol = True # Only works with landscape at the moment. #calculatePVMismatch = True #portraitorlandscape='landscape' # portrait or landscape #cellsnum = 72 #bififactor = 1.0 # Tracking instructions tracking = False backtrack = False limit_angle = 60 # read input myTMY3, meta = bifacialvf.bifacialvf.readInputTMY(TMYtoread) deltastyle = 'TMY3' myTMY3_2 = myTMY3.iloc[0:24].copy() # Simulate just the first 24 hours of the Richmond data file bifacialvf.simulate(myTMY3_2, meta, writefiletitle=writefiletitle, tilt=tilt, sazm=sazm, pitch=pitch, clearance_height=clearance_height, rowType=rowType, transFactor=transFactor, sensorsy=sensorsy, PVfrontSurface=PVfrontSurface, PVbackSurface=PVbackSurface, albedo=albedo, tracking=tracking, backtrack=backtrack, limit_angle=limit_angle, deltastyle=deltastyle) #Load the results from the resultfile from bifacialvf import loadVFresults (data, metadata) = loadVFresults(writefiletitle) data['GTIFrontavg'] = data[[ 'No_1_RowFrontGTI', 'No_2_RowFrontGTI', 'No_3_RowFrontGTI', 'No_4_RowFrontGTI', 'No_5_RowFrontGTI', 'No_6_RowFrontGTI' ]].mean(axis=1) data['GTIBackavg'] = data[[ 'No_1_RowBackGTI', 'No_2_RowBackGTI', 'No_3_RowBackGTI', 'No_4_RowBackGTI', 'No_5_RowBackGTI', 'No_6_RowBackGTI' ]].mean(axis=1) # Lad comparison data (data_Marion, metadata2) = loadVFresults(MARION_C_File) # calculate average front and back global tilted irradiance across the module chord data_Marion['GTIFrontavg'] = data_Marion[[ 'No_1_RowFrontGTI', 'No_2_RowFrontGTI', 'No_3_RowFrontGTI', 'No_4_RowFrontGTI', 'No_5_RowFrontGTI', 'No_6_RowFrontGTI' ]].mean(axis=1) data_Marion['GTIBackavg'] = data_Marion[[ 'No_1_RowBackGTI', 'No_2_RowBackGTI', 'No_3_RowBackGTI', 'No_4_RowBackGTI', 'No_5_RowBackGTI', 'No_6_RowBackGTI' ]].mean(axis=1) assert np.allclose(list(round(data['GTIFrontavg'][1:4], 1)), list(round(data_Marion['GTIFrontavg'][1:4], 1))) assert np.allclose(list(round(data['GTIFrontavg'][1:4], 1)), FIXED_ENDTOEND_GTIFRONT[1:4]) assert np.allclose(list(round(data['GTIBackavg'][1:4], 1)), list(round(data_Marion['GTIBackavg'][1:4], 1))) assert np.allclose(list(round(data['GTIbackBroadBand'][1:10], 1)), list(round(data_Marion['GTIbackBroadBand'][1:10], 1)))
def test_1axis_endtoend(): ''' end to end test, first 24 hours of VA Richmond .EPW file this one uses ARGlass and a single row. ''' #TODO: consolidate and improve this # IO Files TMYtoread = os.path.join( DATADIR, "USA_VA_Richmond.Intl.AP.724010_TMY.epw") # VA Richmond EPW writefiletitle = os.path.join(TESTDIR, "_RICHMOND_1axis.csv") # Variables tilt = 0 # PV tilt (deg) sazm = 180 # PV Azimuth(deg) or tracker axis direction albedo = 0.2 # ground albedo clearance_height = 1 pitch = 2.86 # 0.35 GCR. row to row spacing in normalized panel lengths. rowType = "single" # RowType(first interior last single) transFactor = 0.013 # TransmissionFactor(open area fraction) sensorsy = 6 # sensorsy(# hor rows in panel) <--> THIS ASSUMES LANDSCAPE ORIENTATION PVfrontSurface = "ARglass" # PVfrontSurface(glass or ARglass) PVbackSurface = "ARglass" # PVbackSurface(glass or ARglass) # Tracking instructions tracking = True backtrack = True limit_angle = 60 deltastyle = 'TMY3' # Calculate PV Output Through Various Methods # read input myTMY3, meta = bifacialvf.bifacialvf.readInputTMY(TMYtoread) #deltastyle = 'TMY3' myTMY3_2 = myTMY3.iloc[0:24].copy() # Simulate just the first 24 hours of the Richmond data file. SINGLE bifacialvf.simulate(myTMY3_2, meta, writefiletitle=writefiletitle, tilt=tilt, sazm=sazm, pitch=pitch, clearance_height=clearance_height, rowType=rowType, transFactor=transFactor, sensorsy=sensorsy, PVfrontSurface=PVfrontSurface, PVbackSurface=PVbackSurface, albedo=albedo, tracking=tracking, backtrack=backtrack, limit_angle=limit_angle, deltastyle=deltastyle) #Load the results from the resultfile from bifacialvf import loadVFresults (data, metadata) = loadVFresults(writefiletitle) #print data.keys() # calculate average front and back global tilted irradiance across the module chord data['GTIFrontavg'] = data[[ 'No_1_RowFrontGTI', 'No_2_RowFrontGTI', 'No_3_RowFrontGTI', 'No_4_RowFrontGTI', 'No_5_RowFrontGTI', 'No_6_RowFrontGTI' ]].mean(axis=1) data['GTIBackavg'] = data[[ 'No_1_RowBackGTI', 'No_2_RowBackGTI', 'No_3_RowBackGTI', 'No_4_RowBackGTI', 'No_5_RowBackGTI', 'No_6_RowBackGTI' ]].mean(axis=1) assert np.allclose(data['GTIFrontavg'].array, TRACKED_ENDTOEND_GTIFRONT) assert np.allclose(data['GTIBackavg'].array, TRACKED_ENDTOEND_GTIBACK)
portraitorlandscape='landscape' # portrait or landscape cellsnum = 72 bififactor = 1.0 agriPV = False # Returns ground irradiance values # Tracking instructions tracking=False backtrack=False limit_angle = 60 writefiletitle = os.path.join(testfolder, 'Tutorial3_Results.csv') myTMY3 = myTMY3.iloc[0:24].copy() # Simulate just the first 24 hours of the data file for speed on this example bifacialvf.simulate(myTMY3, meta, writefiletitle=writefiletitle, tilt=tilt, sazm=sazm, pitch=pitch, clearance_height=clearance_height, rowType=rowType, transFactor=transFactor, sensorsy=sensorsy, PVfrontSurface=PVfrontSurface, PVbackSurface=PVbackSurface, albedo=albedo, tracking=tracking, backtrack=backtrack, limit_angle=limit_angle, deltastyle=deltastyle, calculateBilInterpol=calculateBilInterpol, calculatePVMismatch=calculatePVMismatch, cellsnum = cellsnum, bififactor=bififactor, agriPV=agriPV) # # 5. Load the results from the resultfile # # In[4]: from bifacialvf import loadVFresults mismatchResultstitle = os.path.join(testfolder, 'Tutorial3_Results_PVMismatch.csv') (data, metadata) = loadVFresults(mismatchResultstitle)