Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/sphinx/source/whatsnew/v0.16.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Deprecations

Bug fixes
~~~~~~~~~
* :py:meth:`pvlib.pvsystem.PVSystem.first_solar_spectral_loss` no longer
infers spectral coefficients for modules whose CEC ``Technology`` is
``"Thin Film"``: the technology is ambiguous (it may be CdTe, CIGS, or
another thin-film type), so it now raises a ``ValueError`` directing the
user to set the actual cell type or supply
``first_solar_spectral_coefficients`` explicitly. (:issue:`1984`)
* Correct the Series name in ``ModelChain.results.dc_ohmic_losses`` from
``i_mp`` to ``p_dc_ohmic_loss`` when using ``dc_ohms_from_percent``.
(:issue:`1959`, :pull:`2912`)
Expand Down
18 changes: 18 additions & 0 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,12 @@ def first_solar_spectral_loss(self, pw, airmass_absolute):
- 'Material' - a string describing the cell type, can be read from
the Sandia module database.

A CEC ``Technology`` of ``'Thin Film'`` is not inferred: it is
ambiguous (it may be CdTe, CIGS, or another thin-film type), so
``first_solar_spectral_loss`` raises a ``ValueError`` unless
user-supplied coefficients are provided or the ``Technology`` is
corrected to the actual cell type (e.g. ``'CdTe'``).

Parameters
----------
pw : array-like
Expand All @@ -771,6 +777,18 @@ def _spectral_correction(array, pw):
'first_solar_spectral_coefficients'
]
module_type = None
elif array.module_parameters.get('Technology') == 'Thin Film':
# GH 1984: 'Thin Film' is ambiguous -- it may be CdTe,
# CIGS, or another thin-film type -- so do not infer
# coefficients from it. The user must specify the actual
# cell type or supply coefficients explicitly.
raise ValueError(
'Cannot infer First Solar spectral coefficients for '
'a module with CEC Technology "Thin Film": the '
'technology is ambiguous. Set '
'module_parameters["Technology"] to the actual cell '
'type (e.g. "CdTe" for First Solar modules) or supply '
'"first_solar_spectral_coefficients" explicitly.')
else:
module_type = array._infer_cell_type()
coefficients = None
Expand Down
29 changes: 29 additions & 0 deletions tests/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,35 @@ def test_PVSystem_first_solar_spectral_loss(module_parameters, module_type,
assert_allclose(out, 1, atol=0.5)


def test_PVSystem_first_solar_spectral_loss_thin_film():
# GH 1984: a CEC Technology of 'Thin Film' is ambiguous (it may be
# CdTe, CIGS, or another thin-film type), so coefficients must not
# be inferred from it.
module_parameters = {'Technology': 'Thin Film'}
system = pvsystem.PVSystem(module_parameters=module_parameters)
with pytest.raises(ValueError, match='Thin Film'):
system.first_solar_spectral_loss(3, 3)

# the two remedies keep working: correct the Technology, or supply
# coefficients explicitly
module_parameters_cdte = {'Technology': 'CdTe'}
system = pvsystem.PVSystem(module_parameters=module_parameters_cdte)
out_cdte = system.first_solar_spectral_loss(3, 3)
assert_allclose(out_cdte,
spectrum.spectral_factor_firstsolar(3, 3, 'cdte'))

module_parameters_coeffs = {
'Technology': 'Thin Film',
'first_solar_spectral_coefficients': (
0.84, -0.03, -0.008, 0.14, 0.04, -0.002)}
system = pvsystem.PVSystem(module_parameters=module_parameters_coeffs)
out_coeffs = system.first_solar_spectral_loss(3, 3)
assert_allclose(out_coeffs,
spectrum.spectral_factor_firstsolar(
3, 3, coefficients=(0.84, -0.03, -0.008, 0.14,
0.04, -0.002)))


def test_PVSystem_multi_array_first_solar_spectral_loss():
system = pvsystem.PVSystem(
arrays=[
Expand Down
Loading