Skip to content

Allow user to set tol and maxiter for singlediode newton method #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
toddkarin opened this issue Jun 17, 2021 · 3 comments · Fixed by #1764
Closed

Allow user to set tol and maxiter for singlediode newton method #1249

toddkarin opened this issue Jun 17, 2021 · 3 comments · Fixed by #1764
Milestone

Comments

@toddkarin
Copy link

The first few lines of pvlib.singlediode set tol and maxiter for all the solvers using the newton method:

from scipy.optimize import brentq, newton
from scipy.special import lambertw

# set keyword arguments for all uses of newton in this module
newton = partial(newton, tol=1e-6, maxiter=100, fprime2=None)

However, I would like to change tol and maxiter for my application. It would be great if these could be added instead as keyword arguments to the various functions so they can be adjusted by the user. Using a variety of singlediode model params, I have found that by setting tol=0.1 and maxiter=10, I can realize a 1.4x speedup in the singeldiode.bishop88_mpp algorithm while incurring a maximum error of 0.007038% and a mean absolute error of 0.000042% in calculated V_mp.

@cwhanse
Copy link
Member

cwhanse commented Jun 17, 2021

At what level would they be exposed? At the pvlib.singlediode.bishop88_xxx functions or at a higher level, e.g., pvlib.pvsystem.singlediode?

@toddkarin
Copy link
Author

At the level of bishop88_xxx would be good enough for my purposes.

@cwhanse
Copy link
Member

cwhanse commented Jun 18, 2021

I support this as long as the interface is common for both the newton and brentq options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants