Skip to content

Cell Model Solutions

Anton Driesse edited this page Apr 4, 2018 · 13 revisions

PVLIB-Python solves for cell voltage and current using a single-diode model (SDM), a.k.a. "DeSoto" or "5-parameter", in pvlib.pvsystem.singlediode, pvlib.pvsystem.i_from_v, and pvlib.pvsystem.v_from_i. These methods allow a user to find the following IV-curve points at any temperature and irradiance combination:

  • max power point current, i_mp, and voltage, v_mp,
  • open circuit voltage, v_oc
  • short circuit current, i_sc
  • a set of voltage and current pairs at arbitrary points along the full curve from i_sc through the max power point (mpp) to v_oc

This page discusses the methods used to solve the SDM, which is an implicit equation and typically requires an iterative method.

Lambert W

The SDM can be transformed to an explicit Lambert-W function. Solving the Lambert-W function returns the values, w, for given values, z, that satisfy z = w - exp(w).

(Actually this solution also requires iteration, but the iteration hidden inside lamberw().)

Iterative Methods

Since the SDM produces a continuously differentiable and monotonic IV-curve, it can be solved using any of the standard iterative methods, such as:

  • gradient descent like the Newton-Raphson, Secant, or Powell methods
  • bisection like Brent or Golden Section methods
  • any combination of the above including quadratic extrapolation, trust-region, etc.

Bisection

This method is considered the gold standard because it is a bounded search method. Applying this to the SDM is very straight-forward and guaranteed to converge on a solution. Also the bisection method by itself does not required derivatives. For zero searching it require the function to be monotonic, but for minimum searching it does not have to be monotonic.

Gradient Descent

The most common example of a gradient descent is the Newton-Raphson method, which method uses the slope of the curve at an arbitrary initial location to predict where the curve will cross the x-axis. This distance from the initial location to get to the predicted zero is called the "Newton step" and is typically used as one of the convergence criteria. The Newton method converges more rapidly than bisection and is not bounded, but it has some limitations.

  • It can't possibly predict where the curve crosses the x-axis if the derivative returns a slope of zero!
  • If the curve has discontinuities, or is characterized by both relative flat and steep sections, then, given a poor initial starting point, the Newton step may "shoot" over the true zero into a "fake valley" with no zero.

There are methods to mitigate against these limitations, but they aren't necessary in the case of the SDM because it is smooth and monotonic, and the slope is everywhere greater than the machine precision of IEEE double precision floats, 2e-16.

Full IV Curves: Bishop's method - a compromise

One of the methods above can be used to calculate a full IV curve for a specific set of voltages. However if the user doesn't need to specify the voltages, only that they are bounded by the 1st quadrant, then the algorithm presented by J.W. Bishop in "Computer simulation of the effects of electrical mismatches in photovoltaic cell interconnection circuits", Solar Cells Vol 25, No 1, 1988, pp 73-89 presents an explicit way to do this by recognizing that the SDM is explicit for diode voltage.

  1. Select a range of diode voltages, v_diode

  2. Calculate the cell current, i, from the explicit SDM equations:

     i = i_l - i_o * (exp(v_diode / v_th) - 1.0) - v_diode / r_sh
    
  3. Back calculate the cell voltage from the resulting currents:

     v = v_diode - i * r_s
    

Notes on Bishop's method

  • This method is just a very slight substitution into the existing SDM. It does not change the SDM governing equations.
  • Bishop's method can only be used to find cell current and voltage at a specified diode voltage, and not for a specific cell voltage. Therefore it is best used to find the entire IV curve.
  • Since Bishop's method is explicit, it takes less calculations than an iterative or Lambert-W approach, and therefore can produce a full IV curve in less time.

Max Power Point, Short Circuit, and Open Circuit

These specific points always require either a Lambert-W or iterative approach because they specify a condition to search for.

Max Power Point

There are two approaches:

  1. Find the point where the product of cell current and voltage are the maximum. This can be accomplished using a bisection method to find the largest value assuming the there is only one maximum and the curve is monotonic on both sides of the maximum. This is how NREL-SAM finds the max power point. Sidenote, typically the search algorithm finds the minimum, which is accomplished by taking the negative of the cell power.

  2. Find the point where the derivative of the power with respect to voltage, dp/dv is zero. This can be accomplished by using either bisection or gradient descent. In the case of gradient descent the second derivative, d^2p/dv^2 can be provided, or else the secant method can be used to approximate it.

The gradient descent method will be faster, but due to possible limitations for gradient descent discussed above, the bisection is considered the "gold" standard because it is guaranteed to find the solution.

Open Circuit Voltage

Either bisection or gradient descent can be used to find the point where the current is zero. To use the bisection method, an upper bound greater than v_oc must be used. This is accomplished by estimating the value assuming infinite shunt resistance,

v_oc_estimate = n * n_s * v_th * log(i_l / i_o + 1.0)

and then using that estimate as the diode voltage which will always yield a negative current for this specific value. See proof in the documentation.

The gradient descent method doesn't require any bounds and will converge on v_oc faster than bisection, but due to possible limitations for gradient descent discussed above, the bisection is considered the "gold" standard because it is guaranteed to find the solution.

Short Circuit Current

Either bisection or gradient descent can be used to find the point where the voltage is zero. To use the bisection method, a pair of voltages that bound zero volts must be used.

The gradient descent method doesn't require any bounds and will converge on i_s faster than bisection, but due to possible limitations for gradient descent discussed above, the bisection is considered the "gold" standard because it is guaranteed to find the solution.

Conclusion

This page summarize the possible ways to solve the SDM for the desired points. In summary:

  • for an arbitrary set of IV-curve points use Bishop's method
  • for guaranteed max power, open circuit, and short circuit points, the "gold" method is bisection
  • for max power, open circuit, and short circuit points, a possible faster calculation is the gradient descent method.
  • for points outside but close to quadrant 1, use gradient descent but beware that as the specified location moves away from quadrant 1, both the SDM and the gradient descent method may not be able to accurately provide a solution.