Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4b66810
Enhance Huld model with EU JRC coefficients
OmarBahamida Jun 15, 2025
928207e
Refactor Huld model tests for EU JRC coefficients
OmarBahamida Jun 15, 2025
1833dc1
Fix Flake8 linter errors
OmarBahamida Jul 20, 2025
98846e6
Fix Flake8 errors:
OmarBahamida Jul 20, 2025
241c272
restructure lookup and test
cwhanse Jul 21, 2025
79f490f
fix test and formatting
cwhanse Jul 21, 2025
a5a5ae8
adjust error message
cwhanse Jul 21, 2025
aa7d3ee
Merge branch 'main' of https://github.com/pvlib/pvlib-python into fix…
cwhanse Jul 22, 2025
91da25c
add whatsnew
cwhanse Jul 22, 2025
140b55b
Apply suggestions from code review
cwhanse Jul 23, 2025
752ef05
Update pvlib/pvarray.py
cwhanse Jul 23, 2025
0703ac1
Update pvlib/pvarray.py
cwhanse Jul 23, 2025
889805b
Update pvlib/pvarray.py
cwhanse Jul 23, 2025
57edf70
correct coefficients for 2025 and references
cwhanse Jul 24, 2025
92b5cde
fix conflict
cwhanse Jul 24, 2025
8b41911
fix docstring
cwhanse Jul 24, 2025
89727f3
change parameter key to pvgis5, etc.
cwhanse Aug 6, 2025
5052843
Merge branch 'main' of https://github.com/pvlib/pvlib-python into fix…
cwhanse Aug 6, 2025
607938d
error message
cwhanse Aug 6, 2025
cafd131
lint
cwhanse Aug 6, 2025
d078e74
fix test
cwhanse Aug 6, 2025
a23f5cd
Merge branch 'main' into fix2461
cwhanse Sep 19, 2025
c74a279
Merge branch 'main' into fix2461
kandersolar Sep 23, 2025
a1ea251
Apply suggestions from code review
kandersolar Sep 23, 2025
4d56803
Merge remote-tracking branch 'upstream/main' into pr/2486
kandersolar Sep 23, 2025
a72d557
Merge branch 'fix2461' of https://github.com/OmarBahamida/pvlib-pytho…
kandersolar Sep 23, 2025
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
4 changes: 4 additions & 0 deletions docs/sphinx/source/whatsnew/v0.13.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Bug fixes

Enhancements
~~~~~~~~~~~~
* Add new parameters for the Huld PV array mode :py:func:`~pvlib.pvarray.huld` (:issue:`2461`, :pull:`2486`)
* Add k coefficient in :py:func:`~pvlib.temperature.ross`
(:issue:`2506`, :pull:`2521`)
* Add iotools functions to retrieve irradiance and weather data from Meteonorm:
Expand Down Expand Up @@ -73,6 +74,9 @@ Maintenance
Contributors
~~~~~~~~~~~~
* Elijah Passmore (:ghuser:`eljpsm`)
* Omar Bahamida (:ghuser:`OmarBahamida`)
* Cliff Hansen (:ghuser:`cwhanse`)

