Skip to content

Support for PV systems with multiple arrays #1076

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

Merged
merged 249 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 206 commits
Commits
Show all changes
249 commits
Select commit Hold shift + click to select a range
4c1b9bc
Initial implementation of pvsystem.Array class
wfvining Oct 6, 2020
532bf77
Refactor PVSystem to use pvsystem.Array internally
wfvining Oct 6, 2020
4cccbd5
Use self._array.temperature_parameters in PVSystem
wfvining Oct 9, 2020
6e980d5
Fix error passing surface_tilt in place of surface_azimuth
wfvining Oct 12, 2020
527ea2c
Expose Array attributes as attributes of PVSystem
wfvining Oct 12, 2020
8b096ab
Pass attributes of PVSystem._array when constructing LocalizedPVSystem
wfvining Oct 12, 2020
a84eab9
Fix over-indented lines
wfvining Oct 12, 2020
955d932
Merge branch 'master' into array-class
wfvining-snl Oct 12, 2020
39d47eb
Access Array attributes as attributes of the PVSystem
wfvining Oct 12, 2020
2f7ccdb
Initialize Array.albedo correctly
wfvining Oct 12, 2020
0bc8a42
add ModelChainResults, plumb for airmass
cwhanse Oct 13, 2020
75bd755
assign rest of ModelChain outputs to ModelChain.results
cwhanse Oct 13, 2020
22d6414
first cut at ModelChain tests
cwhanse Oct 13, 2020
312c3f6
formatting
cwhanse Oct 13, 2020
b9029d6
more test development
cwhanse Oct 13, 2020
bc2c2c1
few more additions
cwhanse Oct 13, 2020
8ebcedc
put dataclasses in pip section for py36
cwhanse Oct 13, 2020
05091f0
Store a list of Arrays in PVSystem
wfvining Oct 12, 2020
6602401
Wrap per-array inputs in a list
wfvining Oct 13, 2020
4f8f1dd
Restore PVSystem._infer_cell_type()
wfvining Oct 13, 2020
02d1bfc
Rename and document validation decorator
wfvining Oct 13, 2020
7071cc7
Rename decorator for returning singleton list as a single value
wfvining Oct 13, 2020
8de0eae
Fix indentation and formatting errors
wfvining Oct 13, 2020
0c75807
Use nested def instead of assigning a lambda
wfvining Oct 13, 2020
cdb3463
Fix indentation in ModelChain._prepare_temperatures
wfvining Oct 13, 2020
90dba53
Add test for Array.__repr__()
wfvining Oct 16, 2020
202fc22
Pass list of Arrays to PVSystem.__init__
wfvining Oct 16, 2020
40ee652
Return tuple instead of list for multi-array PVSystem
wfvining Oct 16, 2020
be48170
Fix indentation
wfvining Oct 16, 2020
c3796db
deprecate old ModelChain attributes
cwhanse Oct 16, 2020
6ad6ade
Merge branch 'array-class' of https://github.com/wfvining/pvlib-pytho…
cwhanse Oct 16, 2020
03eac94
remove solar_position = None from ModelChain.__init__
cwhanse Oct 16, 2020
3e82f83
Require tuple input in list_or_scalar decorator
wfvining Oct 16, 2020
4ed9424
Document meaning of `arrays` parameter to PVSystem.__init__
wfvining Oct 16, 2020
389d1b2
Test multi-array PVSystem.scale_voltage_current_power()
wfvining Oct 16, 2020
87a6000
add modelchain test on pvsystem with 2 arrays
cwhanse Oct 16, 2020
1d21af4
Test multi-array PVSystem.get_aoi()
wfvining Oct 16, 2020
3fa6ba3
Test multi-array PVSystem.get_irradiance()
wfvining Oct 16, 2020
c60c382
Test multi-array PVSystem.pvwatts_dc()
wfvining Oct 16, 2020
dfa07ca
Test input length validation on PVSystem.pvwatts_dc()
wfvining Oct 16, 2020
26b7efb
Cover non-tuple iterable edge case
wfvining Oct 16, 2020
accef41
Test multi-array PVSystem.get_iam()
wfvining Oct 16, 2020
adf366b
Fix whitespace in test_pvsystem.py
wfvining Oct 16, 2020
be8fc9e
Test PVSystem.get_iam() input length mismatch
wfvining Oct 19, 2020
cb0f670
Test PVSystem.sapm with multiple arrays
wfvining Oct 19, 2020
8554aed
Test PVSystem.sapm_spectral_loss with multiple arrays
wfvining Oct 19, 2020
5f6a0ce
Test PVSystem.sapm_effective_irradiance with multiple arrays
wfvining Oct 19, 2020
0e88f9e
Test PVSystem.sapm_celltemp() with multiple arrays
wfvining Oct 19, 2020
25d7f94
Clean up whitespace
wfvining Oct 19, 2020
55c202c
Test PVSystem.first_solar_spectral_loss() with multiple arrays
wfvining Oct 19, 2020
fc22db0
Test PVSystem.pvsyst_celltemp() with multiple arrays
wfvining Oct 19, 2020
84653bb
Consolidate tests for PVSystem.xxxx_celltemp() functions
wfvining Oct 19, 2020
97975f3
Clean up whitespace
wfvining Oct 19, 2020
d90970d
Fix comment in PVSystem.fuentes_celltemp()
wfvining Oct 19, 2020
16e6fa9
Test all PVSystem.calcparams_xxxx() functions with multiple arrays
wfvining Oct 19, 2020
c82eccb
Add tests to cover PVSystem.albedo and PVSystem.surface_azimuth attri…
wfvining Oct 19, 2020
f82ff5e
Conditionally install dataclasses for tests
wfvining Oct 19, 2020
402e42f
formatting
cwhanse Oct 19, 2020
f220a82
Remove TODOs
wfvining Oct 19, 2020
9e7960f
Make decorators private
wfvining Oct 19, 2020
2600141
Update PVSystem.__repr__() to handle multiple Arrays
wfvining Oct 19, 2020
b72840c
Expect new format in tracking.SingleAxisTracker.__repr__() tests
wfvining Oct 19, 2020
ea26f83
Update parameter names and doc for _validate_against_arrays()
wfvining Oct 19, 2020
482b2fd
Replace validation decorator with a private method
wfvining Oct 20, 2020
09bf16a
Remove unused `inspect` import in `pvsystem`
wfvining Oct 20, 2020
b23d3b5
Add blank line before nested defs
wfvining Oct 20, 2020
ed929dd
lets see what breaks
cwhanse Oct 20, 2020
493b704
correct misspelled parameters
cwhanse Oct 20, 2020
7e1f3c1
infer methods, handle tuples in calculations
cwhanse Oct 21, 2020
2da65b4
inverter isn't on array
cwhanse Oct 21, 2020
8013029
fix iteration in ModelChain.effective_irradiance_model
cwhanse Oct 21, 2020
7744a44
_tuple_from_dfs to function
cwhanse Oct 21, 2020
0606eb5
use isinstance for dataframe vs. tuple of df
cwhanse Oct 22, 2020
4231205
consolidate check for consistent parameters
cwhanse Oct 22, 2020
6611f57
missing set()
cwhanse Oct 22, 2020
3e4871c
missed one instance
cwhanse Oct 22, 2020
75195b6
Rename and document kwarg to prevent unwrapping return value
wfvining Oct 26, 2020
9ce66a4
Test ModelChain with multi-array system and no losses
wfvining Oct 27, 2020
e053674
Initialize losses parameters corresponding to system._arrays
wfvining Nov 2, 2020
e33a860
Fix whitespace
wfvining Nov 2, 2020
1abc17f
Add PVSystem.num_arrays property
wfvining Nov 2, 2020
d4a82b1
Use self.system.num_arrays instead of len(self.system._arrays)
wfvining Nov 2, 2020
070f628
Correct types of ModelChainResult fields
wfvining Nov 2, 2020
a64d8b1
Remove direct uses of ModelChain.system._arrays
wfvining Nov 2, 2020
3376753
Assign to self.results.effective_irradiance
wfvining Nov 2, 2020
4abaf2b
Test multi-array ModelChain with pvwatts losses
wfvining Nov 2, 2020
b4ace32
Shorten line
wfvining Nov 2, 2020
cf8fd87
Test multi-array modelchain with DC models that call _singlediode
wfvining Nov 3, 2020
e666052
Rewrite ModelChain._singlediode to support multi-array systems
wfvining Nov 3, 2020
b187444
Add `name` attribute to `pvsystem.Array`
wfvining Nov 3, 2020
b98ea00
Allow per-array GHI/DHI/DNI input to PVSystem.get_irradiance()
wfvining Nov 18, 2020
a49d16e
Test that the correct input is passed to each array
wfvining Nov 20, 2020
955f727
Fix whitespace in test_modelchain.py
wfvining Nov 20, 2020
92f28f5
Support multiple weather input to PVSystem.xxxx_celltemp()
wfvining Nov 20, 2020
2783a87
Fix whitespace in test_pvsystem.py
wfvining Nov 20, 2020
0a00f52
Merge branch 'master' into array-class
wfvining Nov 23, 2020
71c7f3b
Allow unique weather input for each array
wfvining Nov 23, 2020
0b16384
Merge branch 'master' into array-class
wfvining Nov 23, 2020
df13360
Document that ModelChain.prepare_inputs() can take a tuple
wfvining Nov 23, 2020
94a087c
Raise if length of weather is not same as system.num_arrays
wfvining Nov 23, 2020
071ddf4
Add tests for ModelChain.run_model with multiple weather
wfvining Nov 23, 2020
0b3c7ed
Add test for ModelChain._prepare_temperature with multiple weather
wfvining Nov 23, 2020
4d0ec6c
Use itertools.starmap in _validate_weather_indices
wfvining Nov 24, 2020
d7a64f6
Update arrays in sapm_dc_snl_ac_system_same_arrays fixture
wfvining Nov 24, 2020
d808820
Rework _prepare_temperature tests
wfvining Nov 24, 2020
0f4cbf7
ModelChain._prepare_temperature accepts multiple DataFrames
wfvining Nov 24, 2020
5ef7b9a
Fix indentation in ModelChain._get_cell_temperature()
wfvining Nov 24, 2020
8cfacfa
Support multiple weather DataFrames in all ModelChain.xxxx_temp()
wfvining Nov 24, 2020
2f991f3
Refactor ModelChain.xxxx_temp() functions
wfvining Nov 24, 2020
0096181
Accept multiple weather frames in ModelChain.complete_irradiance
wfvining Nov 30, 2020
663fb0c
ModelChain.complete_irradiance input same length as number of arrays
wfvining Nov 30, 2020
a0fa84b
Validate per-array input to ModelChain.prepare_inputs_from_poa()
wfvining Nov 30, 2020
f7fd6c7
Multiple inputs to ModelChain.run_model_from_effective_irradiance()
wfvining Nov 30, 2020
919353b
Clean up whitespace
wfvining Nov 30, 2020
59db97c
Only validate indices if a tuple is passed
wfvining Nov 30, 2020
280a2a5
Add test to cover undefined attribute
wfvining Nov 30, 2020
eb31432
Verify all arrays have consistent parameters
wfvining Nov 30, 2020
cc87fd3
Don't test that all combinations of indices are equal
wfvining Nov 30, 2020
926044f
Use ModelChain.results.dc instead of ModelChain.dc
wfvining Dec 1, 2020
a430ab5
Consolidate multi-input validation
wfvining Dec 1, 2020
5c1cdb1
Add tests for multi-array module/string paramters
wfvining Dec 1, 2020
fa5a06f
Refactor all same index check
wfvining Dec 1, 2020
5078e9d
Prevent instantiation of SingleAxisTracker with multiple arrays
wfvining Dec 1, 2020
a18b189
Test that inconsistent array parameters causes error
wfvining Dec 1, 2020
e28ac7e
Add test coverage for pvsystem.Array._infer_xxxx() methods
wfvining Dec 1, 2020
e1be2bf
Add pvsystem.Array to Classes section of api.rst
wfvining Dec 1, 2020
58c9e0c
Merge branch 'master' into array-class
wfvining Dec 4, 2020
0301ce7
Add PVSystem.sandia_multi() method
wfvining Dec 4, 2020
08946f8
Fix whitespace
wfvining Dec 4, 2020
5167901
Add 'sandia_multi' as a valid key for ModelChain.ac_model
wfvining Dec 4, 2020
db6d736
Add sandia_multi_inverter to ModelChain.infer_ac_model()
wfvining Dec 4, 2020
99a63e7
Update ModelChain tests to use sandia_multi inverter model
wfvining Dec 4, 2020
85ee956
Shorten long line
wfvining Dec 4, 2020
cf6e94c
Support multiple arrays in ModelChain.pvwatts_losses
wfvining Dec 4, 2020
f5f309d
Decorate test_complete_irradiance_arrays with @requires_tables
wfvining Dec 4, 2020
a0047a4
Pass explicit freq to DataFrame.shift() in poa_arrays test
wfvining Dec 4, 2020
e58db3a
Pass explicit freq to DataFrame.shift() in ModelChain tests
wfvining Dec 4, 2020
54fc167
Add description of multi-array PVSystem to pvsystem.rst
wfvining Dec 4, 2020
ca77bef
Remove commented-out code in ModelChainResults
wfvining Dec 4, 2020
e4da96b
Docstring edits
wfvining Dec 4, 2020
a43125f
Remove stray whitespace from _tuple_from_dfs() docstring
wfvining Dec 4, 2020
4138990
Add docstring to ModelChain._check_consistent_params()
wfvining Dec 4, 2020
03b9795
Improvements in pvsystem.rst
wfvining Dec 7, 2020
d542241
Docstring edits in pvsystem.py
wfvining Dec 7, 2020
555c830
Shorten line in pvsystem.Array docstring
wfvining Dec 7, 2020
6c4e9f0
Fix typo in ModelChain.complete_irradiance() docstring
wfvining Dec 8, 2020
494560c
Avoid use of `inplace=True` in ModelChain._singlediode()
wfvining Dec 8, 2020
8960f25
Make list of deprecated ModelChain attrs a class variable
wfvining Dec 8, 2020
ed2c72a
Include 'dataclasses' as a requirement in setup.py
wfvining Dec 8, 2020
42e096a
Remove dataclasses from CI environment for python 3.7+
wfvining Dec 8, 2020
c03625b
Replace modelchain._array_keys() with modelchain._common_keys()
wfvining Dec 8, 2020
a7567c9
Update ModelChain.__getattr__ deprecation message
wfvining Dec 8, 2020
07b3d05
Expose PVSystem.arrays as a public attribute
wfvining Dec 8, 2020
8936e60
Iterate over arrays in ModelChain._check_consistent_params()
wfvining Dec 8, 2020
f454807
Refactor ModelChain.effective_irradiance_model()
wfvining Dec 8, 2020
c572153
rewrite pvsystem.rst
cwhanse Dec 9, 2020
11fe336
Raise a TypeError in ModelChain._check_multiple_input()
wfvining Dec 9, 2020
06203dd
Note that indices assumed to be same in ModelChain._assign_times()
wfvining Dec 11, 2020
9c53600
Add comment in ModelChain.complete_irradiance()
wfvining Dec 11, 2020
9c10612
Copy input before assigning in ModelChain.complete_irradiance()
wfvining Dec 11, 2020
57ba56f
Document ModelChain.run_model() and run_model_from_poa() input type
wfvining Dec 11, 2020
46f0bfd
Don't allow SingleAxisTracker Array with non-None tilt/azimuth
wfvining Dec 11, 2020
23c50fa
Improve documentation of ValueErrors from ModelChain methods
wfvining Dec 11, 2020
286667f
Separate ac model inference for multiple arrays
wfvining Dec 11, 2020
9b6ef5c
Update docstring for ModelChain.run_model_from_effective_irradiance()
wfvining Dec 14, 2020
db8d046
Expand error messages for missing array params in ModelChain
wfvining Dec 14, 2020
784e1ad
Remove ModelChain._check_consistent_params
wfvining Dec 14, 2020
6d1bff5
Test ModelChain.infer_ac_model() error with one array
wfvining Dec 14, 2020
192a550
Capitalize 'Arrays' when referring to the "constituents" of a PVSystem
wfvining Dec 14, 2020
7c4a0af
Return early from ModelChain._prepare_temperature()
wfvining Dec 15, 2020
404ffd1
More test coverage of ModelChain.run_model_from_effective_irradiance()
wfvining Dec 15, 2020
529313a
Note poa_global requirements for run_model_from_effective_irradiance()
wfvining Dec 15, 2020
ab8f982
Move ModelChain.tracking to ModelChain.results.tracking
wfvining Dec 15, 2020
a15eaa7
Improve pvsystem.Array docstring
wfvining Dec 15, 2020
ce7f95d
Better documentation for ModelChain._check_multiple_input()
wfvining Dec 15, 2020
5d9c1e6
Merge branch 'array-class' of https://github.com/wfvining/pvlib-pytho…
cwhanse Dec 15, 2020
b53d2be
Raise ValueError from ModelChain._prepare_temperature()
wfvining Dec 15, 2020
224c968
Update expected error message for run_model_from_effective_irradiance()
wfvining Dec 15, 2020
07b9b5b
coerce weather/data to tuple in run_model methods
cwhanse Dec 15, 2020
4f6744f
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
wfvining Dec 15, 2020
689fd82
Merge branch 'array-class' of https://github.com/wfvining/pvlib-pytho…
cwhanse Dec 15, 2020
d0fc6eb
don't use decorator, _to_tuple in complete_irradiance
cwhanse Dec 15, 2020
fbb27a8
adjust modelchain, add tests for [weather, weather], add test_run_mod…
cwhanse Dec 16, 2020
6ca45cc
Parameterize types in tests
cwhanse Dec 16, 2020
aecf156
add tuple/list type tests
cwhanse Dec 16, 2020
60e2c5d
Use unwrap=True to simplify ModelChain._singldiode()
wfvining Dec 17, 2020
57a0ab8
Add docstrings to helper functions
wfvining Dec 17, 2020
3530fd6
Fix type annotations in ModelChainResults
wfvining Dec 17, 2020
2644d6a
Add index information to error message in ModelChain._verify()
wfvining Dec 17, 2020
89053bc
fix copy, add input_type to wrong length tests
cwhanse Dec 17, 2020
1cb9e86
Improve error message for inconsistent temperature model params
wfvining Dec 17, 2020
a809051
Correct attribute name in ModelChain._set_celltemp docstring
wfvining Dec 17, 2020
956df5a
Remove unused ModelChainResult.array_ac field
wfvining Dec 17, 2020
40aa2da
add coerce to prepare_inputs functions
cwhanse Dec 17, 2020
f4f09c7
add _to_tuple back to run_model
cwhanse Dec 17, 2020
e5914a9
Coerce weather/data inputs to tuple in ModelChain entry points (#1)
cwhanse Dec 17, 2020
c283134
Add DatetimeIndex for test_prepare_inputs_multi_weather()
wfvining Dec 17, 2020
a3c374a
Add whatsnew entries for 0.9.0
wfvining Dec 17, 2020
b267175
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
cwhanse Dec 18, 2020
7353c84
merge master and upstream
cwhanse Dec 18, 2020
f046347
edits to pvsystem.rst
cwhanse Dec 18, 2020
6e14654
fix ipython in pvsystem.rst
cwhanse Dec 18, 2020
9e09c80
edits to modelchain.py docstrings
cwhanse Dec 18, 2020
4534633
minor edits to whatsnew
cwhanse Dec 21, 2020
42dde2c
pvsystem.rst edits
cwhanse Dec 21, 2020
b23be5e
Allow Series input to modelchain._common_keys()
wfvining Dec 21, 2020
1673ca0
Update whatsnew v0.9.0 label
wfvining Jan 4, 2021
a277b0a
Note dataclasses requirement in whatsnew/v0.9.0.rst
wfvining Jan 4, 2021
1d823cf
Fix indentation in ModelChain.martin_ruiz_aoi_loss()
wfvining Jan 4, 2021
e4a00aa
Clean up Array.get_iam() docstring
wfvining Jan 4, 2021
0ee4a87
Change PVSystem to Array in Array.get_iam() error message
wfvining Jan 4, 2021
dc6b0ec
Update links to other pvlib functions in Array.get_irradiance()
wfvining Jan 4, 2021
111ff32
Compare function objects in ModelChain._get_cell_temperature()
wfvining Jan 4, 2021
93a70b4
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
cwhanse Jan 4, 2021
5264866
merge master, edits to pvsystem.rst from review
cwhanse Jan 4, 2021
4bd32ab
Reword multi-array SingleAxisTracker error message
wfvining Jan 4, 2021
1dcda05
Revert "Compare function objects in ModelChain._get_cell_temperature()"
wfvining Jan 4, 2021
eef913a
Update return types of PVSystem methods
wfvining Jan 4, 2021
82cccd2
Compare function objects in ModelChain._get_cell_temperature()
wfvining Jan 4, 2021
bff88d1
Add project urls to setup.py for pypi page (#1119)
AzizCode92 Dec 23, 2020
bbf01d6
fix pvgis test (#1121)
kandersolar Jan 4, 2021
7114e58
make clean: also delete generated, auto_examples, savefig (#1122)
kandersolar Jan 4, 2021
00bed5e
merge master, edits to pvsystem.rst from review
cwhanse Jan 4, 2021
aa2e65c
Fix formatting in PVSystem.get_iam() docstring
wfvining Jan 4, 2021
af04a55
Pass model and kwargs to Array.get_irradiance()
wfvining Jan 4, 2021
1d061d6
Note which parameters of PVSystem methods accept tuples
wfvining Jan 4, 2021
036f601
Update Array docstring to describe modules "at same orientation"
wfvining Jan 4, 2021
268e736
Document 0.25 as fallback value for Array.albedo
wfvining Jan 4, 2021
7bc040a
Update defaults in Array docstring
wfvining Jan 4, 2021
002ca84
Rename and clean up duplicate PVSystem test
wfvining Jan 4, 2021
2e389fa
Reword PVSystem.sandia_multi docstring
wfvining Jan 4, 2021
19ed9a2
Add notes on system-wide parameters to PVSystem method docstrings
wfvining Jan 4, 2021
68617fa
Add ModelChainResults to classes section of api.rst
wfvining Jan 4, 2021
02e17c4
Expand ModelChain docstring to describe how models are applied
wfvining Jan 4, 2021
2cd4d7a
Revert "Add ModelChainResults to classes section of api.rst"
wfvining Jan 4, 2021
8433e24
Simplify ModelChain.__getattr__()
wfvining Jan 5, 2021
252b545
Replace object with super() in ModelChain.__setattr__
wfvining Jan 5, 2021
1f13855
Use mc.results.ac instead of mc.ac in introtutorial.rst
wfvining Jan 5, 2021
775d3bf
Replace deprecated ModelChain attributes in forecasts.rst
wfvining Jan 5, 2021
8eb21ac
Merge branch 'master' into array-class
wfvining Jan 5, 2021
8472e98
fix pvsystem.rst examples
cwhanse Jan 5, 2021
8cfab24
fix conflict
cwhanse Jan 5, 2021
33ccfeb
Fix bug in pvsystem.rst examples
wfvining Jan 5, 2021
c90136b
Add modelchain.ModelChainResult to Classes section of api.rst
wfvining Jan 5, 2021
c2a1d7c
Update contributors list
wfvining Jan 5, 2021
8d74ea5
Add ModelChain.solar_position to deprecated attrs in whatsnew
wfvining Jan 6, 2021
159829a
Fix single array aoi example output
wfvining Jan 6, 2021
823151f
Add missing space in ValueError message from PVSystem.get_iam()
wfvining Jan 6, 2021
f3b3751
Add Results to ModelChain section of api.rst
wfvining Jan 6, 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
1 change: 1 addition & 0 deletions ci/requirements-py36-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
- pytz
- requests
- pip:
- dataclasses
- numpy==1.12.0
- pandas==0.22.0
- scipy==1.2.0
Expand Down
1 change: 1 addition & 0 deletions ci/requirements-py36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ dependencies:
- siphon # conda-forge
- statsmodels
- pip:
- dataclasses
- nrel-pysam>=2.0
- pvfactors==1.4.1
1 change: 1 addition & 0 deletions docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ corresponding procedural code.

location.Location
pvsystem.PVSystem
pvsystem.Array
tracking.SingleAxisTracker
modelchain.ModelChain

Expand Down
242 changes: 195 additions & 47 deletions docs/sphinx/source/pvsystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ PVSystem
from pvlib import pvsystem


The :py:class:`~pvlib.pvsystem.PVSystem` class wraps many of the
functions in the :py:mod:`~pvlib.pvsystem` module. This simplifies the
API by eliminating the need for a user to specify arguments such as
module and inverter properties when calling PVSystem methods.
:py:class:`~pvlib.pvsystem.PVSystem` is not better or worse than the
functions it wraps -- it is simply an alternative way of organizing
your data and calculations.
The :py:class:`~pvlib.pvsystem.PVSystem` represents one inverter and the
PV modules that supply DC power to the inverter. A PV system may be on fixed
mounting or single axis trackers. The :py:class:`~pvlib.pvsystem.PVSystem`
is supported by the :py:class:`~pvlib.pvsystem.Array` which represents the
PV modules in the :py:class:`~pvlib.pvsystem.PVSystem`. An instance of
:py:class:`~pvlib.pvsystem.PVSystem` has a single inverter, but can have
multiple instances of :py:class:`~pvlib.pvsystem.Array`. Arrays can have
different tilt, orientation, and number or type of modules.

The :py:class:`~pvlib.pvsystem.PVSystem` class methods wrap many of the
functions in the :py:mod:`~pvlib.pvsystem` module. Similarly,
:py:class:`~pvlib.pvsystem.Array` wraps several functions with its class
methods. Methods that wrap functions have similar names as the wrapped functions.
This practice simplifies the API for :py:class:`~pvlib.pvsystem.PVSystem`
and :py:class:`~pvlib.pvsystem.Array` methods by eliminating the need to specify
arguments that are stored as attributes of these classes, such as
module and inverter properties. Using :py:class:`~pvlib.pvsystem.PVSystem`
is not better or worse than using the functions it wraps -- it is an
alternative way of organizing your data and calculations.

This guide aims to build understanding of the PVSystem class. It assumes
basic familiarity with object-oriented code in Python, but most
Expand All @@ -40,26 +52,57 @@ data that influences the PV system (e.g. the weather).
The data that represents the PV system is *intrinsic*. The
data that influences the PV system is *extrinsic*.

Intrinsic data is stored in object attributes. For example, the data
that describes a PV system's module parameters is stored in
`PVSystem.module_parameters`.
Intrinsic data is stored in object attributes. For example, the parameters
that describe a PV system's inverter is stored in
`PVSystem.inverter_parameters`.

.. ipython:: python

module_parameters = {'pdc0': 10, 'gamma_pdc': -0.004}
system = pvsystem.PVSystem(module_parameters=module_parameters)
inverter_parameters = {'pdc0': 5000, 'eta_inv_nom': 0.96}
system = pvsystem.PVSystem(inverter_parameters=inverter_parameters)
print(system.inverter_parameters)


In the case of a PV system with a single array, the parameters that describe the
system's modules can be provided directly to `PVSystem.module_parameters`:

.. ipython:: python

module_parameters = {'pdc0': 5000, 'gamma_pdc': -0.004}
system = pvsystem.PVSystem(module_parameters=module_parameters,
inverter_parameters=inverter_parameters)
print(system.module_parameters)

Extrinsic data is passed to a PVSystem as method arguments. For example,

In the case of a PV system with several arrays, the module parameters are
provided for each array, and the arrays are provided to
:py:class:`~pvlib.pvsystem.PVSystem` as a tuple or list of instances of
:py:class:`~pvlib.pvsystem.Array`:

.. 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)
system_two_arrays = pvsystem.PVSystem(arrays=[array_one, array_two],
inverter_parameters=inverter_parameters)
print(system_two_arrays.module_parameters)
print(system_two_arrays.inverter_parameters)

Note that in the case of a PV system with multiple arrays, the
:py:class:`~pvlib.pvsystem.PVSystem` attribute `module_parameters` contains
a tuple with the `module_parameters` for each array.

Extrinsic data is passed to the arguments of PVSystem methods. For example,
the :py:meth:`~pvlib.pvsystem.PVSystem.pvwatts_dc` method accepts extrinsic
data irradiance and temperature.

.. ipython:: python

pdc = system.pvwatts_dc(1000, 30)
pdc = system.pvwatts_dc(g_poa_effective=1000, temp_cell=30)
print(pdc)

Methods attached to a PVSystem object wrap corresponding functions in
Methods attached to a PVSystem object wrap the corresponding functions in
:py:mod:`~pvlib.pvsystem`. The methods simplify the argument list by
using data stored in the PVSystem attributes. Compare the
:py:meth:`~pvlib.pvsystem.PVSystem.pvwatts_dc` method signature to the
Expand Down Expand Up @@ -95,66 +138,137 @@ as well as the incidence angle modifier methods.
PVSystem attributes
-------------------

Here we review the most commonly used PVSystem attributes. Please see
the :py:class:`~pvlib.pvsystem.PVSystem` class documentation for a
comprehensive list.
Here we review the most commonly used PVSystem and Array attributes.
Please see the :py:class:`~pvlib.pvsystem.PVSystem` and
:py:class:`~pvlib.pvsystem.Array` class documentation for a
comprehensive list of attributes.


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.

.. 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.surface_tilt, system_one_array.surface_azimuth)


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`.

.. ipython:: python

The first PVSystem parameters are `surface_tilt` and `surface_azimuth`.
These parameters are used in PVSystem methods such as
:py:meth:`~pvlib.pvsystem.PVSystem.get_aoi` and
:py:meth:`~pvlib.pvsystem.PVSystem.get_irradiance`. Angle of incidence
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)
system = pvsystem.PVSystem(arrays=[array_one, array_two])
system.num_arrays
system.surface_tilt
system.surface_azimuth


The `surface_tilt` and `surface_azimuth` attributes are used in PVSystem
(or Array) methods such as :py:meth:`~pvlib.pvsystem.PVSystem.get_aoi` or
:py:meth:`~pvlib.pvsystem.Array.get_aoi`. The angle of incidence (AOI)
(AOI) calculations require `surface_tilt`, `surface_azimuth` and also
the sun position. The :py:meth:`~pvlib.pvsystem.PVSystem.get_aoi` method
uses the `surface_tilt` and `surface_azimuth` attributes in its PVSystem
object, and so requires only `solar_zenith` and `solar_azimuth` as
arguments.
the extrinsic sun position. The `PVSystem` method :py:meth:`~pvlib.pvsystem.PVSystem.get_aoi`
uses the `surface_tilt` and `surface_azimuth` attributes from the
:py:class:`pvlib.pvsystem.PVSystem` instance, and so requires only `solar_zenith`
and `solar_azimuth` as arguments.

.. ipython:: python

# 20 deg tilt, south-facing
system = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
print(system.surface_tilt, system.surface_azimuth)
# single south-facing array at 20 deg tilt
system_one_array = pvsystem.PVSystem(surface_tilt=20, surface_azimuth=180)
print(system_one_array.surface_tilt, system_one_array.surface_azimuth)

# call get_aoi with solar_zenith, solar_azimuth
aoi = system_one_array.get_aoi(solar_zenith=30, solar_azimuth=180)
print(aoi)


The `Array` method :py:meth:`~pvlib.pvsystem.Array.get_aoi`
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_aoi = array_one.get_aoi(solar_zenith=30, solar_azimuth=180)
print(aoi)


The `PVSystem` method :py:meth:`~pvlib.pvsystem.PVSystem.get_aoi`
operates on all `Array` instances in the `PVSystem`, whereas the the
`Array` method operates only on its `Array` instance.

.. ipython:: python

array_two = pvsystem.Array(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
aoi = system.get_aoi(30, 180)
aoi = system_multiarray.get_aoi(solar_zenith=30, solar_azimuth=180)
print(aoi)


As a reminder, when the PV system includes more than one array, the output of the
`PVSystem` method :py:meth:`~pvlib.pvsystem.PVSystem.get_aoi` is a *tuple* with
the order of the elements corresponding to the order of the arrays.

Other `PVSystem` and `Array` methods operate in a similar manner. When a `PVSystem`
method needs input for each array, the input is provided in a tuple:

.. ipython:: python

aoi = system.get_aoi(solar_zenith=30, solar_azimuth=180)
print(aoi)
system_multiarray.get_iam(aoi)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor complaint -- this prints (array(0.99182856), array(0.99952705)); would be nice if it showed (0.99182856, 0.99952705) instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to achieve that without muddying the example. print(np.array(1)) will unwrap the value, but if you put arrays in a tuple you get the same result as above. We would need to resort to mapping str over the tuple, then printing it.

I guess tuple.__str__ calls __repr__ on its entries, not __str__. Seems like odd behavior to me, but what can you do.

Suggested change
system_multiarray.get_iam(aoi)
iam = system_multiarray.get_iam(aoi)
print(tuple(map(str, iam)))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I guess I was thinking that, if there was an issue to fix, it was that system.get_iam returned tuple of array instead of tuple of float, not that the printing here needs to be fixed. Let's not worry about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth a separate issue to address the return types from the function layer.



Module and inverter parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`module_parameters` and `inverter_parameters` contain the data
necessary for computing DC and AC power using one of the available
PVSystem methods. These are typically specified using data from
the :py:func:`~pvlib.pvsystem.retrieve_sam` function:
PVSystem methods. Values for these attributes can be obtained from databases
included with pvlib python by using the :py:func:`~pvlib.pvsystem.retrieve_sam` function:

.. ipython:: python

# Load the database of CEC module model parameters
modules = pvsystem.retrieve_sam('cecmod')
# retrieve_sam returns a dict. the dict keys are module names,
# and the values are model parameters for that module
modules = pvsystem.retrieve_sam('cecmod')
module_parameters = modules['Canadian_Solar_Inc__CS5P_220M']
# Load the database of CEC inverter model parameters
inverters = pvsystem.retrieve_sam('cecinverter')
inverter_parameters = inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_']
system = pvsystem.PVSystem(module_parameters=module_parameters, inverter_parameters=inverter_parameters)
system_one_array = pvsystem.PVSystem(module_parameters=module_parameters,
inverter_parameters=inverter_parameters)


The module and/or inverter parameters can also be specified manually.
This is useful for specifying modules and inverters that are not
included in the supplied databases. It is also useful for specifying
systems for use with the PVWatts models, as demonstrated in
:ref:`designphilosophy`.
This is useful for modules or inverters that are not
included in the supplied databases, or when using the PVWatts model,
as demonstrated in :ref:`designphilosophy`.

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
<pvlib.pvsystem.PVSystem.pvwatts_losses>` and
:py:func:`pvsystem.pvwatts_losses <pvlib.pvsystem.pvwatts_losses>`, but
we hope to add more related functions and methods in the future.

Module strings
^^^^^^^^^^^^^^

The attributes `modules_per_string` and `strings_per_inverter` are used
in the :py:meth:`~pvlib.pvsystem.PVSystem.scale_voltage_current_power`
method. Some DC power models in :py:class:`~pvlib.modelchain.ModelChain`
automatically call this method and make use of these attributes. As an
example, consider a system with 35 modules arranged into 5 strings of 7
modules each.
example, consider a system with a single array comprising 35 modules
arranged into 5 strings of 7 modules each.

.. ipython:: python

Expand All @@ -166,6 +280,40 @@ modules each.
print(data_scaled)


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
<pvlib.pvsystem.PVSystem.pvwatts_losses>` and
:py:func:`pvsystem.pvwatts_losses <pvlib.pvsystem.pvwatts_losses>`, but
we hope to add more related functions and methods in the future.


.. _multiarray:

PVSystem with multiple Arrays
-----------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fine section on its own, but it doesn't really work in the context of the entire page and the actual API. We need to rethink at least the "PVSystem Attributes" section as we add this. I'd probably also introduce the Array class in the first paragraph of the page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wholmgren see if this rewrite works better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I like the modified PVSystem attributes section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwhanse did you intend to delete this multiple arrays section when rewriting the attributes section? This one is now repetitive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't consider that, happy to look at it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that it's a bit strange to arrive at the PVSystem with multiple Arrays section after already seeing examples of PVSystems with multiple Arrays.


A system with multiple arrays is specified by passing a list of
:py:class:`~pvlib.pvsystem.Array` to the :py:class:`~pvlib.pvsystem.PVSystem`
constructor. 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`,
`module_parameters`, `temperature_model_parameters`, `modules_per_string`,
`strings_per_inverter`, `albedo`, `surface_type`, `module_type`, and
`racking_model`.

When instantiating a :py:class:`~pvlib.pvsystem.PVSystem` with a tuple or list
of :py:class:`~pvlib.pvsystem.Array`, each array parameter must be specified individually
when each instance of :py:class:`~pvlib.pvsystem.Array` is constructed.
For example, if all arrays are at the same tilt you must specify that tilt for
every array. When using :py:class:`~pvlib.pvsystem.Array` you shouldn't
also pass any array attributes to the `PVSystem` attributes; these values
are ignored.


.. _sat:

SingleAxisTracker
Expand All @@ -176,4 +324,4 @@ The :py:class:`~pvlib.tracking.SingleAxisTracker` is a subclass of
includes a few more keyword arguments and attributes that are specific
to trackers, plus the
:py:meth:`~pvlib.tracking.SingleAxisTracker.singleaxis` method. It also
overrides the `get_aoi` and `get_irradiance` methods.
overrides the `get_aoi` and `get_irradiance` methods.
Loading