CALCPARAMS_CEC

Overview

The CALCPARAMS_CEC function calculates five parameter values for the single diode equation at a given effective irradiance and cell temperature using the California Energy Commission (CEC) model. These parameters are essential for modeling the current-voltage (I-V) characteristics of photovoltaic (PV) modules.

This implementation wraps the pvlib.pvsystem.calcparams_cec function from the pvlib-python library, a widely-used open-source tool for solar energy modeling.

The CEC model is based on the work by Dobos (2012) and differs from the earlier De Soto et al. (2006) model by introducing an Adjust parameter that modifies the temperature coefficient for short-circuit current. This adjustment improves the accuracy of module performance predictions under varying environmental conditions.

The function returns five parameters required by the single diode model:

  • Photocurrent (I_L): The light-generated current in amperes
  • Saturation current (I_o): The diode reverse saturation current in amperes
  • Series resistance (R_s): Resistance in ohms
  • Shunt resistance (R_{sh}): Resistance in ohms
  • nNsVth: The product of diode ideality factor (n), number of cells in series (N_s), and cell thermal voltage (V_{th})

Key reference parameters such as EgRef (energy bandgap, default 1.121 eV for crystalline silicon) and dEgdT (temperature dependence of bandgap) are consistent with values used in the SAM (System Advisor Model) CEC module database maintained by NREL.

For further details, see the original paper: A. Dobos, “An Improved Coefficient Calculator for the California Energy Commission 6 Parameter Photovoltaic Module Model”, Journal of Solar Energy Engineering, vol 134, 2012.

This example function is provided as-is without any representation of accuracy.

Excel Usage

=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 (int, required): The effective_irradiance value
  • temp_cell (int, required): The temp_cell value
  • alpha_sc (float, required): The alpha_sc value
  • a_ref (float, required): The a_ref value
  • I_L_ref (float, required): The I_L_ref value
  • I_o_ref (float, required): The I_o_ref value
  • R_sh_ref (int, required): The R_sh_ref value
  • R_s (float, required): The R_s value
  • Adjust (int, required): The Adjust value
  • EgRef (float, optional, default: 1.121): The EgRef value
  • dEgdT (float, optional, default: -0.0002677): The dEgdT value
  • irrad_ref (int, optional, default: 1000): The irrad_ref value
  • temp_ref (int, optional, default: 25): The temp_ref value

Returns (list[list]): [photocurrent, saturation current, series resistance, shunt resistance, nNsVth]. If input is invalid, returns a string error message.

Examples

Example 1: Demo case 1

Inputs:

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
1000 25 0.004 1.5 6 1e-10 200 0.5 0 1.121 -0.0002677 1000 25

Excel formula:

=CALCPARAMS_CEC(1000, 25, 0.004, 1.5, 6, 1e-10, 200, 0.5, 0, 1.121, -0.0002677, 1000, 25)

Expected output:

Result
6 1e-10 0.5 200 1.5

Example 2: Demo case 2

Inputs:

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
800 35 0.004 1.5 6 1e-10 200 0.5 0 1.2 -0.0003 1000 25

Excel formula:

=CALCPARAMS_CEC(800, 35, 0.004, 1.5, 6, 1e-10, 200, 0.5, 0, 1.2, -0.0003, 1000, 25)

Expected output:

Result
4.832 5.756e-10 0.5 250 1.55

Example 3: Demo case 3

Inputs:

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
1000 25 0.004 1.5 6 1e-10 200 0.5 0 1.121 -0.0002677 900 20

Excel formula:

=CALCPARAMS_CEC(1000, 25, 0.004, 1.5, 6, 1e-10, 200, 0.5, 0, 1.121, -0.0002677, 900, 20)

Expected output:

Result
6.689 2.347e-10 0.5 180 1.526

Example 4: Demo case 4

Inputs:

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
950 30 0.004 1.6 6.2 2e-10 210 0.55 0.01 1.15 -0.00028 950 30

Excel formula:

=CALCPARAMS_CEC(950, 30, 0.004, 1.6, 6.2, 2e-10, 210, 0.55, 0.01, 1.15, -0.00028, 950, 30)

Expected output:

Result
6.2 2e-10 0.55 210 1.6

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.

    See: https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.pvsystem.calcparams_cec.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        effective_irradiance (int): The effective_irradiance value
        temp_cell (int): The temp_cell value
        alpha_sc (float): The alpha_sc value
        a_ref (float): The a_ref value
        I_L_ref (float): The I_L_ref value
        I_o_ref (float): The I_o_ref value
        R_sh_ref (int): The R_sh_ref value
        R_s (float): The R_s value
        Adjust (int): The Adjust value
        EgRef (float, optional): The EgRef value Default is 1.121.
        dEgdT (float, optional): The dEgdT value Default is -0.0002677.
        irrad_ref (int, optional): The irrad_ref value Default is 1000.
        temp_ref (int, optional): The temp_ref value Default is 25.

    Returns:
        list[list]: [photocurrent, saturation current, series resistance, shunt resistance, nNsVth]. If input is invalid, returns a string error message.
    """
    # Define helper function inside main function as per guidelines
    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 "Error: 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)
        )
        # Return values without rounding as per Excel Python Function Guidelines
        row = [float(vals[0]), float(vals[1]), float(vals[2]), float(vals[3]), float(vals[4])]
        return [row]
    except Exception as ex:
        return f"Error: {ex}"

Online Calculator