def test_RadianceObj_1axis_gendaylit_end_to_end():
    # 1-axis tracking end-to-end test with torque tube and gap generation.
    # Takes 20 seconds for 2-sensor scan
    module_height = 1.95 * 2 + 0.1  # module portrait dimension in meters
    gcr = 0.35  # ground cover ratio,  = module_height / pitch
    albedo = 0.3  # ground albedo
    hub_height = 2  # tracker height at 0 tilt in meters (hub height)

    demo = RadianceObj()  # Create a RadianceObj 'object'
    demo.setGround(
        albedo
    )  # input albedo number or material name like 'concrete'.  To see options, run this without any input.
    metdata = demo.readEPW(
        MET_FILENAME)  # read in the EPW weather data from above
    #metdata = demo.readTMY(MET_FILENAME2) # select a TMY file using graphical picker
    # create metdata files for each condition. keys are timestamps for gendaylit workflow
    trackerdict = demo.set1axis(cumulativesky=False)
    # create the skyfiles needed for 1-axis tracking
    demo.gendaylit1axis(metdata=metdata, enddate='01/01')
    # test modules with gap and rear tube
    demo.makeModule(name='Longi_torquetube',
                    x=0.984,
                    y=1.95,
                    torquetube=True,
                    numpanels=2,
                    panelgap=0.1)
    #demo.makeModule(name='Longi_torquetube',x=0.984,y=1.95)
    # set module type to be used and passed into makeScene1axis
    module_type = 'Longi_torquetube'

    # Create the scene for the 1-axis tracking
    sceneDict = {
        'pitch': module_height / gcr,
        'height': hub_height,
        'orientation': 'portrait'
    }
    key = '01_01_11'
    demo.makeScene1axis(
        {key: trackerdict[key]},
        module_type,
        sceneDict,
        cumulativesky=False,
        nMods=10,
        nRows=3,
        modwanted=3,
        rowwanted=3,
        sensorsy=2
    )  #makeScene creates a .rad file with 20 modules per row, 7 rows.

    demo.makeOct1axis(trackerdict,
                      key)  # just run this for one timestep: Jan 1 11am
    demo.analysis1axis(trackerdict,
                       key)  # just run this for one timestep: Jan 1 11am

    assert (np.mean(demo.Wm2Front) == pytest.approx(214.0, 0.01))
    assert (np.mean(demo.Wm2Back) == pytest.approx(40.0, 0.1))
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)
Ejemplo n.º 4
0
epwfile = demo.getEPW(
    37.5, -77.6
)  #Pull TMY weather data for any global lat/lon.  In this case, Richmond, VA

metdata = demo.readEPW(epwfile)  # read in the weather data

# create separate metdata files for each 1-axis tracker angle (5 degree resolution).
trackerdict = demo.set1axis(metdata,
                            limit_angle=limit_angle,
                            backtrack=True,
                            gcr=gcr)

# create cumulativesky functions for each tracker angle: demo.genCumSky1axis
trackerdict = demo.genCumSky1axis(trackerdict)
# Create a new moduletype: Prism Solar Bi60. width = .984m height = 1.695m. Bifaciality = 0.90
demo.makeModule(name='Prism Solar Bi60', x=0.984, y=module_height, bifi=0.90)
# print available module types
demo.printModules()

# create a 1-axis scene using panels in portrait, 2m hub height, 0.33 GCR. NOTE: clearance needs to be calculated at each step. hub height is constant
sceneDict = {
    'pitch': module_height / gcr,
    'height': hub_height,
    'orientation': 'portrait'
}
module_type = 'Prism Solar Bi60'
trackerdict = demo.makeScene1axis(
    trackerdict, module_type, sceneDict, nMods=20,
    nRows=7)  #makeScene creates a .rad file with 20 modules per row, 7 rows.

trackerdict = demo.makeOct1axis(trackerdict)
# 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

# In[5]: