From 556f5175facc60c301e1ca2d1afbe1ffd9e4da7f Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 9 Jun 2022 16:46:15 -0400 Subject: [PATCH 1/6] Create plot_pvfactors_fixed_tilt.py --- .../bifacial/plot_pvfactors_fixed_tilt.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 docs/examples/bifacial/plot_pvfactors_fixed_tilt.py diff --git a/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py b/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py new file mode 100644 index 0000000000..60aed7429b --- /dev/null +++ b/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py @@ -0,0 +1,68 @@ +""" +Fixed-Tilt Simulation with pvfactors +==================================== + +Modeling the irradiance on the rear side of a fixed-tilt array. +""" + +# %% +# Because pvfactors was originally designed for modeling single-axis +# tracking systems, it's not necessarily obvious how to use it to model +# fixed-tilt systems correctly. +# This example shows how to model rear-side irradiance on a fixed-tilt +# array using :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries`. + +import pandas as pd +from pvlib import location +from pvlib.bifacial.pvfactors import pvfactors_timeseries +import matplotlib.pyplot as plt +import warnings + +# supressing shapely warnings that occur on import of pvfactors +warnings.filterwarnings(action='ignore', module='pvfactors') + +# %% +# First, generate the usual modeling inputs: + +times = pd.date_range('2021-06-21', '2021-06-22', freq='1T', tz='Etc/GMT+5') +loc = location.Location(latitude=40, longitude=-80, tz=times.tz) +sp = loc.get_solarposition(times) +cs = loc.get_clearsky(times) + +# example array geometry +pvrow_height = 1 +pvrow_width = 4 +pitch = 10 +gcr = pvrow_width / pitch +axis_azimuth = 180 +albedo = 0.2 + +# %% +# Now the trick: since pvfactors only wants to model single-axis tracking +# arrays, we have to pretend our fixed tilt array is a single-axis tracking +# array that never rotates. In that case, the "axis of rotation" is +# the along the length of the row, 90 degrees offset from the +# fixed ``surface_azimuth``. + +irrad = pvfactors_timeseries( + solar_azimuth=sp['azimuth'], + solar_zenith=sp['apparent_zenith'], + surface_azimuth=180, # south-facing array + surface_tilt=20, + axis_azimuth=90, # 90 degrees off from surface_azimuth. 270 is ok too + timestamps=times, + dni=cs['dni'], + dhi=cs['dhi'], + gcr=gcr, + pvrow_height=pvrow_height, + pvrow_width=pvrow_width, + albedo=albedo, + n_pvrows=3, + index_observed_pvrow=1 +) + +# turn into pandas DataFrame +irrad = pd.concat(irrad, axis=1) + +irrad[['total_inc_back', 'total_abs_back']].plot() +plt.ylabel('Irradiance [W m$^{-2}$]') From 82b1fcca03b693abdffb736743a53665629fe42b Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 9 Jun 2022 16:47:48 -0400 Subject: [PATCH 2/6] whatsnew --- docs/sphinx/source/whatsnew/v0.9.2.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.9.2.rst b/docs/sphinx/source/whatsnew/v0.9.2.rst index 05b7ed58ab..d70ea91661 100644 --- a/docs/sphinx/source/whatsnew/v0.9.2.rst +++ b/docs/sphinx/source/whatsnew/v0.9.2.rst @@ -25,6 +25,9 @@ Testing Documentation ~~~~~~~~~~~~~ +* Add gallery example of simulating rearside irradiance for a fixed-tilt + array with pvfactors (:pull:`1470`) + Benchmarking ~~~~~~~~~~~~~ @@ -40,3 +43,4 @@ Contributors * Naman Priyadarshi (:ghuser:`Naman-Priyadarshi`) * Chencheng Luo (:ghuser:`roger-lcc`) * Prajwal Borkar (:ghuser:`PrajwalBorkar`) +* Kevin Anderson (:ghuser:`kanderso-nrel`) From ea4b8f6df7cc7cfa53436a28e0ba56426b20f47c Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 9 Jun 2022 16:52:37 -0400 Subject: [PATCH 3/6] add note in docstring parameter description --- pvlib/bifacial/pvfactors.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pvlib/bifacial/pvfactors.py b/pvlib/bifacial/pvfactors.py index 3c70b779fb..5a434ef3e5 100644 --- a/pvlib/bifacial/pvfactors.py +++ b/pvlib/bifacial/pvfactors.py @@ -35,6 +35,8 @@ def pvfactors_timeseries( axis_azimuth: float Azimuth angle of the rotation axis of the PV modules, using pvlib's convention (deg). This is supposed to be fixed for all timestamps. + When modeling fixed-tilt arrays, set this value to be 90 degrees off + from ``surface_azimuth``. timestamps: datetime or DatetimeIndex List of simulation timestamps dni: numeric From fc55c8cf2284aef10199af7e370817930d0e0c95 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 9 Jun 2022 16:54:22 -0400 Subject: [PATCH 4/6] typo --- docs/examples/bifacial/plot_pvfactors_fixed_tilt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py b/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py index 60aed7429b..5525c49453 100644 --- a/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py +++ b/docs/examples/bifacial/plot_pvfactors_fixed_tilt.py @@ -41,7 +41,7 @@ # Now the trick: since pvfactors only wants to model single-axis tracking # arrays, we have to pretend our fixed tilt array is a single-axis tracking # array that never rotates. In that case, the "axis of rotation" is -# the along the length of the row, 90 degrees offset from the +# along the length of the row, with ``axis_azimuth`` 90 degrees offset from the # fixed ``surface_azimuth``. irrad = pvfactors_timeseries( From 517c03d87c8989fb9e970b569c6afaf214e7d41c Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 5 Jul 2022 09:59:12 -0400 Subject: [PATCH 5/6] Update pvlib/bifacial/pvfactors.py Co-authored-by: Cliff Hansen --- pvlib/bifacial/pvfactors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/bifacial/pvfactors.py b/pvlib/bifacial/pvfactors.py index 5a434ef3e5..be8d626213 100644 --- a/pvlib/bifacial/pvfactors.py +++ b/pvlib/bifacial/pvfactors.py @@ -35,7 +35,7 @@ def pvfactors_timeseries( axis_azimuth: float Azimuth angle of the rotation axis of the PV modules, using pvlib's convention (deg). This is supposed to be fixed for all timestamps. - When modeling fixed-tilt arrays, set this value to be 90 degrees off + When modeling fixed-tilt arrays, set this value to be 90 degrees clockwise from ``surface_azimuth``. timestamps: datetime or DatetimeIndex List of simulation timestamps From d003fccd2dc79134d4224b562b886b894644ca56 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 5 Jul 2022 10:00:19 -0400 Subject: [PATCH 6/6] stickler --- pvlib/bifacial/pvfactors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/bifacial/pvfactors.py b/pvlib/bifacial/pvfactors.py index be8d626213..ed09879a21 100644 --- a/pvlib/bifacial/pvfactors.py +++ b/pvlib/bifacial/pvfactors.py @@ -35,8 +35,8 @@ def pvfactors_timeseries( axis_azimuth: float Azimuth angle of the rotation axis of the PV modules, using pvlib's convention (deg). This is supposed to be fixed for all timestamps. - When modeling fixed-tilt arrays, set this value to be 90 degrees clockwise - from ``surface_azimuth``. + When modeling fixed-tilt arrays, set this value to be 90 degrees + clockwise from ``surface_azimuth``. timestamps: datetime or DatetimeIndex List of simulation timestamps dni: numeric