@@ -1313,56 +1313,62 @@ def test_singlediode_array():
13131313 resistance_series , resistance_shunt , nNsVth ,
13141314 method = 'lambertw' )
13151315
1316- expected = np .array ([
1317- 0. , 0.54538398 , 1.43273966 , 2.36328163 , 3.29255606 ,
1318- 4.23101358 , 5.16177031 , 6.09368251 , 7.02197553 , 7.96846051 ,
1319- 8.88220557 ])
1320-
1321- assert_allclose (sd ['i_mp' ], expected , atol = 0.01 )
1316+ expected_i = np .array ([
1317+ 0. , 0.54614798740338 , 1.435026463529 , 2.3621366610078 , 3.2953968319952 ,
1318+ 4.2303869378787 , 5.1655276691892 , 6.1000269648604 , 7.0333996177802 ,
1319+ 7.9653036915959 , 8.8954716265647 ])
1320+ expected_v = np .array ([
1321+ 0. , 7.0966259059555 , 7.9961986643428 , 8.2222496810656 , 8.3255927555753 ,
1322+ 8.3766915453915 , 8.3988872440242 , 8.4027948807891 , 8.3941399580559 ,
1323+ 8.3763655188855 , 8.3517057522791 ])
1324+
1325+ assert_allclose (sd ['i_mp' ], expected_i , atol = 1e-8 )
1326+ assert_allclose (sd ['v_mp' ], expected_v , atol = 1e-8 )
13221327
13231328 sd = pvsystem .singlediode (photocurrent , saturation_current ,
13241329 resistance_series , resistance_shunt , nNsVth )
1325-
13261330 expected = pvsystem .i_from_v (resistance_shunt , resistance_series , nNsVth ,
13271331 sd ['v_mp' ], saturation_current , photocurrent ,
13281332 method = 'lambertw' )
1329-
1330- assert_allclose (sd ['i_mp' ], expected , atol = 0.01 )
1333+ assert_allclose (sd ['i_mp' ], expected , atol = 1e-8 )
13311334
13321335
13331336def test_singlediode_floats ():
1334- out = pvsystem .singlediode (7 , 6e -7 , .1 , 20 , .5 , method = 'lambertw' )
1335- expected = {'i_xx' : 4.2498 ,
1336- 'i_mp' : 6.1275 ,
1337- 'v_oc' : 8.1063 ,
1338- 'p_mp' : 38.1937 ,
1339- 'i_x' : 6.7558 ,
1340- 'i_sc' : 6.9651 ,
1341- 'v_mp' : 6.2331 ,
1337+ out = pvsystem .singlediode (7. , 6.e -7 , .1 , 20. , .5 , method = 'lambertw' )
1338+ expected = {'i_xx' : 4.264060478 ,
1339+ 'i_mp' : 6.136267360 ,
1340+ 'v_oc' : 8.106300147 ,
1341+ 'p_mp' : 38.19421055 ,
1342+ 'i_x' : 6.7558815684 ,
1343+ 'i_sc' : 6.965172322 ,
1344+ 'v_mp' : 6.224339375 ,
13421345 'i' : None ,
13431346 'v' : None }
13441347 assert isinstance (out , dict )
13451348 for k , v in out .items ():
13461349 if k in ['i' , 'v' ]:
13471350 assert v is None
13481351 else :
1349- assert_allclose (v , expected [k ], atol = 1e-3 )
1352+ assert_allclose (v , expected [k ], atol = 1e-6 )
13501353
13511354
13521355def test_singlediode_floats_ivcurve ():
1353- out = pvsystem .singlediode (7 , 6e-7 , .1 , 20 , .5 , ivcurve_pnts = 3 , method = 'lambertw' )
1354- expected = {'i_xx' : 4.2498 ,
1355- 'i_mp' : 6.1275 ,
1356- 'v_oc' : 8.1063 ,
1357- 'p_mp' : 38.1937 ,
1358- 'i_x' : 6.7558 ,
1359- 'i_sc' : 6.9651 ,
1360- 'v_mp' : 6.2331 ,
1361- 'i' : np .array ([6.965172e+00 , 6.755882e+00 , 2.575717e-14 ]),
1362- 'v' : np .array ([0. , 4.05315 , 8.1063 ])}
1356+ out = pvsystem .singlediode (7. , 6e-7 , .1 , 20. , .5 , ivcurve_pnts = 3 ,
1357+ method = 'lambertw' )
1358+ expected = {'i_xx' : 4.264060478 ,
1359+ 'i_mp' : 6.136267360 ,
1360+ 'v_oc' : 8.106300147 ,
1361+ 'p_mp' : 38.19421055 ,
1362+ 'i_x' : 6.7558815684 ,
1363+ 'i_sc' : 6.965172322 ,
1364+ 'v_mp' : 6.224339375 ,
1365+ 'i' : np .array ([
1366+ 6.965172322 , 6.755881568 , 2.664535259e-14 ]),
1367+ 'v' : np .array ([
1368+ 0. , 4.053150073 , 8.106300147 ])}
13631369 assert isinstance (out , dict )
13641370 for k , v in out .items ():
1365- assert_allclose (v , expected [k ], atol = 1e-3 )
1371+ assert_allclose (v , expected [k ], atol = 1e-6 )
13661372
13671373
13681374def test_singlediode_series_ivcurve (cec_module_params ):
@@ -1383,21 +1389,20 @@ def test_singlediode_series_ivcurve(cec_module_params):
13831389 out = pvsystem .singlediode (IL , I0 , Rs , Rsh , nNsVth , ivcurve_pnts = 3 ,
13841390 method = 'lambertw' )
13851391
1386- expected = OrderedDict ([('i_sc' , array ([0. , 3.01054475 , 6.00675648 ])),
1387- ('v_oc' , array ([0. , 9.96886962 , 10.29530483 ])),
1388- ('i_mp' , array ([0. , 2.65191983 , 5.28594672 ])),
1389- ('v_mp' , array ([0. , 8.33392491 , 8.4159707 ])),
1390- ('p_mp' , array ([0. , 22.10090078 , 44.48637274 ])),
1391- ('i_x' , array ([0. , 2.88414114 , 5.74622046 ])),
1392- ('i_xx' , array ([0. , 2.04340914 , 3.90007956 ])),
1392+ expected = OrderedDict ([('i_sc' , array ([0. , 3.01079860 , 6.00726296 ])),
1393+ ('v_oc' , array ([0. , 9.96959733 , 10.29603253 ])),
1394+ ('i_mp' , array ([0. , 2.656285960 , 5.290525645 ])),
1395+ ('v_mp' , array ([0. , 8.321092255 , 8.409413795 ])),
1396+ ('p_mp' , array ([0. , 22.10320053 , 44.49021934 ])),
1397+ ('i_x' , array ([0. , 2.884132006 , 5.746202281 ])),
1398+ ('i_xx' , array ([0. , 2.052691562 , 3.909673879 ])),
13931399 ('v' , array ([[0. , 0. , 0. ],
1394- [0. , 4.98443481 , 9.96886962 ],
1395- [0. , 5.14765242 , 10.29530483 ]])),
1400+ [0. , 4.984798663 , 9.969597327 ],
1401+ [0. , 5.148016266 , 10.29603253 ]])),
13961402 ('i' , array ([[0. , 0. , 0. ],
1397- [3.01079860e+00 , 2.88414114e+00 ,
1398- 3.10862447e-14 ],
1399- [6.00726296e+00 , 5.74622046e+00 ,
1400- 0.00000000e+00 ]]))])
1403+ [3.0107985972 , 2.8841320056 , 0. ],
1404+ [6.0072629615 , 5.7462022810 , 0. ]]))])
1405+
14011406
14021407 for k , v in out .items ():
14031408 assert_allclose (v , expected [k ], atol = 1e-2 )
@@ -1414,7 +1419,7 @@ def test_singlediode_series_ivcurve(cec_module_params):
14141419 method = 'lambertw' ).T
14151420
14161421 for k , v in out .items ():
1417- assert_allclose (v , expected [k ], atol = 1e-2 )
1422+ assert_allclose (v , expected [k ], atol = 1e-6 )
14181423
14191424
14201425def test_scale_voltage_current_power ():
0 commit comments