* Ioannis Sifnaios (:ghuser:`IoannisSifnaios`)
* Rajiv Daxini (:ghuser:`RDaxini`)
* Omar Bahamida (:ghuser:`OmarBahamida`)
Expand Down
78 changes: 61 additions & 17 deletions pvlib/pvarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def pvefficiency_adr(effective_irradiance, temp_cell,
the reference conditions. [unitless]

k_d : numeric, negative
Dark irradiance or diode coefficient which influences the voltage
"Dark irradiance" or diode coefficient which influences the voltage
increase with irradiance. [unitless]

tc_d : numeric
Expand Down Expand Up @@ -225,24 +225,55 @@ def adr_wrapper(xdata, *params):
return popt


def _infer_k_huld(cell_type, pdc0):
def _infer_k_huld(cell_type, pdc0, k_version):
r"""
Get the EU JRC updated coefficients for the Huld model.

Parameters
----------
cell_type : str
Must be one of 'csi', 'cis', or 'cdte'
pdc0 : numeric
Power of the modules at reference conditions [W]
k_version : str
Either 'pvgis5' or 'pvgis6'.

Returns
-------
tuple
The six coefficients (k1-k6) for the Huld model, scaled by pdc0
"""
# from PVGIS documentation, "PVGIS data sources & calculation methods",
# Section 5.2.3, accessed 12/22/2023
# The parameters in PVGIS' documentation are for a version of Huld's
# equation that has factored Pdc0 out of the polynomial:
# P = G/1000 * Pdc0 * (1 + k1 log(Geff) + ...) so these parameters are
# multiplied by pdc0
huld_params = {'csi': (-0.017237, -0.040465, -0.004702, 0.000149,
0.000170, 0.000005),
'cis': (-0.005554, -0.038724, -0.003723, -0.000905,
-0.001256, 0.000001),
'cdte': (-0.046689, -0.072844, -0.002262, 0.000276,
0.000159, -0.000006)}
if k_version.lower() == 'pvgis5':
# coefficients from PVGIS webpage
huld_params = {'csi': (-0.017237, -0.040465, -0.004702, 0.000149,
0.000170, 0.000005),
'cis': (-0.005554, -0.038724, -0.003723, -0.000905,
-0.001256, 0.000001),
'cdte': (-0.046689, -0.072844, -0.002262, 0.000276,
0.000159, -0.000006)}
elif k_version.lower() == 'pvgis6':
# Coefficients from EU JRC paper
huld_params = {'csi': (-0.0067560, -0.016444, -0.003015, -0.000045,
-0.000043, 0.0),
'cis': (-0.011001, -0.029734, -0.002887, 0.000217,
-0.000163, 0.0),
'cdte': (-0.020644, -0.035136, -0.003406, 0.000073,
-0.000141, 0.000002)}
else:
raise ValueError(f'Invalid k_version={k_version}: must be either '
'"pvgis5" or "pvgis6"')
k = tuple([x*pdc0 for x in huld_params[cell_type.lower()]])
return k


def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None):
def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None,
k_version='pvgis5'):
r"""
Power (DC) using the Huld model.

Expand Down Expand Up @@ -274,6 +305,11 @@ def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None):
cell_type : str, optional
If provided, must be one of ``'cSi'``, ``'CIS'``, or ``'CdTe'``.
Used to look up default values for ``k`` if ``k`` is not specified.
k_version : str, optional
Either ``'pvgis5'`` (default) or ``'pvgis6'``. Selects values
for ``k`` if ``k`` is not specified. If ``'pvgis5'``, values are
from PVGIS documentation and are labeled in [2]_ as "current".
If ``'pvgis6'`` values are from [2]_ labeled as "updated".
Comment on lines +309 to +312
Copy link
Member

@adriesse adriesse Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Either ``'pvgis5'`` (default) or ``'pvgis6'``. Selects values
for ``k`` if ``k`` is not specified. If ``'pvgis5'``, values are
from PVGIS documentation and are labeled in [2]_ as "current".
If ``'pvgis6'`` values are from [2]_ labeled as "updated".
Selects a set of values for ``k`` if ``k`` is not specified: either ``'pvgis5'`` (default)
or ``'pvgis6'``. For ``'pvgis5'``, ``k`` values are from PVGIS documentation,
which are also identified as "current" in [2]_ . For ``'pvgis6'``, values are
from [2]_ where they are labeled as "updated".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll not take this suggestion as the phrasing implies that a value of 'pvgis5' is assigned to k rather than being a value of k_version.


Returns
-------
Expand Down Expand Up @@ -328,14 +364,19 @@ def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None):

References
----------
.. [1] T. Huld, G. Friesen, A. Skoczek, R. Kenny, T. Sample, M. Field,
E. Dunlop. A power-rating model for crystalline silicon PV modules.
Solar Energy Materials and Solar Cells 95, (2011), pp. 3359-3369.
:doi:`10.1016/j.solmat.2011.07.026`.
.. [1] T. Huld, G. Friesen, A. Skoczek, R. Kenny, T. Sample, M. Field, and
E. Dunlop, "A power-rating model for crystalline silicon PV
modules," Solar Energy Materials and Solar Cells 95, (2011),
pp. 3359-3369. :doi:`10.1016/j.solmat.2011.07.026`.
.. [2] A. Chatzipanagi, N. Taylor, I. Suarez, A. Martinez, T. Lyubenova,
and E. Dunlop, "An Updated Simplified Energy Yield Model for Recent
Photovoltaic Module Technologies,"
Progress in Photovoltaics: Research and Applications 33,
no. 8 (2025): 905–917, :doi:`10.1002/pip.3926`.
"""
if k is None:
if cell_type is not None:
k = _infer_k_huld(cell_type, pdc0)
k = _infer_k_huld(cell_type, pdc0, k_version)
else:
raise ValueError('Either k or cell_type must be specified')

