Skip to content

Commit f13d1b1

Browse files
kandersolarcwhansewholmgren
authored
add Mount classes (#1176)
* add Mount classes, incorporate into Array and PVSystem * update pvsystem tests * delete mounts module * fix modelchain tests * some modifications to SingleAxisTracker * changes from review * stickler * use dataclasses for mounts * update tests * update docs * whatsnew * test mount classes * stickler * more tests * another test * fix typo * clean up AbstractMount * remove unnecessary use of dataclasses.field * calculate -> get * Update pvlib/pvsystem.py Co-authored-by: Cliff Hansen <[email protected]> * stickler * test fixes * add optional surface_tilt parameter to PVSystem.fuentes_celltemp * move racking_model and module_height to the Mounts * fix some tests * remove unnecessary fixture * Revert "remove unnecessary fixture" This reverts commit 74a6be4. * update merged test * fix fuentes issue, sort of * pep8 * pep8 * remove PVSystem.fuentes_celltemp surface_tilt parameter * placeholder fuentes surface_tilt logic * test updates * remove unused imports * remove fuentes override complexity * stickler * update RST pages * revert unnecessary docs change * add link to pvsystem and modelchain pages in api listing * other changes from review * get module_height from mount instead of temperature_model_parameters * coverage for fuentes module_height parameter * deprecate SingleAxisTracker * suppress SAT deprecation warnings in tests * Apply suggestions from code review Co-authored-by: Will Holmgren <[email protected]> * Tracking -> Tracker Co-authored-by: Cliff Hansen <[email protected]> Co-authored-by: Will Holmgren <[email protected]>
1 parent 4ba9871 commit f13d1b1

File tree

9 files changed

+463
-291
lines changed

9 files changed

+463
-291
lines changed

docs/sphinx/source/api.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ object-oriented programming. These classes can help users keep track of
1313
data in a more organized way, and can help to simplify the modeling
1414
process. The classes do not add any functionality beyond the procedural
1515
code. Most of the object methods are simple wrappers around the
16-
corresponding procedural code.
16+
corresponding procedural code. For examples of using these classes, see
17+
the :ref:`pvsystemdoc` and :ref:`modelchaindoc` pages.
1718

1819
.. autosummary::
1920
:toctree: generated/
2021

2122
location.Location
2223
pvsystem.PVSystem
2324
pvsystem.Array
25+
pvsystem.FixedMount
26+
pvsystem.SingleAxisTrackerMount
2427
tracking.SingleAxisTracker
2528
modelchain.ModelChain
2629
modelchain.ModelChainResult

docs/sphinx/source/modelchain.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. _modelchaindoc:
12

23
ModelChain
34
==========
@@ -40,7 +41,7 @@ objects, module data, and inverter data.
4041
# pvlib imports
4142
import pvlib
4243
43-
from pvlib.pvsystem import PVSystem
44+
from pvlib.pvsystem import PVSystem, FixedMount
4445
from pvlib.location import Location
4546
from pvlib.modelchain import ModelChain
4647
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
@@ -53,8 +54,8 @@ objects, module data, and inverter data.
5354
sandia_module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
5455
cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_']
5556
56-
Now we create a Location object, a PVSystem object, and a ModelChain
57-
object.
57+
Now we create a Location object, a Mount object, a PVSystem object, and a
58+
ModelChain object.
5859

5960
.. ipython:: python
6061
@@ -448,11 +449,11 @@ are in the same order as in ``PVSystem.arrays``.
448449
location = Location(latitude=32.2, longitude=-110.9)
449450
inverter_parameters = {'pdc0': 10000, 'eta_inv_nom': 0.96}
450451
module_parameters = {'pdc0': 250, 'gamma_pdc': -0.004}
451-
array_one = Array(surface_tilt=20, surface_azimuth=200,
452+
array_one = Array(mount=FixedMount(surface_tilt=20, surface_azimuth=200),
452453
module_parameters=module_parameters,
453454
temperature_model_parameters=temperature_model_parameters,
454455
modules_per_string=10, strings=2)
455-
array_two = Array(surface_tilt=20, surface_azimuth=160,
456+
array_two = Array(mount=FixedMount(surface_tilt=20, surface_azimuth=160),
456457
module_parameters=module_parameters,
457458
temperature_model_parameters=temperature_model_parameters,
458459
modules_per_string=10, strings=2)

docs/sphinx/source/pvsystem.rst

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ provided for each array, and the arrays are provided to
138138
.. ipython:: python
139139
140140
module_parameters = {'pdc0': 5000, 'gamma_pdc': -0.004}
141-
array_one = pvsystem.Array(module_parameters=module_parameters)
142-
array_two = pvsystem.Array(module_parameters=module_parameters)
141+
mount = pvsystem.FixedMount(surface_tilt=20, surface_azimuth=180)
142+
array_one = pvsystem.Array(mount=mount, module_parameters=module_parameters)
143+
array_two = pvsystem.Array(mount=mount, module_parameters=module_parameters)
143144
system_two_arrays = pvsystem.PVSystem(arrays=[array_one, array_two],
144145
inverter_parameters=inverter_parameters)
145146
print([array.module_parameters for array in system_two_arrays.arrays])
@@ -148,7 +149,7 @@ provided for each array, and the arrays are provided to
148149
149150
The :py:class:`~pvlib.pvsystem.Array` class includes those
150151
:py:class:`~pvlib.pvsystem.PVSystem` attributes that may vary from array
151-
to array. These attributes include `surface_tilt`, `surface_azimuth`,
152+
to array. These attributes include
152153
`module_parameters`, `temperature_model_parameters`, `modules_per_string`,
153154
`strings_per_inverter`, `albedo`, `surface_type`, `module_type`, and
154155
`racking_model`.
@@ -179,27 +180,30 @@ Tilt and azimuth
179180
The first parameters which describe the DC part of a PV system are the tilt
180181
and azimuth of the modules. In the case of a PV system with a single array,
181182
these parameters can be specified using the `PVSystem.surface_tilt` and
182-
`PVSystem.surface_azimuth` attributes.
183+
`PVSystem.surface_azimuth` attributes. This will automatically create
184+
an :py:class:`~pvlib.pvsystem.Array` with a :py:class:`~pvlib.pvsystem.FixedMount`
185+
at the specified tilt and azimuth:
183186

184187
.. ipython:: python
185188
186189
# single south-facing array at 20 deg tilt
187190
system_one_array = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
188-
print(system_one_array.arrays[0].surface_tilt,
189-
system_one_array.arrays[0].surface_azimuth)
191+
print(system_one_array.arrays[0].mount)
190192
191193
192194
In the case of a PV system with several arrays, the parameters are specified
193-
for each array using the attributes `Array.surface_tilt` and `Array.surface_azimuth`.
195+
for each array by passing a different :py:class:`~pvlib.pvsystem.FixedMount`
196+
(or another `Mount` class):
194197

195198
.. ipython:: python
196199
197-
array_one = pvsystem.Array(surface_tilt=30, surface_azimuth=90)
198-
print(array_one.surface_tilt, array_one.surface_azimuth)
199-
array_two = pvsystem.Array(surface_tilt=30, surface_azimuth=220)
200+
array_one = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=90))
201+
print(array_one.mount.surface_tilt, array_one.mount.surface_azimuth)
202+
array_two = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=220))
200203
system = pvsystem.PVSystem(arrays=[array_one, array_two])
201204
system.num_arrays
202-
[(array.surface_tilt, array.surface_azimuth) for array in system.arrays]
205+
for array in system.arrays:
206+
print(array.mount)
203207
204208
205209
The `surface_tilt` and `surface_azimuth` attributes are used in PVSystem
@@ -215,8 +219,7 @@ and `solar_azimuth` as arguments.
215219
216220
# single south-facing array at 20 deg tilt
217221
system_one_array = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
218-
print(system_one_array.arrays[0].surface_tilt,
219-
system_one_array.arrays[0].surface_azimuth)
222+
print(system_one_array.arrays[0].mount)
220223
221224
# call get_aoi with solar_zenith, solar_azimuth
222225
aoi = system_one_array.get_aoi(solar_zenith=30, solar_azimuth=180)
@@ -229,7 +232,7 @@ operates in a similar manner.
229232
.. ipython:: python
230233
231234
# two arrays each at 30 deg tilt with different facing
232-
array_one = pvsystem.Array(surface_tilt=30, surface_azimuth=90)
235+
array_one = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=90))
233236
array_one_aoi = array_one.get_aoi(solar_zenith=30, solar_azimuth=180)
234237
print(array_one_aoi)
235238
@@ -240,7 +243,7 @@ operates on all `Array` instances in the `PVSystem`, whereas the the
240243

