Skip to content

Commit b265b1c

Browse files
kandersolarcwhanse
andauthored
Gallery example for modeling fixed-tilt arrays with pvfactors (#1470)
* Create plot_pvfactors_fixed_tilt.py * whatsnew * add note in docstring parameter description * typo * Update pvlib/bifacial/pvfactors.py Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * stickler Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
1 parent c0daa5d commit b265b1c

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"""
2+
Fixed-Tilt Simulation with pvfactors
3+
====================================
4+
5+
Modeling the irradiance on the rear side of a fixed-tilt array.
6+
"""
7+
8+
# %%
9+
# Because pvfactors was originally designed for modeling single-axis
10+
# tracking systems, it's not necessarily obvious how to use it to model
11+
# fixed-tilt systems correctly.
12+
# This example shows how to model rear-side irradiance on a fixed-tilt
13+
# array using :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries`.
14+
15+
import pandas as pd
16+
from pvlib import location
17+
from pvlib.bifacial.pvfactors import pvfactors_timeseries
18+
import matplotlib.pyplot as plt
19+
import warnings
20+
21+
# supressing shapely warnings that occur on import of pvfactors
22+
warnings.filterwarnings(action='ignore', module='pvfactors')
23+
24+
# %%
25+
# First, generate the usual modeling inputs:
26+
27+
times = pd.date_range('2021-06-21', '2021-06-22', freq='1T', tz='Etc/GMT+5')
28+
loc = location.Location(latitude=40, longitude=-80, tz=times.tz)
29+
sp = loc.get_solarposition(times)
30+
cs = loc.get_clearsky(times)
31+
32+
# example array geometry
33+
pvrow_height = 1
34+
pvrow_width = 4
35+
pitch = 10
36+
gcr = pvrow_width / pitch
37+
axis_azimuth = 180
38+
albedo = 0.2
39+
40+
# %%
41+
# Now the trick: since pvfactors only wants to model single-axis tracking
42+
# arrays, we have to pretend our fixed tilt array is a single-axis tracking
43+
# array that never rotates. In that case, the "axis of rotation" is
44+
# along the length of the row, with ``axis_azimuth`` 90 degrees offset from the
45+
# fixed ``surface_azimuth``.
46+
47+
irrad = pvfactors_timeseries(
48+
solar_azimuth=sp['azimuth'],
49+
solar_zenith=sp['apparent_zenith'],
50+
surface_azimuth=180, # south-facing array
51+
surface_tilt=20,
52+
axis_azimuth=90, # 90 degrees off from surface_azimuth. 270 is ok too
53+
timestamps=times,
54+
dni=cs['dni'],
55+
dhi=cs['dhi'],
56+
gcr=gcr,
57+
pvrow_height=pvrow_height,
58+
pvrow_width=pvrow_width,
59+
albedo=albedo,
60+
n_pvrows=3,
61+
index_observed_pvrow=1
62+
)
63+
64+
# turn into pandas DataFrame
65+
irrad = pd.concat(irrad, axis=1)
66+
67+
irrad[['total_inc_back', 'total_abs_back']].plot()
68+
plt.ylabel('Irradiance [W m$^{-2}$]')

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Testing
3030

3131
Documentation
3232
~~~~~~~~~~~~~
33+
* Add gallery example of simulating rearside irradiance for a fixed-tilt
34+
array with pvfactors (:pull:`1470`)
35+
3336

3437
Benchmarking
3538
~~~~~~~~~~~~~

pvlib/bifacial/pvfactors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def pvfactors_timeseries(
3535
axis_azimuth: float
3636
Azimuth angle of the rotation axis of the PV modules, using pvlib's
3737
convention (deg). This is supposed to be fixed for all timestamps.
38+
When modeling fixed-tilt arrays, set this value to be 90 degrees
39+
clockwise from ``surface_azimuth``.
3840
timestamps: datetime or DatetimeIndex
3941
List of simulation timestamps
4042
dni: numeric

0 commit comments

Comments
 (0)