Expand All @@ -346,7 +387,10 @@ def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None):
logGprime = np.log(gprime, out=np.zeros_like(gprime),
where=np.array(gprime > 0))
# Eq. 1 in [1]
pdc = gprime * (pdc0 + k[0] * logGprime + k[1] * logGprime**2 +
k[2] * tprime + k[3] * tprime * logGprime +
k[4] * tprime * logGprime**2 + k[5] * tprime**2)
pdc = gprime * (
pdc0 + k[0] * logGprime + k[1] * logGprime**2 +
k[2] * tprime + k[3] * tprime * logGprime +
k[4] * tprime * logGprime**2 +
k[5] * tprime**2
)
return pdc
51 changes: 48 additions & 3 deletions tests/test_pvarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ def test_pvefficiency_adr_round_trip():


def test_huld():
# tests with default k_version='pvgis5'
pdc0 = 100
res = pvarray.huld(1000, 25, pdc0, cell_type='cSi')
assert np.isclose(res, pdc0)
exp_sum = np.exp(1) * (np.sum(pvarray._infer_k_huld('cSi', pdc0)) + pdc0)
k = pvarray._infer_k_huld('cSi', pdc0, 'pvgis5')
exp_sum = np.exp(1) * (np.sum(k) + pdc0)
res = pvarray.huld(1000*np.exp(1), 26, pdc0, cell_type='cSi')
assert np.isclose(res, exp_sum)
res = pvarray.huld(100, 30, pdc0, k=(1, 1, 1, 1, 1, 1))
Expand All @@ -67,5 +69,48 @@ def test_huld():
res = pvarray.huld(eff_irr, tm, pdc0, k=(1, 1, 1, 1, 1, 1))
assert_series_equal(res, expected)
with pytest.raises(ValueError,
match='Either k or cell_type must be specified'):
res = pvarray.huld(1000, 25, 100)
match='Either k or cell_type must be specified'
):
pvarray.huld(1000, 25, 100)


def test_huld_params():
"""Test Huld with built-in coefficients."""
pdc0 = 100
# Use non-reference values so coefficients affect the result
eff_irr = 800 # W/m^2 (not 1000)
temp_mod = 35 # deg C (not 25)
# calculated by C. Hansen using Excel, 2025
expected = {'pvgis5': {'csi': 76.405089,
'cis': 77.086016,
'cdte': 78.642762
},
'pvgis6': {'csi': 77.649421,
'cis': 77.723110,
'cdte': 77.500399
}
}
# Test with PVGIS5 coefficients for all cell types
for yr in expected:
for cell_type in expected[yr]:
result = pvarray.huld(eff_irr, temp_mod, pdc0, cell_type=cell_type,
k_version=yr)
assert np.isclose(result, expected[yr][cell_type])


def test_huld_errors():
# Check errors
pdc0 = 100
# Use non-reference values so coefficients affect the result
eff_irr = 800 # W/m^2 (not 1000)
temp_mod = 35 # deg C (not 25)
# provide both cell_type and k_version
with pytest.raises(KeyError):
pvarray.huld(
eff_irr, temp_mod, pdc0, cell_type='invalid', k_version='pvgis5'
)
# provide invalid k_version
with pytest.raises(ValueError, match='Invalid k_version=2021'):
pvarray.huld(
eff_irr, temp_mod, pdc0, cell_type='csi', k_version='2021'
)
Loading