Пример #1
0
def test_declination():
    site = Site(latitude=47.68, longitude=-122.25, elevation=20.0)
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)

    assert round(solar_angles.declination.max(), 2) == 23.45
    assert round(solar_angles.declination.min(), 2) == -23.45
Пример #2
0
def test_time_init():
    time = Time(start_hour=1, end_hour=2, time_steps_per_hour=3)

    assert time is not None
    assert time.start_hour == 1
    assert time.end_hour == 2
    assert time.time_steps_per_hour == 3
Пример #3
0
def test_gamma():
    site = Site(latitude=47.68, longitude=-122.25, elevation=20.0)
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)

    assert round(solar_angles.gamma.max(), 0) == 359
    assert round(solar_angles.gamma.min(), 0) == 0
Пример #4
0
def test_equation_of_time():
    site = Site(latitude=47.68, longitude=-122.25, elevation=20.0)
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)

    assert round(solar_angles.equation_of_time.max(), 1) == 16.4
    assert round(solar_angles.equation_of_time.min(), 1) == -14.3
Пример #5
0
def test_surface_init():
    site = Site()
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)
    surface = Surface('surface1', azimuth=0, tilt=90, width=1, height=1)

    assert surface is not None
Пример #6
0
def test_sun_surface_azimuth():
    site = Site(latitude=47.68, longitude=-122.25, elevation=20.0)
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)
    surface = Surface('surface1', azimuth=0, tilt=90, width=1, height=1)
    surface_solar_angles = SurfaceSolarAngles(time, solar_angles, surface)

    assert round(surface_solar_angles.sun_surface_azimuth.max(), 0) == 90.0
    assert round(surface_solar_angles.sun_surface_azimuth.min(), 0) == 0.0
Пример #7
0
def test_heat_transfer_surface_init():
    site = Site()
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)
    weather = EPW(time)
    weather.direct_normal_radiation = np.ones(time.length)
    weather.diffuse_horizontal_radiation = np.ones(time.length)
    surface = Surface('surface1', azimuth=0, tilt=90, width=1, height=1)
    ht_surface = HeatTransferSurface('ht_surface1', time, solar_angles,
                                     weather, surface)

    assert ht_surface is not None
Пример #8
0
def test_external_shortwave_radiation_init():
    settings = Settings('')
    site = Site()
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)
    weather = EPW(time)
    weather.direct_normal_radiation = np.ones(time.length)
    weather.diffuse_horizontal_radiation = np.ones(time.length)
    surface = Surface('surface1', azimuth=0, tilt=90, width=1, height=1)
    surface_solar_angles = SurfaceSolarAngles(time, solar_angles, surface)
    external_shortwave_radiation = ExternalShortwaveRadiation(
        time, solar_angles, weather, surface, surface_solar_angles)

    assert external_shortwave_radiation is not None
Пример #9
0
def test_incident_diffuse_radiation():
    settings = Settings('')
    site = Site(latitude=0, longitude=0, elevation=0.0)
    time = Time()
    weather = EPW(time)
    weather.direct_normal_radiation = np.ones(time.length)
    weather.diffuse_horizontal_radiation = np.ones(time.length)
    solar_angles = SolarAngles(time=time, site=site)
    surface = Surface('surface1', azimuth=0, tilt=90, width=1, height=1)
    surface_solar_angles = SurfaceSolarAngles(time, solar_angles, surface)
    external_shortwave_radiation = ExternalShortwaveRadiation(
        time, solar_angles, weather, surface, surface_solar_angles)

    assert round(external_shortwave_radiation.incident_diffuse_radiation.max(),
                 2) == 1.3
    assert round(external_shortwave_radiation.incident_diffuse_radiation.min(),
                 2) == 0.55
Пример #10
0
def test_solar_angles_init():
    site = Site()
    time = Time()
    solar_angles = SolarAngles(time=time, site=site)

    assert solar_angles is not None
Пример #11
0
def test_weather_init():
    time = Time()
    weather = EPW(time)

    assert weather is not None
Пример #12
0
def test_resample_dry_bulb_temperature():
    time = Time(time_steps_per_hour=1)
    weather = EPW(time)
    weather.dry_bulb_temperature = pd.Series(np.ones(time.length))

    assert sum(weather.dry_bulb_temperature) == 8760
Пример #13
0
def test_resample_direct_normal_radiation():
    time = Time(time_steps_per_hour=2)
    weather = EPW(time)
    weather.direct_normal_radiation = pd.Series(np.ones(time.length))

    assert sum(weather.direct_normal_radiation) == 8760*2
Пример #14
0
def test_length_direct_normal_radiation():
    time = Time()
    weather = EPW(time)
    weather.direct_normal_radiation = pd.Series(np.ones(time.length))

    assert len(weather.direct_normal_radiation) == 35040