@@ -1411,7 +1411,8 @@ def _pvsyst_objfun(pvs_mod, cec_ivs, ee, tc, cs):
14111411 return mean_abs_diff
14121412
14131413
1414- def convert_cec_pvsyst (cec_model , cells_in_series ):
1414+ def convert_cec_pvsyst (cec_model , cells_in_series , method = 'Nelder-Mead' ,
1415+ options = None ):
14151416 r"""
14161417 Convert a CEC model to a PVsyst model.
14171418
@@ -1426,6 +1427,10 @@ def convert_cec_pvsyst(cec_model, cells_in_series):
14261427 'R_sh_ref', 'R_s', 'Adjust'
14271428 cell_in_series : int
14281429 Number of cells in series.
1430+ method : str, default 'Nelder-Mead'
1431+ Method for scipy.optimize.minimize.
1432+ options : dict, optional
1433+ Solver options passed to scipy.optimize.minimize
14291434
14301435 Returns
14311436 -------
@@ -1474,6 +1479,8 @@ def convert_cec_pvsyst(cec_model, cells_in_series):
14741479 .. [2] "IEC 61853-3 Photovoltaic (PV) module performance testing and energy
14751480 rating - Part 3: Energy rating of PV modules". IEC, Geneva, 2018.
14761481 """
1482+ if options == None :
1483+ options = {'maxiter' : 5000 , 'maxfev' : 5000 , 'xatol' : 0.001 }
14771484
14781485 # calculate target IV curve values
14791486 cec_params = calcparams_cec (
@@ -1504,8 +1511,10 @@ def convert_cec_pvsyst(cec_model, cells_in_series):
15041511 _pvsyst_objfun , initial ,
15051512 args = (cec_ivs , IEC61853 ['effective_irradiance' ],
15061513 IEC61853 ['temp_cell' ], cells_in_series ),
1507- method = 'Nelder-Mead' , bounds = bounds ,
1508- options = {'maxiter' : 5000 , 'maxfev' : 5000 , 'xatol' : 0.001 })
1514+ method = 'Nelder-Mead' ,
1515+ bounds = bounds ,
1516+ options = options )
1517+
15091518 alpha_sc , gamma , mu_gamma , I_L_ref , I_o_ref , Rsh_mult , R_sh_ref , R_s = \
15101519 result .x
15111520
@@ -1550,7 +1559,7 @@ def _cec_objfun(cec_mod, pvs_ivs, ee, tc, alpha_sc):
15501559 return mean_diff
15511560
15521561
1553- def convert_pvsyst_cec (pvsyst_model ):
1562+ def convert_pvsyst_cec (pvsyst_model , method = 'Nelder-Mead' , options = None ):
15541563 r"""
15551564 Convert a PVsyst model to a CEC model.
15561565
@@ -1564,6 +1573,10 @@ def convert_pvsyst_cec(pvsyst_model):
15641573 Must include keys: 'alpha_sc', 'I_L_ref', 'I_o_ref', 'EgRef', 'R_s',
15651574 'R_sh_ref', 'R_sh_0', 'R_sh_exp', 'gamma_ref', 'mu_gamma',
15661575 'cells_in_series'
1576+ method : str, default 'Nelder-Mead'
1577+ Method for scipy.optimize.minimize.
1578+ options : dict, optional
1579+ Solver options passed to scipy.optimize.minimize
15671580
15681581 Returns
15691582 -------
@@ -1608,6 +1621,10 @@ def convert_pvsyst_cec(pvsyst_model):
16081621 .. [2] "IEC 61853-3 Photovoltaic (PV) module performance testing and energy
16091622 rating - Part 3: Energy rating of PV modules". IEC, Geneva, 2018.
16101623 """
1624+
1625+ if options == None :
1626+ options = {'maxiter' : 5000 , 'maxfev' : 5000 , 'xatol' : 0.001 }
1627+
16111628 # calculate target IV curve values
16121629 pvs_params = calcparams_pvsyst (
16131630 IEC61853 ['effective_irradiance' ],
@@ -1641,8 +1658,10 @@ def convert_pvsyst_cec(pvsyst_model):
16411658 _cec_objfun , initial ,
16421659 args = (pvsyst_ivs , IEC61853 ['effective_irradiance' ],
16431660 IEC61853 ['temp_cell' ], pvsyst_model ['alpha_sc' ]),
1644- method = 'Nelder-Mead' , bounds = bounds ,
1645- options = {'maxiter' : 5000 , 'maxfev' : 5000 , 'xatol' : 0.001 })
1661+ method = 'Nelder-Mead' ,
1662+ bounds = bounds ,
1663+ options = options )
1664+
16461665 I_L_ref , I_o_ref , a_ref , R_sh_ref , R_s , Adjust = result .x
16471666
16481667 return {'alpha_sc' : pvsyst_model ['alpha_sc' ],
0 commit comments