# Low-Order Electrochemical State Estimation for Li-Ion Batteries
## 2 Methodology and Models
### Dynamic Mode Decomposition with Control  
By providing the specific parameters to the numerical model, a simulation can be conducted. All the data are collected then into the so-called snapshots [32; 33; 34]. DMDc uses these snapshots together with the external signals (current and temperature) to approximate the input-output dynamics. For this purpose, consider the vector \(\mathbf{x}_{k}\), conformed by stacking of all the electrochemical states defined in the mathematical equation of Section 2.1:  
\[\mathbf{x}_{k}= \begin{bmatrix}\mathbf{C}_{e}&\mathbf{\Phi}_{e}&\mathbf{C}_{s}^{-}&\mathbf{\Phi}_{s }^{-}&\mathbf{C}_{s}^{+}&\mathbf{\Phi}_{s}^{+}\end{bmatrix} ^{T}. \tag{17}\]  
DMDc characterizes the relationship between the actual state \(\mathbf{x}_{k}\), the future state \(\mathbf{x}_{k+1}\) and the external input \(\mathbf{u}_{k}\) considering a linear discrete time dynamical system of the form  
\[\mathbf{x}_{k+1} =\mathbf{A}\mathbf{x}_{k}+\mathbf{B}\mathbf{u}_{k}, \tag{18}\]  
where \(\mathbf{x}_{k}\in\mathbb{R}^{n}\), \(\mathbf{u}_{k}\in\mathbb{R}^{q}\), \(\mathbf{A}\in\mathbb{R}^{n\times n}\), \(\mathbf{B}\in R^{n\times q}\) and \(k\in[1,M]\). The goal is to find an approximation to \(\mathbf{A}\) and \(\mathbf{B}\) via regression over the snapshots. For this purpose two sets of matrices are build:  
\[\mathbf{X}= \begin{bmatrix}|&|&\cdots&|\\ \mathbf{x}_{1}&\mathbf{x}_{2}&\cdots&\mathbf{x}_{M-1}\\ |&|&\cdots&|\end{bmatrix} ,\qquad\mathbf{X}^{\prime}= \begin{bmatrix}|&|&\cdots&|\\ \mathbf{x}_{2}&\mathbf{x}_{3}&\cdots&\mathbf{x}_{M}\\ |&|&\cdots&|\end{bmatrix} ,\quad\in\mathbb{R}^{n\times(M-1)} \tag{19}\]  
and from the external signal the matrix  
\[\mathbf{Y}= \begin{bmatrix}|&|&\cdots&|\\ \mathbf{u}_{1}&\mathbf{u}_{2}&\cdots&\mathbf{u}_{M-1}\\ |&|&\cdots&|\end{bmatrix} ,\quad\in\mathbb{R}^{q\times(M-1)} \tag{20}\]  
is obtained. Equation (18) implies  
\[\mathbf{X}^{\prime}\approx\mathbf{A}\mathbf{X}+\mathbf{B}\mathbf{Y}= \begin{bmatrix}\mathbf{A}&\mathbf{B} \end{bmatrix}\begin{bmatrix}\mathbf{X}\\ \mathbf{Y}\end{bmatrix} =:[\mathbf{A},\mathbf{B}]\mathbf{\Omega}, \tag{21}\]  
with the solution given by  
\[[\mathbf{A},\mathbf{B}]=\mathbf{X}^{\prime}\mathbf{\Omega}^{\dagger} \tag{22}\]  
where \(\mathbf{\Omega}^{\dagger}\)\(\in\mathbb{R}^{(M-1)\times(n+q)}\) denotes the pseudo-inverse. The eigenvectors of \(\mathbf{A}\) are the so-called DMD modes. Reduced order modelling  
Following [34], the singular value decomposition (svd) of \(\mathbf{\Omega}\) and \(\mathbf{X}^{\prime}\) are used to approximate \(\mathbf{G}\) with a reduced order \(\tilde{r}\)  
\[\mathbf{\Omega}\approx\mathbf{\Omega}\tilde{\mathbf{\Sigma}}\mathbf{\tilde{\
abla}}^{\star}. \tag{23}\]The svd presents a suitable way to find the solution that minimizes the Frobenius norm of the approximation error matrix \(\mathbf{X}^{\prime}-[\mathbf{A},\mathbf{B}]\mathbf{U}\mathbf{\tilde{\Sigma}}\mathbf{\tilde{V}}^{*}\). The matrix \([\mathbf{A},\mathbf{B}]\) can then be approximated as  
\[\left[\mathbf{\tilde{A}}\mathbf{\tilde{B}}\right] =\left[\mathbf{X}^{\prime}\mathbf{\tilde{V}}\mathbf{\tilde{\Sigma}}^{-1}\mathbf{ \tilde{\Omega}}_{1}^{*}\quad\mathbf{X}^{\prime}\mathbf{\tilde{V}}\mathbf{\tilde{\Sigma}}^{- 1}\mathbf{\tilde{\Omega}}_{2}^{*}\right] \tag{24}\]  
where \(\mathbf{G}\in\mathbb{R}^{n\times(n+q)}\), \(\mathbf{\tilde{U}}_{1}\in\mathbb{R}^{n\times q}\) and \(\mathbf{\tilde{U}}_{2}\in\mathbb{R}^{q\times q}\). The left singular vectors of the output matrix \(\mathbf{X}^{\prime}\) in turn, which are summarized in the matrix \(\mathbf{\tilde{U}}\), are used to find the reduced-order subspace of order \(\hat{r}\) using the svd of \(\mathbf{X}^{\prime}\)  
\[\mathbf{X}^{\prime}\approx\mathbf{\tilde{U}}\mathbf{\tilde{\Sigma}}\mathbf{\tilde{V}}^{*}, \qquad\mathbf{x}=\mathbf{\tilde{U}}\mathbf{\tilde{x}} \tag{25}\]  
where \(\mathbf{\tilde{x}}\) denotes the reduced-order state of dimension \(\hat{r}\).