Skip to content

Add 2025 coefficients for Huld model #2486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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
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':
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