Skip to content

Commit 79f490f

Browse files
committed
fix test and formatting
1 parent 241c272 commit 79f490f

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

pvlib/pvarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ def _infer_k_huld(cell_type, pdc0, k_version):
249249
# equation that has factored Pdc0 out of the polynomial:
250250
# P = G/1000 * Pdc0 * (1 + k1 log(Geff) + ...) so these parameters are
251251
# multiplied by pdc0
252-
if k_version=='2011':
252+
if k_version == '2011':
253253
huld_params = {'csi': (-0.017237, -0.040465, -0.004702, 0.000149,
254254
0.000170, 0.000005),
255255
'cis': (-0.005554, -0.038724, -0.003723, -0.000905,
256256
-0.001256, 0.000001),
257257
'cdte': (-0.046689, -0.072844, -0.002262, 0.000276,
258258
0.000159, -0.000006)}
259-
elif k_version=='2025':
259+
elif k_version == '2025':
260260
# Updated coefficients from EU JRC paper
261261
huld_params = {'csi': (-0.017162, -0.040289, -0.004681, 0.000148,
262262
0.000169, 0.000005),

tests/test_pvarray.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def test_huld():
5353
pdc0 = 100
5454
res = pvarray.huld(1000, 25, pdc0, cell_type='cSi')
5555
assert np.isclose(res, pdc0)
56-
exp_sum = np.exp(1) * (np.sum(pvarray._infer_k_huld('cSi', pdc0)) + pdc0)
56+
k = pvarray._infer_k_huld('cSi', pdc0, '2011')
57+
exp_sum = np.exp(1) * (np.sum(k) + pdc0)
5758
res = pvarray.huld(1000*np.exp(1), 26, pdc0, cell_type='cSi')
5859
assert np.isclose(res, exp_sum)
5960
res = pvarray.huld(100, 30, pdc0, k=(1, 1, 1, 1, 1, 1))
@@ -78,18 +79,15 @@ def test_huld_params():
7879
eff_irr = 800 # W/m^2 (not 1000)
7980
temp_mod = 35 # deg C (not 25)
8081
# calculated by C. Hansen using Excel, 2025
81-
expected = {
82-
'2011': {
83-
'csi': 79.964051,
84-
'cis': 79.970860,
85-
'cdte': 79.986428
86-
},
87-
'2025': {
88-
'csi': 79.964214,
89-
'cis': 79.970951,
90-
'cdte': 79.986485
91-
}
92-
}
82+
expected = {'2011': {'csi': 76.405089,
83+
'cis': 77.086016,
84+
'cdte': 78.642762
85+
},
86+
'2025': {'csi': 76.421390,
87+
'cis': 77.095102,
88+
'cdte': 78.648450
89+
}
90+
}
9391
# Test with 2011 coefficients for all cell types
9492
for yr in expected:
9593
for cell_type in expected[yr]:

0 commit comments

Comments
 (0)