Skip to content

Commit be99b7f

Browse files
committed
Add tests for retrive_sam function
In particular for the CEC module and inverter data.
1 parent b3e9968 commit be99b7f

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

pvlib/test/test_pvsystem.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,69 @@ def test_retrieve_sam_raise_no_parameters():
273273
assert 'A name or path must be provided!' == str(error.value)
274274

275275

276+
def test_retrieve_sam_cecmod():
277+
"""
278+
Test the expected data is retrieved from the CEC module database. In
279+
particular, check for a known module in the database and check for the
280+
expected keys for that module.
281+
"""
282+
data = pvsystem.retrieve_sam('cecmod')
283+
keys = [
284+
'BIPV',
285+
'Date',
286+
'T_NOCT',
287+
'A_c',
288+
'N_s',
289+
'I_sc_ref',
290+
'V_oc_ref',
291+
'I_mp_ref',
292+
'V_mp_ref',
293+
'alpha_sc',
294+
'beta_oc',
295+
'a_ref',
296+
'I_L_ref',
297+
'I_o_ref',
298+
'R_s',
299+
'R_sh_ref',
300+
'Adjust',
301+
'gamma_r',
302+
'Version',
303+
'PTC',
304+
'Technology',
305+
]
306+
module = 'iTek_iT_300_HE'
307+
assert module in data
308+
assert set(data[module].keys()) == set(keys)
309+
310+
311+
def test_retrieve_sam_cecinverter():
312+
"""
313+
Test the expected data is retrieved from the CEC inverter database. In
314+
particular, check for a known inverter in the database and check for the
315+
expected keys for that inverter.
316+
"""
317+
data = pvsystem.retrieve_sam('cecinverter')
318+
keys = [
319+
'Vac',
320+
'Paco',
321+
'Pdco',
322+
'Vdco',
323+
'Pso',
324+
'C0',
325+
'C1',
326+
'C2',
327+
'C3',
328+
'Pnt',
329+
'Vdcmax',
330+
'Idcmax',
331+
'Mppt_low',
332+
'Mppt_high',
333+
]
334+
inverter = 'Solectria__PVI_5300_5300_P_208V__CEC_2008_'
335+
assert inverter in data
336+
assert set(data[inverter].keys()) == set(keys)
337+
338+
276339
def test_sapm(sapm_module_params):
277340

278341
times = pd.date_range(start='2015-01-01', periods=5, freq='12H')

0 commit comments

Comments
 (0)