Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Bug fixes
~~~~~~~~~
* `data` can no longer be left unspecified in
:py:meth:`pvlib.modelchain.ModelChain.run_model_from_effective_irradiance`. (:issue:`1713`, :pull:`1720`)
* fix ``d2mutau`` and ``NsVbi`` were hardcoded in :py:func:`pvlib.pvsystem.max_power_point` instead of
passing through the arguments to the function.

Testing
~~~~~~~
Expand All @@ -43,4 +45,5 @@ Contributors
* Siddharth Kaul (:ghuser:`k10blogger`)
* Kshitiz Gupta (:ghuser:`kshitiz305`)
* Stefan de Lange (:ghuser:`langestefan`)
* Mark Mikofski (:ghuser:`mikofski`)

3 changes: 1 addition & 2 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2948,8 +2948,7 @@ def max_power_point(photocurrent, saturation_current, resistance_series,
"""
i_mp, v_mp, p_mp = _singlediode.bishop88_mpp(
photocurrent, saturation_current, resistance_series,
resistance_shunt, nNsVth, d2mutau=0, NsVbi=np.Inf,
method=method.lower()
resistance_shunt, nNsVth, d2mutau, NsVbi, method=method.lower()
)
if isinstance(photocurrent, pd.Series):
ivp = {'i_mp': i_mp, 'v_mp': v_mp, 'p_mp': p_mp}
Expand Down
39 changes: 39 additions & 0 deletions pvlib/tests/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pvlib import temperature
from pvlib._deprecation import pvlibDeprecationWarning
from pvlib.tools import cosd
from pvlib.singlediode import VOLTAGE_BUILTIN
from pvlib.tests.test_singlediode import get_pvsyst_fs_495


@pytest.mark.parametrize('iam_model,model_params', [
Expand Down Expand Up @@ -1250,6 +1252,43 @@ def test_mpp_floats():
assert np.isclose(v, expected[k])


def test_mpp_recombination():
"""test max_power_point"""
pvsyst_fs_495 = get_pvsyst_fs_495()
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_pvsyst(
effective_irradiance=pvsyst_fs_495['irrad_ref'],
temp_cell=pvsyst_fs_495['temp_ref'],
alpha_sc=pvsyst_fs_495['alpha_sc'],
gamma_ref=pvsyst_fs_495['gamma_ref'],
mu_gamma=pvsyst_fs_495['mu_gamma'], I_L_ref=pvsyst_fs_495['I_L_ref'],
I_o_ref=pvsyst_fs_495['I_o_ref'], R_sh_ref=pvsyst_fs_495['R_sh_ref'],
R_sh_0=pvsyst_fs_495['R_sh_0'], R_sh_exp=pvsyst_fs_495['R_sh_exp'],
R_s=pvsyst_fs_495['R_s'],
cells_in_series=pvsyst_fs_495['cells_in_series'],
EgRef=pvsyst_fs_495['EgRef'])
out = pvsystem.max_power_point(
IL, I0, Rs, Rsh, nNsVth,
d2mutau=pvsyst_fs_495['d2mutau'],
NsVbi=VOLTAGE_BUILTIN*pvsyst_fs_495['cells_in_series'],
method='brentq')
expected_imp = pvsyst_fs_495['I_mp_ref']
expected_vmp = pvsyst_fs_495['V_mp_ref']
expected_pmp = expected_imp*expected_vmp
expected = {'i_mp': expected_imp,
'v_mp': expected_vmp,
'p_mp': expected_pmp}
assert isinstance(out, dict)
for k, v in out.items():
assert np.isclose(v, expected[k], 0.1)
out = pvsystem.max_power_point(
IL, I0, Rs, Rsh, nNsVth,
d2mutau=pvsyst_fs_495['d2mutau'],
NsVbi=VOLTAGE_BUILTIN*pvsyst_fs_495['cells_in_series'],
method='newton')
for k, v in out.items():
assert np.isclose(v, expected[k], 0.1)


def test_mpp_array():
"""test max_power_point"""
IL, I0, Rs, Rsh, nNsVth = (np.array([7, 7]), 6e-7, .1, 20, .5)
Expand Down