# SMCSPO-Based Robust Control of AUV in Underwater Environments including Disturbances
## 4 Simulation  
### PID and SMCSPO Control Simulations without Disturbances  
To compare and evaluate the performance of the PID and SMCSPO methods, the dynamics of the underwater vehicle and each control algorithms were implemented in MATLAB Simulink. Figure 2 shows a simplified control block diagram of an underwater vehicle. The reference input command of the system can be any other state variable except the surge direction variable among the state variables in (22). In this section, simulation results are only considered for the variables \(p,\ q\), and \(r\), which affect the high-speed turning of an underwater vehicle. The effect of disturbance on each controller is discussed in the next section.  
In order to evaluate the high-speed turning performance of the vehicle according to the type of controller, the desired reference input is given as shown in Figure 3. The step reference input actually results in more velocity errors compared to a smooth curved trajectory; however, we used a step reference input to maximize turning velocity and acceleration. The shape of the desired reference input of \(p,\ q\), and \(r\) is the same; however, the maximum desired angular velocity is different because of the limitation of the control fins \(\delta_{r}\) and \(\delta_{s}\).  
Figure 4 shows the PID control simulation results and control inputs of the vehicle's rolling, pitching, and yawing velocity without any external disturbances, and Figure 5 shows SMCSPO control results. Red dotted lines on the control input graphs mean the angle limitation of control fins. In the rolling velocity control results of PID, it can be seen that there is an overshoot on the high-speed turning after 8 s of the simulation start point. On the other hand, in the rolling velocity simulation results of SMCSPO, the overshoot is significantly reduced in the same time section despite the high-speed turning of the vehicle. There are still some overshoots at t = 8.5 s and 9.5 s in the rolling velocity graph of SMCSPO; however, these are due to fin angle limitations of \(\delta_{sn}\).  
The SMC controller can robustly control the underwater vehicle; however, some chattering problems occur due to high switching gain in the control input. To solve this chattering problem, the SMCSPO controller is designed and applied to control the fin. Because SMCSPO can reduce the gain of the switching function term by compensating the estimated nonlinear terms, this chattering phenomenon in the control result using the SMCSPO is barely presented in Figure 5. Through the error graph of the vehicle's rolling velocity in Figure 6, it is confirmed that the overall error of the SMCSPO controller is smaller than that of the PID controller.  
In terms of the pitching and yawing velocity control results, the results for SMCSPO control also have some overshoots because of the control fin limitation. Due to the limited position of the control fins, the SMCSPO robust controller cannot provide sufficient control power to the vehicle system. These overshoots can be removed when the position limitations of the control fins are removed, as with the results of the rolling velocity control.