Apparent numerical instability in I_mp calculation using PVsyst model
See original GitHub issueDescribe the bug
I used these parameters in pvlib.pvsystem.calcparams_pvsyst()
in order to calculate I_mp
vs. T
using pvlib.pvsystem.singlediode()
with effective_irradiance
fixed at 1000 W/m^2 and temp_cell
having 1001 values ranging from 15 to 50 degC:
{'alpha_sc': 0.006, 'gamma_ref': 1.009, 'mu_gamma': -0.0005, 'I_L_ref': 13.429, 'I_o_ref': 3.719506010004821e-11, 'R_sh_ref': 800.0, 'R_sh_0': 3200.0, 'R_s': 0.187, 'cells_in_series': 72, 'R_sh_exp': 5.5, 'EgRef': 1.121, 'irrad_ref': 1000, 'temp_ref': 25}
My purpose was to investigate the temperature coefficient of I_mp
, and I got the following result, which appears to suffer from a numeric instability:
For comparison, the corresponding V_mp
vs. T
plot:
To Reproduce
Run the above calculations using the parameters provided.
Expected behavior
Better numerical stability in I_mp
vs. T
.
Screenshots
See above.
Versions:
pvlib.__version__
: 0.8.0numpy.__version__
: 1.19.2scipy.__version__
: 1.5.2pandas.__version__
: 1.1.3- python: 3.8.5
Additional context
I was going to attempt a numerical computation of the temperature coefficient of I_mp
for a model translation to the SAPM. I have seen reports from CFV in which this coefficient is actually negative, and I have computed it alternately using the P_mp
and V_mp
temperature coefficients, and gotten a negative value for this particular PV module. Despite the apparent numerical instability in the above plot, it still suggests that the coefficient should be positive, not negative. Perhaps I am missing something here?
Also, I have not dug deep enough to figure out if the underlying issue is in pvlib.pvsystem.singlediode()
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Leave it open, there’s a pvlib issue to be addressed.
I tracked down the source of the oscillatory behavior to this line.
It’s a product of two terms: constant factor : Rs * I0 / (a (Rs Gsh + 1)) which is very small (~1E-10) and exponential factor: np.exp( (Rs * (IL + I0) + V) / (a * (Rs * Gsh + 1)) ) which is quite large (~1E+10), since the argument is ~20.
The constant factor increases smoothly with cell temperature, as expected.
The argument of the exponential term decreases with temperature but not smoothly. The cause seems to be that Vmp (
V
in that line of code) decreases but not smoothly. Vmp is calculated usingpvlib.tools._golden_sect_DataFrame
. I suspect the convergence of this root finder is the culprit.@cwhanse An incidental colleague of mine (Ken Roberts) figured out a way around the numerical convergence issues with using the LambertW function for solving the single diode equation. I have never had the time to do it full justice in code (I use simple newton in PVfit), but this “Log Wright Omega” function might be worth looking into for pvlib. Here are some references he shared with me. He was so pleasant to work with and I found his exposition very approachable.