## 2 Monitoring Model Based on Statistical Process Control
### Online Monitoring and Diagnosis  
After training, the monitoring model can be used for online monitoring. For the newly input variable sample \(\mathbf{x}_{new}\in\mathbf{R}^{1\times m}\), the data standardization processing should be unified with the training model at first. When the PLS algorithm is used for monitoring, a projection direction matrix \(\mathbf{R}\) (\(\mathbf{R}=[\mathbf{r}_{1},\mathbf{r}_{2},\ldots,\mathbf{r}_{A}]\)) of data matrix \(\mathbf{X}\) should be introducedinto the basis of the training model, \(\mathbf{T}=\mathbf{X}\mathbf{R}\). Therefore, we can directly find the matrix of the principal components.  
Measurement sample scores and residuals:  
\[\left\{\begin{array}{l}\mathbf{t}_{\text{new}}=\mathbf{x}_{\text{new}}\mathbf{R}\\ \widetilde{\mathbf{x}}_{\text{new}}=\mathbf{x}_{\text{new}}\big{(}1-\mathbf{P}\mathbf{R}^{ \text{T}}\big{)}\end{array}\right. \tag{12}\]  
Describing the fluctuation of the system and residual by \(T^{2}\) and \(SPE\) statistics.  
\[\left\{\begin{array}{l}T^{2}=\mathbf{t}_{\text{new}}^{T}\mathbf{\Lambda}^{-1}\mathbf{t}_ {\text{new}}\\ SPE=\widetilde{\mathbf{x}}_{\text{new}}^{2}\end{array}\right. \tag{13}\]  
where \(\mathbf{\Lambda}\) is the covariance matrix of the training model sample scores, \(\mathbf{\Lambda}=\frac{T^{2}T}{n-1}\).  
The control limits of the two statistics are calculated as follows.  
\[\left\{\begin{array}{l}T_{\text{ucl}}^{2}(\alpha)=\frac{A\big{(}n^{2}-1 \big{)}}{n(n-A)}F_{A,n-A,\alpha}\\ SPE_{\text{ucl}}^{2}(\alpha)=g\chi_{h,\alpha}^{2}\end{array}\right. \tag{14}\]  
where \(g=\frac{S}{2\mu},\ h=\frac{2\mu^{2}}{5}\), \(\mu\) is the mean of the \(SPE\) statistic, and \(S\) is the variance.  
KPLS algorithm is used for online monitoring. Firstly, the kernel matrix of samples is constructed as follows:  
\[K_{\text{new}}=\big{[}k(\mathbf{x}_{1},\mathbf{x}_{\text{new}}),k(\mathbf{x}_{2},\mathbf{x}_{ \text{new}}),\cdots,k(\mathbf{x}_{n},\mathbf{x}_{\text{new}})\big{]}\in\mathbf{R}^{1\times n} \tag{15}\]  
The new kernel matrix is centralized as follows:  
\[\overline{\mathbf{K}}_{\text{new}}=\mathbf{K}_{\text{new}}-\mathbf{I}_{N}\overline{\mathbf{K} }-\mathbf{K}_{\text{new}}\mathbf{I}_{n}+\mathbf{I}_{N}\overline{\mathbf{K}}\mathbf{I}_{n} \tag{16}\]  
where \(\mathbf{I}_{N}=\frac{1}{n}[1\cdots 1]\in\mathbf{R}^{1\times n}\).  
The score matrix of the sample to be tested is calculated as follows:  
\[\mathbf{t}_{\text{new}}=\overline{\mathbf{K}}_{\text{new}}\mathbf{U}\Big{(}\mathbf{T}^{T} \overline{\mathbf{K}}\mathbf{U}\Big{)}^{-1} \tag{17}\]  
The calculation of \(T^{2}\) statistic, control limit of the KPLS online monitoring model and control limit of \(SPE\) is the same as PLS. The \(SPE\) statistic is calculated by a simple method as follows:  
\[SPE=\sum_{i=1}^{n}\mathbf{t}_{i}^{2}-\sum_{i=1}^{A}\mathbf{t}_{i}^{2} \tag{18}\]  
In engineering application, when the two indexes are within the allowable range, the process runs normally. When both indexes exceed the standard, it is judged that the current process is uncontrollable. Only a certain statistical index exceeds the standard, and an early warning appears.