123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #******************************************************************************
- #******************************************************************************
- # import libraries
- from math import isclose, pi
- import datetime as dt
- from src.pysoleng.models import tilted_plane_irradiance_isotropic
- from src.pysoleng.timeplace import Location, FlatSurface
- # *****************************************************************************
- # *****************************************************************************
- class TestIrradianceModels:
- def test_isotropic_model(self):
-
- # *********************************************************************
- # *********************************************************************
-
- # Example 2.15.1, page
- # Using the isotropic diffuse model, estimate the beam, diffuse, and
- # ground-reflected components of solar radiation and the total radiation
- # on a surface sloped 60◦ toward the south at a latitude of 40◦ N for
- # the hour 9 to 10 AM on February 20. Here I = 1.04 MJ/m2 and ρ_g = 0.6
-
- # >>> from datetime import datetime
- # >>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')
-
- site_ground_reflectance = 0.6
- site_horizontal_total = 1.04 # MJ/m2
- site_horizontal_diffuse = site_horizontal_total*0.766 # kt=0.445
-
- surface = FlatSurface(
- azimuth=0*pi/180,
- slope=60*pi/180
- )
-
- site = Location(
- coordinates=(40,0),
- crs_string='epsg:4326')
-
- local_time = dt.datetime.fromisoformat('2011-02-20 09:30:00+00:00')
-
- # final results (expected)
-
- efr_itt = 1.17 # MJ/m2 # original: 1.170
-
- efr_itt_tol = 0.01 # MJ/m2
-
- efr_itb = 0.417 # MJ/m2
-
- efr_itb_tol = 0.01 # MJ/m2
-
- efr_itsd = 0.596 # MJ/m2
-
- efr_itsd_tol = 0.01 # MJ/m2
-
- efr_ita = 0.156 # MJ/m2
-
- efr_ita_tol = 0.01 # MJ/m2
-
- # *********************************************************************
- # *********************************************************************
-
- (I_tilted_total,
- I_tilted_beam,
- I_tilted_sky_diffuse,
- I_tilted_albedo) = tilted_plane_irradiance_isotropic(
- site,
- #surface,
- surface.slope,
- surface.azimuth,
- local_time,
- site_ground_reflectance,
- site_horizontal_total,
- site_horizontal_diffuse)
-
- # *********************************************************************
- # *********************************************************************
-
- # total
- assert isclose(I_tilted_total, efr_itt, abs_tol=efr_itt_tol)
-
- # beam
- assert isclose(I_tilted_beam, efr_itb, abs_tol=efr_itb_tol)
-
- # sky diffuse
- assert isclose(I_tilted_sky_diffuse, efr_itsd, abs_tol=efr_itsd_tol)
-
- # albedo
- assert isclose(I_tilted_albedo, efr_ita, abs_tol=efr_ita_tol)
-
- # *********************************************************************
- # *********************************************************************
- # *****************************************************************************
- # *****************************************************************************
|