You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)]'
The text was updated successfully, but these errors were encountered:
Confirmed for haydavies and reindl. For klucher, the term involving cos_tt is squared so it has an erroneous effect but increases diffuse irradiance rather than decreasing. The other sky diffuse models (isotropic and king) don't use a cos_tt term and don't specifically account for circumsolar irradiance.
This is an implementation error. #432 is relevant. We could either
fix in each sky diffuse implementation with np.where(cos_tt<0) or similar, or
change the AOI calculations to return 0 (or nan) when the sun is behind the array plane.
I'm inclined to the first option because I prefer the mathematically clean definition of AOI as the angle between the sun vector and the front-facing normal to the array, and I anticipate using AOI calculations with bifacial modeling. In PVLib for Matlab, we implemented the first option.
@jdnewmil thank you for catching and reporting this bug!
I also prefer to fix each diffuse implementation.
I suggest that we fix this after #427 is merged in the next few days. The merge conflicts will relatively difficult to resolve if we do them in parallel.
The tests for the individual models do verify the returned values. With only a quick look, I believe that the second value in the expected results array is subject to this condition.
Maybe related is a behaviour in spectrum.spectrl2 that I came across this week. North-facing panels exhibit negative irradiance. Not sure if this is due to the AOI value range or if the NREL reference implementation (cf. Bird1984) simply does not hold for purely indirect lighting.
Describe the bug
In the
irradiance.py
module theisotropic
,klucher
,haydavies
,reindl
, andking
functions have anRb
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 intest_irradiance.py
. The secondephem_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 theRb
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
whenevercos_tt
is negative orcos_sun_zenith
is negative.Versions:
pvlib.__version__
: '0.5.2+20.g09126e9'pandas.__version__
: '0.23.1'The text was updated successfully, but these errors were encountered: