## 3 Proposed Fault Diagnosis Method
### Fault Data Recognition Model Based on Improved MSPCA  
When monitoring the actual dynamic traffic data, the noise distribution of the data are random and its intensity is time-varying. However, when dealing with the wavelet coefficients beyond the control threshold, the traditional MSPCA uses the unified threshold under the decomposition scale to reconstruct the wavelet, lacking the consideration of the time-varying noise. Therefore, part of the noise will be mistaken as fault data and separated into residual space. In addition, part of the fault data covered by noise will be expanded, resulting in an increased false alarm rate. In order to solve the problems of a fixed model, principal component subspace, SPE, \(T^{2}\) and a single parameter in traditional MSPCA, based on the recursive idea of the adaptive PCA, the traditional MSPCA is adjusted. The modifications are as follows:  
1. Segmental processing of collected traffic flow data;
2. In order to improve the resolution of the model, the wavelet decomposition is adjusted to the wavelet packet decomposition;
3. The energy difference of nodes in each decomposition scale is calculated by the energy difference of wavelet packet to locate the fault data location. Figure 5 shows the flow chart of the improved method. The model is mainly divided into two modules: offline module and online fault diagnosis module. The offline module preprocesses the model with normal data. Through this process, the scale parameters of wavelet packet and the number of principal components of principal component analysis can be determined. The online fault detection module uses the parameters calculated by the offline module to monitor the online data in real time, remove the noise interference, and finally complete the data fault diagnosis. As shown in Figure 5, in offline mode, the model firstly preprocesses the normal historical data, uses the wavelet packet to decompose the data at \(J-level\), calculates the wavelet packet energy of each component on each scale, and models the component data on each scale by PCA, and chooses the appropriate number of principal components. The data space is decomposed into principal component space and residual space, and the control limits of \(T^{2}-SPE\) statistics for each component on each scale are calculated. Figure 4: The flow chart of the calculation of MSPCA (multiscale principal component analysis) mode. In the online fault diagnosis mode, the data are denoised by wavelet threshold. Referring to the scale parameters calculated in the offline mode, the data are decomposed into J-scales. The wavelet packet energy of each component on the scale is calculated, and the difference of wavelet packet energy on each scale is obtained. According to the set threshold, the fault can be judged. The components with faults are selected for principal component analysis, and the location and size of data faults are determined according to \(T^{2}-SPE\) control limits obtained from offline mode. Finally, all the data are analyzed by PCA to determine which sensors are responsible for the fault and the severity of the fault. The detailed algorithm process is as follows:  
1. Input the normal data matrix \(X\), set the size of the data window is \(m\), and \(N\) is a multivariate variable dimension;
2. The wavelet packet transform is used to decompose each row of the data matrix \(X\), that is, each variable to a scale \(J\), and to calculate the wavelet packet energy value of each component under the scale;
3. Perform the principal component analysis on each wavelet packet component to calculate the number of each principal component and the two control-limit parameters of the component;
4. Input the online monitoring data, carry out the wavelet threshold diagnosing for each component, and reconstruct the wavelet packet with the same scale according to the corresponding components in Step2;
5. Calculate the wavelet packet energy of each component.