Ship RBF neural network sliding mode PID heading control

. In view of the inherent non-linearity, complexity, susceptibility to external wind, wave, and current interference of under-driven ships, and the difficulty of adjusting and adjusting control parameters, to improve the performance of ship's autopilot, a kind of RBF neural network sliding mode variable structure PID controller is designed. Traditional PID control is sensitive to parameter changes, online tuning is difficult, and easy to overshoot. In order to solve this problem, combining the variable structure characteristics of PID, a differential compensation term is added to the integral term to convert the PID control parameters into three parameters with more obvious physical meanings, and then combined with the RBF neural network learning and identification function to realize online tuning and adaptive control of ship control parameters. Using MATLAB software to simulate the container ship "MV KOTA SEGAR" MMG model shows that the designed RBF neural network sliding mode PID controller can effectively eliminate the ship's lateral deviation caused by external interference such as wind, waves, currents, etc., with high control accuracy,robustness and strong adaptability.


Introduction
Since substantive progress was made in the development of gyro compasses in the early 1920s, ship heading control has always been an important research topic in the field of ship motion control [1]. The original course controller was only simple proportional control, and could only be used for course keeping control with low precision requirements, but it gave people the hope of realizing automatic control in the field of ship maneuvering. At present, there are a variety of methods used in the field of ship control systems, such as PID control, neural network adaptive control, fuzzy control, etc. The use of the above methods is to design a PID autopilot or adaptive autopilot and other products. In terms of PID autopilots used by more than 90% of ships, PID autopilot parameters are simple to adjust and do not depend on the prior knowledge of the controlled object, and its structure is simple and robust. Although PID autopilots have made great progress compared with the previous ones, conventional PID autopilots still have shortcomings. This is because the design of PID autopilots of ships is based on a definite mathematical model. However, when the ship is sailing at sea, the speed of the ship is , Loading conditions, draught conditions will change the ship's motion state, changes in the external wind, waves, currents and other sea conditions will also cause changes in external interference, resulting in ship control cannot reach the ideal state, while the conventional PID autopilot does not have self-adjusting parameters The ability of the ship cannot adapt to the various changing sea conditions when the ship is sailing. At the same time, it is difficult for the pilot to accurately adjust the PID parameters according to the ship's sailing conditions. Therefore, the performance of the ship's PID autopilot will be greatly affected. In actual navigation, conventional PID autopilots can only adopt the "dead zone" method in the face of real-time changing sea conditions. This method reduces the accuracy of ship control while also increasing energy consumption. Therefore, how to design ship control systems Ship controller, and accurately optimize and adjust its PID parameters, so that the ship achieves the ideal control state will be particularly important. The basic problem of PID control is the contradiction between integral overshoot and steady-state error, and the ship motion state has the characteristics of large time delay, large inertia, and nonlinearity, which makes it more difficult to select the parameters of the ship's PID controller. In recent decades, many PID optimization methods have been proposed, which are mainly divided into two types: one is traditional methods, such as Ziegler-Nichols rule, critical ratio rule, and simplex rule; the other is intelligent algorithm, Such as genetic algorithm, particle swarm algorithm, ant colony algorithm, artificial neural network, fuzzy theory, etc. Traditional methods are usually empirical, and it is difficult to meet the requirements in the face of complex control situations, while intelligent algorithms can better meet the parameter optimization of PID complex control situations. In recent years, intelligent algorithms have been widely used in PID parameter optimization, and certain research results have been obtained. Mao Min [2] and others have used genetic algorithms to optimize PID parameters without the need to differentiate the objective function, but it is complex in optimization. The problem has shortcomings that cannot be ignored, and the basic genetic algorithm has a slow convergence speed and is prone to premature maturity, which leads to a greatly reduced optimization ability. Tan Guanzheng [3], etc., in view of the PID parameter optimization problem, combined with the ant colony algorithm to design an optimal PID controller with incomplete differentiation. Simulation shows that compared with the traditional PID controller design, this method has better control performance and Robust performance can be used to control many different objects and processes. Wang Jingzhi [4] and others used the BP neural network to have the characteristics of arbitrary non-linear expression ability, and proposed a PID control algorithm based on the BP neural network to achieve the best PID control effect through the learning of the system performance. Obviously the PID controller is the core of the entire control system, and its PID parameters play a vital role in its control quality. At present, there are many optimization methods for PID parameter tuning. Both traditional methods and intelligent algorithms are not omnipotent. Each has its own strengths and weaknesses, and further research is needed.
Aiming at the problem of integral overshoot caused by conventional PID control, this paper adds differential compensation to its integral term, and combines the theoretical characteristics of sliding mode variable structure to design a sliding mode PID controller. Aiming at the problem of ship navigation in time-varying sea conditions, the RBF neural network learning algorithm is introduced into the design of the sliding mode PID controller, which eliminates the need to estimate external disturbances such as wind, waves, and currents to achieve adaptive control of under-driven ships. And use MATLAB simulation environment to verify.

