Skip to content
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

add Mount classes #1176

Merged
merged 54 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cb3c207
add Mount classes, incorporate into Array and PVSystem
kandersolar Feb 23, 2021
8a6d0e6
update pvsystem tests
kandersolar Feb 23, 2021
6d4240e
delete mounts module
kandersolar Feb 23, 2021
fc4064b
fix modelchain tests
kandersolar Feb 24, 2021
e8f1404
some modifications to SingleAxisTracker
kandersolar Feb 24, 2021
02a2b27
changes from review
kandersolar Feb 27, 2021
0be45ae
stickler
kandersolar Feb 27, 2021
9406ccd
Merge branch 'master' into mount_classes
kandersolar Mar 2, 2021
e1bdc67
use dataclasses for mounts
kandersolar Mar 7, 2021
61650e9
update tests
kandersolar Mar 7, 2021
fc47003
update docs
kandersolar Mar 7, 2021
887fd3a
whatsnew
kandersolar Mar 7, 2021
ecc4737
test mount classes
kandersolar Mar 7, 2021
cbb41e1
stickler
kandersolar Mar 7, 2021
9e663d2
more tests
kandersolar Mar 7, 2021
105edb7
another test
kandersolar Mar 7, 2021
6d32c41
fix typo
kandersolar Mar 7, 2021
4a6347e
clean up AbstractMount
kandersolar Mar 13, 2021
1e063ba
remove unnecessary use of dataclasses.field
kandersolar Mar 13, 2021
3dcf106
calculate -> get
kandersolar Mar 13, 2021
d4045a3
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Mar 21, 2021
b0b551f
Update pvlib/pvsystem.py
kandersolar Mar 21, 2021
515a359
stickler
kandersolar Mar 21, 2021
a874b11
test fixes
kandersolar Mar 21, 2021
17195ae
add optional surface_tilt parameter to PVSystem.fuentes_celltemp
kandersolar Mar 21, 2021
93716bb
move racking_model and module_height to the Mounts
kandersolar Mar 21, 2021
efe6b3b
fix some tests
kandersolar Mar 21, 2021
74a6be4
remove unnecessary fixture
kandersolar Mar 28, 2021
9da9eb4
Revert "remove unnecessary fixture"
kandersolar Mar 30, 2021
2320ed7
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar May 14, 2021
6370143
update merged test
kandersolar May 14, 2021
6181e96
fix fuentes issue, sort of
kandersolar May 14, 2021
47b6884
pep8
kandersolar May 14, 2021
dbc1193
pep8
kandersolar May 14, 2021
e0eeef4
remove PVSystem.fuentes_celltemp surface_tilt parameter
kandersolar May 14, 2021
cf3fe20
placeholder fuentes surface_tilt logic
kandersolar May 14, 2021
7c18126
Merge branch 'master' into mount_classes
kandersolar May 21, 2021
86292c5
test updates
kandersolar May 21, 2021
cc5f45a
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Jun 17, 2021
739359e
remove unused imports
kandersolar Jun 17, 2021
59547f5
remove fuentes override complexity
kandersolar Jun 23, 2021
bed27c9
stickler
kandersolar Jun 23, 2021
1103f99
update RST pages
kandersolar Jun 23, 2021
e6504cd
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Jun 23, 2021
73aba9a
revert unnecessary docs change
kandersolar Jun 23, 2021
f3ff722
add link to pvsystem and modelchain pages in api listing
kandersolar Jun 29, 2021
9c0c3ff
other changes from review
kandersolar Jun 29, 2021
35da280
get module_height from mount instead of temperature_model_parameters
kandersolar Jun 29, 2021
1a43ea8
coverage for fuentes module_height parameter
kandersolar Jun 29, 2021
c1738e9
deprecate SingleAxisTracker
kandersolar Jul 21, 2021
781b133
suppress SAT deprecation warnings in tests
kandersolar Jul 21, 2021
22341ec
Apply suggestions from code review
kandersolar Jul 22, 2021
6df8408
Tracking -> Tracker
kandersolar Jul 22, 2021
506edbc
Merge branch 'mount_classes' of https://github.com/kanderso-nrel/pvli…
kandersolar Jul 22, 2021
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
5 changes: 4 additions & 1 deletion docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ object-oriented programming. These classes can help users keep track of
data in a more organized way, and can help to simplify the modeling
process. The classes do not add any functionality beyond the procedural
code. Most of the object methods are simple wrappers around the
corresponding procedural code.
corresponding procedural code. For examples of using these classes, see
the :ref:`pvsystemdoc` and :ref:`modelchaindoc` pages.

