V_FROM_I
This function computes the device voltage corresponding to a specified operating current under the single-diode model. It is useful when a current setpoint is already known and only the matching voltage on the IV curve is required.
The calculation inverts the single-diode relationship
I = I_L - I_0 \left[\exp\left(\frac{V + I R_s}{n N_s V_{th}}\right) - 1\right] - \frac{V + I R_s}{R_{sh}}
to solve for V at the requested current. When shunt resistance is effectively infinite the solution can simplify, while finite-shunt cases use the selected numerical method.
Excel Usage
=V_FROM_I(current, photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth, vfi_solver)
current(float, required): Operating current (A).photocurrent(float, required): Light-generated current (A).saturation_current(float, required): Diode saturation current (A).resistance_series(float, required): Series resistance (ohms).resistance_shunt(float, required): Shunt resistance (ohms). Use a large value for infinite.nNsVth(float, required): Product of ideality factor, cells in series, and thermal voltage (V).vfi_solver(str, optional, default: “lambertw”): Numerical solver method.
Returns (float): The device voltage (V), or an error string.
Example 1: Voltage at typical Imp
Inputs:
| current | photocurrent | saturation_current | resistance_series | resistance_shunt | nNsVth | vfi_solver |
|---|---|---|---|---|---|---|
| 5.09341 | 5.5 | 2e-10 | 0.5 | 300 | 1.5 | lambertw |
Excel formula:
=V_FROM_I(5.09341, 5.5, 2e-10, 0.5, 300, 1.5, "lambertw")
Expected output:
29.151
Example 2: Voltage at zero current approximates Voc
Inputs:
| current | photocurrent | saturation_current | resistance_series | resistance_shunt | nNsVth | vfi_solver |
|---|---|---|---|---|---|---|
| 0 | 5.5 | 2e-10 | 0.5 | 300 | 1.5 | lambertw |
Excel formula:
=V_FROM_I(0, 5.5, 2e-10, 0.5, 300, 1.5, "lambertw")
Expected output:
36.0231
Example 3: Voltage at typical Imp using Newton solver
Inputs:
| current | photocurrent | saturation_current | resistance_series | resistance_shunt | nNsVth | vfi_solver |
|---|---|---|---|---|---|---|
| 5.09341 | 5.5 | 2e-10 | 0.5 | 300 | 1.5 | newton |
Excel formula:
=V_FROM_I(5.09341, 5.5, 2e-10, 0.5, 300, 1.5, "newton")
Expected output:
29.151
Example 4: Voltage at operating current with higher series resistance
Inputs:
| current | photocurrent | saturation_current | resistance_series | resistance_shunt | nNsVth | vfi_solver |
|---|---|---|---|---|---|---|
| 5.09341 | 5.5 | 2e-10 | 0.9 | 300 | 1.5 | lambertw |
Excel formula:
=V_FROM_I(5.09341, 5.5, 2e-10, 0.9, 300, 1.5, "lambertw")
Expected output:
27.1137
Python Code
Show Code
from pvlib.pvsystem import v_from_i as result_func
def v_from_i(current, photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth, vfi_solver='lambertw'):
"""
Calculate device voltage at a given current for the single-diode model.
See: https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.pvsystem.v_from_i.html
This example function is provided as-is without any representation of accuracy.
Args:
current (float): Operating current (A).
photocurrent (float): Light-generated current (A).
saturation_current (float): Diode saturation current (A).
resistance_series (float): Series resistance (ohms).
resistance_shunt (float): Shunt resistance (ohms). Use a large value for infinite.
nNsVth (float): Product of ideality factor, cells in series, and thermal voltage (V).
vfi_solver (str, optional): Numerical solver method. Valid options: Lambert W, Newton, Brentq, Chandrupatla. Default is 'lambertw'.
Returns:
float: The device voltage (V), or an error string.
"""
try:
i = float(current)
il = float(photocurrent)
i0 = float(saturation_current)
rs_v = float(resistance_series)
rsh = float(resistance_shunt)
nv = float(nNsVth)
meth = str(vfi_solver) if vfi_solver is not None else "lambertw"
res = result_func(
current=i,
photocurrent=il,
saturation_current=i0,
resistance_series=rs_v,
resistance_shunt=rsh,
nNsVth=nv,
method=meth
)
return float(res)
except Exception as e:
return f"Error: {str(e)}"