Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
5 changes: 4 additions & 1 deletion docs/sphinx/source/whatsnew/v0.13.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Bug fixes

Enhancements
~~~~~~~~~~~~

* Add new parameters for the Huld PV array mode :py:func:`~pvlib.pvarray.huld` (:issue:`2461`, :pull:`2486`)

Documentation
~~~~~~~~~~~~~
Expand All @@ -45,3 +45,6 @@ Maintenance
Contributors
~~~~~~~~~~~~
* Elijah Passmore (:ghuser:`eljpsm`)
* Omar Bahamida (:ghuser:`OmarBahamida`)
* Cliff Hansen (:ghuser:`cwhanse`)

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,54 @@ 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 '2011' or '2025'.

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 == '2011':
Copy link
Member

Choose a reason for hiding this comment

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

I don't think '2011' is a good choice of identifier for the older coefficients. To me it suggests the 2011 paper is the source of those coefficients, which isn't the case.

I think something like PVGIS5.3 (the current version) and PVGIS{something} could be a good option, but I don't know what version will have the new coefficients. I've emailed Nikos Alexandris at JRC asking about this.

Copy link
Member

Choose a reason for hiding this comment

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

Nikos responded that PVGIS 6 will use the new coefficients by default. Maybe PVGIS5 and PVGIS6 are good identifiers, then.

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 == '2025':
# Updated coefficients from EU JRC paper
huld_params = {'csi': (-0.017162, -0.040289, -0.004681, 0.000148,
0.000169, 0.000005),
'cis': (-0.005521, -0.038576, -0.003711, -0.000901,
-0.001251, 0.000001),
'cdte': (-0.046477, -0.072509, -0.002252, 0.000275,
0.000158, -0.000006)}
else:
raise ValueError(f'Invalid k_version={k_version}: must be either '
'"2011" or "2025" as a string')
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=None):
r"""
Power (DC) using the Huld model.

Expand Down Expand Up @@ -274,6 +304,10 @@ 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 `'2011'` (default) or `'2025'`. Used to select default values
for ``k`` if ``k`` is not specified. If `'2011'`, values from [1]_
are used; if `'2025'` values are from [2]_.

Returns
-------
Expand Down Expand Up @@ -328,14 +362,21 @@ 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)
if k_version is None:
k_version = '2011'
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
36 changes: 35 additions & 1 deletion tests/test_pvarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def test_huld():
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, '2011')
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 @@ -69,3 +70,36 @@ def test_huld():
with pytest.raises(ValueError,
match='Either k or cell_type must be specified'):
res = 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 = {'2011': {'csi': 76.405089,
'cis': 77.086016,
'cdte': 78.642762
},
'2025': {'csi': 76.421390,
'cis': 77.095102,
'cdte': 78.648450
}
}
# Test with 2011 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])
# Check errors for incorrect cell_type and incorrect k_version
with pytest.raises(KeyError):
pvarray.huld(
eff_irr, temp_mod, pdc0, cell_type='invalid', k_version='2011'
)
with pytest.raises(ValueError, match='Invalid k_version=2021'):
pvarray.huld(
eff_irr, temp_mod, pdc0, cell_type='csi', k_version='2021'
)
Loading