Skip to content
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

Issue #2245 Infinite sheds beam fraction on ground zenith guardrail syntax bug #2359

Merged
merged 8 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.11.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Deprecations

Enhancements
~~~~~~~~~~~~

* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero
ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)

Documentation
~~~~~~~~~~~~~
Expand All @@ -37,4 +38,5 @@ Contributors
~~~~~~~~~~~~
* Rajiv Daxini (:ghuser:`RDaxini`)
* Mark Campanelli (:ghuser:`markcampanelli`)
* Jason Lun Leung (:ghuser:`jason-rpkt`)
* Manoj K S (:ghuser:`manojks1999`)
7 changes: 4 additions & 3 deletions pvlib/bifacial/infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
Returns
-------
output : dict or DataFrame
Output is a DataFrame when input ghi is a Series. See Notes for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I read this, I think I should have suggested following the type of ghi instead of solar_zenith. Sorry for the confusion @jason-rpkt .

descriptions of content.
Output is a ``pandas.DataFrame`` when ``ghi`` is a Series.
Otherwise it is a dict of ``numpy.ndarray``
See Notes for descriptions of content.

Notes
-----
Expand Down Expand Up @@ -372,7 +373,7 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
'poa_global': poa_global, 'poa_direct': poa_direct,
'poa_diffuse': poa_diffuse, 'poa_ground_diffuse': poa_gnd_pv,
'poa_sky_diffuse': poa_sky_pv, 'shaded_fraction': f_x}
if isinstance(poa_global, pd.Series):
if isinstance(ghi, pd.Series):
output = pd.DataFrame(output)
return output

Expand Down
3 changes: 2 additions & 1 deletion pvlib/bifacial/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def _unshaded_ground_fraction(surface_tilt, surface_azimuth, solar_zenith,
surface_azimuth)
f_gnd_beam = 1.0 - np.minimum(
1.0, gcr * np.abs(cosd(surface_tilt) + sind(surface_tilt) * tan_phi))
np.where(solar_zenith > max_zenith, 0., f_gnd_beam) # [1], Eq. 4
# [1], Eq. 4
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam)
return f_gnd_beam # 1 - min(1, abs()) < 1 always


Expand Down
1 change: 1 addition & 0 deletions pvlib/tests/bifacial/test_infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_get_irradiance_poa():
# series inputs
surface_tilt = pd.Series(surface_tilt)
surface_azimuth = pd.Series(data=surface_azimuth, index=surface_tilt.index)
ghi = pd.Series(data=ghi, index=surface_tilt.index)
solar_zenith = pd.Series(solar_zenith, index=surface_tilt.index)
solar_azimuth = pd.Series(data=solar_azimuth, index=surface_tilt.index)
expected_diffuse = pd.Series(
Expand Down