From 637e4bdc0b161a97ddc8a6105316cf999de94d7a Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 20 Feb 2025 17:59:09 -0500 Subject: [PATCH 1/6] remove irrelevant sapm entries from `_DC_MODEL_PARAMS` --- pvlib/pvsystem.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index f99f0275af..662ea6befa 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -29,11 +29,10 @@ # a dict of required parameter names for each DC power model _DC_MODEL_PARAMS = { 'sapm': { - 'A0', 'A1', 'A2', 'A3', 'A4', 'B0', 'B1', 'B2', 'B3', - 'B4', 'B5', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', - 'C7', 'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco', + 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', + 'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco', 'Mbvoc', 'Bvmpo', 'Mbvmp', 'N', 'Cells_in_Series', - 'IXO', 'IXXO', 'FD'}, + 'IXO', 'IXXO'}, 'desoto': { 'alpha_sc', 'a_ref', 'I_L_ref', 'I_o_ref', 'R_sh_ref', 'R_s'}, From 1d3af5f9f36e64b25bd291bbffe72e6d4b6d2298 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 20 Feb 2025 17:59:26 -0500 Subject: [PATCH 2/6] create bug fixes section in whatsnew --- docs/sphinx/source/whatsnew/v0.11.3.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.3.rst b/docs/sphinx/source/whatsnew/v0.11.3.rst index 6363275fd2..78a36106a3 100644 --- a/docs/sphinx/source/whatsnew/v0.11.3.rst +++ b/docs/sphinx/source/whatsnew/v0.11.3.rst @@ -4,6 +4,15 @@ v0.11.3 (Anticipated March, 2025) --------------------------------- +Bug fixes +~~~~~~~~~ +* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero + ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`) +* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported + using the `from pvlib.transformer` syntax (:pull:`2388`) + + + Deprecations ~~~~~~~~~~~~ @@ -12,10 +21,6 @@ Enhancements ~~~~~~~~~~~~ * :py:func:`~pvlib.irradiance.gti_dirint` now raises an informative message when input data don't include values with AOI<90 (:issue:`1342`, :pull:`2347`) -* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero - ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`) -* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported - using the `from pvlib.transformer` syntax (:pull:`2388`) Documentation ~~~~~~~~~~~~~ From f04c9eb6a53d1f8042d29e3ab29419b5971af173 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 20 Feb 2025 18:01:16 -0500 Subject: [PATCH 3/6] add whatsnew entry --- docs/sphinx/source/whatsnew/v0.11.3.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.3.rst b/docs/sphinx/source/whatsnew/v0.11.3.rst index 78a36106a3..408cc9c7b5 100644 --- a/docs/sphinx/source/whatsnew/v0.11.3.rst +++ b/docs/sphinx/source/whatsnew/v0.11.3.rst @@ -10,7 +10,8 @@ Bug fixes ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`) * Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported using the `from pvlib.transformer` syntax (:pull:`2388`) - +* :py:class:`~pvlib.modelchain.ModelChain` now requires only a minimal set of + parameters to run the SAPM electrical model. (:issue:`2369`, :pull:`2393`) Deprecations @@ -53,3 +54,4 @@ Contributors * Manoj K S (:ghuser:`manojks1999`) * Kurt Rhee (:ghuser:`kurt-rhee`) * Ayush jariyal (:ghuser:`ayushjariyal`) +* Kevin Anderson (:ghuser:`kandersolar`) From 1f5bcb50b7f9440b3006297ee594e1e315212cfe Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 20 Feb 2025 18:05:11 -0500 Subject: [PATCH 4/6] adjust test --- pvlib/tests/test_modelchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/tests/test_modelchain.py b/pvlib/tests/test_modelchain.py index dcbd820f16..4ba84e295d 100644 --- a/pvlib/tests/test_modelchain.py +++ b/pvlib/tests/test_modelchain.py @@ -1733,7 +1733,7 @@ def test_invalid_dc_model_params(sapm_dc_snl_ac_system, cec_dc_snl_ac_system, 'aoi_model': 'no_loss', 'spectral_model': 'no_loss', 'temperature_model': 'sapm', 'losses_model': 'no_loss'} for array in sapm_dc_snl_ac_system.arrays: - array.module_parameters.pop('A0') # remove a parameter + array.module_parameters.pop('C0') # remove a parameter with pytest.raises(ValueError): ModelChain(sapm_dc_snl_ac_system, location, **kwargs) From 47c89774256cc6ede1d28a81892a69b2db9226be Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 4 Mar 2025 16:09:09 -0500 Subject: [PATCH 5/6] add test --- pvlib/tests/test_modelchain.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pvlib/tests/test_modelchain.py b/pvlib/tests/test_modelchain.py index 4ba84e295d..18d71e8975 100644 --- a/pvlib/tests/test_modelchain.py +++ b/pvlib/tests/test_modelchain.py @@ -1220,6 +1220,22 @@ def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system, assert isinstance(mc.results.dc, (pd.Series, pd.DataFrame)) +def test_infer_dc_model_sapm_minimal(location): + # GH 2369 -- Omit A*, B*, FD parameters; specify only DC electrical keys + dc_keys = ['C0', 'C1', 'C2', 'C3', 'Isco', 'Impo', 'Voco', 'Vmpo', + 'Aisc', 'Aimp', 'Bvoco', 'Bvmpo', 'Mbvoc', 'Mbvmp', 'N', + 'Cells_in_Series', 'IXO', 'IXXO', 'C4', 'C5', 'C6', 'C7'] + sapm_parameters = {key: 0 for key in dc_keys} + + system = pvsystem.PVSystem(module_parameters=sapm_parameters, + temperature_model_parameters={'u0': 0, 'u1': 0}, + inverter_parameters={'pdc0': 0}) + + mc = ModelChain(system, location, dc_model='sapm', + spectral_model='no_loss', aoi_model='no_loss') + assert isinstance(mc, ModelChain) + + def test_infer_dc_model_incomplete(multi_array_sapm_dc_snl_ac_system, location): match = 'Could not infer DC model from the module_parameters attributes ' From 291ce238c616333f2f4ca8c297a020517f5279a7 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 5 Mar 2025 08:32:34 -0500 Subject: [PATCH 6/6] repair bad whatsnew merge --- docs/sphinx/source/whatsnew/v0.11.3.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.3.rst b/docs/sphinx/source/whatsnew/v0.11.3.rst index d32cfa219f..22aca60e9d 100644 --- a/docs/sphinx/source/whatsnew/v0.11.3.rst +++ b/docs/sphinx/source/whatsnew/v0.11.3.rst @@ -23,16 +23,10 @@ Enhancements ~~~~~~~~~~~~ * :py:func:`~pvlib.irradiance.gti_dirint` now raises an informative message when input data don't include values with AOI<90 (:issue:`1342`, :pull:`2347`) - -* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero - ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`) -* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported - using the `from pvlib.transformer` syntax (:pull:`2388`) * Reduced space requirements by excluding tests and test files from wheel. Zipped wheel is now 66% of the previous size, and installed size is 50% of the previous size. (:issue:`2271`, :pull:`2277`) -* Correct keys for First Solar modules in `~pvlib.spectrum.spectral_factor_pvspec` (:issue:`2398`, :pull:`2400`) Documentation ~~~~~~~~~~~~~