# Online Learning Based Underwater Robotic Thruster Fault Detection
## 4 Propulsion System Online Modeling  
### Propeller Control Variable and Speed Model  
The rotation speed is an important parameter that characterizes the operating status of a propeller. For a properly designed propeller, interference from environmental factors (e.g., ocean currents) will not have a serious impact on the speed of the propeller. Therefore, the detection of thruster faults based on abnormal changes in rotational speed can effectively eliminate the interference of environmental factors, such as ocean currents. We first establish a model of the relationship between the propeller's \"control variable-rotation speed\" and then predict the residual, based on the model's speed, to achieve fault detection.  
Limited by many factors, most current propellers operate in open-loop speed regulation mode. Even those propellers working in closed-loop speed regulation mode have a certain dynamic in the speed regulation process. Therefore, in practical applications, the relationship between the control amount of the propeller and the rotational speed is obviously non-linear and fluctuates with the change of the working state.  
When detecting a fault of the thruster, the residual of the speed prediction will be normal (and, thus, cause false detection) only when the \"control variable-speed\" model can accurately describe the non-linear change of the speed. As the actual control variable-speed model is non-linear and changes with the working state, it is difficult to accurately describe the control variable-speed relationship through a fixed model established in advance. Therefore, in this article, we establish a control variable-speed model through online learning, and update the speed prediction model used in the online fault detection process as needed.  
Polynomial fitting [40] is a non-linear relationship learning method based on data, which involves simple operations and is easy to realize online. In this paper, polynomial fitting is used to conduct online learning of the non-linear relationship between the control variable and speed.  
For the realigned control variable sequence \(U_{\tau}\) and speed sequence \(V_{\tau}\), the control variable-speed model form obtained by polynomial fitting is:  
\[v_{N}=a_{0}+a_{1}u_{N-\hat{\tau}}+\cdots+a_{q}u_{N-\hat{\tau}}^{q} \tag{4}\]  
where \(v_{N}\) is the current measured value of the propeller speed, \(u_{N-\hat{\tau}}\) is the corresponding control variable after the  
where \(w\) is the length of the control variable and speed sequence used when calculating the control variable-speed model parameters; that is, the amount of data used for modeling.  
When modeling the control variable-speed relationship by polynomial fitting, the model order \(q\) and the modeling data volume \(w\) are modeling parameters that need to be determined in advance. If the order of the model is too low, it will have difficulty in reflecting the dynamic change information of the system; meanwhile, if the order is too high, overfitting can easily occur. During the operation of the underwater robot, the environment and its own state change over time, which will cause changes in the system model. These changes are generally gradual, and the model can be approximated as unchanged in a short time period. Therefore, during the entire operation process, the \"control variable-rotation speed\" model has a phased nature, where different time periods of data correspond to different models. Therefore, in order to improve the modeling accuracy, in addition to selecting the appropriate model order, it is also necessary to select the appropriate amount of modeling data.  
In order to ensure the accuracy of the online modeling of the control variable-speed model, we propose the use of an improved PSO algorithm, which is suitable for online applications, for online optimization to achieve the appropriate selection of model order and modeling data volume.