Skip to content

RuntimeWarning: overflow encountered in exp in singlediode.py #1843

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
ElyWacime opened this issue Aug 27, 2023 · 6 comments
Closed

RuntimeWarning: overflow encountered in exp in singlediode.py #1843

ElyWacime opened this issue Aug 27, 2023 · 6 comments

Comments

@ElyWacime
Copy link

ElyWacime commented Aug 27, 2023

While running a solar energy simulation using pvlib, I encountered a RuntimeWarning of overflow in the exp function within singlediode.py.

Warning Message:
/home/user/.local/lib/python3.10/site-packages/pvlib/singlediode.py:763: RuntimeWarning: overflow encountered in exp
np.exp((Rs[idx_p] * (IL[idx_p] + I0[idx_p]) + V[idx_p]) /
Error accured: upper >= lower is required

I have a two-file setup:
refactored_code.py contains all the functions required for the simulation.
APIprojectTADD_refactored.py contains the main logic and calls the functions defined in refactored_code.py.
The warning appears when I run APIprojectTADD_refactored.py.
you can find the files in this repo: https://github.com/ElyWacime/TADD_API

Questions:
Is this warning expected under certain conditions, or could it be a bug?
What steps should I take to debug or resolve this warning?
Environment:
Python version: 3.10
pvlib version: 0.10.0

@kandersolar
Copy link
Member

There are two separate things in the text you showed: a warning, and an error. The warning (overflow encountered...) can likely be ignored; see https://pvlib-python.readthedocs.io/en/stable/user_guide/faq.html#i-got-a-warning-like-runtimewarning-invalid-value-encountered-in-arccos-what-does-it-mean

The error is unexpected for pvlib version 0.10.0 (see #1782 and #1673). Can you double check the version of pvlib you have installed in the environment where you observe this error? If it is >=0.10.0, then it is likely something that we want to fix in pvlib. If so, it would be helpful if you could provide a short piece of code, and whatever data inputs are needed, that we can run ourselves to reproduce the error.

@cwhanse
Copy link
Member

cwhanse commented Aug 28, 2023

@ElyWacime that warning almost certainly occurred on this line. It is also unexpected (and can be ignored) but I'd like to reproduce it. I suspect it results from some inputs (effective irradiance and/or cell temperature) that are far outside physical norms, but perhaps not. Can you post code and data to reproduce the warning also?

@ElyWacime
Copy link
Author

@cwhanse @kandersolar thank you for your responses. I attempted to reproduce the issue with only one configuration for the sake of simplicity so that I could share the code with you. However, the error did not occur in that case. The function causing the issue can be found here, and it's implemented at this line in the code.

And yes, @kandersolar, I double-checked the version of pvlib; it's 0.10.0.

@cwhanse
Copy link
Member

cwhanse commented Aug 28, 2023

@ElyWacime I'm almost certain that warning comes from this line and it is likely caused by a non-physical value of effective_irradiance, like 10^6. That's the only way I can picture getting an overflow from that exponential. I see you are getting module parameters from the CEC file and they look reasonable.

@ElyWacime
Copy link
Author

ElyWacime commented Aug 28, 2023

@cwhanse yes you're 100% correct i miss closed a parenthesis, wish caused the overflow that caused the error, apologies for wasting you're time i'm still new to coding, i didn't notice it at all.

@cwhanse
Copy link
Member

cwhanse commented Aug 28, 2023

Glad you found the issue @ElyWacime and glad you find pvlib useful for your work.

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

No branches or pull requests

3 participants