def test_RadianceObj_set1axis():
    # test set1axis.  requires metdata for boulder.
    demo = RadianceObj()
    demo.readEPW(epwfile=MET_FILENAME)
    trackerdict = demo.set1axis()
    assert trackerdict[0]['count'] == 108
    assert trackerdict[45]['count'] == 823
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_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)
Example #4
0
print('starting simulation: {}'.format(datetime.datetime.now()))
# Example 1-axis tracking system using Radiance.  This takes 5-10 minutes to complete, depending on computer.

demo = RadianceObj(
    path=testfolder)  # Create a RadianceObj 'object' named 'demo'

demo.setGround(
    albedo
)  # input albedo number or material name like 'concrete'.  To see options, run this without any input.

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