|
@@ -19,6 +19,7 @@ void SOC(void)
|
|
|
static uint16_T socn_pct_battSocEE;
|
|
|
static uint16_T socn_pct_bcuSocEE;
|
|
|
static uint16_T socn_Q_cap;
|
|
|
+ //static int16_T socn_ohm_cellRAvrg;
|
|
|
//
|
|
|
real_T Q;
|
|
|
real_T battcurr;
|
|
@@ -147,6 +148,7 @@ void SOC(void)
|
|
|
socn_pct_battSocEE = look1_iu16lu16n16tu16_binlcase(sfmd_V_cellUAvrg, (&(cmnm_V_ocv[0])), (&(cmnm_pct_soc[0])), 12U);
|
|
|
}
|
|
|
socn_Q_cap = (uint16_T)((uint16_T)((uint32_T)sohd_pct_bcuSoh * cmnc_Q_ratedCp / 2000U) << 1);
|
|
|
+ //socn_ohm_cellRAvrg = ArrMean(&sorv_ohm_cellREi[0], cmnc_num_cellUNum);
|
|
|
}
|
|
|
|
|
|
//printf("1---- battSocEi:%d,bcuSocEi:%d,battSocEE:%d,bcuSocEE:%d\n",socd_pct_battSocEi,socd_pct_bcuSocEi,socn_pct_battSocEE,socn_pct_bcuSocEE);
|
|
@@ -218,7 +220,7 @@ void SOC(void)
|
|
|
//输出
|
|
|
EKFSOCMin = (uint16_T)(soc_Min_Delay * 10);
|
|
|
socn_flg_ekfInvalidMin = (deltU > 0.01) || (deltU < -0.01);
|
|
|
- //printf("2----soc:%f,Up:%f,U:%d,deltU:%f,K[0]:%f,K[1]:%f\n",soc_Min_Delay,Up_Min_Delay,sfmd_V_cellUMin,deltU,K[0],K[1]);
|
|
|
+ //printf("2----socmin:%f,U:%d,R:%f\n",soc_Min_Delay,sfmd_V_cellUMin,Ro);
|
|
|
//------------------------EKFSOCmax-----------------------------------
|
|
|
if (FirstRun_SOC)
|
|
|
{
|
|
@@ -231,7 +233,7 @@ void SOC(void)
|
|
|
}
|
|
|
// 参数查表
|
|
|
ocv = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10), (&(cmnm_pct_soc[0])), (&(cmnm_V_ocv[0])), 12U) * 0.001;
|
|
|
- Ro = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10), (&(cmnm_pct_soc[0])), (&(cmnm_R_ohm[0])), 12U) * 0.001 * 0.001;
|
|
|
+ Ro = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10), (&(cmnm_pct_soc[0])), (&(cmnm_R_ohm[0])), 12U) * 0.001 * 0.001 ;
|
|
|
Rp = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10), (&(cmnm_pct_soc[0])), (&(cmnm_R_polar[0])), 12U) * 0.001 * 0.001;
|
|
|
C = (real_T)look1_iu16lu16n16tu16_binlcase((uint16_T)(soc_Max_Delay * 10), (&(cmnm_pct_soc[0])), (&(cmnm_F_polar[0])), 12U) * 0.001 * 1000;
|
|
|
A[0] = 1;
|
|
@@ -281,7 +283,7 @@ void SOC(void)
|
|
|
//输出
|
|
|
EKFSOCMax = (uint16_T)(soc_Max_Delay * 10);
|
|
|
socn_flg_ekfInvalidMax = (deltU > 0.01) || (deltU < -0.01);
|
|
|
- //printf("4----soc:%f,Up:%f,U:%d,deltU:%f,K[0]:%f,K[1]:%f\n",soc_Max_Delay,Up_Max_Delay,sfmd_V_cellUMax,deltU,K[0],K[1]);
|
|
|
+ //printf("4----socmax:%f,U:%d,R:%f\n\n",soc_Max_Delay,sfmd_V_cellUMax,Ro);
|
|
|
//-----------------------EKFSOC----------------------------------------
|
|
|
socn_flg_ekfInvalid = socn_flg_ekfInvalidMax || socn_flg_ekfInvalidMin;
|
|
|
if (EKFSOCMax > 800)
|
|
@@ -581,8 +583,7 @@ void SOC(void)
|
|
|
|
|
|
//===============================================================================================================================================================
|
|
|
////////////////////////////////////////////////BCUSOC///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- //===============================================================================================================================================================
|
|
|
-
|
|
|
+ //===============================================================================================================================================================
|
|
|
if (sfmd_I_curr < 10 && sfmd_I_curr > -10)
|
|
|
{
|
|
|
statCntl = (statCntl + 1) > 250 ? 250 : (statCntl + 1);
|
|
@@ -593,7 +594,7 @@ void SOC(void)
|
|
|
}
|
|
|
statFlg = statCntl > 2;
|
|
|
|
|
|
- Flg = (FirstRun_SOC || (ihd_st_chrgSta_Delay == 2 && ihd_st_workStat != 2) || (ihd_st_chrgSta_Delay != 2 && ihd_st_workStat == 2) || ((int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) > 10 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) < -10) || statFlg);
|
|
|
+ Flg = (FirstRun_SOC || (ihd_st_chrgSta_Delay == 2 && ihd_st_workStat != 2) || (ihd_st_chrgSta_Delay != 2 && ihd_st_workStat == 2) || ((int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) > 5 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) < -5) || statFlg);
|
|
|
|
|
|
ihd_st_chrgSta_Delay = ihd_st_workStat;
|
|
|
socd_pct_battSoc_Delay = socd_pct_battSoc;
|
|
@@ -669,16 +670,18 @@ void SOC(void)
|
|
|
onceFlg_dischrg = false;
|
|
|
socd_pct_bcuSoc = 2000;
|
|
|
}
|
|
|
-
|
|
|
socd_pct_bcuSoc = SOCfitSystem(bcuSoc, &socd_pct_bcuSoc, 1);
|
|
|
//printf("11-----x:[%d-%d-%d],y:[%d-%d-%d],bcusoc:%d,socd_pct_bcuSoc:%d\n",x[0],x[1],x[2],y[0],y[1],y[2],bcuSoc,socd_pct_bcuSoc);
|
|
|
}
|
|
|
- //
|
|
|
socd_pct_bcuSocEo = socd_pct_bcuSoc;
|
|
|
+
|
|
|
+ //=======================================VCUSOC========================================================================================
|
|
|
+
|
|
|
socd_pct_vcuSoc = (uint16_T)((uint32_T)((socd_pct_bcuSoc - socc_pct_battSocLow) * 1000) / (socc_pct_battSocUp - socc_pct_battSocLow));
|
|
|
+
|
|
|
//printf("BattSOC:%d,BCUSOC:%d,VcuSoc:%d\n",socd_pct_battSoc,socd_pct_bcuSoc,socd_pct_vcuSoc);
|
|
|
- //===================================================================
|
|
|
- //------------------EEsave-------------------------------------------
|
|
|
+ //================================================================================================
|
|
|
+ //------------------EEsave-------------------------------------------=============================
|
|
|
//================================================================================================
|
|
|
if ((int16_T)(socd_pct_battSoc - socd_pct_battSoc_save) > 10 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_save) < -10 || (int16_T)(socd_pct_bcuSoc - socd_pct_bcuSoc_save) > 10 || (int16_T)(socd_pct_bcuSoc - socd_pct_bcuSoc_save) < -10 )
|
|
|
{
|