Skip to content

Nonzero direct irradiance contribution to sky diffuse when sun is behind the array #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jdnewmil opened this issue Aug 9, 2018 · 3 comments · Fixed by #535
Closed

Comments

@jdnewmil
Copy link

jdnewmil commented Aug 9, 2018

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)]'
@cwhanse
Copy link
Member

cwhanse commented Aug 9, 2018

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

  1. fix in each sky diffuse implementation with np.where(cos_tt<0) or similar, or
  2. 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.

@cwhanse cwhanse added this to the 0.6.0 milestone Aug 9, 2018
@wholmgren
Copy link
Member

@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.

We should fix #432 at the same time.

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.

@cweickhmann
Copy link

cweickhmann commented Dec 1, 2021

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.

I filed this under #1348.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants