Skip to content

Commit e6e5b04

Browse files
kandersolarcwhanse
andauthored
Rename pvwatts to pvwattsv5 everywhere (#1558)
* v5: extensive renaming and deprecations * whatsnew * pr number * some tests * use new names in gallery and user's guide * more tests * stickler * update API listing * fix tests * stickler * a bit of cleanup * bit more cleanup * fix broken test * stickler... * Update docs/sphinx/source/user_guide/modelchain.rst Co-authored-by: Cliff Hansen <[email protected]> * switch deprecation removal from 0.10 to 0.11 * a few more 0.10 -> 0.11 Co-authored-by: Cliff Hansen <[email protected]>
1 parent 4bdbfd6 commit e6e5b04

File tree

13 files changed

+515
-238
lines changed

13 files changed

+515
-238
lines changed

docs/examples/bifacial/plot_bifi_model_pvwatts.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# %%
99
# This example shows how to complete a bifacial modeling example using the
10-
# :py:func:`pvlib.pvsystem.pvwatts_dc` with the
10+
# :py:func:`pvlib.pvsystem.pvwattsv5_dc` with the
1111
# :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries` function to
1212
# transpose GHI data to both front and rear Plane of Array (POA) irradiance.
1313

@@ -83,27 +83,27 @@
8383
temp_cell = temperature.faiman(effective_irrad_bifi, temp_air=25,
8484
wind_speed=1)
8585

86-
# using the pvwatts_dc model and parameters detailed above,
86+
# using the pvwattsv5_dc model and parameters detailed above,
8787
# set pdc0 and return DC power for both bifacial and monofacial
8888
pdc0 = 1
8989
gamma_pdc = -0.0043
90-
pdc_bifi = pvsystem.pvwatts_dc(effective_irrad_bifi,
91-
temp_cell,
92-
pdc0,
93-
gamma_pdc=gamma_pdc
94-
).fillna(0)
90+
pdc_bifi = pvsystem.pvwattsv5_dc(effective_irrad_bifi,
91+
temp_cell,
92+
pdc0,
93+
gamma_pdc=gamma_pdc
94+
).fillna(0)
9595
pdc_bifi.plot(title='Bifacial Simulation on June Solstice', ylabel='DC Power')
9696

9797
# %%
9898
# For illustration, perform monofacial simulation using pvfactors front-side
9999
# irradiance (AOI-corrected), and plot along with bifacial results.
100100

101101
effective_irrad_mono = irrad['total_abs_front']
102-
pdc_mono = pvsystem.pvwatts_dc(effective_irrad_mono,
103-
temp_cell,
104-
pdc0,
105-
gamma_pdc=gamma_pdc
106-
).fillna(0)
102+
pdc_mono = pvsystem.pvwattsv5_dc(effective_irrad_mono,
103+
temp_cell,
104+
pdc0,
105+
gamma_pdc=gamma_pdc
106+
).fillna(0)
107107

108108
# plot monofacial results
109109
plt.figure()

docs/sphinx/source/reference/modelchain.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ ModelChain model definitions.
8181
modelchain.ModelChain.desoto
8282
modelchain.ModelChain.pvsyst
8383
modelchain.ModelChain.pvwatts_dc
84+
modelchain.ModelChain.pvwattsv5_dc
8485
modelchain.ModelChain.sandia_inverter
8586
modelchain.ModelChain.adr_inverter
8687
modelchain.ModelChain.pvwatts_inverter
88+
modelchain.ModelChain.pvwattsv5_inverter
8789
modelchain.ModelChain.ashrae_aoi_loss
8890
modelchain.ModelChain.physical_aoi_loss
8991
modelchain.ModelChain.sapm_aoi_loss
@@ -98,6 +100,7 @@ ModelChain model definitions.
98100
modelchain.ModelChain.dc_ohmic_model
99101
modelchain.ModelChain.no_dc_ohmic_loss
100102
modelchain.ModelChain.pvwatts_losses
103+
modelchain.ModelChain.pvwattsv5_losses
101104
modelchain.ModelChain.no_extra_losses
102105

103106
Inference methods

docs/sphinx/source/reference/pv_modeling.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ Inverter models (DC to AC conversion)
107107
inverter.sandia_multi
108108
inverter.adr
109109
inverter.pvwatts
110+
inverter.pvwattsv5
110111
inverter.pvwatts_multi
112+
inverter.pvwattsv5_multi
111113

112114
Functions for fitting inverter models
113115

@@ -152,8 +154,11 @@ PVWatts model
152154
:toctree: generated/
153155

154156
pvsystem.pvwatts_dc
157+
pvsystem.pvwattsv5_dc
155158
inverter.pvwatts
159+
inverter.pvwattsv5
156160
pvsystem.pvwatts_losses
161+
pvsystem.pvwattsv5_losses
157162

158163
Estimating PV model parameters
159164
------------------------------

docs/sphinx/source/user_guide/modelchain.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -290,25 +290,25 @@ Wrapping methods into a unified API
290290
Readers may notice that the source code of the :py:meth:`~pvlib.modelchain.ModelChain.run_model`
291291
method is model-agnostic. :py:meth:`~pvlib.modelchain.ModelChain.run_model` calls generic methods
292292
such as ``self.dc_model`` rather than a specific model such as
293-
``pvwatts_dc``. So how does :py:meth:`~pvlib.modelchain.ModelChain.run_model` know what models
293+
``pvwattsv5_dc``. So how does :py:meth:`~pvlib.modelchain.ModelChain.run_model` know what models
294294
it’s supposed to run? The answer comes in two parts, and allows us to
295295
explore more of the ModelChain API along the way.
296296

297297
First, ModelChain has a set of methods that wrap the PVSystem methods
298298
that perform the calculations (or further wrap the pvsystem.py module’s
299299
functions). Each of these methods takes the same arguments (``self``)
300300
and sets the same attributes, thus creating a uniform API. For example,
301-
the :py:meth:`~pvlib.modelchain.ModelChain.pvwatts_dc` method is shown below. Its only argument is
301+
the :py:meth:`~pvlib.modelchain.ModelChain.pvwattsv5_dc` method is shown below. Its only argument is
302302
``self``, and it sets the ``dc`` attribute.
303303

304304
.. ipython:: python
305305
306-
mc.pvwatts_dc??
306+
mc.pvwattsv5_dc??
307307
308-
The :py:meth:`~pvlib.modelchain.ModelChain.pvwatts_dc` method calls the pvwatts_dc method of the
308+
The :py:meth:`~pvlib.modelchain.ModelChain.pvwattsv5_dc` method calls the pvwattsv5_dc method of the
309309
PVSystem object that we supplied when we created the ModelChain instance,
310310
using data that is stored in the ModelChain ``effective_irradiance`` and
311-
``cell_temperature`` attributes. The :py:meth:`~pvlib.modelchain.ModelChain.pvwatts_dc` method assigns its
311+
``cell_temperature`` attributes. The :py:meth:`~pvlib.modelchain.ModelChain.pvwattsv5_dc` method assigns its
312312
result to the ``dc`` attribute of the ModelChain's ``results`` object. The code
313313
below shows a simple example of this.
314314

@@ -322,21 +322,21 @@ below shows a simple example of this.
322322
mc = ModelChain(pvwatts_system, location,
323323
aoi_model='no_loss', spectral_model='no_loss')
324324
325-
# manually assign data to the attributes that ModelChain.pvwatts_dc will need.
325+
# manually assign data to the attributes that ModelChain.pvwattsv5_dc will need.
326326
# for standard workflows, run_model would assign these attributes.
327327
mc.results.effective_irradiance = pd.Series(1000, index=[pd.Timestamp('20170401 1200-0700')])
328328
mc.results.cell_temperature = pd.Series(50, index=[pd.Timestamp('20170401 1200-0700')])
329329
330-
# run ModelChain.pvwatts_dc and look at the result
331-
mc.pvwatts_dc();
330+
# run ModelChain.pvwattsv5_dc and look at the result
331+
mc.pvwattsv5_dc();
332332
mc.results.dc
333333
334334
The :py:meth:`~pvlib.modelchain.ModelChain.sapm` method works in a manner similar
335-
to the :py:meth:`~pvlib.modelchain.ModelChain.pvwatts_dc`
335+
to the :py:meth:`~pvlib.modelchain.ModelChain.pvwattsv5_dc`
336336
method. It calls the :py:meth:`~pvlib.pvsystem.PVSystem.sapm` method using stored data, then
337337
assigns the result to the ``dc`` attribute of ``ModelChain.results``.
338338
The :py:meth:`~pvlib.modelchain.ModelChain.sapm` method differs from the
339-
:py:meth:`~pvlib.modelchain.ModelChain.pvwatts_dc` method in
339+
:py:meth:`~pvlib.modelchain.ModelChain.pvwattsv5_dc` method in
340340
a notable way: the PVSystem.sapm method returns a DataFrame with current,
341341
voltage, and power results, rather than a simple Series
342342
of power. The ModelChain methods for single diode models (e.g.,
@@ -370,7 +370,7 @@ DC quantities to the output of the full PVSystem.
370370
mc.sapm();
371371
mc.results.dc
372372
373-
We’ve established that the ``ModelChain.pvwatts_dc`` and
373+
We’ve established that the ``ModelChain.pvwattsv5_dc`` and
374374
``ModelChain.sapm`` have the same API: they take the same arugments
375375
(``self``) and they both set the ``dc`` attribute.\* Because the methods
376376
have the same API, we can call them in the same way. ModelChain includes
@@ -381,7 +381,7 @@ Again, so how does :py:meth:`~pvlib.modelchain.ModelChain.run_model` know which
381381
models it’s supposed to run?
382382

383383
At object construction, ModelChain assigns the desired model’s method
384-
(e.g. ``ModelChain.pvwatts_dc``) to the corresponding generic attribute
384+
(e.g. ``ModelChain.pvwattsv5_dc``) to the corresponding generic attribute
385385
(e.g. ``ModelChain.dc_model``) either with the value assigned to the ``dc_model``
386386
parameter at construction, or by inference as described in the next
387387
section.
@@ -428,15 +428,15 @@ method.
428428
mc.infer_ac_model??
429429
pvlib.modelchain._snl_params??
430430
pvlib.modelchain._adr_params??
431-
pvlib.modelchain._pvwatts_params??
431+
pvlib.modelchain._pvwattsv5_params??
432432
433433
ModelChain for a PVSystem with multiple Arrays
434434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
435435

436436
The PVSystem can represent a PV system with a single array of modules, or
437437
with multiple arrays (see :ref:`multiarray`). The same models are applied to
438438
all ``PVSystem.array`` objects, so each ``Array`` must contain the appropriate model
439-
parameters. For example, if ``ModelChain.dc_model='pvwatts'``, then each
439+
parameters. For example, if ``ModelChain.dc_model='pvwattsv5'``, then each
440440
``Array.module_parameters`` must contain ``'pdc0'``.
441441

442442
When the PVSystem contains multiple arrays, ``ModelChain.results`` attributes

docs/sphinx/source/user_guide/pvsystem.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,28 @@ that describe a PV system's modules and inverter are stored in
7070
7171
7272
Extrinsic data is passed to the arguments of PVSystem methods. For example,
73-
the :py:meth:`~pvlib.pvsystem.PVSystem.pvwatts_dc` method accepts extrinsic
73+
the :py:meth:`~pvlib.pvsystem.PVSystem.pvwattsv5_dc` method accepts extrinsic
7474
data irradiance and temperature.
7575

7676
.. ipython:: python
7777
78-
pdc = system.pvwatts_dc(g_poa_effective=1000, temp_cell=30)
78+
pdc = system.pvwattsv5_dc(g_poa_effective=1000, temp_cell=30)
7979
print(pdc)
8080
8181
Methods attached to a PVSystem object wrap the corresponding functions in
8282
:py:mod:`~pvlib.pvsystem`. The methods simplify the argument list by
8383
using data stored in the PVSystem attributes. Compare the
84-
:py:meth:`~pvlib.pvsystem.PVSystem.pvwatts_dc` method signature to the
85-
:py:func:`~pvlib.pvsystem.pvwatts_dc` function signature:
84+
:py:meth:`~pvlib.pvsystem.PVSystem.pvwattsv5_dc` method signature to the
85+
:py:func:`~pvlib.pvsystem.pvwattsv5_dc` function signature:
8686

87-
* :py:meth:`PVSystem.pvwatts_dc(g_poa_effective, temp_cell) <pvlib.pvsystem.PVSystem.pvwatts_dc>`
88-
* :py:func:`pvwatts_dc(g_poa_effective, temp_cell, pdc0, gamma_pdc, temp_ref=25.) <pvlib.pvsystem.pvwatts_dc>`
87+
* :py:meth:`PVSystem.pvwattsv5_dc(g_poa_effective, temp_cell) <pvlib.pvsystem.PVSystem.pvwattsv5_dc>`
88+
* :py:func:`pvwattsv5_dc(g_poa_effective, temp_cell, pdc0, gamma_pdc, temp_ref=25.) <pvlib.pvsystem.pvwattsv5_dc>`
8989

90-
How does this work? The :py:meth:`~pvlib.pvsystem.PVSystem.pvwatts_dc`
90+
How does this work? The :py:meth:`~pvlib.pvsystem.PVSystem.pvwattsv5_dc`
9191
method looks in `PVSystem.module_parameters` for the `pdc0`, and
92-
`gamma_pdc` arguments. Then the :py:meth:`PVSystem.pvwatts_dc
93-
<pvlib.pvsystem.PVSystem.pvwatts_dc>` method calls the
94-
:py:func:`pvsystem.pvwatts_dc <pvlib.pvsystem.pvwatts_dc>` function with
92+
`gamma_pdc` arguments. Then the :py:meth:`PVSystem.pvwattsv5_dc
93+
<pvlib.pvsystem.PVSystem.pvwattsv5_dc>` method calls the
94+
:py:func:`pvsystem.pvwattsv5_dc <pvlib.pvsystem.pvwattsv5_dc>` function with
9595
all of the arguments and returns the result to the user. Note that the
9696
function includes a default value for the parameter `temp_ref`. This
9797
default value may be overridden by specifying the `temp_ref` key in the
@@ -101,7 +101,7 @@ default value may be overridden by specifying the `temp_ref` key in the
101101
102102
system.arrays[0].module_parameters['temp_ref'] = 0
103103
# lower temp_ref should lead to lower DC power than calculated above
104-
pdc = system.pvwatts_dc(1000, 30)
104+
pdc = system.pvwattsv5_dc(1000, 30)
105105
print(pdc)
106106
107107
Multiple methods may pull data from the same attribute. For example, the
@@ -320,8 +320,8 @@ Losses
320320

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

327327

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ v0.9.4 (anticipated December 2022)
55

66
Deprecations
77
~~~~~~~~~~~~
8+
* In anticipation of implementing newer versions of the PVWatts model
9+
in the future and to clarify the relevant PVWatts model version for
10+
existing functionality, several parts of pvlib have been renamed from
11+
`pvwatts` to `pvwattsv5`:
12+
13+
* ``pvlib.inverter.pvwatts`` is now :py:func:`pvlib.inverter.pvwattsv5`
14+
* ``pvlib.inverter.pvwatts_multi`` is now :py:func:`pvlib.inverter.pvwattsv5_multi`
15+
* ``pvlib.pvsystem.pvwatts_dc`` is now :py:func:`pvlib.pvsystem.pvwattsv5_dc`
16+
* ``pvlib.pvsystem.pvwatts_losses`` is now :py:func:`pvlib.pvsystem.pvwattsv5_losses`
17+
* ``pvlib.pvsystem.PVSystem.pvwatts_dc`` is now :py:meth:`pvlib.pvsystem.PVSystem.pvwattsv5_dc`
18+
* ``pvlib.pvsystem.PVSystem.pvwatts_losses`` is now :py:meth:`pvlib.pvsystem.PVSystem.pvwattsv5_losses`
19+
* ``pvlib.modelchain.ModelChain.pvwatts_dc`` is now :py:meth:`pvlib.modelchain.ModelChain.pvwattsv5_dc`
20+
* ``pvlib.modelchain.ModelChain.pvwatts_inverter`` is now :py:meth:`pvlib.modelchain.ModelChain.pvwattsv5_inverter`
21+
* ``pvlib.modelchain.ModelChain.pvwatts_losses`` is now :py:meth:`pvlib.modelchain.ModelChain.pvwattsv5_losses`
22+
23+
* The ``model`` parameter to :py:meth:`pvlib.pvsystem.PVSystem.get_ac` should
24+
now be ``'pvwattsv5'`` instead of ``'pvwatts'``.
25+
* The ``dc_model``, ``ac_model``, and ``losses_model`` parameters of
26+
:py:class:`pvlib.modelchain.ModelChain` should now be ``'pvwattsv5'``
27+
instead of ``'pvwatts'``.
28+
29+
The originals should continue to work for now (emitting a deprecation warning),
30+
but will be removed in a future release. (:issue:`1350`, :pull:`1558`)
831

932

1033
Enhancements

pvlib/inverter.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import pandas as pd
1515
from numpy.polynomial.polynomial import polyfit # different than np.polyfit
1616

17+
from pvlib._deprecation import deprecated
1718

1819
def _sandia_eff(v_dc, p_dc, inverter):
1920
r'''
@@ -330,9 +331,9 @@ def adr(v_dc, p_dc, inverter, vtol=0.10):
330331
return power_ac
331332

332333

333-
def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
334+
def pvwattsv5(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
334335
r"""
335-
NREL's PVWatts inverter model.
336+
NREL's PVWatts v5 inverter model.
336337
337338
The PVWatts inverter model [1]_ calculates inverter efficiency :math:`\eta`
338339
as a function of input DC power
@@ -370,14 +371,14 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
370371
Notes
371372
-----
372373
Note that ``pdc0`` is also used as a symbol in
373-
:py:func:`pvlib.pvsystem.pvwatts_dc`. ``pdc0`` in this function refers to
374+
:py:func:`pvlib.pvsystem.pvwattsv5_dc`. ``pdc0`` in this function refers to
374375
the DC power input limit of the inverter. ``pdc0`` in
375-
:py:func:`pvlib.pvsystem.pvwatts_dc` refers to the DC power of the modules
376-
at reference conditions.
376+
:py:func:`pvlib.pvsystem.pvwattsv5_dc` refers to the DC power of the
377+
modules at reference conditions.
377378
378379
See Also
379380
--------
380-
pvlib.inverter.pvwatts_multi
381+
pvlib.inverter.pvwattsv5_multi
381382
382383
References
383384
----------
@@ -404,13 +405,19 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
404405
return power_ac
405406

406407

407-
def pvwatts_multi(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
408+
pvwatts = deprecated(since='0.9.4',
409+
name='pvwatts',
410+
alternative='pvwattsv5',
411+
removal='0.11')(pvwattsv5)
412+
413+
414+
def pvwattsv5_multi(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
408415
r"""
409-
Extend NREL's PVWatts inverter model for multiple MPP inputs.
416+
Extend NREL's PVWatts v5 inverter model for multiple MPPT inputs.
410417
411-
DC input power is summed over MPP inputs to obtain the DC power
412-
input to the PVWatts inverter model. See :py:func:`pvlib.inverter.pvwatts`
413-
for details.
418+
DC input power is summed over MPPT inputs to obtain the DC power
419+
input to the PVWatts v5 inverter model.
420+
See :py:func:`pvlib.inverter.pvwattsv5` for details.
414421
415422
Parameters
416423
----------
@@ -432,9 +439,15 @@ def pvwatts_multi(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
432439
433440
See Also
434441
--------
435-
pvlib.inverter.pvwatts
442+
pvlib.inverter.pvwattsv5
436443
"""
437-
return pvwatts(sum(pdc), pdc0, eta_inv_nom, eta_inv_ref)
444+
return pvwattsv5(sum(pdc), pdc0, eta_inv_nom, eta_inv_ref)
445+
446+
447+
pvwatts_multi = deprecated(since='0.9.4',
448+
name='pvwatts_multi',
449+
alternative='pvwattsv5_multi',
450+
removal='0.11')(pvwattsv5_multi)
438451

439452

440453
def fit_sandia(ac_power, dc_power, dc_voltage, dc_voltage_level, p_ac_0, p_nt):

0 commit comments

Comments
 (0)