|
@@ -143,7 +143,6 @@ void SOC(void)
|
|
}
|
|
}
|
|
socn_Q_cap = (uint16_T)((uint16_T)((uint32_T)sohd_pct_bcuSoh * cmnc_Q_ratedCp / 2000U) << 1);
|
|
socn_Q_cap = (uint16_T)((uint16_T)((uint32_T)sohd_pct_bcuSoh * cmnc_Q_ratedCp / 2000U) << 1);
|
|
}
|
|
}
|
|
-
|
|
|
|
//printf("1---- battSocEi:%d,bcuSocEi:%d,battSocEE:%d,bcuSocEE:%d\n",socd_pct_battSocEi,socd_pct_bcuSocEi,socn_pct_battSocEE,socn_pct_bcuSocEE);
|
|
//printf("1---- battSocEi:%d,bcuSocEi:%d,battSocEE:%d,bcuSocEE:%d\n",socd_pct_battSocEi,socd_pct_bcuSocEi,socn_pct_battSocEE,socn_pct_bcuSocEE);
|
|
//======================================================================
|
|
//======================================================================
|
|
////////////////////////EKFSOC//////////////////////////////////////////
|
|
////////////////////////EKFSOC//////////////////////////////////////////
|
|
@@ -193,16 +192,7 @@ void SOC(void)
|
|
//后验
|
|
//后验
|
|
deltU = (real_T)sfmd_V_cellUMin * 0.001 - UL;
|
|
deltU = (real_T)sfmd_V_cellUMin * 0.001 - UL;
|
|
soc_Min_Delay = soc1 + K[0] * deltU;
|
|
soc_Min_Delay = soc1 + K[0] * deltU;
|
|
-
|
|
|
|
- if (soc_Min_Delay < (real_T)socc_pct_battSocLow * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Min_Delay = (real_T)socc_pct_battSocLow * 0.1;
|
|
|
|
- }
|
|
|
|
- if (soc_Min_Delay > (real_T)socc_pct_battSocUp * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Min_Delay = (real_T)socc_pct_battSocUp * 0.1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ soc_Min_Delay = Saturation_r(soc_Min_Delay, (real_T)socc_pct_battSocLow * 0.1, (real_T)socc_pct_battSocUp * 0.1);
|
|
Up_Min_Delay = Up1 + K[1] * deltU;
|
|
Up_Min_Delay = Up1 + K[1] * deltU;
|
|
//P更新
|
|
//P更新
|
|
P_Min_Delay[0] = (1 - K[0] * H[0]) * P1[0] - K[0] * P1[1];
|
|
P_Min_Delay[0] = (1 - K[0] * H[0]) * P1[0] - K[0] * P1[1];
|
|
@@ -258,15 +248,7 @@ void SOC(void)
|
|
//后验
|
|
//后验
|
|
deltU = (real_T)sfmd_V_cellUMax * 0.001 - UL;
|
|
deltU = (real_T)sfmd_V_cellUMax * 0.001 - UL;
|
|
soc_Max_Delay = soc1 + K[0] * deltU;
|
|
soc_Max_Delay = soc1 + K[0] * deltU;
|
|
-
|
|
|
|
- if (soc_Max_Delay < (real_T)socc_pct_battSocLow * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Max_Delay = (real_T)socc_pct_battSocLow * 0.1;
|
|
|
|
- }
|
|
|
|
- if (soc_Max_Delay > (real_T)socc_pct_battSocUp * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Max_Delay = (real_T)socc_pct_battSocUp * 0.1;
|
|
|
|
- }
|
|
|
|
|
|
+ soc_Max_Delay = Saturation_r(soc_Max_Delay, (real_T)socc_pct_battSocLow * 0.1, (real_T)socc_pct_battSocUp * 0.1);
|
|
Up_Max_Delay = Up1 + K[1] * deltU;
|
|
Up_Max_Delay = Up1 + K[1] * deltU;
|
|
|
|
|
|
//P更新
|
|
//P更新
|
|
@@ -340,15 +322,7 @@ void SOC(void)
|
|
deltU = (real_T)sfmd_V_cellUAvrg * 0.001 - UL;
|
|
deltU = (real_T)sfmd_V_cellUAvrg * 0.001 - UL;
|
|
soc_Avrg_Delay = soc1 + K[0] * deltU;
|
|
soc_Avrg_Delay = soc1 + K[0] * deltU;
|
|
|
|
|
|
- if (soc_Avrg_Delay < (real_T)socc_pct_battSocLow * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Avrg_Delay = (real_T)socc_pct_battSocLow * 0.1;
|
|
|
|
- }
|
|
|
|
- if (soc_Avrg_Delay > (real_T)socc_pct_battSocUp * 0.1)
|
|
|
|
- {
|
|
|
|
- soc_Avrg_Delay = (real_T)socc_pct_battSocUp * 0.1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ soc_Avrg_Delay = Saturation_r(soc_Avrg_Delay, (real_T)socc_pct_battSocLow * 0.1, (real_T)socc_pct_battSocUp * 0.1);
|
|
Up_Avrg_Delay = Up1 + K[1] * deltU;
|
|
Up_Avrg_Delay = Up1 + K[1] * deltU;
|
|
//P更新
|
|
//P更新
|
|
P_avrg_Delay[0] = (1 - K[0] * H[0]) * P1[0] - K[0] * P1[1];
|
|
P_avrg_Delay[0] = (1 - K[0] * H[0]) * P1[0] - K[0] * P1[1];
|
|
@@ -397,24 +371,14 @@ void SOC(void)
|
|
ahDelay = ahDelay + battcurr / (real_T)(cmnc_Q_ratedCp * 0.1) / 36.0;//cmnc_Q_ratedCp
|
|
ahDelay = ahDelay + battcurr / (real_T)(cmnc_Q_ratedCp * 0.1) / 36.0;//cmnc_Q_ratedCp
|
|
}
|
|
}
|
|
ahSoc = (int16_T)(ahDelay * 10);
|
|
ahSoc = (int16_T)(ahDelay * 10);
|
|
- if (ahSoc > socc_pct_battSocUp)
|
|
|
|
- {
|
|
|
|
- socd_pct_ahSoc = socc_pct_battSocUp;
|
|
|
|
- }
|
|
|
|
- else if (ahSoc < socc_pct_battSocLow)
|
|
|
|
- {
|
|
|
|
- socd_pct_ahSoc = socc_pct_battSocLow;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- socd_pct_ahSoc = (uint16_T)ahSoc;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ socd_pct_ahSoc = Saturation_u(ahSoc < 0 ? 0 : (uint16_T)ahSoc, socc_pct_battSocLow, socc_pct_battSocUp);
|
|
//printf("5----ahDelay:%f,ahSoc:%d,battcurr:%f,sfmd_I_curr:%d\n",ahDelay,ahSoc,battcurr,sfmd_I_curr);
|
|
//printf("5----ahDelay:%f,ahSoc:%d,battcurr:%f,sfmd_I_curr:%d\n",ahDelay,ahSoc,battcurr,sfmd_I_curr);
|
|
|
|
|
|
//======================================================================
|
|
//======================================================================
|
|
///////////////////////estSOC//////////////////////////////////////////
|
|
///////////////////////estSOC//////////////////////////////////////////
|
|
//======================================================================
|
|
//======================================================================
|
|
- socn_flg_ekfDisable = !JudgeTimeSystem(1,!socn_flg_ekfInvalid,&ekfInvalidCntl,20);
|
|
|
|
|
|
+ socn_flg_ekfDisable = !JudgeTimeSystem(1,!socn_flg_ekfInvalid,&ekfInvalidCntl,2);
|
|
if (socn_flg_ekfDisable)
|
|
if (socn_flg_ekfDisable)
|
|
{
|
|
{
|
|
if (onceFlg_est)
|
|
if (onceFlg_est)
|
|
@@ -430,16 +394,8 @@ void SOC(void)
|
|
onceFlg_est = true;
|
|
onceFlg_est = true;
|
|
socd_pct_estSoc = socd_pct_ekfSoc;
|
|
socd_pct_estSoc = socd_pct_ekfSoc;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ socd_pct_estSoc = Saturation_u(socd_pct_estSoc, socc_pct_battSocLow, socc_pct_battSocUp);
|
|
//
|
|
//
|
|
- if (socd_pct_estSoc > socc_pct_battSocUp)
|
|
|
|
- {
|
|
|
|
- socd_pct_estSoc = socc_pct_battSocUp;
|
|
|
|
- }
|
|
|
|
- if (socd_pct_estSoc < socc_pct_battSocLow)
|
|
|
|
- {
|
|
|
|
- socd_pct_estSoc = socc_pct_battSocLow;
|
|
|
|
- }
|
|
|
|
//printf("6----ahSoc0_est:%d,ekfSoc0_est:%d,socd_pct_estSoc:%d\n",ahSoc0_est,ekfSoc0_est,socd_pct_estSoc);
|
|
//printf("6----ahSoc0_est:%d,ekfSoc0_est:%d,socd_pct_estSoc:%d\n",ahSoc0_est,ekfSoc0_est,socd_pct_estSoc);
|
|
|
|
|
|
//======================================================================
|
|
//======================================================================
|