Skip to content

Commit

Permalink
Adjust and document dni/ beam irradiation
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Oct 21, 2020
1 parent db11702 commit bb3e7e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion feedinlib/models/geometric_solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def geometric_radiation(data_weather,
Parameters
----------
data_weather : :pandas:`pandas.DataFrame<dataframe>`
Has to contain time stamps (including time zone) as index,
and irradiation data ("dhi" and one of "ghi"/"dni")
collector_slope : numeric
collector tilt in degree
surface_azimuth : numeric
Expand All @@ -152,6 +154,13 @@ def geometric_radiation(data_weather,
-------
:pandas:`pandas.DataFrame<dataframe>`
containing the total radiation on the sloped surface
Internally, beam irradiation (bi, direct radiation to a horizontal surface)
is used. However, typically, either direct normal irradiation (dni)
or global horizontal irradiation (ghi) is given. So we use
.. math:: \mathrm{ghi} = \mathrm{bi} + \mathrm{dhi}
= \mathrm{dni} * \cos(\theta) + \mathrm{dhi}
to calculate the beam irradiation.
"""
angle_of_incidence, solar_zenith_angle = solar_angles(
data_weather.index, collector_slope, surface_azimuth,
Expand All @@ -174,7 +183,7 @@ def geometric_radiation(data_weather,
irradiation_beam = irradiation_direct_horizontal/np.cos(
angle_of_incidence)
else:
irradiation_beam = data_weather['dni']
irradiation_beam = data_weather['dni'] * np.cos(angle_of_incidence)

# beam radiation correction factor
beam_corr_factor = np.array(angle_of_incidence / solar_zenith_angle)
Expand Down
5 changes: 3 additions & 2 deletions test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def test_geometric_angles(self):
assert incidence_a == pytest.approx(
incidence_b, 1e-5)

def test_geometric_radiation(self):
# For calculation of radiation, direct radiation is blocked at night.
# So if there is neither reflection (albedo) nor diffuse radiation,
# total radiation should be 0.
Expand Down Expand Up @@ -233,11 +234,11 @@ def test_geometric_angles(self):
freq="h", tz='UTC'))

assert (plant4.geometric_radiation(data_weather_test)[0]
== pytest.approx(345.424687, 1e-5))
== pytest.approx(302.86103, 1e-5))

# extra test for feedin
assert (plant4.feedin(data_weather_test)[0]
== pytest.approx(89.23768, 1e-5))
== pytest.approx(78.67677, 1e-5))

# check giving same weather with temperature in Kelvin
data_weather_kelvin = pd.DataFrame(data={'wind_speed': [0],
Expand Down

0 comments on commit bb3e7e1

Please sign in to comment.