Skip to content

Remove diffuse_fraction calculation from infinite_sheds #2451

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.12.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Enhancements
:py:func:`~pvlib.iotools.get_nsrdb_psm4_full_disc`,
:py:func:`~pvlib.iotools.read_nsrdb_psm4`, and
:py:func:`~pvlib.iotools.parse_nsrdb_psm4`. (:issue:`2326`, :pull:`2378`)
* :py:mod:`pvlib.bifacial.infinite_sheds` no longer emits "invalid value" warnings
when supplying irradiance arrays with nighttime zero values. (:issue:`2450`, :pull:`2451`)

Documentation
~~~~~~~~~~~~~
Expand Down
27 changes: 11 additions & 16 deletions pvlib/bifacial/infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@
from pvlib.irradiance import beam_component, aoi, haydavies


def _poa_ground_shadows(poa_ground, f_gnd_beam, df, vf_gnd_sky):
def _poa_ground_shadows(ghi, dhi, albedo, f_gnd_beam, vf_gnd_sky):
"""
Reduce ground-reflected irradiance to the tilted plane (poa_ground) to
account for shadows on the ground.

Parameters
----------
poa_ground : numeric
Ground reflected irradiance on the tilted surface, assuming full GHI
illumination on all of the ground. [W/m^2]
ghi : numeric
Global horizontal irradiance, with no adjustments. [W/m^2]
dhi : numeric
Diffuse horizontal irradiance, with no adjustments. [W/m^2]
albedo : numeric
Ground albedo, the ratio of reflected to incident irradiance of the
ground surface. [W/m^2]
f_gnd_beam : numeric
Fraction of the distance between rows that is illuminated (unshaded).
[unitless]
df : numeric
Diffuse fraction, the ratio of DHI to GHI. [unitless]
vf_gnd_sky : numeric
View factor from the ground to the sky, integrated along the distance
between rows. [unitless]
Expand All @@ -35,7 +37,7 @@ def _poa_ground_shadows(poa_ground, f_gnd_beam, df, vf_gnd_sky):
ground. [W/m^2]

"""
return poa_ground * (f_gnd_beam*(1 - df) + df*vf_gnd_sky)
return albedo * (f_gnd_beam * (ghi - dhi) + vf_gnd_sky * dhi)


def _poa_sky_diffuse_pv(dhi, gcr, surface_tilt):
Expand Down Expand Up @@ -339,18 +341,11 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
# and restricted views
# this is a deviation from [1], because the row to ground view factor
# is accounted for in a different manner
ground_diffuse = ghi * albedo

# diffuse fraction
diffuse_fraction = np.clip(dhi / ghi, 0., 1.)
# make diffuse fraction 0 when ghi is small
diffuse_fraction = np.where(ghi < 0.0001, 0., diffuse_fraction)

# Reduce ground-reflected irradiance because other rows in the array
# block irradiance from reaching the ground.
# [2], Eq. 9
ground_diffuse = _poa_ground_shadows(
ground_diffuse, f_gnd_beam, diffuse_fraction, vf_gnd_sky)
ground_diffuse = _poa_ground_shadows(ghi, dhi, albedo, f_gnd_beam,
vf_gnd_sky)

# Ground-reflected irradiance on the row surface accounting for
# the view to the ground. This deviates from [1], Eq. 10, 11 and
Expand Down
23 changes: 12 additions & 11 deletions tests/bifacial/test_infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ def test_system():


def test__poa_ground_shadows():
poa_ground, f_gnd_beam, df, vf_gnd_sky = (300., 0.5, 0.5, 0.2)
result = infinite_sheds._poa_ground_shadows(
poa_ground, f_gnd_beam, df, vf_gnd_sky)
expected = 300. * (0.5 * 0.5 + 0.5 * 0.2)
ghi, dhi, albedo, f_gnd_beam, vf_gnd_sky = (300., 100, 0.3, 0.5, 0.2)
result = infinite_sheds._poa_ground_shadows(ghi, dhi, albedo, f_gnd_beam,
vf_gnd_sky)

expected = 0.3 * (200 * 0.5 + 100 * 0.2)
assert np.isclose(result, expected)
# vector inputs
poa_ground = np.array([300., 300.])
f_gnd_beam = np.array([0.5, 0.5])
df = np.array([0.5, 0.])
vf_gnd_sky = np.array([0.2, 0.2])
result = infinite_sheds._poa_ground_shadows(
poa_ground, f_gnd_beam, df, vf_gnd_sky)
expected_vec = np.array([expected, 300. * 0.5])
ghi = np.array([ghi, ghi])
dhi = np.array([dhi, 0])
f_gnd_beam = np.array([f_gnd_beam, f_gnd_beam])
vf_gnd_sky = np.array([vf_gnd_sky, vf_gnd_sky])
result = infinite_sheds._poa_ground_shadows(ghi, dhi, albedo, f_gnd_beam,
vf_gnd_sky)
expected_vec = np.array([expected, 300. * 0.5 * 0.3])
assert np.allclose(result, expected_vec)


Expand Down
Loading