**5. Hydraulic Valve Fault Diagnosis Based on PCA and XGBoost**

## *5.1. Acquisition of Sample Data for a Hydraulic Valve Fault Diagnosis*

Figure 2 shows that, in each working cycle, the hydraulic directional valve (V10) is switched at about the 10th second, and the valve outlet pressure (PS2) rises rapidly when the valve inlet pressure (PS1) decreases significantly. It can be seen that the sensor data contain the fault characteristics of the hydraulic valve. As shown in Figure 3, based on the working principle and switching performance characteristics of the hydraulic valve, 100 data points between 9.3 s and 11.3 s in each cycle of PS1 (Figure 3a) and PS2 (Figure 3b) are, respectively, intercepted in the 1449 sets of data, which obtains two sample data sets of 1449 × 100 dimensions for the modeling analysis. These data sets contain the pressure changes before and after the hydraulic valve switching process.

**Figure 3.** The sample data of the hydraulic valve fault diagnosis.
