## 6 Simulation and Experiment
### Simulation
#### 6.1.1 Zig-Zag Path Following under Constant Ocean Currents  
In the case study, we assume that the reference path is composed of two linked non-colinear straight lines, namely \(P=P_{1}\cup P_{2}\), where \(P_{1}\triangleq\{y=x-20,x\in[20,120]\}\) and \(P_{2}\triangleq\{y=-\frac{2}{3}x+180,x\in[120,270]\}\). The velocity of ocean currents is a constant 0.5 m/s with the direction from south to north (\(0^{\circ}\)). The desired forward speed is constant with \(u=1.5\) m/s. The initial conditions of AUV are \([u,v,r,x,y,\psi]^{T}=[1.5,0,0,0,45^{\circ}]^{T}\). The comparison diagrams are sketched in Figure 12 and Table 3.  
Figure 11: Fractional order PID controller plane. Figure 12a shows the resulting motion of AUV. The red line is the trajectory of _APLOS_ and the black dashed line is the reference. The blue arrow shows forty times the velocity of ocean currents (40\(U_{c}\)) every 12 s. From this plot, it can clearly be seen that _ALOS_ and _APLOS_ have a better convergence performance in the convergence stage, which proves the effectiveness of the ALOS method taking the cross-track error into consideration. Although _ALOS_ converges to the reference path, it has some deviation in the guidance stage. This is because the combined motion of AUV deviates from the desired path because of drift angle. _PLOS_ and _APLOS_ are able to converge to the path and fit the path well in the guidance stage, but _PLOS_ reaches the reference path slowly in the convergence stage, which also reflects the role of ALOS considering cross-track error. Under the ocean currents, _APLOS_ has a better tracking effect than other methods. Figure 12: Zig-zag path following under constant ocean currents (\(u=1.5\) m/s). (**a**) comparison of trajectory; (**b**) comparison of cross-track error; (**c**) comparison of look-ahead distance; (**d**) comparison of velocity and drift angle; (**e**) comparison of heading effect. \begin{table}
\begin{tabular}{l c c c c c} \hline \hline  & **LOS** & **PLOS** & **ALOS** & **APLOS** & **Improvement** \\ \hline MAE(m) & 4.1281 & 1.2733 & 2.5136 & 1.1004 & 73.34\% \\ RMSE(m) & 4.5229 & 2.7571 & 3.1869 & 2.5777 & 43.00\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Performance metric of zig-zag tracking under constant ocean currents (\(u=1.5\) m/s). Figure 12b illustrates the trajectory deviation under four methods. Significantly, _LOS_ (the yellow line) and _ALOS_ (the blue line) are larger than _PLOS_ (the pink line) and _APLOS_ (the red line). Hence, it is necessary to consider the effect of drift angle. Compared with _PLOS_, the cross-track error of _APLOS_ is first reduced to a stable value due to the adaptivity of look-ahead distance. Figure 12c presents the time evolution of look-ahead distance. _LOS_ (the yellow line) and _PLOS_ (the pink line) use a constant look-ahead 15m. _ALOS_ (the blue line) and _APLOS_ (the red line) use varied look-ahead distance in the convergence. In the guidance, the look-ahead of _ALOS_ is smaller than _APLOS_ because the cross-track error of _ALOS_ is larger than _APLOS_, which reflects the effect of the proportional method on eliminating the influence of drift angle. Figure 12d gives the time history of velocity and drift angle. In four plots, the red line and the blue line are the forward speed and sway speed of AUV, respectively. The black line is the real-time drift angle. Obviously, the sway speed based on four methods in \(P_{1}\) is different from \(P_{2}\). Combined Figure 12d with Figure 12a, _PLOS_ and _APLOS_ can resist the effects of drift angles, i.e., under the changing drift angle, both _PLOS_ and _APLOS_ can sail on the reference path without deviation. However, _LOS_ and _ALOS_, without considering proportional guidance, deviate from the path as the drift angle changes. Figure 12e gives the performance of heading control. In four plots, the current heading is denoted by the blue line, and the desired heading is denoted by the red line.