|
@@ -9,17 +9,19 @@ void SOC_Init(void)
|
|
{
|
|
{
|
|
FirstRun_SOC = true;
|
|
FirstRun_SOC = true;
|
|
}
|
|
}
|
|
-//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+//-------------------------------------------------------------------------
|
|
|
|
+//---------------------------SOC-------------------------------------------
|
|
|
|
+//-------------------------------------------------------------------------
|
|
void SOC(void)
|
|
void SOC(void)
|
|
{
|
|
{
|
|
static uint16_T socn_pct_battSocEE;
|
|
static uint16_T socn_pct_battSocEE;
|
|
static uint16_T socn_pct_bcuSocEE;
|
|
static uint16_T socn_pct_bcuSocEE;
|
|
static uint16_T socn_Q_cap;
|
|
static uint16_T socn_Q_cap;
|
|
//
|
|
//
|
|
- uint16_T EKFSOCMin;
|
|
|
|
- uint16_T EKFSOCMax;
|
|
|
|
- uint16_T EKFSOCAvrg;
|
|
|
|
|
|
+ real_T Q;
|
|
|
|
+ real_T battcurr;
|
|
boolean_T socn_flg_ekfInvalidMin;
|
|
boolean_T socn_flg_ekfInvalidMin;
|
|
boolean_T socn_flg_ekfInvalidMax;
|
|
boolean_T socn_flg_ekfInvalidMax;
|
|
boolean_T socn_flg_ekfInvalidAvrg;
|
|
boolean_T socn_flg_ekfInvalidAvrg;
|
|
@@ -29,6 +31,7 @@ void SOC(void)
|
|
real_T Rp;
|
|
real_T Rp;
|
|
real_T C;
|
|
real_T C;
|
|
real_T deltU;
|
|
real_T deltU;
|
|
|
|
+ real_T UL;
|
|
real_T A[4];
|
|
real_T A[4];
|
|
real_T B[2];
|
|
real_T B[2];
|
|
real_T H[2];
|
|
real_T H[2];
|
|
@@ -45,21 +48,22 @@ void SOC(void)
|
|
static real_T Up_Min_Delay;
|
|
static real_T Up_Min_Delay;
|
|
static real_T Up_Max_Delay;
|
|
static real_T Up_Max_Delay;
|
|
static real_T Up_Avrg_Delay;
|
|
static real_T Up_Avrg_Delay;
|
|
|
|
+ uint16_T EKFSOCMin;
|
|
|
|
+ uint16_T EKFSOCMax;
|
|
|
|
+
|
|
|
|
+ uint16_T EKFSOCAvrg;
|
|
uint16_T cellSocMax;
|
|
uint16_T cellSocMax;
|
|
uint16_T cellSocMin;
|
|
uint16_T cellSocMin;
|
|
- real_T Q;
|
|
|
|
- real_T battcurr;
|
|
|
|
- real_T UL;
|
|
|
|
uint16_T factor;
|
|
uint16_T factor;
|
|
//
|
|
//
|
|
static real_T ahDelay;
|
|
static real_T ahDelay;
|
|
int16_T ahSoc;
|
|
int16_T ahSoc;
|
|
//
|
|
//
|
|
- static uint16_T ekfInvalidCntl;
|
|
|
|
|
|
+ static uint16_T ekfInvalidCntl;
|
|
static boolean_T onceFlg_est;
|
|
static boolean_T onceFlg_est;
|
|
- static int16_T ahSoc0_est;
|
|
|
|
- static uint16_T ekfSoc0_est;
|
|
|
|
- //
|
|
|
|
|
|
+ static int16_T ahSoc0_est;
|
|
|
|
+ static uint16_T ekfSoc0_est;
|
|
|
|
+ //
|
|
uint16_T socd_V_chrgCCV;
|
|
uint16_T socd_V_chrgCCV;
|
|
uint16_T socd_V_disChrgCCV;
|
|
uint16_T socd_V_disChrgCCV;
|
|
static boolean_T overFlg;
|
|
static boolean_T overFlg;
|
|
@@ -67,8 +71,8 @@ void SOC(void)
|
|
static uint8_T overCntl;
|
|
static uint8_T overCntl;
|
|
static uint8_T fulCntl;
|
|
static uint8_T fulCntl;
|
|
static boolean_T onceFlg_utrckOver;
|
|
static boolean_T onceFlg_utrckOver;
|
|
- static int16_T ahSoc0_utrckOver;
|
|
|
|
- static uint16_T estSoc0_utrckOver;
|
|
|
|
|
|
+ static int16_T ahSoc0_utrckOver;
|
|
|
|
+ static uint16_T estSoc0_utrckOver;
|
|
static uint16_T Soc_Delay;
|
|
static uint16_T Soc_Delay;
|
|
static boolean_T lowFlg;
|
|
static boolean_T lowFlg;
|
|
static uint8_T lowCntl;
|
|
static uint8_T lowCntl;
|
|
@@ -89,7 +93,7 @@ void SOC(void)
|
|
static uint16_T socd_pct_bcuSoc0;
|
|
static uint16_T socd_pct_bcuSoc0;
|
|
uint16_T delSOC;
|
|
uint16_T delSOC;
|
|
uint16_T bcuSoc;
|
|
uint16_T bcuSoc;
|
|
- int16_T coinSoc;
|
|
|
|
|
|
+ int16_T coinSoc;
|
|
uint16_T x[3];
|
|
uint16_T x[3];
|
|
uint16_T y[3];
|
|
uint16_T y[3];
|
|
boolean_T Flg;
|
|
boolean_T Flg;
|
|
@@ -556,7 +560,7 @@ void SOC(void)
|
|
{
|
|
{
|
|
onceFlg_utrckLow = false;
|
|
onceFlg_utrckLow = false;
|
|
ahSoc0_utrckLow = ahSoc;
|
|
ahSoc0_utrckLow = ahSoc;
|
|
- estSoc0_utrckLow = socd_pct_estSoc < socc_pct_disChrgCor ? socd_pct_estSoc : socc_pct_disChrgCor;
|
|
|
|
|
|
+ estSoc0_utrckLow = socc_pct_disChrgCor;
|
|
}
|
|
}
|
|
socn_pct_utrackSoc = (int16_T)(ahSoc - ahSoc0_utrckLow + estSoc0_utrckLow) > 0 ? (uint16_T)(ahSoc - ahSoc0_utrckLow + estSoc0_utrckLow) : 0;
|
|
socn_pct_utrackSoc = (int16_T)(ahSoc - ahSoc0_utrckLow + estSoc0_utrckLow) > 0 ? (uint16_T)(ahSoc - ahSoc0_utrckLow + estSoc0_utrckLow) : 0;
|
|
}
|
|
}
|
|
@@ -589,7 +593,7 @@ void SOC(void)
|
|
}
|
|
}
|
|
statFlg = statCntl > 2;
|
|
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) > 20 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_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) > 10 || (int16_T)(socd_pct_battSoc - socd_pct_battSoc_Delay) < -10) || statFlg);
|
|
|
|
|
|
ihd_st_chrgSta_Delay = ihd_st_workStat;
|
|
ihd_st_chrgSta_Delay = ihd_st_workStat;
|
|
socd_pct_battSoc_Delay = socd_pct_battSoc;
|
|
socd_pct_battSoc_Delay = socd_pct_battSoc;
|
|
@@ -689,6 +693,9 @@ void SOC(void)
|
|
|
|
|
|
FirstRun_SOC = false;
|
|
FirstRun_SOC = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//===================================================================================================================
|
|
//===================================================================================================================
|
|
//----------------------------function-------------------------------------------------------------------------------
|
|
//----------------------------function-------------------------------------------------------------------------------
|
|
//===================================================================================================================
|
|
//===================================================================================================================
|
|
@@ -705,6 +712,7 @@ real_T docvmath(real_T soc)
|
|
0.02732;
|
|
0.02732;
|
|
return docv;
|
|
return docv;
|
|
}
|
|
}
|
|
|
|
+
|
|
////
|
|
////
|
|
uint16_T SOC_LookUp(uint16_T battsoc, uint16_T x[3], uint16_T y[3])
|
|
uint16_T SOC_LookUp(uint16_T battsoc, uint16_T x[3], uint16_T y[3])
|
|
{
|
|
{
|
|
@@ -731,8 +739,8 @@ uint16_T SOC_LookUp(uint16_T battsoc, uint16_T x[3], uint16_T y[3])
|
|
}
|
|
}
|
|
return bcusoc;
|
|
return bcusoc;
|
|
}
|
|
}
|
|
-//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
+//-------------------------------------------------------------------------
|
|
uint16_T SOCfitSystem(uint16_T SOC, uint16_T *SOCfit, uint16_T m)
|
|
uint16_T SOCfitSystem(uint16_T SOC, uint16_T *SOCfit, uint16_T m)
|
|
{
|
|
{
|
|
int16_T socdelt;
|
|
int16_T socdelt;
|
|
@@ -752,3 +760,4 @@ uint16_T SOCfitSystem(uint16_T SOC, uint16_T *SOCfit, uint16_T m)
|
|
|
|
|
|
return *SOCfit;
|
|
return *SOCfit;
|
|
}
|
|
}
|
|
|
|
+
|