Skip to content

Commit

Permalink
Fixed errors in the I_L and I_0 equations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Richert committed Sep 8, 2017
1 parent d8107ab commit 13aa33d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions shared/lib_mlmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ static const int IAM_MODE_ASHRAE = 1;
static const int IAM_MODE_SANDIA = 2;
static const int IAM_MODE_SPLINE = 3;

// 1: Use Sandia polynomial [corr=f(AM)], 2: Use standard coefficients from DeSoto model [3] [corr=f(AM)], 3: Use First Solar polynomial [corr=f(AM, p_wat)]
static const int AM_MODE_SANDIA = 1;
static const int AM_MODE_DESOTO = 2;
static const int AM_MODE_LEE_PANCHULA = 3;
// 1: Do not use AM correction 1: Use Sandia polynomial [corr=f(AM)], 2: Use standard coefficients from DeSoto model [3] [corr=f(AM)], 3: Use First Solar polynomial [corr=f(AM, p_wat)]
static const int AM_MODE_OFF = 1;
static const int AM_MODE_SANDIA = 2;
static const int AM_MODE_DESOTO = 3;
static const int AM_MODE_LEE_PANCHULA = 4;

mlmodel_module_t::mlmodel_module_t()
{
Expand Down Expand Up @@ -91,9 +92,10 @@ void mlmodel_module_t::initializeManual()
{
isInitialized = true;
// Calculate values of constant reference values.
double R_sh_STC = R_shref + (R_sh0 - R_shref) * exp(-R_shexp * (S_ref / S_ref));
nVT = N_series * n_0 * k * (T_ref + T_0) / q;
I_0ref = (I_sc_ref + (I_sc_ref * R_s + V_oc_ref) / R_shref) / (exp(V_oc_ref / nVT - 1) - exp((I_sc_ref * R_s) / nVT - 1));
I_Lref = I_0ref * exp(V_oc_ref / nVT - 1) + V_oc_ref / R_shref;
I_0ref = (I_sc_ref + (I_sc_ref * R_s - V_oc_ref) / R_sh_STC) / ((exp(V_oc_ref / nVT) - 1) - (exp((I_sc_ref * R_s) / nVT) - 1));
I_Lref = I_0ref * (exp(V_oc_ref / nVT) - 1) + V_oc_ref / R_sh_STC;

// set up IAM spline
if (IAM_mode == IAM_MODE_SPLINE)
Expand Down Expand Up @@ -159,6 +161,9 @@ bool mlmodel_module_t::operator() (pvinput_t &input, double T_C, double opvoltag
double f_AM = 0;
switch (AM_mode)
{
case AM_MODE_OFF:
f_AM = 1.0;
break;
case AM_MODE_SANDIA:
f_AM = air_mass_modifier(input.Zenith, input.Elev, AM_c_sa);
break;
Expand Down Expand Up @@ -214,7 +219,6 @@ bool mlmodel_module_t::operator() (pvinput_t &input, double T_C, double opvoltag
P = V*I;
}
eff = P / ((Width * Length) * S);

}

out.Power = P;
Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_pvsamv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static var_info _cm_vtab_pvsamv1[] = {
{ SSC_INPUT, SSC_NUMBER, "mlm_T_c_fa_alpha", "Extended Faiman model absorptivity", "-", "", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_T_c_fa_U0", "Extended Faiman model U_0", "W/m²K", "", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_T_c_fa_U1", "Extended Faiman model U_1", "W/m³sK", "", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_AM_mode", "Air-mass modifier mode", "-", "1: Use Sandia polynomial [corr=f(AM)], 2: Use standard coefficients from DeSoto model [corr=f(AM)], 3: Use First Solar polynomial [corr=f(AM, p_wat)]", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_AM_mode", "Air-mass modifier mode", "-", "1: Do not consider AM effects, 2: Use Sandia polynomial [corr=f(AM)], 3: Use standard coefficients from DeSoto model [corr=f(AM)], 4: Use First Solar polynomial [corr=f(AM, p_wat)]", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_AM_c_sa0", "Coefficient 0 for Sandia Air Mass Modifier", "-", "", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_AM_c_sa1", "Coefficient 1 for Sandia Air Mass Modifier", "-", "", "pvsamv1", "module_model=5", "", "" },
{ SSC_INPUT, SSC_NUMBER, "mlm_AM_c_sa2", "Coefficient 2 for Sandia Air Mass Modifier", "-", "", "pvsamv1", "module_model=5", "", "" },
Expand Down

0 comments on commit 13aa33d

Please sign in to comment.