Skip to content

implement inverter.pvwatts_multi #1106

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 6 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ Inverter models (DC to AC conversion)
inverter.sandia_multi
inverter.adr
inverter.pvwatts
inverter.pvwatts_multi

Functions for fitting inverter models

Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/source/whatsnew/v0.8.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Enhancements
option to :py:class:`~pvlib.modelchain.ModelChain`. (:pull:`1042`) (:issue:`1073`)
* Added :py:func:`pvlib.temperature.ross` for cell temperature modeling using
only NOCT. (:pull:`1045`)
* Added :py:func:`pvlib.inverter.sandia_multi` for modeling inverters with
multiple MPPTs (:issue:`457`, :pull:`1085`)
* Added :py:func:`pvlib.inverter.sandia_multi` and :py:func:`pvlib.inverter.pvwatts_multi`
for modeling inverters with multiple MPPTs (:issue:`457`, :pull:`1085`, :pull:`1106`)
* Added optional ``attributes`` parameter to :py:func:`pvlib.iotools.get_psm3`
and added the option of fetching 5- and 15-minute PSM3 data. (:pull:`1086`)
* Added :py:func:`pvlib.irradiance.campbell_norman` for estimating DNI, DHI and GHI
Expand Down
41 changes: 39 additions & 2 deletions pvlib/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def adr(v_dc, p_dc, inverter, vtol=0.10):

def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
r"""
Implements NREL's PVWatts inverter model.
NREL's PVWatts inverter model.

The PVWatts inverter model [1]_ calculates inverter efficiency :math:`\eta`
as a function of input DC power
Expand All @@ -348,7 +348,7 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):

Parameters
----------
pdc: numeric
pdc : numeric
DC power. Same unit as ``pdc0``.
pdc0: numeric
DC input limit of the inverter. Same unit as ``pdc``.
Expand All @@ -371,6 +371,10 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
:py:func:`pvlib.pvsystem.pvwatts_dc` refers to the DC power of the modules
at reference conditions.

See Also
--------
pvlib.inverter.pvwatts_multi

References
----------
.. [1] A. P. Dobos, "PVWatts Version 5 Manual,"
Expand All @@ -396,6 +400,39 @@ def pvwatts(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
return power_ac


def pvwatts_multi(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
r"""
Extend NREL's PVWatts inverter model for multiple MPP inputs.

DC input power is summed over MPP inputs to obtain the DC power
input to the PVWatts inverter model. See :py:func:`pvlib.inverter.pvwatts`
for details.

Parameters
----------
pdc : tuple, list or array of numeric
DC power on each MPPT input of the inverter. If type is array, must
be 2d with axis 0 being the MPPT inputs. Same unit as ``pdc0``.
pdc0: numeric
DC input limit of the inverter. Same unit as ``pdc``.
eta_inv_nom: numeric, default 0.96
Nominal inverter efficiency. [unitless]
eta_inv_ref: numeric, default 0.9637
Reference inverter efficiency. PVWatts defines it to be 0.9637
and is included here for flexibility. [unitless]

Returns
-------
power_ac: numeric
AC power. Same unit as ``pdc0``.

See Also
--------
pvlib.inverter.pvwatts
"""
return pvwatts(sum(pdc), pdc0, eta_inv_nom, eta_inv_ref)


def fit_sandia(ac_power, dc_power, dc_voltage, dc_voltage_level, p_ac_0, p_nt):
r'''
Determine parameters for the Sandia inverter model.
Expand Down
19 changes: 19 additions & 0 deletions pvlib/tests/test_inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,25 @@ def test_pvwatts_series():
assert_series_equal(expected, out)


def test_pvwatts_multi():
pdc = np.array([np.nan, 0, 50, 100]) / 2
pdc0 = 100
expected = np.array([np.nan, 0., 47.608436, 95.])
out = inverter.pvwatts_multi((pdc, pdc), pdc0, 0.95)
assert_allclose(expected, out)
# with 2D array
pdc_2d = np.array([pdc, pdc])
out = inverter.pvwatts_multi(pdc_2d, pdc0, 0.95)
assert_allclose(expected, out)
# with Series
pdc = pd.Series(pdc)
out = inverter.pvwatts_multi((pdc, pdc), pdc0, 0.95)
assert_series_equal(expected, out)
# with list instead of tuple
out = inverter.pvwatts_multi([pdc, pdc], pdc0, 0.95)
assert_series_equal(expected, out)


INVERTER_TEST_MEAS = DATA_DIR / 'inverter_fit_snl_meas.csv'
INVERTER_TEST_SIM = DATA_DIR / 'inverter_fit_snl_sim.csv'

Expand Down