## 5 Simulation and Analysis
It can be seen that the chattering problem can be reduced under fault-tolerant control. This is because the integral term is reasonably introduced and the saturation function \(sat(S)\) is added to the control rate. The fault detection results obtained in the Figure 5b can finally converge under the action of continuous fault, indicating the robustness of the fault detection method. In the experiment, the system fault at 25 s is successfully detected, but it can be seen from the small difference between the Figure 3a,b at 10-20 s that there will still be false alarm. Figure 6 shows that selecting appropriate nonlinear ideal virtual input can effectively improve the transient performance of the system, which is manifested in accelerating the convergence speed and reducing the overshoot. Figure 5: (a) Description of system control input; and (b) description of fault detection result. Figure 6: Comparison of transient performance under ideal input. In order to further verify the effectiveness of the proposed method, the hardware-in-the-loop simulation is carried out with the help of RflySim platform [33] developed by Beihang University. The flight control device is selected as pixhawk 2.4.8. Wirelessly connect the RadioLink R9 DS receiver to the remote-control handle. The simulation condition parameters remain unchanged and the fault settings are still as shown in Table 1. The fault occurrence time becomes 50 s. The hardware-in-the-loop simulation model is shown in Figure 7. The hardware system connection is shown in Figure 8.  
The code generated by the designed AFTC controller algorithm is downloaded to the pixhawk system, and the USB physical data line is used to replace the virtual signal transmission in the simulation. Rotor parameters and sensor parameters such as attitude are sent to pixhawk system through Coptersim (Coptersim is a real-time motion simulation  
Figure 8: Hardware system connection. Figure 7: Hardware-in-the-loop simulation model. software and the core of the RflySim platform). When the fault occurs, with the help of AFTC method, the expected attitude tracking can be realized after 2.2 s (2.5% error) in Figure 9a. Figure 9b shows the output of the system under PID mode and fault-tolerant control. Although the attitude tracking effect is lower than that before the failure, it is acceptable in practice. Through the preliminary test on the real pixhawk autopilot system, on the one hand, it verifies the proposed AFTC method and effectively eliminated the problems in the actual flight test, on the other hand, it lays foundation for the actual air-ground platform manufacture. In addition, from the power consumption calculation formula shown in Equation (42),  
Figure 4:0  
it obtains that PID control and AFTC control consume 0.347 and 3.752, respectively, in MATLAB simulation (the former saves about 10 times more performance than the latter). Considering that the control quantity will be converted into the action of the actuator in the actual project, we use the output square of the control quantity which shows the energy consumption of the actuator as the index to evaluate the control algorithm. According to the evaluation index, it is necessary to switch between PID control and AFTC control on the premise that the attitude is controllable as shown in Figure 4:1