Skip to content

Commit 5f70c5a

Browse files
shethkajal7RDaxinicwhanse
authored
Add bifacial scaling to Townsend snow loss model (pvlib#2756)
* Add bifacial scaling to Townsend snow loss Add optional front_side_fraction argument to loss_townsend for bifacial snow loss adjustment. Includes test coverage for the scaling behavior. * Update tests/test_snow.py rewrite the test function to avoid repetition in numpy array. Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> * Address review comments Set front_side_fraction default to 1.0, simplify the scaling logic, clean up tests, and add a whatsnew entry. * Updated test_snow.py Added two newlines before the test function * Update docs/sphinx/source/whatsnew/v0.15.2.rst Remove the username information following format of other entries Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> * Update pvlib/snow.py to change parentheses and period position Parentheses and period positions are updated to follow style guide Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> * Apply suggestion from @cwhanse Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply suggestion from @cwhanse Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> --------- Co-authored-by: Rajiv Daxini <143435106+RDaxini@users.noreply.github.com> Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
1 parent 6fd4b07 commit 5f70c5a

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

docs/sphinx/source/whatsnew/v0.15.2.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Bug fixes
2525

2626
Enhancements
2727
~~~~~~~~~~~~
28+
* Add the ``front_side_fraction`` parameter to
29+
:py:func:`pvlib.snow.loss_townsend` to support Townsend snow-loss
30+
workflows for bifacial systems. (:issue:`2755`, :pull:`2756`)
31+
2832
* Added mapping of the parameter ``"albedo"`` in
2933
:py:func:`~pvlib.iotools.get_nasa_power` when ``map_variables=True``
3034
(:pull:`2753`)
@@ -60,5 +64,6 @@ Contributors
6064
~~~~~~~~~~~~
6165
* :ghuser:`Omesh37`
6266
* Cliff Hansen (:ghuser:`cwhanse`)
67+
* :ghuser:`shethkajal7`
6368
* Arthur Onno (:ghuser:`ArthurOnnoTerabase`)
6469
* Adam R. Jensen (:ghuser:`AdamRJensen`)

pvlib/snow.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ def _townsend_effective_snow(snow_total, snow_events):
248248

249249
def loss_townsend(snow_total, snow_events, surface_tilt, relative_humidity,
250250
temp_air, poa_global, slant_height, lower_edge_height,
251-
string_factor=1.0, angle_of_repose=40):
251+
string_factor=1.0, angle_of_repose=40,
252+
front_side_fraction=1.0):
252253
'''
253254
Calculates monthly snow loss based on the Townsend monthly snow loss
254255
model.
@@ -293,6 +294,12 @@ def loss_townsend(snow_total, snow_events, surface_tilt, relative_humidity,
293294
Piled snow angle, assumed to stabilize at 40°, the midpoint of
294295
25°-55° avalanching slope angles. [deg]
295296
297+
front_side_fraction : numeric or array-like, default 1.0
298+
Fraction of monthly energy from front-side insolation. [unitless]
299+
Multiplies the calculated loss fraction. For example,
300+
use 0.9 when 90% of monthly energy is from the front side
301+
of a bifacial system and 10% is from the rear side.
302+
296303
Returns
297304
-------
298305
loss : array-like
@@ -310,6 +317,10 @@ def loss_townsend(snow_total, snow_events, surface_tilt, relative_humidity,
310317
publication of [1]_, as described in [2]_.
311318
The definition for snow events documented above is based on [3]_.
312319
320+
For bifacial systems, [2]_ recommends including both front-side and
321+
rear-side insolation in ``poa_global``. The resulting loss is
322+
scaled by the front-side energy fraction ``front_side_fraction``.
323+
313324
References
314325
----------
315326
.. [1] Townsend, Tim & Powers, Loren. (2011). Photovoltaics and snow: An
@@ -384,4 +395,6 @@ def loss_townsend(snow_total, snow_events, surface_tilt, relative_humidity,
384395
* string_factor
385396
)
386397

398+
loss_fraction = loss_fraction * front_side_fraction
399+
387400
return np.clip(loss_fraction, 0, 1)

tests/test_snow.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,28 @@ def test_loss_townsend_cases(poa_global, surface_tilt, slant_height,
247247
poa_global, slant_height, lower_edge_height, string_factor)
248248
actual = np.around(actual * 100)
249249
assert np.allclose(expected, actual)
250+
251+
252+
def test_loss_townsend_front_side_fraction():
253+
snow_total = np.array([25.4, 25.4, 12.7, 2.54, 0, 0, 0, 0, 0, 0, 12.7,
254+
25.4])
255+
snow_events = np.array([2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 2, 3])
256+
surface_tilt = 20
257+
relative_humidity = np.full(12, 80)
258+
temp_air = np.full(12, 0)
259+
poa_global = np.full(12, 350000)
260+
slant_height = 2.54
261+
lower_edge_height = 0.254
262+
front_side_fraction = 0.9
263+
264+
unadjusted = snow.loss_townsend(
265+
snow_total, snow_events, surface_tilt, relative_humidity, temp_air,
266+
poa_global, slant_height, lower_edge_height)
267+
268+
adjusted = snow.loss_townsend(
269+
snow_total, snow_events, surface_tilt, relative_humidity, temp_air,
270+
poa_global, slant_height, lower_edge_height,
271+
front_side_fraction=front_side_fraction)
272+
273+
np.testing.assert_allclose(adjusted, unadjusted * front_side_fraction)
274+

0 commit comments

Comments
 (0)