# In-the-Loop Simulation Experiment of Aero-Engine Fault-Tolerant Control Technology
## 2 Materials and Methods
### Extended Kalman Filter Design  
The classical Kalman filter proposed according to the linear system can not meet the full envelope work, so the extended Kalman filter is often used in engineering.  
The calculation flow of Kalman filter is shown in Figure 1; the optimal estimated value of the state quantity is output according to the measured value, and the specific calculation method is as follows:  
Assume that the linearized state equation of a dynamic linear system is:  
\[\left\{\begin{array}{c}X(k+1)=\Phi\cdot X(k)+\tau\cdot W(k)\\ Y(k)=H\cdot X(k)+V(k)\end{array}\right. \tag{1}\]  
where \(X(k)\) is the system state, \(Y(k)\) is the observation signal, \(W(k)\) is the white noise, \(V(k)\) is the observation noise, \(\Phi\) is the state transition matrix, \(H\) is the observation matrix, and \(\tau\) is the noise driven matrix.  
Predict the state at time \(K+1\) according to the state estimation at time k:  
\[\hat{X}(k+1|k)=\varnothing\cdot\hat{X}(k|k) \tag{2}\]  
One-step prediction with covariance matrix:  
\[P(k+1|k)=\varnothing\cdot P(k|k)\cdot\varnothing^{T}+\tau\cdot Q\cdot\tau^{T} \tag{3}\]  
Filter gain matrix:  
\[K(k+1)=P(k+1|k)\cdot H^{T}\cdot\left[H\cdot P(k+1|k)\cdot H^{T}+R\right]^{-1} \tag{4}\]  
Figure 1: Basic calculation flow chart of Kalman filter.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Sensor** & **Nh/\%** & **NI/\%** & **P3/Pa** & **T5/K** \\ \hline Before introducing noise & 100.6 & 99.81 & 2,930,250 & 1038.14 \\ After introducing noise & 100.63 & 99.69 & 2,928,840 & 1037.64 \\ Scale/\% & 0.029 & 0.12 & 0.048 & 0.048 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Influence of noise on measured value of sensor.  
Status update:  
\[\hat{X}(k+1|k+1)=\hat{X}(k+1|k)+K(k+1)\cdot\varepsilon(k+1) \tag{5}\]  
\[\varepsilon(k+1)=Y(k+1)-H\cdot\hat{X}(k+1|k) \tag{6}\]  
Covariance matrix update:  
\[P(k+1|k+1)=[I_{n}-K(k+1)\cdot H]\cdot P(k+1|k) \tag{7}\]  
In a recursive calculation cycle, the algorithm mainly carries out two processes: state prediction using state transition matrix and state update using current sensor information. Update or correct the state quantity \(\hat{X}(k+1|k)\) at the last time by using the observation quantity \(Y(k+1)\), so as to obtain the state quantity \(\hat{X}(k+1|k+1)\) at the current time [38].  
Compared with the classical Kalman filter, the extended Kalman filter replaces \(\varnothing(k)\) and \(H(k)\) by the Jacobian matrix of F and h, that is:  
\[X=\left[\begin{array}{cccc}x_{1}&x_{2}&\cdots&x_{n}\end{array}\right]^{T} \tag{8}\]  
Then the Jacobian matrix is:  
\[\varnothing(k)=\frac{\partial f}{\partial X}=\left[\begin{array}{cccc}\frac {\partial f_{1}}{\partial x_{1}}&\frac{\partial f_{1}}{\partial x_{2}}&\cdots &\frac{\partial f_{1}}{\partial x_{n}}\\ \frac{\partial f_{2}}{\partial x_{1}}&\frac{\partial f_{2}}{\partial x_{2}}& \cdots&\frac{\partial f_{2}}{\partial x_{n}}\\ \vdots&\vdots&\ddots&\vdots\\ \frac{\partial f_{n}}{\partial x_{1}}&\frac{\partial f_{n}}{\partial x_{2}}& \cdots&\frac{\partial f_{n}}{\partial x_{n}}\end{array}\right] \tag{9}\]  
\[H(k)=\frac{\partial h}{\partial X}=\left[\begin{array}{cccc}\frac{\partial h _{1}}{\partial x_{1}}&\frac{\partial h_{1}}{\partial x_{2}}&\cdots&\frac{ \partial h_{1}}{\partial x_{n}}\\ \frac{\partial h_{2}}{\partial x_{1}}&\frac{\partial h_{2}}{\partial x_{2}}& \cdots&\frac{\partial h_{2}}{\partial x_{n}}\\ \vdots&\vdots&\ddots&\vdots\\ \frac{\partial h_{n}}{\partial x_{1}}&\frac{\partial h_{n}}{\partial x_{2}}& \cdots&\frac{\partial h_{n}}{\partial x_{n}}\end{array}\right] \tag{10}\]