CALCPARAMS_CEC
Overview
The CALCPARAMS_CEC
function calculates the five parameters for the single diode equation at a given effective irradiance and cell temperature using the California Energy Commission (CEC) model. This function is essential for photovoltaic (PV) modeling, enabling the simulation of current-voltage (IV) curves for PV modules. The CEC model is widely used in the solar industry and is based on the work of Dobos (2012). The function computes the following parameters: photocurrent, saturation current, series resistance, shunt resistance, and the product of diode ideality factor, number of cells in series, and cell thermal voltage. These parameters are used as inputs to the single diode model for PV performance analysis.
The calculation is based on the following equations (see pvlib documentation ):
where is the effective irradiance, is the cell temperature, and the other parameters are module-specific constants.
For more details, see the pvlib documentation .
This example function is provided as-is without any representation of accuracy.
Usage
To use the function in Excel:
=CALCPARAMS_CEC(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, [EgRef], [dEgdT], [irrad_ref], [temp_ref])
effective_irradiance
(float, required): The irradiance (W/m^2) converted to photocurrent. Must be a scalar value.temp_cell
(float, required): The average cell temperature in degrees Celsius. Must be a scalar value.alpha_sc
(float, required): Short-circuit current temperature coefficient (A/C).a_ref
(float, required): Product of diode ideality factor, number of cells in series, and cell thermal voltage at reference (V).I_L_ref
(float, required): Light-generated current at reference (A).I_o_ref
(float, required): Diode reverse saturation current at reference (A).R_sh_ref
(float, required): Shunt resistance at reference (ohms).R_s
(float, required): Series resistance at reference (ohms).Adjust
(float, required): Adjustment to temperature coefficient for short circuit current (percent).EgRef
(float, optional, default=1.121): Energy bandgap at reference temperature (eV).dEgdT
(float, optional, default=-0.0002677): Temperature dependence of energy bandgap (1/K).irrad_ref
(float, optional, default=1000): Reference irradiance (W/m^2).temp_ref
(float, optional, default=25): Reference cell temperature (C).
The function returns a 2D list with five columns: photocurrent, saturation current, series resistance, shunt resistance, and nNsVth. If the input is invalid or not scalar, an error message (string) is returned.
Examples
Example 1: Typical CEC Parameters (Scalar Inputs)
In Excel:
=CALCPARAMS_CEC(1000, 25, 0.004, 1.5, 6.0, 1e-10, 200, 0.5, 0)
Expected output:
Photocurrent | Saturation Current | Series Resistance | Shunt Resistance | nNsVth |
---|---|---|---|---|
6.0 | 1.00e-10 | 0.5 | 200.0 | 1.5 |
Example 2: Custom Bandgap and Temperature Dependence
In Excel:
=CALCPARAMS_CEC(800, 35, 0.004, 1.5, 6.0, 1e-10, 200, 0.5, 0, 1.2, -0.0003)
Expected output:
Photocurrent | Saturation Current | Series Resistance | Shunt Resistance | nNsVth |
---|---|---|---|---|
4.83 | 5.76e-10 | 0.5 | 250.0 | 1.6 |
Example 3: Custom Reference Irradiance and Temperature
In Excel:
=CALCPARAMS_CEC(1000, 25, 0.004, 1.5, 6.0, 1e-10, 200, 0.5, 0, 1.121, -0.0002677, 900, 20)
Expected output:
Photocurrent | Saturation Current | Series Resistance | Shunt Resistance | nNsVth |
---|---|---|---|---|
6.69 | 2.35e-10 | 0.5 | 180.0 | 1.5 |
This means, for example, that for a typical crystalline silicon module at standard test conditions, the function returns the five CEC model parameters for use in single diode modeling.
Python Code
import micropip
await micropip.install('pvlib')
from pvlib.pvsystem import calcparams_cec as pvlib_calcparams_cec
import numpy as np
def calcparams_cec(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, EgRef=1.121, dEgdT=-0.0002677, irrad_ref=1000, temp_ref=25):
"""
Calculate five CEC model parameters for the single diode equation at given irradiance and cell temperature.
Args:
effective_irradiance: Scalar, irradiance in W/m^2.
temp_cell: Scalar, cell temperature in Celsius.
alpha_sc: Short-circuit current temperature coefficient (A/C).
a_ref: Product of diode ideality factor, number of cells in series, and cell thermal voltage at reference (V).
I_L_ref: Light-generated current at reference (A).
I_o_ref: Diode reverse saturation current at reference (A).
R_sh_ref: Shunt resistance at reference (ohms).
R_s: Series resistance at reference (ohms).
Adjust: Adjustment to temperature coefficient for short circuit current (percent).
EgRef: Energy bandgap at reference temperature (eV, default 1.121).
dEgdT: Temperature dependence of energy bandgap (1/K, default -0.0002677).
irrad_ref: Reference irradiance (W/m^2, default 1000).
temp_ref: Reference cell temperature (C, default 25).
Returns:
List: [photocurrent, saturation current, series resistance, shunt resistance, nNsVth].
If input is invalid, returns a string error message.
This example function is provided as-is without any representation of accuracy.
"""
import numpy as np
# Check that all arguments are scalar (not list, tuple, or array with ndim > 0)
def is_scalar(x):
if isinstance(x, (list, tuple, np.ndarray)):
return False
return True
args = [effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, EgRef, dEgdT, irrad_ref, temp_ref]
if not all(is_scalar(arg) for arg in args):
return "All arguments to calcparams_cec must be scalar values."
try:
vals = pvlib_calcparams_cec(
float(effective_irradiance), float(temp_cell), float(alpha_sc), float(a_ref), float(I_L_ref), float(I_o_ref), float(R_sh_ref), float(R_s), float(Adjust), float(EgRef), float(dEgdT), float(irrad_ref), float(temp_ref)
)
row = [float(vals[0]), float(vals[1]), float(vals[2]), float(vals[3]), float(vals[4])]
# Round for Excel display
row = [round(row[0], 2), f"{row[1]:.2e}", round(row[2], 2), round(row[3], 2), round(row[4], 1)]
return [row]
except Exception as ex:
return str(ex)
Live Notebook
Edit this function in a live notebook .