diff --git a/docs/sphinx/source/whatsnew/v0.17.0.rst b/docs/sphinx/source/whatsnew/v0.17.0.rst new file mode 100644 index 0000000000..b7f5b698d7 --- /dev/null +++ b/docs/sphinx/source/whatsnew/v0.17.0.rst @@ -0,0 +1,50 @@ +.. _whatsnew_0_X_Y: + + +v0.X.Y (Month XX, 20YY) +----------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ +* ``ModelChain`` no longer infers cell type for modules in the CEC database + with Technology of 'Thin Film'. Previously cell type 'cigs' was assigned + for all such modules, which is incorrect for some. Cell type is used to + infer default parameters for :py:func:`pvlib.spectrum.spectral_factor_firstsolar` + Users should assign spectral model parameters in ``PVSystem.module_parameters`` + or set ``PVSystem.Technology`` to the correct cell type. + +Deprecations +~~~~~~~~~~~~ + + +Bug fixes +~~~~~~~~~ + + +Enhancements +~~~~~~~~~~~~ + + +Documentation +~~~~~~~~~~~~~ + + +Testing +~~~~~~~ + + +Benchmarking +~~~~~~~~~~~~ + + +Requirements +~~~~~~~~~~~~ + + +Maintenance +~~~~~~~~~~~ + + +Contributors +~~~~~~~~~~~~ +* Cliff Hansen (:ghuser:`cwhanse`) diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index 79d8a58d11..d3419c0e40 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -774,7 +774,12 @@ def _spectral_correction(array, pw): else: module_type = array._infer_cell_type() coefficients = None - + if (module_type is None): + msg = ( + "No parameters provided for the First Solar spectral", + " model and pvlib could not infer spectral model", + " parameters from the module parameters.") + raise ValueError(msg) return spectrum.spectral_factor_firstsolar( pw, airmass_absolute, module_type, coefficients ) @@ -1090,7 +1095,7 @@ def _infer_cell_type(self): _cell_type_dict = {'Multi-c-Si': 'multisi', 'Mono-c-Si': 'monosi', - 'Thin Film': 'cigs', + 'Thin Film': None, # mixes CIGS & CdTe GH#1984 'a-Si/nc': 'asi', 'CIS': 'cigs', 'CIGS': 'cigs', diff --git a/tests/test_pvsystem.py b/tests/test_pvsystem.py index 71a515ab03..4aa4fa7d65 100644 --- a/tests/test_pvsystem.py +++ b/tests/test_pvsystem.py @@ -385,6 +385,14 @@ def test_PVSystem_multi_array_first_solar_spectral_loss(): assert loss_one == loss_two +def test_PVSsytem_first_solar_spectral_loss_error(): + module_parameters = {'Technology': 'Thin Film'} # returns None + system = pvsystem.PVSystem(module_parameters=module_parameters) + with pytest.raises(ValueError, + match='No parameters provided for the First Solar'): + system.first_solar_spectral_loss(3, 3) + + @pytest.mark.parametrize('test_input,expected', [ ([1000, 100, 5, 45], 1140.0510967821877), ([np.array([np.nan, 1000, 1000]), @@ -842,6 +850,12 @@ def test_Array__infer_cell_type(): array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), module_parameters={}) assert array._infer_cell_type() is None + array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), + module_parameters={'Technology': 'Thin Film'}) + assert array._infer_cell_type() is None + array = pvsystem.Array(mount=pvsystem.FixedMount(0, 180), + module_parameters={'Technology': 'Multi-c-Si'}) + assert array._infer_cell_type() == 'multisi' def _calcparams_correct_Python_type_numeric_type_cases():