Description
Hello everyone,
while using the fit_desoto function to estimate parameters for further solar module calculations, I received the following error:
RuntimeError: Parameter estimation failed: The iteration is not making good progress, as measured by the improvement from the last five Jacobian evaluations.
The error comes from the optimize.root function from the SciPy library, which is used within the fit_desoto function.
Even if I use only 1s for the initial values of the fit_desoto function, I get this error.
The code for the function call in the main programm:
self.mp_desoto_fit = pvlib.ivtools.sdm.fit_desoto(v_mp=module['Vmpo'], i_mp=module['Impo'], v_oc=module['Voco'], i_sc=module['Isco'], alpha_sc=module['Aisc'], beta_voc=module['Bvoco'], cells_in_series=module['Cells_in_Series'], EgRef=1.121, dEgdT=-0.0002677, temp_ref=25, irrad_ref=1000, root_kwargs={'options': {'col_deriv': 0, 'xtol': 1.49012e-05, 'maxfev': 0, 'band': None, 'eps': None, 'factor': 100, 'diag': None}})
The root_kwargs in the function call of the fit_desoto function influence the solver of the root function, but different properties for the solver don't fix the problem.
To Reproduce the error
You can easily reproduce the error by simply using the fit_desoto function. It doesn't make a difference if you use concrete values of a photovoltaic cell or just 1s. All values after cells in series (8) are default values.
mp_desoto_fit_num = pvlib.ivtools.sdm.fit_desoto(4.568, 3.3, 5.36, 3.5, 0.0010, -0.0158, 8, EgRef=1.121, dEgdT=-0.0002677, temp_ref=25, irrad_ref=1000, root_kwargs={})
or
mp_desoto_fit_ones = pvlib.ivtools.sdm.fit_desoto(1, 1, 1, 1, 1, 1, 1, EgRef=1.121, dEgdT=-0.0002677, temp_ref=25, irrad_ref=1000, root_kwargs={})
When using those code examples the error message changes to:
RuntimeError: Parameter estimation failed:
The iteration is not making good progress, as measured by the
improvement from the last ten iterations.
Do you have any ideas on this issue?
What I already tried:
-
Checked all types of initial values for the fit_desoto function (temperature coefficients are handed over in [A/K]).
-
Choosed different options for the root function solver with the method 'hybr'
-
Code debugged and checked the variables inside the root_function. No NaN values or similar arise while the function is calculating
Suggestions
perhaps the problem could be solved by choosing a different method for the root function via the function call of fit_desoto. The kwargs of the fit_desoto function itself can only change the options of the solver, but not which method is used. The default method is "hybr" which is only one of several.
Thanks in advance!
Versions:
numpy 1.20.2
pandas 1.2.4
pvlib 0.8.1
scipy 1.6.3
python 3.9.0
I am using Spyder and/or PyCharm