Ship steering motion equation
When When describing the maneuvering movement of a ship, two different coordinate systems are usually used: One is the inertial (fixed) coordinate system E x y z → , used to describe the position of the ship relative to the ground; the other is the attached (on board) coordinate system o xyz → ,the origin of the coordinates is generally at the center of gravity or midship of the ship, the positive x-axis points to the bow, the positive y-axis points to starboard, the positive z-axis points to the bottom keel. Choose the center of the ship as the origin of the appendage coordinate system, and the ship's operational motion equation is [5]: where: x and y are the abscissa and ordinate of the ship in a fixed coordinate system; u and v are the longitudinal speed and lateral speed of the ship in the appendage coordinate transverse forces acting on the hull, respectively; N is the moment about the vertical axis; the subscripts S , P , R and E represent fluid viscosity, propeller, rudder blade and external interference, respectively.

Control the target
Contral the rudder angle δ by adjusting the parameters 1 k , 2 k , 3 k , make the ship sail on the desired course, that is, the course deviation 0 e ϕ → .

Controller design 3.1 Sliding mode variable structure integral compensation PID control design
The basic form of PID control law is In traditional PID control, the integral coefficient i k is constant, In the actual control process, we hope that when the system deviation is too large, the control effect of the integral should be relatively weakened or even zero. When the system deviation is reduced, the integral control function should be appropriately strengthened at this time, so adjust the integral control reasonably speed according to the system deviation is the key to improving control quality [6]. In order to solve the problem of integral overshoot, a differential term is added to the integral term of PID control for compensation design: The controller parameters in formula (3) are still three, and while the system tends to be stable, it can effectively offset the integral of the PID integral term system output deviation, and when the system output deviates from the target, it can accelerate the stability of the system.
Using the idea of sliding mode variable structure [7][8] [9] to analyze the formula (3), we can get: In formula (4), let: 1 It can be seen from formula (5) that the physical meaning of converting the parameter control of the PID controller to the control of 1 k , 2 k , 3 k is more obvious, and it is more convenient to optimize its tuning.

RBF neural network sliding mode PID control design
RBF neural network can approximate arbitrary non-linear functions, can handle difficult-toanalyze regularities in the system, has good generalization ability, and has a fast learning convergence rate [10]. In the RBF network, is the input of the network, the hidden layer output of the network is ( ) T j h h = , j h is the output of the j th neuron in the hidden layer: where j C is the coordinate vector of the center point of the Gaussian function of the j th neuron in the hidden layer, j b is the width of the Gaussian function of the j th neuron in the hidden layer. The network weight of RBF is w , the RBF network output is The performance index function of the identifier is: In the formula, ( ) y k is the output value of the system identified at time k , and ( ) m y k is the output value of the identification network.
In the RBF neural network, in order to realize the tuning of the control system parameters, the internal parameters that can be adjusted are: the center vector value of the Gaussian function, the base width parameter and the output weight value. In this paper, the gradient descent method is used to learn and train the internal parameters of the network. The iterative algorithm of network weights, node center values and base width parameters is as follows [11]: In the formula, η is learning efficiency, α and β are momentum factors, η , α , β ( ) The Jacobian array reflects the sensitivity of the output of the controlled object to the change of the control quantity. Its value is identified by the RBF network. Its formula is as follows: Whether it is p k , i k , d k in traditional PID control or 1 k , 2 k , 3 k in sliding mode PID control in formula (5), its parameters are relatively difficult to tune in the control system, and traditional empirical methods and trial-and-error methods are far from satisfying the current control needs. In this paper, the RBF neural network identification system is applied to sliding mode PID control to realize online self-tuning of parameters 1 k , 2 k , 3 k in sliding mode PID control. RBF neural network tuning sliding mode PID parameter control block diagram is shown in Figure 2: It can be seen from Figure 2 that the input quantity of the system control error signal is: The input items of the sliding mode PID controller are: According to the idea of incremental PID discretization, the sliding mode PID control algorithm is known from formula (5): u k u k u k u k k k k e k e k k e k k k e k e k e k The parameters 1 k , 2 k , and 3 k in the sliding mode PID controller are adjusted by the gradient descent method [12] in the neural network, and the tuning performance indicators are: Therefore, the calculation formula for parameter adjustment is: In formula (14), 1 η , 2 η , 3 η are the learning rates of the three parameters of sliding mode is the Jacobian identification result of the neural network, the calculation process is as formula (9).

