# SOC Estimation with an Adaptive Unscented Kalman Filter Based on Model Parameter Optimization
## 3 The AUKF Based on the Second-Order RC Equivalent Circuit Model  
Based on the equivalent circuit model, the corresponding SOC estimation algorithm can be established. A power lithium battery is a typical nonlinear system. The nonlinear system is governed by the equations of state, and the observation equations are shown in Equation (9). \[\left\{ \begin{array}{l}\mathrm{x}_{k}=f(x_{k-1},u_{k-1})+\omega_{k-1}\\ y_{k}=h(x_{k},u_{k})+v_{k}\end{array} \right. \tag{9}\]  
where the random variables \(w_{k}\) and \(v_{k}\) represent the process and measurement noise, respectively. For the UKF, the iteration equation is based on a certain set of sample points, which are chosen to make their mean value and variance consistent with the mean value and variance of the state variables. Then, these points will recycle the equation of the discrete-time process model to produce a set of predicted points. After, the mean value and the variance of the predicted points will be calculated to modify the results, and the mean value and the variance will be estimated. Before the UKF recursion, the state variables must be modified in a superposition of the process noise and the measurement noise of the original states. The SOC of the lithium battery pack can be calculated using the ampere-hour integral method:  
\[SOC(t)=SOC(t^{\prime})-\frac{1}{C_{N}}\int_{t^{\prime}}^{t}\eta idt \tag{10}\]  
In Equation (10), \(\eta=\frac{k_{k}k_{t}}{k_{c}}\), where \(k_{i}\) is the compensation coefficient of the charge and discharge rate, \(k_{t}\) is the temperature compensation coefficient, \(k_{c}\) is the cycle compensation coefficient, and \(C_{N}\) is the actual available battery capacity. From the equivalent circuit model shown in Figure 3, the lithium battery equation of state can be obtained from Equations (2) and (10):  
\[\left[ \begin{array}{c}SOC_{k}\\ u_{s,k}\\ u_{p,k}\end{array} \right]=\left[ \begin{array}{ccc}1&0&0\\ 0&a_{s}&0\\ 0&0&a_{p}\end{array} \right]\left[\begin{array}{c}SOC_{k-1}\\ u_{s,k-1}\\ u_{p,k-1}\end{  
(2) State expansion:  
\[\left\{ \begin{array}{l}\hat{X}_{0}=E[X_{0}]=E[\hat{x}_{0},\;0,\;0]\\ \\ P_{X,0}=E\Big{[}\Big{(}X_{0}-\hat{X}_{0}\Big{)}\Big{(}X_{0}-\hat{X}_{0}\Big{)}^{T }\Big{]}=\left[\begin{array}{cc}P_{0}&\\ &Q\\ &&R\end{array}\right]\end{array} \right. \tag{15}\]  
\[E[w_{nn},\;w_{n}]=\left\{ \begin{array}{l}Q\;m=n\\ 0\;m\
eq n\end{array} \right. \tag{16}\]  
\[E[v_{m},\;v_{n}]=\left\{ \begin{array}{l}R\;m=n\\ 0\;m\
eq n\end{array} \right. \tag{17}\]  
\(Q\) and \(R\) are covariance matrices, which are symmetric, and the diagonal is the variance in each dimension. State mean expansion:  
\[\hat{X}_{k-1}=\Big{[}(\hat{x}_{k-1})^{T},\overline{w}_{k}^{T},\overline{v}_{k} ^{T}\Big{]}^{T} \tag{18}\]  
State variance expansion:  
\[P_{X,k-1}=\left[ \begin{array}{cc}P_{x,k-1}&&\\ &Q&\\ &&R\end{array} \right] \tag{19}\]  
(3) Sample point selection  
\(\text{Sample}=\{z_{i},X_{k-1},i\}\), \(i=0,1,2,\ldots,2L+1\), where \(X_{k-1,i}\) represents the selected points, and \(z_{i}\) is the corresponding weighting value. Then, select the points in the following manner:  
\[\left\{ \begin{array}{l}X_{k-1,0}=\hat{X}_{k-1}\\ X_{k-1,i}=\hat{X}_{k-1}+\left(\sqrt{(L+\lambda)P_{X,k-1}}\right)_{i}&i=1\sim L \\ X_{k-1,i}=\hat{X}_{k-1}-\left(\sqrt{(L+\lambda)P_{X,k-1}}\right)_{i}&i=(L+1) \sim 2L\end{array} \right. \tag{20}\]  
The corresponding weighting values are:  
\[\left\{ \begin{array}{l}z_{0}^{(m)}=\frac{\lambda}{L+\lambda}\\ z_{0}^{(c)}=\frac{\lambda}{L+\lambda}+\left(1+\alpha^{2}+\beta\right)\\ z_{i}^{(m)}=z_{i}^{(c)}=\frac{1}{2(L+\lambda)}\;\;\;i=1\sim 2L\end{array} \right. \tag{21}\]  
where \(\lambda=\alpha^{2}(L+t)-L,z^{(m)}\) is the corresponding weighting value of the mean, \(z^{(c)}\) is the corresponding weighting value of the variance, and \(\left(\sqrt{(L+\lambda)P_{X,k-1}}\right)_{i}\) denotes the values of column \(i\) in the square-root matrix \((L+\lambda)P_{X,k-1}\).