.. autosummary::
:toctree: generated/

location.Location
pvsystem.PVSystem
pvsystem.Array
pvsystem.FixedMount
pvsystem.SingleAxisTrackerMount
kandersolar marked this conversation as resolved.
Show resolved Hide resolved
tracking.SingleAxisTracker
modelchain.ModelChain
modelchain.ModelChainResult
Expand Down
11 changes: 6 additions & 5 deletions docs/sphinx/source/modelchain.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.. _modelchaindoc:

ModelChain
==========
Expand Down Expand Up @@ -40,7 +41,7 @@ objects, module data, and inverter data.
# pvlib imports
import pvlib

from pvlib.pvsystem import PVSystem
from pvlib.pvsystem import PVSystem, FixedMount
from pvlib.location import Location
from pvlib.modelchain import ModelChain
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
Expand All @@ -53,8 +54,8 @@ objects, module data, and inverter data.
sandia_module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_']

Now we create a Location object, a PVSystem object, and a ModelChain
object.
Now we create a Location object, a Mount object, a PVSystem object, and a
ModelChain object.

.. ipython:: python

Expand Down Expand Up @@ -448,11 +449,11 @@ are in the same order as in ``PVSystem.arrays``.
location = Location(latitude=32.2, longitude=-110.9)
inverter_parameters = {'pdc0': 10000, 'eta_inv_nom': 0.96}
module_parameters = {'pdc0': 250, 'gamma_pdc': -0.004}
array_one = Array(surface_tilt=20, surface_azimuth=200,
array_one = Array(mount=FixedMount(surface_tilt=20, surface_azimuth=200),
module_parameters=module_parameters,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=10, strings=2)
array_two = Array(surface_tilt=20, surface_azimuth=160,
array_two = Array(mount=FixedMount(surface_tilt=20, surface_azimuth=160),
module_parameters=module_parameters,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=10, strings=2)
Expand Down
37 changes: 20 additions & 17 deletions docs/sphinx/source/pvsystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ provided for each array, and the arrays are provided to
.. ipython:: python

module_parameters = {'pdc0': 5000, 'gamma_pdc': -0.004}
array_one = pvsystem.Array(module_parameters=module_parameters)
array_two = pvsystem.Array(module_parameters=module_parameters)
mount = pvsystem.FixedMount(surface_tilt=20, surface_azimuth=180)
array_one = pvsystem.Array(mount=mount, module_parameters=module_parameters)
array_two = pvsystem.Array(mount=mount, module_parameters=module_parameters)
system_two_arrays = pvsystem.PVSystem(arrays=[array_one, array_two],
inverter_parameters=inverter_parameters)
print([array.module_parameters for array in system_two_arrays.arrays])
Expand All @@ -148,7 +149,7 @@ provided for each array, and the arrays are provided to

The :py:class:`~pvlib.pvsystem.Array` class includes those
:py:class:`~pvlib.pvsystem.PVSystem` attributes that may vary from array
to array. These attributes include `surface_tilt`, `surface_azimuth`,
to array. These attributes include
`module_parameters`, `temperature_model_parameters`, `modules_per_string`,
`strings_per_inverter`, `albedo`, `surface_type`, `module_type`, and
`racking_model`.
Expand Down Expand Up @@ -179,27 +180,30 @@ Tilt and azimuth
The first parameters which describe the DC part of a PV system are the tilt
and azimuth of the modules. In the case of a PV system with a single array,
these parameters can be specified using the `PVSystem.surface_tilt` and
`PVSystem.surface_azimuth` attributes.
`PVSystem.surface_azimuth` attributes. This will automatically create
an :py:class:`~pvlib.pvsystem.Array` with a :py:class:`~pvlib.pvsystem.FixedMount`
at the specified tilt and azimuth:

.. ipython:: python

# single south-facing array at 20 deg tilt
system_one_array = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
print(system_one_array.arrays[0].surface_tilt,
system_one_array.arrays[0].surface_azimuth)
print(system_one_array.arrays[0].mount)


In the case of a PV system with several arrays, the parameters are specified
for each array using the attributes `Array.surface_tilt` and `Array.surface_azimuth`.
for each array by passing a different :py:class:`~pvlib.pvsystem.FixedMount`
(or another `Mount` class):

.. ipython:: python

array_one = pvsystem.Array(surface_tilt=30, surface_azimuth=90)
print(array_one.surface_tilt, array_one.surface_azimuth)
array_two = pvsystem.Array(surface_tilt=30, surface_azimuth=220)
array_one = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=90))
print(array_one.mount.surface_tilt, array_one.mount.surface_azimuth)
array_two = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=220))
system = pvsystem.PVSystem(arrays=[array_one, array_two])
system.num_arrays
[(array.surface_tilt, array.surface_azimuth) for array in system.arrays]
for array in system.arrays:
print(array.mount)


