## 4 SOC Estimation Based on EKF and UKF
### Strong Tracking Unscented Kalman Filtering  
Although UKF can achieve better performance than EKF in estimation accuracy, it should be mentioned that UKF could lose the tracking capability and fail to converge the real value when it comes \begin{table}
\begin{tabular}{c} \hline \hline
**Initialization** \\ \hline \(1\). Initialize with: \\ \(\overline{x}_{0}=E(x_{0}),\ P_{0}=\big{[}(x_{0}-\overline{x}_{0})(x_{0}- \overline{x}_{0})^{T}\big{]}\) \\ \hline \multicolumn{2}{c}{**State prediction**} \\ \hline \(1\). Update the step state vector: \\ \(\chi_{i,k|k-1}=f\big{(}x_{i,k-1},\ u_{k}\big{)}\) \(\quad\)\(i=0,\ \ldots,\ 2n\) \\ \(\overline{x}_{k|k-1}=\sum\limits_{i=0}^{2n}W_{i}^{m}x_{i,k|k-1}\) \\ \(2\). Update the step error covariance: \\ \(P_{k|k-1}=\sum\limits_{i=0}^{2n}W_{i}^{c}\Big{(}x_{i,k|k-1}-\overline{x}_{k|k -1}\Big{)}\Big{(}x_{i,k|k-1}-\overline{x}_{k|k-1}\Big{)}^{T}+Q_{k}\) \\ \hline \multicolumn{2}{c}{**Measurement update**} \\ \hline \(1\). Output estimate time update: \\ \(y_{i,\ k|k-1}=g\big{(}\chi_{i,k-1},u_{k}\big{)}\) \(\quad\)\(i=0,\ \ldots,\ 2n\) \\ \(\overline{y}_{k|k-1}=\sum\limits_{i=0}^{2n}W_{i}^{m}y_{i,k-1}\) \\ \(2\). Calculate prediction covariance: \\ \(P_{yy,\ k}=\sum\limits_{i=0}^{2n}W_{i}^{c}\Big{(}y_{i,k|k-1}-\overline{y}_{k|k -1}\Big{)}\Big{(}y_{i,k|k-1}-\overline{y}_{k|k-1}\Big{)}^{T}+R_{k}\) \\ \(3\). Calculate cross-covariance covariance: \\ \(P_{xy,\ k}=\sum\limits_{i=0}^{2n}W_{i}^{c}\Big{(}\chi_{i,k|k-1}-\overline{x}_{k|k -1}\Big{)}\Big{(}y_{i,k|k-1}-\overline{y}_{k|k-1}\Big{)}^{T}\) \\ \hline \multicolumn{2}{c}{**Measurement correction**} \\ \hline \(1\). Calculate the Kalman gain: \\ \(K_{k}=\frac{P_{xy,\ k}}{P_{yy,\ k}}\) \\ \(2\). State estimate measurement update: \\ \(\overline{x}_{k|k}=\overline{x}_{k|k-1}+K_{k}\Big{(}y_{k}-\overline{y}_{k|k-1} \Big{)}\) \\ \(3\). Error covariance measurement update: \\ \(P_{k|k}=P_{k|k-1}-K_{k}P_{yy,k}K_{k}^{T}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Summary of the unscented Kalman filter (UKF) approach for SOC estimation. to the scenario that there is an abnormal change in one of the state vector components. Unfortunately, in real-world conditions, batteries suffer from highly dynamic current load that results in sudden acceleration and deceleration of driver intent. For the algorithm serve in a BMS, the sudden change of state vector, as well as the measurement error caused by the transducer, may lead to poor performance or biased results. Therefore, the STF is introduced in this study to address this problem. The idea of STF is to adjust Kalman gain matrix \(K_{k}\) by introducing the suboptimal multiple fading factors into the covariance matrix \(P_{k|k-1}\)[30]. With the adaptively modifying Kalman gain matrix and priori covariance matrix online, STF is able to resist the sudden change of system state vectors. The algorithm for \(\mu_{k}\) and \(P_{k|k-1}\) are as follows [30; 32]:  
Firstly, define the residual error \(\varepsilon_{k}\) and residual error sequence covariance matrix \(V_{k}\):  
\[\varepsilon_{k}=y_{k}-\overline{y}_{k|k-1} \tag{38}\]  
\[V_{k}=\left\{ \begin{array}{cc}\varepsilon_{k}\varepsilon_{k}^{T}&k=1\\ \frac{\rho V_{k-1}+\varepsilon_{k}\varepsilon_{k}^{T}}{1+\rho}&k\geq 2\end{array} \right. \tag{39}\]  
Generally, set \(\rho=0.95\). Secondly, define the matrixes \(N_{k}\) and \(M_{k}\) as:  
\[\left\{ \begin{array}{cc}N_{k}=V_{k}-C_{k}Q_{k-1}C_{k}^{T}-R_{k}\\ M_{k}=C_{k}P_{k|k-1}C_{k}^{T}+R_{k}-V_{k}+N_{k}\end{array} \right. \tag{40}\]  
Lastly, the fading factor \(\mu_{k}\) is calculated by the following equation:  
\[u_{k}=\left\{ \begin{array}{cc}\frac{tr[N_{k}]}{tr[M_{k}]}&u_{k}\geq 1\\ 1&u_{k}\leq 1\end{array} \right. \tag{41}\]  
where \(tr[\cdot]\) represents the trace of the matrix. STF enforces the output residuals to be orthogonal or approximately orthogonal at each step to overcome the dynamic errors. The \(P_{k|k-1}\) is recalculated by Equation (42) to replace Equation (30). The rest of the algorithm framework is the same as UKF algorithm.