# Online Learning Based Underwater Robotic Thruster Fault Detection
## 3 Propulsion System Time Delay Online Estimation  
Time delay is a widespread phenomenon in electromechanical systems. For systems with complex structures such as underwater robots, multiple sampling cycles from the controller output control to the propeller generating the corresponding actions are generally required. When modeling and fault detection are based on data, the existence of a time delay can have a serious impact. Therefore, it is necessary to estimate the time delay between the control variable and the rotational speed measurement value, and to realign the data accordingly. Current commonly used delay estimation methods include the online measurement, step response, relay feedback, and optimization-based parameter identification methods [34; 35; 36; 37], among which the online measurement method requires special hardware to measure the time delay. The step response and relay feedback methods need to apply additional excitation signals to the system, while the optimization-based parameter identification method needs to determine the model structure of the system in advance. In practice, the system delay is not always fixed [38], and may change with the operating environment or the state of the system itself. Therefore, it is necessary to estimate the system delay online. The above method was applied. There are certain limitations to the online estimation of the time delay of an underwater vehicle propulsion system. For any two variables, the correlation refers to the follow-up relationship between variables. The more consistent the follow-up changes of the variables, the stronger the correlation. If there is no time delay between two correlated variables, their changes are completely synchronized and the correlation is strongest at this time. If there is a time delay, the follow-up change relationship will be destroyed and the correlation will be weakened. Generally speaking, the greater the delay, the more obvious the decrease in correlation. Therefore, by maximizing the correlation coefficient between two related variables, an approximate estimation of the time delay can be achieved [39]. This paper analyzes the change trend of the correlation between the control variable and the measured value of the thruster speed, in order to realize the online time delay estimation. This method is completely based on data and does not require a systematic model. In order to reduce the amount of calculation and facilitate online application, the Pearson correlation coefficient is used to measure the correlation. Let the control variable in a certain period of time be \(U=(u_{1},u_{2},\cdots,u_{N})\) and the measured value of the propeller speed in the same period of time be \(V=(v_{1},v_{2},\cdots,v_{N})\). Then, the Pearson correlation coefficient between the control variable and the speed in this period of time is:  
\[r(U,V)=\frac{\sum\limits_{i=1}^{N}{(u_{i}-\overline{u})(v_{i}-\overline{v})}}{ \sqrt{\sum\limits_{i=1}^{N}{(u_{i}-\overline{u})^{2}\sum\limits_{i=1}^{N}{(v_{ i}-\overline{v})^{2}}}}} \tag{1}\]  
where \(\overline{u},\overline{v}\) are the average values of the control variable and speed, respectively, in the time period. Suppose that, in this time period, the time delay between the control variable and the rotational speed measurement value has \(\tau\) sampling periods, \(\tau=0,1,\cdots,\tau_{\max}\). Then, we realign the control variable and the measured value of the rotational speed, according to the assumed time delay. From the aligned data, take \(U_{\tau}=(u_{1},u_{2},\cdots,u_{N-\tau_{\max}})\) and \(V_{\tau}=(v_{\tau+1},v_{\tau+2},\cdots,v_{\tau+N-\tau_{\max}})\) to calculate the corresponding correlation coefficient:  
\[r_{\tau}=r(U_{\tau},V_{\tau}),\tau=0,1,\cdots,\tau_{\max} \tag{2}\]According to the above steps, the correlation coefficients of the realigned data under different hypothetical time delays are sequentially calculated.