The `surface_tilt` and `surface_azimuth` attributes are used in PVSystem
Expand All @@ -215,8 +219,7 @@ and `solar_azimuth` as arguments.

# single south-facing array at 20 deg tilt
system_one_array = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
print(system_one_array.arrays[0].surface_tilt,
system_one_array.arrays[0].surface_azimuth)
print(system_one_array.arrays[0].mount)

# call get_aoi with solar_zenith, solar_azimuth
aoi = system_one_array.get_aoi(solar_zenith=30, solar_azimuth=180)
Expand All @@ -229,7 +232,7 @@ operates in a similar manner.
.. ipython:: python

# two arrays each at 30 deg tilt with different facing
array_one = pvsystem.Array(surface_tilt=30, surface_azimuth=90)
array_one = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=90))
array_one_aoi = array_one.get_aoi(solar_zenith=30, solar_azimuth=180)
print(array_one_aoi)

Expand All @@ -240,7 +243,7 @@ operates on all `Array` instances in the `PVSystem`, whereas the the

.. ipython:: python

array_two = pvsystem.Array(surface_tilt=30, surface_azimuth=220)
array_two = pvsystem.Array(pvsystem.FixedMount(surface_tilt=30, surface_azimuth=220))
system_multiarray = pvsystem.PVSystem(arrays=[array_one, array_two])
print(system_multiarray.num_arrays)
# call get_aoi with solar_zenith, solar_azimuth
Expand Down Expand Up @@ -315,8 +318,8 @@ Losses

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


Expand Down
7 changes: 7 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ Deprecations
* ``PVSystem.surface_azimuth``
* ``PVSystem.temperature_model_parameters``

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


Enhancements
~~~~~~~~~~~~
Expand All @@ -116,6 +120,9 @@ Enhancements
* Added :py:class:`~pvlib.pvsystem.Array` class to represent an array of
modules separately from a :py:class:`~pvlib.pvsystem.PVSystem`.
(:pull:`1076`, :issue:`1067`)
* Added :py:class:`~pvlib.pvsystem.FixedMount` and
:py:class:`~pvlib.pvsystem.SingleAxisTrackerMount` classes to use with
the new :py:class:`~pvlib.pvsystem.Array` class (:pull:`1176`)
* Added capability for modeling a PV system with multiple arrays in
:py:class:`~pvlib.pvsystem.PVSystem`. Updates the ``PVSystem`` API
to operate on and return tuples where each element of the tuple corresponds
Expand Down
Loading