# Research of Adaptive Extended Kalman Filter-Based SOC Estimator for Frequency Regulation ESS
## 3 Performance Verification of SOC Estimation Using Adaptive Extended Kalman Filter
### Extended Kalman Filter Algorithm Design  
The Kalman filter (KF) is an algorithm that was developed by [PERSON] in the early 1960s, and is an algorithm that can perform optimal estimation considering noise when noisy data are input. The KF is a prediction system based on probability theory and it estimates objects with linear motion using the recursive method [27; 28; 35]. The estimated object should be a normal distribution with an average of \(\hat{\mathrm{x}}_{\mathrm{k}}\) and an error covariance of \(\mathrm{P}_{\mathrm{k}}\), as shown in the following Equation (4). \[\mathrm{x}_{\mathrm{k}}\sim\mathrm{N}(\hat{\mathrm{x}}_{\mathrm{k}^{\prime}} \mathrm{P}_{\mathrm{k}}). \tag{4}\]  
The error covariance is an index of the accuracy of the estimated value in the KF. The larger the \(\mathrm{P}_{\mathrm{k}}\) value, the larger the estimation error, and the smaller the \(\mathrm{P}_{\mathrm{k}}\) value, the smaller the estimation error. The KF has a system model that shows the correlation between the state variables inside the algorithm, so the unmeasured state variables can be indirectly estimated [34; 35; 36; 37]. However, because KFs are designed for linear systems, they cannot be applied to nonlinear systems. Since most systems exhibit nonlinear characteristics, the algorithm developed to solve this problem is the EKF [36]. As the battery exhibits nonlinear characteristics, the EKF is used as the SOC estimation algorithm, and the operation mechanism of the KF algorithm is shown in Figure 3.  
The operating mechanism of the EKF algorithm is similar to that of the KF, but the state variables of the KF are expressed as Equations (5) and (6), considering the nonlinear system model to reflect the nonlinear characteristics. \[\mathrm{x}_{\mathrm{k}+1}=\mathrm{f}(\mathrm{x}_{\mathrm{k}})+\omega_{\mathrm{ k}}. \tag{5}\]  
\[\mathrm{y}_{\mathrm{k}}=\mathrm{g}(\mathrm{x}_{\mathrm{k}})+\mathrm{v}_{ \mathrm{k}}. \tag{6}\]  
Figure 3: Flow diagram of [PERSON] filter algorithm. The linear matrix of the KF is expressed by a nonlinear function, as shown in Equations (7) and (8). \[\mathbf{A}\mathbf{x}_{\mathrm{k}} \Rightarrow \mathrm{f}(\mathbf{x}_{\mathrm{k}}). \tag{7}\]  
\[\mathbf{H}\mathbf{x}_{\mathrm{k}} \Rightarrow \mathrm{h}(\mathbf{x}_{\mathrm{k}}). \tag{8}\]  
The system matrix \(\mathbf{A}\) shows how the system moves over time, and the system matrix \(\mathbf{H}\) shows the relationship between measured values and state variables. The EKF linearizes the nonlinear model to obtain a linear model, which linearizes the model in a way that partially differentiates between the system matrices \(\mathbf{A}\) and \(\mathbf{H}\). This can be expressed as a Jacobian matrix, as shown in Equations (9) and (10). \[\mathbf{A} = \frac{\partial\mathrm{f}}{\partial\mathbf{x}}\bigg{|}_{\hat{ \mathbf{x}}_{\mathrm{k}}}. \tag{9}\] \[\mathbf{H} = \frac{\partial\mathrm{h}}{\partial\mathbf{x}}\bigg{|}_{\hat{ \mathbf{x}}_{\mathrm{k}}}. \tag{10}\]  
The \(\mathbf{A}\) battery model consisting of one R-C parallel circuit was applied to the EKF algorithm. The values initially input to the EKF algorithm for SOC estimation are the error covariance \(\mathrm{P}_{0}\) and initial SOC, as well as the diffusion voltage \(\mathrm{V}_{\mathrm{diff}}\) shown in the RC parallel circuit of the battery model. Activating the algorithm enables us to predict the state of battery and the error covariance. Here, system matrices \(\mathbf{A}\) and \(\mathbf{B}\) for SOC estimation may be expressed as Equations (11) and (12). \[\mathbf{A}=\left[ \begin{array}{cc}1&0\\ 0&\mathrm{e}^{\frac{-\mathrm{M}}{\mathrm{P}_{1}}\mathrm{C}}\end{array} \right].