def test_RadianceObj_high_azimuth_angle_end_to_end(): # modify example for high azimuth angle to test different parts of makesceneNxR. Rear irradiance fraction roughly 17.3% for 0.95m landscape panel # takes 14 seconds for sensorsy = 9, 11 seconds for sensorsy = 2 demo = RadianceObj() # Create a RadianceObj 'object' demo.setGround( 'white_EPDM' ) # input albedo number or material name like 'concrete'. To see options, run this without any input. #metdata = demo.readEPW() # read in the EPW weather data from above metdata = demo.readTMY( MET_FILENAME2) # select a TMY file using graphical picker # Now we either choose a single time point, or use cumulativesky for the entire year. fullYear = False if fullYear: demo.genCumSky( demo.epwfile ) # entire year. # Don't know how to test this yet in pytest... else: demo.gendaylit(metdata, 4020) # Noon, June 17th # create a scene using panels in landscape at 10 deg tilt, 1.5m pitch. 0.2 m ground clearance sceneDict = { 'tilt': 10, 'pitch': 1.5, 'height': 0.2, 'orientation': 'landscape', 'azimuth': 30 } demo.makeModule(name='simple_panel', x=0.95, y=1.59) scene = demo.makeScene( 'simple_panel', sceneDict, nMods=10, nRows=3 ) #makeScene creates a .rad file with 20 modules per row, 7 rows. octfile = demo.makeOct( demo.getfilelist() ) # makeOct combines all of the ground, sky and object files into a .oct file. analysis = AnalysisObj( octfile, demo.name ) # return an analysis object including the scan dimensions for back irradiance analysis.analysis(octfile, demo.name, scene.frontscan, scene.backscan) # compare the back vs front irradiance #assert np.round(np.mean(analysis.backRatio),2) == 0.20 # bifi ratio was == 0.22 in v0.2.2 assert np.mean(analysis.Wm2Front) == pytest.approx(912, rel=0.005) assert np.mean(analysis.Wm2Back) == pytest.approx(182, rel=0.01)
def test_RadianceObj_fixed_tilt_end_to_end(): # just run the demo example. Rear irradiance fraction roughly 11.8% for 0.95m landscape panel # takes 12 seconds demo = RadianceObj() # Create a RadianceObj 'object' demo.setGround( 0.62 ) # input albedo number or material name like 'concrete'. To see options, run this without any input. metdata = demo.readEPW( epwfile=MET_FILENAME) # read in the EPW weather data from above #metdata = demo.readTMY() # select a TMY file using graphical picker # Now we either choose a single time point, or use cumulativesky for the entire year. fullYear = False if fullYear: demo.genCumSky(demo.epwfile) # entire year. else: demo.gendaylit(metdata, 4020) # Noon, June 17th # create a scene using panels in landscape at 10 deg tilt, 1.5m pitch. 0.2 m ground clearance sceneDict = { 'tilt': 10, 'pitch': 1.5, 'height': 0.2, 'orientation': 'landscape' } demo.makeModule(name='simple_panel', x=0.95, y=1.59) scene = demo.makeScene( 'simple_panel', sceneDict, nMods=10, nRows=3 ) #makeScene creates a .rad file with 20 modules per row, 7 rows. octfile = demo.makeOct( demo.getfilelist() ) # makeOct combines all of the ground, sky and object files into a .oct file. analysis = AnalysisObj( octfile, demo.name ) # return an analysis object including the scan dimensions for back irradiance analysis.analysis(octfile, demo.name, scene.frontscan, scene.backscan) # compare the back vs front irradiance #assert np.round(np.mean(analysis.backRatio),decimals=2) == 0.12 # NOTE: this value is 0.11 when your module size is 1m, 0.12 when module size is 0.95m assert np.mean(analysis.backRatio) == pytest.approx(0.12, abs=0.01)
# ### A. Generating the firt scene object # # This is a standard fixed-tilt setup for one hour. Gencumsky could be used too for the whole year. # # The key here is that we are setting in sceneDict the variable **appendRadfile** to true. # In[4]: demo = RadianceObj("MultipleObj", path=testfolder) # Create a RadianceObj 'object' demo.setGround(0.62) epwfile = demo.getEPW(lat=37.5, lon=-77.6) metdata = demo.readWeatherFile('EPWs\\USA_VA_Richmond.Intl.AP.724010_TMY.epw') fullYear = True demo.gendaylit(metdata, 4020) # Noon, June 17th . # Gencumsky could be used too. module_type = 'Prism Solar Bi60 landscape' demo.makeModule(name=module_type, y=1, x=1.7) sceneDict = { 'tilt': 10, 'pitch': 1.5, 'clearance_height': 0.2, 'azimuth': 180, 'nMods': 5, 'nRows': 2, 'appendRadfile': True } sceneObj1 = demo.makeScene(module_type, sceneDict) # Checking values after Scene for the scene Object created
# ### A. Generating the first scene object # # This is a standard fixed-tilt setup for one hour. Gencumsky could be used too for the whole year. # # The key here is that we are setting in sceneDict the variable **appendRadfile** to true. # In[2]: demo = RadianceObj("tutorial_7", path = testfolder) demo.setGround(0.62) epwfile = demo.getEPW(lat = 37.5, lon = -77.6) metdata = demo.readWeatherFile(epwfile, coerce_year=2001) fullYear = True timestamp = metdata.datetime.index(pd.to_datetime('2001-06-17 13:0:0 -5')) # Noon, June 17th demo.gendaylit(timestamp) module_type = 'test-moduleA' mymodule = demo.makeModule(name=module_type,y=1,x=1.7) sceneDict = {'tilt':10,'pitch':1.5,'clearance_height':0.2,'azimuth':180, 'nMods': 5, 'nRows': 2, 'appendRadfile':True} sceneObj1 = demo.makeScene(mymodule, sceneDict) # Checking values after Scene for the scene Object created # In[3]: print ("SceneObj1 modulefile: %s" % sceneObj1.modulefile) print ("SceneObj1 SceneFile: %s" %sceneObj1.radfiles) print ("SceneObj1 GCR: %s" % round(sceneObj1.gcr,2)) print ("FileLists: \n %s" % demo.getfilelist())