Skip to content

Commit cf551e7

Browse files
committed
make IXO and IXXO optional too
1 parent 0103952 commit cf551e7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pvlib/pvsystem.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
# a dict of required parameter names for each DC power model
2828
_DC_MODEL_PARAMS = {
2929
'sapm': {
30-
'C0', 'C1', 'C2', 'C3', # C4-C7 (i_x and i_xx params) not required
30+
# i_x and i_xx params (IXO, IXXO, C4-C7) not required
31+
'C0', 'C1', 'C2', 'C3',
3132
'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco',
32-
'Mbvoc', 'Bvmpo', 'Mbvmp', 'N', 'Cells_in_Series',
33-
'IXO', 'IXXO'},
33+
'Mbvoc', 'Bvmpo', 'Mbvmp', 'N', 'Cells_in_Series'},
3434
'desoto': {
3535
'alpha_sc', 'a_ref', 'I_L_ref', 'I_o_ref',
3636
'R_sh_ref', 'R_s'},
@@ -2222,11 +2222,11 @@ def sapm(effective_irradiance, temp_cell, module):
22222222
* v_mp : Voltage at maximum-power point (V)
22232223
* p_mp : Power at maximum-power point (W)
22242224
* i_x : Current at module V = 0.5Voc, defines 4th point on I-V
2225-
curve for modeling curve shape. Omitted if ``C4`` and ``C5``
2226-
parameters are not supplied.
2225+
curve for modeling curve shape. Omitted if ``IXO``, ``C4``, and
2226+
``C5`` parameters are not supplied.
22272227
* i_xx : Current at module V = 0.5(Voc+Vmp), defines 5th point on
2228-
I-V curve for modeling curve shape. Omitted if ``C6`` and ``C7``
2229-
parameters are not supplied.
2228+
I-V curve for modeling curve shape. Omitted if ``IXXO``, ``C6``,
2229+
and ``C7`` parameters are not supplied.
22302230
22312231
Notes
22322232
-----
@@ -2334,12 +2334,12 @@ def sapm(effective_irradiance, temp_cell, module):
23342334

23352335
out['p_mp'] = out['i_mp'] * out['v_mp']
23362336

2337-
if 'C4' in module and 'C5' in module:
2337+
if 'IXO' in module and 'C4' in module and 'C5' in module:
23382338
out['i_x'] = (
23392339
module['IXO'] * (module['C4']*Ee + module['C5']*(Ee**2)) *
23402340
(1 + module['Aisc']*(temp_cell - temp_ref)))
23412341

2342-
if 'C6' in module and 'C7' in module:
2342+
if 'IXXO' in module and 'C6' in module and 'C7' in module:
23432343
out['i_xx'] = (
23442344
module['IXXO'] * (module['C6']*Ee + module['C7']*(Ee**2)) *
23452345
(1 + module['Aimp']*(temp_cell - temp_ref)))

tests/test_modelchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ def test_invalid_dc_model_params(sapm_dc_snl_ac_system, cec_dc_snl_ac_system,
17651765
def test_sapm_optional_params(sapm_dc_snl_ac_system, location):
17661766
# inference works when the optional (i_x, i_xx) SAPM parameters are missing
17671767
for array in sapm_dc_snl_ac_system.arrays:
1768-
for key in ['C4', 'C5', 'C6', 'C7']:
1768+
for key in ['IXO', 'IXXO', 'C4', 'C5', 'C6', 'C7']:
17691769
array.module_parameters.pop(key)
17701770

17711771
# no error:

tests/test_pvsystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def test_sapm(sapm_module_params):
197197
pd.Series(sapm_module_params))
198198

199199
# ensure C4-C7 are optional
200-
optional_keys = ['C4', 'C5', 'C6', 'C7']
200+
optional_keys = ['IXO', 'IXXO', 'C4', 'C5', 'C6', 'C7']
201201
params_no_c4c7 = {
202202
k: v for k, v in sapm_module_params.items() if k not in optional_keys
203203
}

0 commit comments

Comments
 (0)