Skip to content

Commit afc90f6

Browse files
authored
Remove unnecessary SAPM keys in pvsystem._DC_MODEL_PARAMS (#2393)
* remove irrelevant sapm entries from `_DC_MODEL_PARAMS` * create bug fixes section in whatsnew * add whatsnew entry * adjust test * add test * repair bad whatsnew merge
1 parent 1eafae0 commit afc90f6

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
v0.11.3 (Anticipated March, 2025)
55
---------------------------------
66

7+
Bug fixes
8+
~~~~~~~~~
9+
* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero
10+
ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
11+
* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported
12+
using the `from pvlib.transformer` syntax (:pull:`2388`)
13+
* :py:class:`~pvlib.modelchain.ModelChain` now requires only a minimal set of
14+
parameters to run the SAPM electrical model. (:issue:`2369`, :pull:`2393`)
15+
* Correct keys for First Solar modules in `~pvlib.spectrum.spectral_factor_pvspec` (:issue:`2398`, :pull:`2400`)
16+
17+
718
Deprecations
819
~~~~~~~~~~~~
920

@@ -12,15 +23,10 @@ Enhancements
1223
~~~~~~~~~~~~
1324
* :py:func:`~pvlib.irradiance.gti_dirint` now raises an informative message
1425
when input data don't include values with AOI<90 (:issue:`1342`, :pull:`2347`)
15-
* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero
16-
ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
17-
* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported
18-
using the `from pvlib.transformer` syntax (:pull:`2388`)
1926
* Reduced space requirements by excluding tests and test files from wheel.
2027
Zipped wheel is now 66% of the previous size, and installed size is 50% of
2128
the previous size.
2229
(:issue:`2271`, :pull:`2277`)
23-
* Correct keys for First Solar modules in `~pvlib.spectrum.spectral_factor_pvspec` (:issue:`2398`, :pull:`2400`)
2430

2531
Documentation
2632
~~~~~~~~~~~~~
@@ -57,4 +63,5 @@ Contributors
5763
* Manoj K S (:ghuser:`manojks1999`)
5864
* Kurt Rhee (:ghuser:`kurt-rhee`)
5965
* Ayush jariyal (:ghuser:`ayushjariyal`)
66+
* Kevin Anderson (:ghuser:`kandersolar`)
6067
* Echedey Luis (:ghuser:`echedey-ls`)

pvlib/pvsystem.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
# a dict of required parameter names for each DC power model
3030
_DC_MODEL_PARAMS = {
3131
'sapm': {
32-
'A0', 'A1', 'A2', 'A3', 'A4', 'B0', 'B1', 'B2', 'B3',
33-
'B4', 'B5', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6',
34-
'C7', 'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco',
32+
'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7',
33+
'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco',
3534
'Mbvoc', 'Bvmpo', 'Mbvmp', 'N', 'Cells_in_Series',
36-
'IXO', 'IXXO', 'FD'},
35+
'IXO', 'IXXO'},
3736
'desoto': {
3837
'alpha_sc', 'a_ref', 'I_L_ref', 'I_o_ref',
3938
'R_sh_ref', 'R_s'},

tests/test_modelchain.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,22 @@ def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system,
12171217
assert isinstance(mc.results.dc, (pd.Series, pd.DataFrame))
12181218

12191219

1220+
def test_infer_dc_model_sapm_minimal(location):
1221+
# GH 2369 -- Omit A*, B*, FD parameters; specify only DC electrical keys
1222+
dc_keys = ['C0', 'C1', 'C2', 'C3', 'Isco', 'Impo', 'Voco', 'Vmpo',
1223+
'Aisc', 'Aimp', 'Bvoco', 'Bvmpo', 'Mbvoc', 'Mbvmp', 'N',
1224+
'Cells_in_Series', 'IXO', 'IXXO', 'C4', 'C5', 'C6', 'C7']
1225+
sapm_parameters = {key: 0 for key in dc_keys}
1226+
1227+
system = pvsystem.PVSystem(module_parameters=sapm_parameters,
1228+
temperature_model_parameters={'u0': 0, 'u1': 0},
1229+
inverter_parameters={'pdc0': 0})
1230+
1231+
mc = ModelChain(system, location, dc_model='sapm',
1232+
spectral_model='no_loss', aoi_model='no_loss')
1233+
assert isinstance(mc, ModelChain)
1234+
1235+
12201236
def test_infer_dc_model_incomplete(multi_array_sapm_dc_snl_ac_system,
12211237
location):
12221238
match = 'Could not infer DC model from the module_parameters attributes '
@@ -1730,7 +1746,7 @@ def test_invalid_dc_model_params(sapm_dc_snl_ac_system, cec_dc_snl_ac_system,
17301746
'aoi_model': 'no_loss', 'spectral_model': 'no_loss',
17311747
'temperature_model': 'sapm', 'losses_model': 'no_loss'}
17321748
for array in sapm_dc_snl_ac_system.arrays:
1733-
array.module_parameters.pop('A0') # remove a parameter
1749+
array.module_parameters.pop('C0') # remove a parameter
17341750
with pytest.raises(ValueError):
17351751
ModelChain(sapm_dc_snl_ac_system, location, **kwargs)
17361752

0 commit comments

Comments
 (0)