@@ -12,32 +12,32 @@ def get_test_iv_params():
1212
1313def test_fit_sandia_simple (get_test_iv_params , get_bad_iv_curves ):
1414 test_params = get_test_iv_params
15- with pytest . warns ( pvlibDeprecationWarning , match = 'ivcurve_pnts' ):
16- testcurve = pvsystem . singlediode ( photocurrent = test_params ['IL ' ],
17- saturation_current = test_params ['I0 ' ],
18- resistance_shunt = test_params ['Rsh' ],
19- resistance_series = test_params ['Rs' ],
20- nNsVth = test_params [ 'nNsVth' ],
21- ivcurve_pnts = 300 )
22- expected = tuple ( test_params [ k ] for k in [ 'IL' , 'I0' , 'Rs' , 'Rsh' ,
23- 'nNsVth' ] )
24- result = sde . fit_sandia_simple ( voltage = testcurve [ 'v' ],
25- current = testcurve [ 'i' ] )
15+ test_params = dict ( photocurrent = test_params [ 'IL' ],
16+ saturation_current = test_params ['I0 ' ],
17+ resistance_series = test_params ['Rs ' ],
18+ resistance_shunt = test_params ['Rsh' ],
19+ nNsVth = test_params ['nNsVth' ])
20+ testcurve = pvsystem . singlediode ( ** test_params )
21+ v = np . linspace ( 0. , testcurve [ 'v_oc' ], 300 )
22+ i = pvsystem . i_from_v ( voltage = v , ** test_params )
23+ expected = tuple ( test_params . values () )
24+
25+ result = sde . fit_sandia_simple ( voltage = v , current = i )
2626 assert np .allclose (result , expected , rtol = 5e-5 )
27- result = sde . fit_sandia_simple ( voltage = testcurve [ 'v' ],
28- current = testcurve [ 'i' ] ,
27+
28+ result = sde . fit_sandia_simple ( voltage = v , current = i ,
2929 v_oc = testcurve ['v_oc' ],
3030 i_sc = testcurve ['i_sc' ])
3131 assert np .allclose (result , expected , rtol = 5e-5 )
32- result = sde . fit_sandia_simple ( voltage = testcurve [ 'v' ],
33- current = testcurve [ 'i' ] ,
32+
33+ result = sde . fit_sandia_simple ( voltage = v , current = i ,
3434 v_oc = testcurve ['v_oc' ],
3535 i_sc = testcurve ['i_sc' ],
3636 v_mp_i_mp = (testcurve ['v_mp' ],
37- testcurve ['i_mp' ]))
37+ testcurve ['i_mp' ]))
3838 assert np .allclose (result , expected , rtol = 5e-5 )
39- result = sde . fit_sandia_simple ( voltage = testcurve [ 'v' ],
40- current = testcurve [ 'i' ] , vlim = 0.1 )
39+
40+ result = sde . fit_sandia_simple ( voltage = v , current = i , vlim = 0.1 )
4141 assert np .allclose (result , expected , rtol = 5e-5 )
4242
4343
0 commit comments