Skip to content
Closed
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
5 changes: 5 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,10 @@ Deprecations

Bug fixes
~~~~~~~~~
* Stop inferring CIGS coefficients for ambiguous ``Thin Film`` modules in
:py:meth:`pvlib.pvsystem.PVSystem.first_solar_spectral_loss`. These modules
now require an explicit cell technology or user-supplied spectral
coefficients. (: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 Expand Up @@ -80,3 +84,4 @@ Contributors
* :ghuser:`bfs2021`
* :ghuser:`xiajiahang`
* Jakub Krasuski (:ghuser:`Blizzeq`)
* :ghuser:`Solarboaters`
10 changes: 8 additions & 2 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ def first_solar_spectral_loss(self, pw, airmass_absolute):
- 'Material' - a string describing the cell type, can be read from
the Sandia module database.

``'Thin Film'`` is ambiguous and does not identify a cell type.
For these modules, supply ``first_solar_spectral_coefficients`` or
set ``Technology`` to a known cell type, such as ``'CdTe'`` or
``'CIGS'``. Otherwise, a ``TypeError`` is raised.

Parameters
----------
pw : array-like
Expand Down Expand Up @@ -1084,13 +1089,14 @@ def _infer_cell_type(self):

Returns
-------
cell_type: str
cell_type: str or None
None if the cell type cannot be inferred.

"""

_cell_type_dict = {'Multi-c-Si': 'multisi',
'Mono-c-Si': 'monosi',
'Thin Film': 'cigs',
'Thin Film': None,
'a-Si/nc': 'asi',
'CIS': 'cigs',
'CIGS': 'cigs',
Expand Down
26 changes: 26 additions & 0 deletions tests/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,32 @@ def test_PVSystem_first_solar_spectral_loss(module_parameters, module_type,
assert_allclose(out, 1, atol=0.5)


@pytest.mark.parametrize('key', ['Technology', 'Material'])
def test_first_solar_ambiguous_thin_film(key):
system = pvsystem.PVSystem(module_parameters={key: 'Thin Film'})
assert system.arrays[0]._infer_cell_type() is None
with pytest.raises(TypeError, match='both module_type and coefficients'):
system.first_solar_spectral_loss(3, 3)


@pytest.mark.parametrize('technology, module_type', [
('CdTe', 'cdte'), ('CIGS', 'cigs'), ('CIS', 'cigs')])
def test_first_solar_explicit_thin_film_technology(technology, module_type):
system = pvsystem.PVSystem(module_parameters={'Technology': technology})
expected = spectrum.spectral_factor_firstsolar(3, 3, module_type)
assert_allclose(system.first_solar_spectral_loss(3, 3), expected)


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


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