Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 695e494

Browse files
committed
New module fixture for test_pvsystem
Do not rely on the SAM module database, as parameters there may change with future updates.
1 parent 31e3ab6 commit 695e494

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

pvlib/test/conftest.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,38 @@ def cec_inverter_parameters():
177177
'Mppt_high': 50.0,
178178
}
179179
return parameters
180+
181+
182+
@pytest.fixture(scope='function')
183+
def cec_module_params():
184+
"""
185+
Define some CEC module parameters for testing.
186+
187+
The scope of the fixture is set to ``'function'`` to allow tests to modify
188+
parameters if required without affecting other tests.
189+
"""
190+
parameters = {
191+
'Name': 'Example Module',
192+
'BIPV': 'Y',
193+
'Date': '4/28/2008',
194+
'T_NOCT': 65,
195+
'A_c': 0.67,
196+
'N_s': 18,
197+
'I_sc_ref': 7.5,
198+
'V_oc_ref': 10.4,
199+
'I_mp_ref': 6.6,
200+
'V_mp_ref': 8.4,
201+
'alpha_sc': 0.003,
202+
'beta_oc': -0.04,
203+
'a_ref': 0.473,
204+
'I_L_ref': 7.545,
205+
'I_o_ref': 1.94e-09,
206+
'R_s': 0.094,
207+
'R_sh_ref': 15.72,
208+
'Adjust': 10.6,
209+
'gamma_r': -0.5,
210+
'Version': 'MM105',
211+
'PTC': 48.9,
212+
'Technology': 'Multi-c-Si',
213+
}
214+
return parameters

pvlib/test/test_pvsystem.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ def sapm_module_params(sam_data):
248248
return module_parameters
249249

250250

251-
@pytest.fixture(scope="session")
252-
def cec_module_params(sam_data):
253-
modules = sam_data['cecmod']
254-
module = 'Example_Module'
255-
module_parameters = modules[module]
256-
return module_parameters
257-
258-
259251
@pytest.fixture()
260252
def pvsyst_module_params():
261253
module_parameters = {}
@@ -1008,9 +1000,7 @@ def test_singlediode_array():
10081000

10091001

10101002
@requires_scipy
1011-
def test_singlediode_floats(sam_data):
1012-
module = 'Example_Module'
1013-
module_parameters = sam_data['cecmod'][module]
1003+
def test_singlediode_floats():
10141004
out = pvsystem.singlediode(7, 6e-7, .1, 20, .5, method='lambertw')
10151005
expected = {'i_xx': 4.2498,
10161006
'i_mp': 6.1275,

0 commit comments

Comments
 (0)