Skip to content

Commit ec6fd33

Browse files
cwhansekandersolar
andauthored
Fix Ixx equation in pvsystem.sapm (#2019)
* fix Ixx equation, use Aimp * Update docs/sphinx/source/whatsnew/v0.10.5.rst * lint * lint * get the spacing right * more spacing --------- Co-authored-by: Kevin Anderson <[email protected]>
1 parent 345b26f commit ec6fd33

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Enhancements
1515

1616
Bug fixes
1717
~~~~~~~~~
18+
* Corrected equation for Ixx0 in :py:func:`pvlib.pvsystem.sapm` (:issue:`2016`, :pull:`2019`)
1819
* Fixed :py:func:`pvlib.pvsystem.retrieve_sam` silently ignoring the `path` parameter
1920
when `name` was provided. Now an exception is raised requesting to only provide one
2021
of the two parameters. (:issue:`2018`, :pull:`2020`)

pvlib/pvsystem.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,10 +2264,9 @@ def sapm(effective_irradiance, temp_cell, module):
22642264
module['IXO'] * (module['C4']*Ee + module['C5']*(Ee**2)) *
22652265
(1 + module['Aisc']*(temp_cell - temp_ref)))
22662266

2267-
# the Ixx calculation in King 2004 has a typo (mixes up Aisc and Aimp)
22682267
out['i_xx'] = (
22692268
module['IXXO'] * (module['C6']*Ee + module['C7']*(Ee**2)) *
2270-
(1 + module['Aisc']*(temp_cell - temp_ref)))
2269+
(1 + module['Aimp']*(temp_cell - temp_ref)))
22712270

22722271
if isinstance(out['i_sc'], pd.Series):
22732272
out = pd.DataFrame(out)

pvlib/tests/test_pvsystem.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,14 @@ def test_sapm(sapm_module_params):
166166
out = pvsystem.sapm(effective_irradiance, temp_cell, sapm_module_params)
167167

168168
expected = pd.DataFrame(np.array(
169-
[[ -5.0608322 , -4.65037767, nan, nan,
170-
nan, -4.91119927, -4.15367716],
171-
[ 2.545575 , 2.28773882, 56.86182059, 47.21121608,
172-
108.00693168, 2.48357383, 1.71782772],
173-
[ 5.65584763, 5.01709903, 54.1943277 , 42.51861718,
174-
213.32011294, 5.52987899, 3.48660728],
175-
[ nan, nan, nan, nan,
176-
nan, nan, nan],
177-
[ nan, nan, nan, nan,
178-
nan, nan, nan]]),
169+
[[-5.0608322, -4.65037767, np.nan, np.nan, np.nan,
170+
-4.91119927, -4.16721569],
171+
[2.545575, 2.28773882, 56.86182059, 47.21121608, 108.00693168,
172+
2.48357383, 1.71782772],
173+
[5.65584763, 5.01709903, 54.1943277, 42.51861718, 213.32011294,
174+
5.52987899, 3.46796463],
175+
[np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
176+
[np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]]),
179177
columns=['i_sc', 'i_mp', 'v_oc', 'v_mp', 'p_mp', 'i_x', 'i_xx'],
180178
index=times)
181179

@@ -184,13 +182,13 @@ def test_sapm(sapm_module_params):
184182
out = pvsystem.sapm(1000, 25, sapm_module_params)
185183

186184
expected = OrderedDict()
187-
expected['i_sc'] = 5.09115
188-
expected['i_mp'] = 4.5462909092579995
189-
expected['v_oc'] = 59.260800000000003
190-
expected['v_mp'] = 48.315600000000003
191-
expected['p_mp'] = 219.65677305534581
192-
expected['i_x'] = 4.9759899999999995
193-
expected['i_xx'] = 3.1880204359100004
185+
expected['i_sc'] = sapm_module_params['Isco']
186+
expected['i_mp'] = sapm_module_params['Impo']
187+
expected['v_oc'] = sapm_module_params['Voco']
188+
expected['v_mp'] = sapm_module_params['Vmpo']
189+
expected['p_mp'] = sapm_module_params['Impo'] * sapm_module_params['Vmpo']
190+
expected['i_x'] = sapm_module_params['IXO']
191+
expected['i_xx'] = sapm_module_params['IXXO']
194192

195193
for k, v in expected.items():
196194
assert_allclose(out[k], v, atol=1e-4)

0 commit comments

Comments
 (0)