# A Novel Real-Time Battery State Estimation Using Data-Driven Prognostics and Health Management
## 3 Battery SOC Model-Driven State-of-the-Art Method
### The Extended Kalman Filter  
The differential equations representing a continuous-time nonlinear system can be expanded with additive noise, as in [8; 18]:  
\[x_{k+1}=f(x_{k},u_{k})+w_{k} \tag{6}\] \[y_{k}=g(x_{k},u_{k})+v_{k} \tag{7}\]  
Herein, \(\mathbf{x}_{k}\in\mathbb{R}^{n}\) represents the system state vector at time index \(k\).  
Figure 1: Second-order RC Thevenin battery model.  
The initial state \(\mathbf{x}_{0}\) is a random vector with known mean \(\mu_{0}=\mathbb{E}[\mathbf{x}_{0}]\) and state error covariance given by \(P_{0}=\mathbb{E}[(\mathbf{x}_{0}-\mu_{0})(\mathbf{x}_{0}-\mu_{0})^{T}]\).  
The input, \(u_{k}\in\mathbb{R}^{l}\) and the measured output \(y_{k}\in\mathbb{R}^{m}\), also called observation vectors, are known variables of the system.  
The vectors \(w_{k}\) and \(v_{k}\) represent, respectively, uncertainties in the model and the measurement noise. It is additionally assumed that the vectors \(w_{k}\) and \(v_{k}\) are composed of zero-mean white Gaussian distributed noise, stochastic processes temporally uncorrelated, with known covariances:  
\[Q_{k} =\mathbb{E}[w_{k}w_{k}^{\mathsf{T}}] \tag{8}\] \[R_{k} =\mathbb{E}[v_{k}v_{k}^{\mathsf{T}}] \tag{9}\]  
The state vector \(x\) contains, for different SOC levels, the overpotential of the \(RC\) terms and the SOC itself:  
\[x_{k}=[SOC_{k}\ V1_{k}\ V2_{k}]^{T} \tag{10}\]  
According to [18], the Kalman filter is used over the whole observable system, consisting of the data \(\{u_{0},\,u_{1}\,\dots\,u_{k}\}\) and \(\{y_{0},\,y_{1}\,\dots\,y_{k}\}\) to find the minimum mean squared error estimate \(\hat{x}_{t}\) of the true state \(x_{t}\). Therefore, the objective function is as follows:  
\[\hat{x}_{k}=\operatorname*{arg\,min}_{\hat{x}\in\mathbb{R}^{m}}\mathbb{E}[(x_ {k}-\hat{x})(x_{k}-\hat{x})^{T}]\Bigg{|}\begin{cases}u_{0}\,\,u_{1}\dots\,\,u_ {k}\\ y_{0}\,\,y_{1}\dots\,\,y_{k}\end{cases} \tag{11}\]  
The battery is a nonlinear system, as demonstrated in [19]. Assuming the nonlinearities in the dynamic and the observation model are smooth, the functions in (6) and (7) are differentiable and can be expanded in the Taylor series. If the difference in time between these two functions is small, they can be roughly estimated using the first-order Taylor expansion. Hence, the Extended Kalman Filter (EKF) is also called the First-Order Filter. The nonlinear system is also depicted in the block diagram of Figure 2.  
At each timestep, \(f(\cdot)\) and \(g(\cdot)\) are linearized by a first-order Taylor-series expansion. Assuming these functions are differentiable at all operating points of \(x_{k}\) and \(u_{k}\),  
\[f(x_{k},u_{k})\approx f(\hat{x}_{k},u_{k})+\frac{\partial f(x_{k},u_{k})}{ \partial x_{k}}\Big{|}_{x_{k}=\hat{x}_{k}}(x_{k}-\hat{x}_{k}) \tag{12}\]  
\[g(x_{k},u_{k})\approx g(\hat{x}_{k},u_{k})+\frac{\partial g(x_{k},u_{k})}{Combining these equations with (6) and (7), the linearized equations are derived to describe the true system state as a function of itself, known inputs, and states \(u_{k}\), \(\hat{x}_{k}\), along with unmeasurable noise inputs \(w_{k}\) and \(v_{k}\):  
\[x_{k+1} \approx f(\hat{x}_{k},u_{k})+w_{k}+\hat{A}_{k}(x_{k}-\hat{x}_{k}) \tag{14}\] \[y_{k} \approx g(\hat{x}_{k},u_{k})+v_{k}+\hat{H}_{k}(x_{k}-\hat{x}_{k}) \tag{15}\]