Skip to content

Commit 7a99b34

Browse files
authored
implement inverter.pvwatts_multi (#1106)
* implement inverter.pvwatts_multi * fix text, formatting * fix docstring * remove mistaken .T * review * pdc not p_dc in docstring
1 parent 0d0aab4 commit 7a99b34

File tree

4 files changed

+61
-4
lines changed

4 files changed

+61
-4
lines changed

docs/sphinx/source/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ Inverter models (DC to AC conversion)
295295
inverter.sandia_multi
296296
inverter.adr
297297
inverter.pvwatts
298+
inverter.pvwatts_multi
298299

299300
Functions for fitting inverter models
300301

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Enhancements
1717
option to :py:class:`~pvlib.modelchain.ModelChain`. (:pull:`1042`) (:issue:`1073`)
1818
* Added :py:func:`pvlib.temperature.ross` for cell temperature modeling using
1919
only NOCT. (:pull:`1045`)
20-
* Added :py:func:`pvlib.inverter.sandia_multi` for modeling inverters with
21-
multiple MPPTs (:issue:`457`, :pull:`1085`)
20+
* Added :py:func:`pvlib.inverter.sandia_multi` and :py:func:`pvlib.inverter.pvwatts_multi`
21+
for modeling inverters with multiple MPPTs (:issue:`457`, :pull:`1085`, :pull:`1106`)
2222
* Added optional ``attributes`` parameter to :py:func:`pvlib.iotools.get_psm3`
2323
and added the option of fetching 5- and 15-minute PSM3 data. (:pull:`1086`)
2424
* Added :py:func:`pvlib.irradiance.campbell_norman` for estimating DNI, DHI and GHI

pvlib/inverter.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def adr(v_dc, p_dc, inverter, vtol=0.10):
328328

329329
def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
330330
r"""
331-
Implements NREL's PVWatts inverter model.
331+
NREL's PVWatts inverter model.
332332
333333
The PVWatts inverter model [1]_ calculates inverter efficiency :math:`\eta`
334334
as a function of input DC power
@@ -348,7 +348,7 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
348348
349349
Parameters
350350
----------
351-
pdc: numeric
351+
pdc : numeric
352352
DC power. Same unit as ``pdc0``.
353353
pdc0: numeric
354354
DC input limit of the inverter. Same unit as ``pdc``.
@@ -371,6 +371,10 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
371371
:py:func:`pvlib.pvsystem.pvwatts_dc` refers to the DC power of the modules
372372
at reference conditions.
373373
374+
See Also
375+
--------
376+
pvlib.inverter.pvwatts_multi
377+
374378
References
375379
----------
376380
.. [1] A. P. Dobos, "PVWatts Version 5 Manual,"
@@ -396,6 +400,39 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
396400
return power_ac
397401

398402

403+
def pvwatts_multi(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
404+
r"""
405+
Extend NREL's PVWatts inverter model for multiple MPP inputs.
406+
407+
DC input power is summed over MPP inputs to obtain the DC power
408+
input to the PVWatts inverter model. See :py:func:`pvlib.inverter.pvwatts`
409+
for details.
410+
411+
Parameters
412+
----------
413+
pdc : tuple, list or array of numeric
414+
DC power on each MPPT input of the inverter. If type is array, must
415+
be 2d with axis 0 being the MPPT inputs. Same unit as ``pdc0``.
416+
pdc0: numeric
417+
DC input limit of the inverter. Same unit as ``pdc``.
418+
eta_inv_nom: numeric, default 0.96
419+
Nominal inverter efficiency. [unitless]
420+
eta_inv_ref: numeric, default 0.9637
421+
Reference inverter efficiency. PVWatts defines it to be 0.9637
422+
and is included here for flexibility. [unitless]
423+
424+
Returns
425+
-------
426+
power_ac: numeric
427+
AC power. Same unit as ``pdc0``.
428+
429+
See Also
430+
--------
431+
pvlib.inverter.pvwatts
432+
"""
433+
return pvwatts(sum(pdc), pdc0, eta_inv_nom, eta_inv_ref)
434+
435+
399436
def fit_sandia(ac_power, dc_power, dc_voltage, dc_voltage_level, p_ac_0, p_nt):
400437
r'''
401438
Determine parameters for the Sandia inverter model.

pvlib/tests/test_inverter.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@ def test_pvwatts_series():
171171
assert_series_equal(expected, out)
172172

173173

174+
def test_pvwatts_multi():
175+
pdc = np.array([np.nan, 0, 50, 100]) / 2
176+
pdc0 = 100
177+
expected = np.array([np.nan, 0., 47.608436, 95.])
178+
out = inverter.pvwatts_multi((pdc, pdc), pdc0, 0.95)
179+
assert_allclose(expected, out)
180+
# with 2D array
181+
pdc_2d = np.array([pdc, pdc])
182+
out = inverter.pvwatts_multi(pdc_2d, pdc0, 0.95)
183+
assert_allclose(expected, out)
184+
# with Series
185+
pdc = pd.Series(pdc)
186+
out = inverter.pvwatts_multi((pdc, pdc), pdc0, 0.95)
187+
assert_series_equal(expected, out)
188+
# with list instead of tuple
189+
out = inverter.pvwatts_multi([pdc, pdc], pdc0, 0.95)
190+
assert_series_equal(expected, out)
191+
192+
174193
INVERTER_TEST_MEAS = DATA_DIR / 'inverter_fit_snl_meas.csv'
175194
INVERTER_TEST_SIM = DATA_DIR / 'inverter_fit_snl_sim.csv'
176195

0 commit comments

Comments
 (0)