241244
.. ipython:: python
242245
243-
array_two = pvsystem.Array(surface_tilt=30, surface_azimuth=220)
246+
array_two = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=220))
244247
system_multiarray = pvsystem.PVSystem(arrays=[array_one, array_two])
245248
print(system_multiarray.num_arrays)
246249
# call get_aoi with solar_zenith, solar_azimuth
@@ -315,8 +318,8 @@ Losses
315318

316319
The `losses_parameters` attribute contains data that may be used with
317320
methods that calculate system losses. At present, these methods include
318-
only :py:meth:`PVSystem.pvwatts_losses` and
319-
:py:func:`pvsystem.pvwatts_losses`, but we hope to add more related functions
321+
only :py:meth:`pvlib.pvsystem.PVSystem.pvwatts_losses` and
322+
:py:func:`pvlib.pvsystem.pvwatts_losses`, but we hope to add more related functions
320323
and methods in the future.
321324

322325

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Deprecations
100100
* ``PVSystem.surface_azimuth``
101101
* ``PVSystem.temperature_model_parameters``
102102

103+
* The :py:class:`pvlib.tracking.SingleAxisTracker` class is deprecated and
104+
replaced by using :py:class:`pvlib.pvsystem.PVSystem` with the new
105+
:py:class:`pvlib.pvsystem.SingleAxisTrackerMount` (:pull:`1176`)
106+
103107

104108
Enhancements
105109
~~~~~~~~~~~~
@@ -120,6 +124,9 @@ Enhancements
120124
* Added :py:class:`~pvlib.pvsystem.Array` class to represent an array of
121125
modules separately from a :py:class:`~pvlib.pvsystem.PVSystem`.
122126
(:pull:`1076`, :issue:`1067`)
127+
* Added :py:class:`~pvlib.pvsystem.FixedMount` and
128+
:py:class:`~pvlib.pvsystem.SingleAxisTrackerMount` classes to use with
129+
the new :py:class:`~pvlib.pvsystem.Array` class (:pull:`1176`)
123130
* Added capability for modeling a PV system with multiple arrays in
124131
:py:class:`~pvlib.pvsystem.PVSystem`. Updates the ``PVSystem`` API
125132
to operate on and return tuples where each element of the tuple corresponds

0 commit comments

Comments
 (0)