Schematic diagram of controller working principle
The working principle of RBF neural network sliding mode PID controller is shown in Figure 3.

Simulation verification and analysis
In order to verify the effectiveness and feasibility of the designed controller, it is in line with the actual marine navigation conditions of the ship. The container ship "MV KOTA SEGAR" is used as the simulation object. The main parameters of the ship are 217m in length between two columns, 37.3m in width, and 12.5 in full load. m, the displacement is 14635t, and the square coefficient is 0.681 [13].

Simulation analysis of ship heading control under ideal sea conditions
Under ideal sea conditions without interference from the external environment such as wind, waves, currents, etc., set the ship's initial speed of 19.4 kn, rotation speed of 78.4 rpm, the ship's initial heading to 0º, and the ship's heading setting value of 60º, respectively, using the designed sliding mode PID controller and RBF neural network sliding mode PID controller are simulated, set sliding mode PID controller parameter 1 0.025, It can be seen from Figure 4 and Figure 5 that the sliding mode PID controller and RBF neural network sliding mode PID controller designed in this paper can achieve good control under ideal sea conditions without interference from external factors such as wind, waves, currents, etc. The effect is that the rise time is short, and the system basically has no overshoot. When the ship's heading changes from 0° to 60°, the adjustment time is about 150s under the action of the sliding mode PID controller, and about 110s under the action of the RBF neural network sliding mode PID controller. Compared with the two, RBF neural network sliding mode PID has better control effect, and the ship rudder angle changes smoothly under its control, which can effectively reduce the loss of ship steering gear and improve the economy of navigation.

Simulation analysis of ship heading control in interfering sea state
In order to verify the control performance of the designed ship controller when the ship is disturbed, on the basis of simulation under ideal sea conditions, interference conditions such as steady wind and random wind and waves are added to the simulation model. The ship parameters are set as: initial speed 19.4kn, main engine the rotation speed is 78.4rpm, the wind speed is 10m/s, the wind direction is 30º, and the interference of sea waves and random wind current is expressed by the second-order oscillation link driven by white noise [14] The simulation interference is shown in Figure 6:  It can be seen from Figure 7 and Figure 8 that the sliding mode PID controller and the RBF neural network PID controller can still achieve better control effects under the interference of steady wind and random wind, waves and currents, which also verifies the designed sliding mode PID control. The device is not sensitive to interference and has strong robustness. The initial parameters of the two controllers are the same, the ship has a slight overshoot under the action of the sliding mode PID controller, and the adjustment time is about 200s, while the RBF neural network sliding mode PID controller adjusts the initial parameters by self-tuning, and the system adjusts the time It is about 160s and there is no overshoot, so the sliding mode PID controller designed based on RBF neural network has better anti-interference ability, robustness and strong adaptive ability. Finally, in order to suppress the interference of steady wind and current, the output rudder angles of the two controllers are maintained at about 3º to maintain the ship's heading control.

Conclusions
In this paper, differential compensation is added to the integral term of traditional PID control, and combined with the variable structure characteristics of PID control, a sliding mode variable structure PID control algorithm is designed. The physical meaning of the control parameters is more obvious, which is convenient for parameter tuning. In the face of the problem of ship control parameter changes in time-varying sea conditions, the RBF neural network learning algorithm is added to the sliding mode variable structure PID control to realize online tuning and adjustment of the control parameters of the ship when sailing under time-varying sea conditions. The MATLAB simulation environment is used to verify the effectiveness of the controller designed in this paper.