# Control Strategy of In-Port U-Turn for Ships Based on Arctangent Function Nonlinear Feedback
## 5 Matlab Simulation and Result Analysis  
According to the controller design and ship model established above, Matlab is used to simulate the ship automatic U-turn in port. Both wind direction and wind speed are measured by absolute wind direction, \(\psi_{T}\), and absolute wind speed, \(U_{T}\); the north wind direction is \(\psi_{T}=0^{\circ}\) and the east wind direction is \(\psi_{T}=90^{\circ}\); the absolute wind speed is the vector sum of the relative wind speed and the ship speed. Generally, the water environment in the port is not too harsh. In this paper, the wind level in the port is set below the Beaufort wind scale of No. 5, the water depth is set as 15 m, and the parameter of the nonlinear feedback link is \(\eta=2,\omega=0.3\). This paper takes the ship \"Mariner\" as an example for discussion, and its relevant parameters are shown in Table 2.  
In addition, this paper quotes MIA, MAE, MTV, and some other indexes to quantitatively analyze the control effect of the controller. MAE is used to measure the deviation between the design ship course and the actual ship course; MIA is used to quantitatively analyze the energy consumption during ship navigation; MTV is used to measure the smoothness of the rudder angle output curve. MIA, MAE, and MTV are calculated as Equations (22)-(24):  
\[\text{MAE}=\frac{1}{t_{\infty}-t_{0}}\int\limits_{t_{0}}^{t_{\infty}}|\psi_{T} -\psi(t)|\text{d}t \tag{22}\]  
\[\text{MIA}=\frac{1}{t_{\infty}-t_{0}}\int\limits_{t_{0}}^{t_{\infty}}|\delta(t )|\text{d}t \tag{23}\]  
\[\text{MTV}=\frac{1}{t_{\infty}-t_{0}}\int\limits_{t_{0}}^{t_{\infty}}|\delta(t )-\delta(t-1)|\text{d}t \tag{24}\]After many simulation experiments, it can be concluded that, when the wind level is below the Beaufort wind scale of No. 5 and the water depth is more than 15 m, the ship can complete an automatic U-turn in restricted waters under the control of the proposed controller. When the wind level is higher than the Beaufort wind scale of No. 6, the ship can achieve an automatic U-turn under certain environmental conditions. Due to the large rudder angle being maintained for a long time, the roll motion of the ship increases, which affects the safety of navigation. Due to the shallow-water effect, it is also not recommended to carry out an automatic U-turn operation in a water area with a water depth of less than 15 m during actual navigation. Some simulation results and analyses are given below. The simulation time is set at 600 s, the simulation experiment is carried in simulink of Matlab, the differential equation is solved by using ode45 solver, and the sample time is set as 1 s.  
In the following simulation results, we compared the control effect of three kinds of control methods: [PERSON] et al. (proposed in [PERSON] et al. (2018)), NF+CGSA (proposed in this paper), and the traditional PID control method. The decline ratio is the comparative result of the first two control methods. (1) Beaufort wind scale of No. 4, \(\psi_{T}=225^{\circ}\)  
It can be seen from the data in Figures 3-5 and Table 3 that, when the wind level in port is at a Beaufort wind scale of No.4, the water depth is 15 m, and the wind direction is \(\psi_{T}=225^{\circ}\), the ship can complete an automatic U-turn in the port. After adding the nonlinear feedback link, the turning range of the ship is reduced by 3.00%, the average rudder angle is reduced by 0.21%, and MIA, MAE, and MTV are reduced by 4.01%, 3.15%, and 36.36%, respectively. It can be seen that the existence of a nonlinear feedback link reduces  
Beaufort wind scale of No. 4, \(\psi_{T}\) = 315\({}^{\circ}\)  
It can be seen from Figures 6-8 and Table 4 that, when the wind level is at a Beaufort wind scale of No. 4, the water depth is 15 m, and the wind angle is \(\psi_{T}\) = 315\({}^{\circ}\), the ship can complete a U-turn in a port within 10 min.