Description
Describe the bug
In the irradiance.py
module the isotropic
, klucher
, haydavies
, reindl
, and king
functions have an Rb
term that contributes an irradiance adjustment to the front-side diffuse even when the sun is behind the array or below the horizon. Under such conditions the only contributions to in-plane sky diffuse should be isotropic sky diffuse and (where modeled) horizon sky diffuse, and should not include the circumsolar component (particularly when this component is computed as a negative value).
To Reproduce
Run the code from the test_total_irrad
function in test_irradiance.py
. The second ephem_data
row happens to represent this geometric condition as input... the test does not currently verify the values thus obtained, but if they are examined the behavior can be observed. For example, using the "haydavies" model the sky diffuse result is 20.4696793893283, but it should be 28.439461728635 because the Rb
term is introducing a negative circumsolar irradiance contribution.
Expected behavior
Sky diffuse irradiance that does not vary significantly based on the sun apparent position when that position is behind the array or below the horizon.
I think that this can be fixed by setting Rb=0
whenever cos_tt
is negative or cos_sun_zenith
is negative.
Versions:
pvlib.__version__
: '0.5.2+20.g09126e9'pandas.__version__
: '0.23.1'- python: '3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)]'