question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apparent numerical instability in I_mp calculation using PVsyst model

See original GitHub issue

Describe 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:

image

For comparison, the corresponding V_mp vs. T plot:

image

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.0
  • numpy.__version__: 1.19.2
  • scipy.__version__: 1.5.2
  • pandas.__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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
cwhansecommented, Nov 5, 2020

Leave it open, there’s a pvlib issue to be addressed.

I tracked down the source of the oscillatory behavior to this line.

        argW = Rs[idx_p] * I0[idx_p] / (
                    a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.)) * \
               np.exp((Rs[idx_p] * (IL[idx_p] + I0[idx_p]) + V[idx_p]) /
                      (a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.)))

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 using pvlib.tools._golden_sect_DataFrame. I suspect the convergence of this root finder is the culprit.

0reactions
markcampanellicommented, Nov 5, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PV module - Model parameters page - PVsyst
This page gives access to several tools for the determination of all secondary parameters of the PV module model. ... These are the...
Read more >
PVsyst_Tutorials_V7_Grid_Conn...
This document is a first step of a series of tutorials which explain the use of. PVsyst Version 7 and may be understood...
Read more >
Project design > Shadings - PVsyst
We call Shading Factor the ratio of the shaded area, with respect to the total sensitive area of the field. The treatment of...
Read more >
Ageing, PV modules degradation - PVsyst
The PV module degradation gives rise to a progressive loss of efficiency, which we will characterize by a "Degradation Loss factor". The simulation...
Read more >
A model of photovoltaic fields in mismatching conditions ...
The model of photovoltaic (PV) fields in mismatching conditions presented in this paper is a tradeoff between accuracy and calculation time.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found