|
@@ -80,12 +80,11 @@ void SOC(void)
|
|
|
static uint8_T chrgCntl;
|
|
|
static uint8_T disChrgCntl;
|
|
|
|
|
|
- static uint16_T socd_pct_battSoc_Delay;
|
|
|
|
|
|
static uint8_T statCntl;
|
|
|
boolean_T statFlg;
|
|
|
static uint8_T ihd_st_chrgSta_Delay;
|
|
|
- static uint16_T socn_pct_utrackSoc_Delay;
|
|
|
+ static uint16_T socd_pct_battSoc_Delay;
|
|
|
static uint16_T socd_pct_battSoc0;
|
|
|
static uint16_T socd_pct_bcuSoc0;
|
|
|
uint16_T delSOC;
|
|
@@ -96,6 +95,9 @@ void SOC(void)
|
|
|
boolean_T Flg;
|
|
|
static boolean_T onceFlg_chrg;
|
|
|
static boolean_T onceFlg_dischrg;
|
|
|
+
|
|
|
+ static uint16_T socd_pct_battSoc_save;
|
|
|
+ static uint16_T socd_pct_bcuSoc_save;
|
|
|
uint16_T i;
|
|
|
|
|
|
if (FirstRun_SOC)
|
|
@@ -112,9 +114,11 @@ void SOC(void)
|
|
|
onceFlg_utrckOver = true;
|
|
|
onceFlg_utrckLow = true;
|
|
|
ihd_st_chrgSta_Delay = 0;
|
|
|
- socn_pct_utrackSoc_Delay = 0;
|
|
|
+ socd_pct_battSoc_Delay = 0;
|
|
|
onceFlg_chrg = true;
|
|
|
onceFlg_dischrg = true;
|
|
|
+ socd_pct_battSoc_save = 0;
|
|
|
+ socd_pct_bcuSoc_save = 0;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -122,7 +126,7 @@ void SOC(void)
|
|
|
|
|
|
if (FirstRun_SOC)
|
|
|
{
|
|
|
- if (socd_pct_battSocEi > 1000 || socd_pct_bcuSocEi > 1000 || ihd_st_EOLState == 0 ||
|
|
|
+ if (socd_pct_battSocEi > 1000 || socd_pct_bcuSocEi > 1000 || ihd_st_EOLState == 0 ||ihd_st_chrgConnect ||
|
|
|
(((int16_T)(socd_pct_battSocEi - socd_pct_bcuSocEi) > 300 || (int16_T)(socd_pct_battSocEi - socd_pct_bcuSocEi) < -300) && ihd_tm_parkTime >= cmnc_tm_parkTime))
|
|
|
{
|
|
|
socn_pct_battSocEE = look1_iu16lu16n16tu16_binlcase(sfmd_V_cellUAvrg, (&(cmnm_V_ocv[0])), (&(cmnm_pct_soc[0])), 12U);
|
|
@@ -290,7 +294,7 @@ void SOC(void)
|
|
|
}
|
|
|
socd_pct_ekfSoc = (uint16_T)(((1 - (real_T)(factor * 0.01)) * (real_T)(EKFSOCMin * 0.1) + (real_T)(factor * 0.01) * (real_T)(EKFSOCMax * 0.1)) * 10);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
if (FirstRun_SOC)
|
|
@@ -404,9 +408,7 @@ void SOC(void)
|
|
|
{
|
|
|
socd_pct_ahSoc = (uint16_T)ahSoc;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -445,6 +447,7 @@ void SOC(void)
|
|
|
socd_pct_estSoc = socc_pct_battSocLow;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -454,8 +457,7 @@ void SOC(void)
|
|
|
chrgCntl = (chrgCntl + 1) > 250 ? 250 : (chrgCntl + 1);
|
|
|
lowCntl = 0;
|
|
|
lowFlg = false;
|
|
|
-
|
|
|
- socd_V_chrgCCV = look1_is16lu16n16tu16_binlcase(sfmd_I_curr,&socm_I_chrgCor[0],&socm_V_chrgCor[0],2U);
|
|
|
+ socd_V_chrgCCV = look1_is16lu16n16tu16_binlcase(sfmd_I_curr,&socm_I_chrgCor[0],&socm_V_chrgCor[0],2U);
|
|
|
if (sfmd_V_cellUMax >= socd_V_chrgCCV)
|
|
|
{
|
|
|
overCntl = (overCntl + 1) > 250 ? 250 : (overCntl + 1);
|
|
@@ -515,7 +517,7 @@ void SOC(void)
|
|
|
socn_pct_utrackSoc = socn_pct_utrackSoc > (socc_pct_battSocUp - 1) ? (socc_pct_battSocUp - 1) : socn_pct_utrackSoc;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -526,7 +528,15 @@ void SOC(void)
|
|
|
overFlg = false;
|
|
|
fulFlg = false;
|
|
|
fulCntl = 0;
|
|
|
- socd_V_disChrgCCV = look1_is16lu16n16tu16_binlcase(sfmd_I_curr,&socm_I_disChrgCor[0],&socm_V_disChrgCor[0],2U) + sfmd_I_curr * (cdmv_ohm_deltR[sfmd_idx_cellUMin]) * 0.001 * 0.1;
|
|
|
+ if (!cdmd_flg_deltOCVDisable)
|
|
|
+ {
|
|
|
+ socd_V_disChrgCCV = look1_is16lu16n16tu16_binlcase(sfmd_I_curr,&socm_I_disChrgCor[0],&socm_V_disChrgCor[0],2U) + sfmd_I_curr * (cdmv_ohm_deltR[sfmd_idx_cellUMin]) * 0.001 * 0.1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ socd_V_disChrgCCV = look1_is16lu16n16tu16_binlcase(sfmd_I_curr,&socm_I_disChrgCor[0],&socm_V_disChrgCor[0],2U);
|
|
|
+ }
|
|
|
+
|
|
|
if (sfmd_V_cellUMin <= socd_V_disChrgCCV)
|
|
|
{
|
|
|
lowCntl = (lowCntl + 1) > 250 ? 250 : (lowCntl + 1);
|
|
@@ -559,25 +569,14 @@ void SOC(void)
|
|
|
{
|
|
|
socn_pct_utrackSoc = socd_pct_estSoc;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
socd_pct_battSoc = socn_pct_utrackSoc;
|
|
|
socd_pct_battSocEo = socn_pct_utrackSoc;
|
|
|
- if ((int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) > 10 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) < -10)
|
|
|
- {
|
|
|
- socd_flg_EEsave = 1;
|
|
|
- socd_pct_battSoc_Delay = socd_pct_battSoc;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- socd_flg_EEsave = 0;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
if (sfmd_I_curr < 10 && sfmd_I_curr > -10)
|
|
@@ -590,10 +589,10 @@ 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)(socn_pct_utrackSoc - socn_pct_utrackSoc_Delay) > 20 || (int16_T)(socn_pct_utrackSoc - socn_pct_utrackSoc_Delay) < -20) || 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) > 20 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) < -20) || statFlg);
|
|
|
|
|
|
ihd_st_chrgSta_Delay = ihd_st_workStat;
|
|
|
- socn_pct_utrackSoc_Delay = socn_pct_utrackSoc;
|
|
|
+ socd_pct_battSoc_Delay = socd_pct_battSoc;
|
|
|
|
|
|
|
|
|
if (Flg)
|
|
@@ -643,7 +642,7 @@ void SOC(void)
|
|
|
{
|
|
|
socd_pct_bcuSoc = socd_pct_bcuSoc > (socc_pct_battSocUp - 1) ? (socc_pct_battSocUp - 1) : socd_pct_bcuSoc;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -668,12 +667,29 @@ void SOC(void)
|
|
|
}
|
|
|
|
|
|
socd_pct_bcuSoc = SOCfitSystem(bcuSoc, &socd_pct_bcuSoc, 1);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
socd_pct_bcuSocEo = socd_pct_bcuSoc;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 )
|
|
|
+ {
|
|
|
+ socd_flg_EEsave = 1;
|
|
|
+ socd_pct_battSoc_save = socd_pct_battSoc;
|
|
|
+ socd_pct_bcuSoc_save = socd_pct_bcuSoc;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ socd_flg_EEsave = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
FirstRun_SOC = false;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|