# Online Learning Based Underwater Robotic Thruster Fault Detection
## 5 Adaptive Fault Detection Based on Online Model Update
### Propulsion System Failure Detection  
During the operation of the underwater robot, it is assumed that the control variable--speed model obtained by the kth online modeling is currently being used to monitor the state of the propeller. If, at time \(t\), the model predicts the residual:  
\[e_{t}^{k}=v_{t}-F_{q_{t}^{*},w_{t}^{*}}^{k}(u_{t-\hat{\tau}_{k}}) \tag{19}\]to exceed the threshold, at this point, the online model update starts and a new model \(F_{q_{k+1}^{k+1}w_{k+1}^{k}}^{k+1}(u_{l-\tau_{k+1}})\) is obtained. Then, the residual of the new model at time \(t\) is calculated:  
\[e_{t}^{k+1}=v_{t}-F_{q_{k+1}^{k+1}w_{k+1}^{k}}^{k+1}(u_{t-\tau_{k+1}}) \tag{20}\]  
In the online update process of the model, due to the optimization of the modeling parameters, the new model obtained can better fit the modeling data than the original model.  
In the absence of failure, it can be considered that the actual model of the propulsion system is approximately unchanged in the short-term; in other words, it can be considered that the data \((u_{t-\tau_{k+1}},v_{t})\) corresponding to time t and other modeling data acquired recently are from the same actual system, where both can be described by the new model \(F_{q_{k+1}^{k+1}w_{k+1}^{k}}^{k+1}\). Therefore, for the data at time \(t\), the prediction residual of the new model should not exceed the threshold.  
Based on the above analysis, if it is detected that the residual of the model exceeds the threshold at time \(t\) and, after updating the model online, the residual of the new model obtained at time \(t\) does not exceed the threshold--indicating that the residual of the original model exceeded the threshold due to gradual system change or noise--the system is determined not to have malfunctioned.  
If the propulsion system fails at time \(t\), the actual system model will change significantly, causing the data generated in the fault state at time \(t\) and the data obtained in the recent normal state to come from different systems. As shown in Figure 5, when the model is updated, as the algorithm sets the minimum amount of modeling data, \(w_{\text{min}}\), in the k + 1 th online modeling, most of the modeling data used are the data generated in the normal state; only an extremely small part comes from the data generated in the fault state. Therefore, the new model obtained has a better fitting effect on the data generated in the normal state, and has a poor fitting effect on the data generated in the fault state. In this case, the residual of the new model at time \(t\) will still exceed the threshold. The algorithm will continuously update the model multiple times until the data generated in the fault state in the modeling data account for the majority, and the residual of the model becomes lower than the threshold again.  
Combining the above analysis, the thruster fault detection rules are as follows:  
(1) If the model residual is less than the threshold, there is no fault;  
Figure 5: Modeling data in fault conditions.  
(2) If the residual of the model at time \(t\) exceeds the threshold, the online model update mechanism is activated; if the residual of the new model at time \(t\) is less than the threshold, no fault occurs;  
(3) If the residual of the model at time \(t\) exceeds the threshold and, after the model is updated online the residual of the new model at time \(t\) also exceeds the threshold, the model will continue to be updated online after the data at time \(t+1\) is collected. If the residual still exceeds the threshold, it is judged that the thruster has failed since time \(t\).