Skip to content

Commit 7d8532a

Browse files
committed
New module fixtures for test_singlediode
Do not rely on the SAM module database, as parameters there may change with future updates.
1 parent ef7a551 commit 7d8532a

File tree

2 files changed

+80
-10
lines changed

2 files changed

+80
-10
lines changed

pvlib/test/conftest.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,73 @@ def cec_module_cs5p_220m():
247247
'Technology': 'Mono-c-Si',
248248
}
249249
return parameters
250+
251+
252+
@pytest.fixture(scope='function')
253+
def cec_module_spr_e20_327():
254+
"""
255+
Define SunPower SPR-E20-327 module parameters for testing.
256+
257+
The scope of the fixture is set to ``'function'`` to allow tests to modify
258+
parameters if required without affecting other tests.
259+
"""
260+
parameters = {
261+
'Name': 'SunPower SPR-E20-327',
262+
'BIPV': 'N',
263+
'Date': '1/14/2013',
264+
'T_NOCT': 46,
265+
'A_c': 1.631,
266+
'N_s': 96,
267+
'I_sc_ref': 6.46,
268+
'V_oc_ref': 65.1,
269+
'I_mp_ref': 5.98,
270+
'V_mp_ref': 54.7,
271+
'alpha_sc': 0.004522,
272+
'beta_oc': -0.23176,
273+
'a_ref': 2.6868,
274+
'I_L_ref': 6.468,
275+
'I_o_ref': 1.88e-10,
276+
'R_s': 0.37,
277+
'R_sh_ref': 298.13,
278+
'Adjust': -0.1862,
279+
'gamma_r': -0.386,
280+
'Version': 'NRELv1',
281+
'PTC': 301.4,
282+
'Technology': 'Mono-c-Si',
283+
}
284+
return parameters
285+
286+
287+
@pytest.fixture(scope='function')
288+
def cec_module_fs_495():
289+
"""
290+
Define First Solar FS-495 module parameters for testing.
291+
292+
The scope of the fixture is set to ``'function'`` to allow tests to modify
293+
parameters if required without affecting other tests.
294+
"""
295+
parameters = {
296+
'Name': 'First Solar FS-495',
297+
'BIPV': 'N',
298+
'Date': '9/18/2014',
299+
'T_NOCT': 44.6,
300+
'A_c': 0.72,
301+
'N_s': 216,
302+
'I_sc_ref': 1.55,
303+
'V_oc_ref': 86.5,
304+
'I_mp_ref': 1.4,
305+
'V_mp_ref': 67.9,
306+
'alpha_sc': 0.000924,
307+
'beta_oc': -0.22741,
308+
'a_ref': 2.9482,
309+
'I_L_ref': 1.563,
310+
'I_o_ref': 2.64e-13,
311+
'R_s': 6.804,
312+
'R_sh_ref': 806.27,
313+
'Adjust': -10.65,
314+
'gamma_r': -0.264,
315+
'Version': 'NRELv1',
316+
'PTC': 89.7,
317+
'Technology': 'CdTe',
318+
}
319+
return parameters

pvlib/test/test_singlediode.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111

1212
POA = 888
1313
TCELL = 55
14-
CECMOD = pvsystem.retrieve_sam('cecmod')
1514

1615

1716
@requires_scipy
1817
@pytest.mark.parametrize('method', ['brentq', 'newton'])
19-
def test_method_spr_e20_327(method):
18+
def test_method_spr_e20_327(method, cec_module_spr_e20_327):
2019
"""test pvsystem.singlediode with different methods on SPR-E20-327"""
21-
spr_e20_327 = CECMOD.SunPower_SPR_E20_327
20+
spr_e20_327 = cec_module_spr_e20_327
2221
x = pvsystem.calcparams_desoto(
2322
effective_irradiance=POA, temp_cell=TCELL,
24-
alpha_sc=spr_e20_327.alpha_sc, a_ref=spr_e20_327.a_ref,
25-
I_L_ref=spr_e20_327.I_L_ref, I_o_ref=spr_e20_327.I_o_ref,
26-
R_sh_ref=spr_e20_327.R_sh_ref, R_s=spr_e20_327.R_s,
23+
alpha_sc=spr_e20_327['alpha_sc'], a_ref=spr_e20_327['a_ref'],
24+
I_L_ref=spr_e20_327['I_L_ref'], I_o_ref=spr_e20_327['I_o_ref'],
25+
R_sh_ref=spr_e20_327['R_sh_ref'], R_s=spr_e20_327['R_s'],
2726
EgRef=1.121, dEgdT=-0.0002677)
2827
il, io, rs, rsh, nnsvt = x
2928
pvs = pvsystem.singlediode(*x, method='lambertw')
@@ -45,13 +44,14 @@ def test_method_spr_e20_327(method):
4544

4645
@requires_scipy
4746
@pytest.mark.parametrize('method', ['brentq', 'newton'])
48-
def test_newton_fs_495(method):
47+
def test_newton_fs_495(method, cec_module_fs_495):
4948
"""test pvsystem.singlediode with different methods on FS495"""
50-
fs_495 = CECMOD.First_Solar_FS_495
49+
fs_495 = cec_module_fs_495
5150
x = pvsystem.calcparams_desoto(
5251
effective_irradiance=POA, temp_cell=TCELL,
53-
alpha_sc=fs_495.alpha_sc, a_ref=fs_495.a_ref, I_L_ref=fs_495.I_L_ref,
54-
I_o_ref=fs_495.I_o_ref, R_sh_ref=fs_495.R_sh_ref, R_s=fs_495.R_s,
52+
alpha_sc=fs_495['alpha_sc'], a_ref=fs_495['a_ref'],
53+
I_L_ref=fs_495['I_L_ref'], I_o_ref=fs_495['I_o_ref'],
54+
R_sh_ref=fs_495['R_sh_ref'], R_s=fs_495['R_s'],
5555
EgRef=1.475, dEgdT=-0.0003)
5656
il, io, rs, rsh, nnsvt = x
5757
x += (101, )

0 commit comments

Comments
 (0)