PSO-BASED PID CONTROLLER DESIGN FOR SHIP COURSE-KEEPING AUTOPILOT

Summary This paper deals with autopilot proportional-integral-derivative (PID) controller design. In the literature, various available methods for PID controller have been presented. Based on the fact that the existing methods do not guarantee the optimal response of the system on the input step change, in this paper we used a valuable technique called Particle Swarm Optimization (PSO) in order to optimally design PID controller taking into account the system limitation such as the value of the rudder angle saturation. Furthermore, we have compared system response on input step and ramp change of input signal for a few PID controller parameters values obtained by using different methods known in literature. It has been proven that by applying the PSO method, it is possible to determine the optimal PID controller parameters which guarantee fast and proper response from the aspect of the minimal overshoot and the minimal settling time. The obtained results confirm the applicability and efficiency of using PSO method for optimal autopilot PID controller design.


Introduction
During its movement, vessel is steering a certain course.Operator monitors movement and position of the ship with his senses (sight, feeling for tilt and acceleration, etc.).The status of ship's movement and position is obtained depending on the situation based on the visual perception of certain fixed points as landmarks or based on readings on instruments.Based on obtained information, a person forms a control signal and gives commands from the bridge control panel which are transmitted to the steering gear mechanism.By using steering gear mechanism, helmsman maintains existing course or changes the course (maneuvering) [1].This type of control is based on the difference between the existing and the desired course, and the rudder mechanism is a part of the automatic control closed-loop [2].A ship, being an autonomous and highly complex dynamic system, is composed of a series of different processes, machines and devices that lend themselves to automation.The automation of a ship's processes contributes to its higher efficiency, cutting maintenance and crew costs, prolonging its lifespan and bringing a host of other advantages.
The automatic steering system's basic task is to maintain the ship's course, i.e. to maintain a current navigational trajectory.The autopilot is a higher level of control in which the ship's course is controlled without the participation of a helmsman [2].By constantly monitoring the actual against the desired course, an error signal is determined, and the microcomputer formulates a steering algorithm that puts the ship back on its desired course.
Proportional-integral-derivative (PID) controllers or proportional-derivative (PD) controllers are usually used in ships autopilot design [3,4].The PID autopilot was developed with the intention of enabling a vessel to follow course as accurately as possible by decreasing the error caused by excessive deviations of the helm and by simultaneously limiting the rudder deviation in order to minimize rudder skid [5].As an addition to the fact that a straight course is not the most economical option, it has been decided that helm control must always be optimized relative to the prevailing state of the environment and that a small bandwidth should be used in order to minimize losses.There are different designs of ship course-keeping autopilots.For example, the steering parameters for normal adaptable PID autopilots have been developed during the last three decades as specified in [6][7][8], and the most important among them is the performance index regarding added resistance due to imperfect steering control.Also, designs based on neural network [9,10], fuzzy logic [11][12], backstepping [13], selftuning control [14], pole placement technique (PPT) [15], extended state observer technique (ESO) [16] and similar are widely used.
As already mentioned, in [15] an analytical method for determining the PID controller parameters was presented.This method is based on the use of a symmetrical optimum and provides very simple formulation for determining PID controller parameter values.Moreover, the authors were analyzing the effect of step and ramp change of input signal and they obtained a good system response in terms of eliminating the errors in steady/stationary state.On the other hand, in [17], the application of the optimization method to determine the optimal values of PID parameters was obtained.It was considered that optimum values of the PID parameters are inside the range 10% of the parameter values compared to analytical method given in [15].Considering the mentioned references [15] and [17], it is important to point out that the steering machine limitation was not taken into account in either study.
On the other hand, a detailed description of the ship's mathematical model and steering machine limitation is presented in [18] where authors analyzed the application of extended state observer for yaw control, which as output does not give certain values of the PID parameters of the autopilot.In addition to the mentioned works, the use of Lyapunov's theory in PID controller design is reported in [19].Specifically, using Lyapunov's theory in determining the PID controller parameters of autopilot, a very slow system response is obtained, what can be inferred from the results shown in [18].From the comprehensive literature review in the area, it can be concluded that the above-mentioned works either use complex mathematical apparatus or provide analytical solutions that do not lead to the optimal results.Moreover, according to the researches done in [15,17] no real model of the ship has been taken into account including the steering machine limitation.
However, this paper presents an upgraded investigation on PID controller design that was previously analyzed in [15,17].The comparison of the system response to the step change in input signal (yaw angle step change), by different methods is presented in [18].In the available works, the authors did not compare the values of overshoot, rise time, settling time and delay time.Otherwise, these transition process parameters define the efficiency, stability and response speed of the regulator.Based on the previous analyses, the aim of this paper is to improve the PID controller design from the perspective of better response quality with respect to limitations dictated by the components of the regulation loop (for example, hydraulic pumps, rudder angle etc.).This improvement was achieved by using the optimization technique called Particle Swarm Optimization (PSO), which is a very powerful technique, whose application can be found in a number of areas such as power converters [20], solar cells [21], electrical machines [22], power network [23], etc.This paper is organized as follows.In Section 2 a mathematical model of a ship and PID controller is proposed.PSO technique with corresponding algorithm and its explanation is described in Section 3. Simulation results with specific values of parameters including robustness analysis are presented in Section 4. In addition, comparative analysis that includes methods from the literature and novel ones provided in this paper are given in Section 5.

Mathematical model
It is well known that ships are equipped with autopilots consisting of PID controllers among others, which make part of the automatic control system and their purpose is to maintain a given course of the ship.During the design of the ship, it is very important to install a control circuit and an automatic control system, i.e. autopilot, in order to relieve the helmsman.
PID-based steering course autopilot is one of the most commonly used types of autopilot for navigating the course of the ship.The course autopilot usually contains a basic algorithm for course maintenance, with or without adaptation to navigation conditions, and a maneuver controller.Setting up the parameters of the PID controller is extremely important since the parameters of the ship represent an object of the steering, i.e. the parameters of the ship dynamics change with the speed, position of the rudder, load, etc.The same is also significant due to disturbances such as winds, waves, currents, etc.
Block diagram of overall structure of ship autopilot is shown in Figure 1.In this figure, the rudder angle (or rudder deflection) is denoted with δ and ψ represents ship heading angle which is closed to its desired value ψd.Based on the value of heading angle error  which appears due to external disturbances, the autopilot generates the input signal for rudder actuator [12].The rudder actuator represents the actuation mechanism that moves the rudder to the controller commanded angle.However, the response of the rudder actuator is defined by the speed of the rudder, whereas the rudder movement is mechanically limited.The rudder is moved by hydraulic pumps, the speed of which is governed by the pump capacity and by opening the valve.Hydraulic fluid flow regulated by the swash plate of the steering machine is controlled by the telemotor system which receives signals from the autopilot controller.Detailed description of rudder actuator can be found in [18].According to the SOLAS Convention [24], the power of the rudder actuator must be sufficient to shift the rudder from 35° on one side, to 30° on the other side in 28 seconds.As proposed in [15], a PID controller with an additional degree of freedom should be used to control the autopilot.Its mathematical equation is: where:   is PID gain coefficient,   is PID main time constant, and   ′ and  1 are time constant where  1 ˂  ′ ˂  .By using this equation, the PID controller is designed by combining the pole placement method with the symmetric optimal criterion [15].If the natural frequency  0 and the attenuation coefficient  are known, the unknown parameters of the PID can be obtained by using the following equations: Finally, the most widely used model of the ship is based on the Nomoto linear model [18] whose differential equation is as follows where  and δ are earlier defined, k represents the static yaw rate gain and T is the effective yaw rate time constant.The corresponding transfer function is given by Therefore, the plant has a low-order model, which contains a pure integrator, and which is characterized by a dominant time constant p and a gain coefficient p.

PSO algorithm
An algorithm that is based on the PSO metaheuristic belongs to the category of algorithms inspired by the swarm intelligence.Similar to bird flocking, this method is originally based on a group of particles that are flying among the search space in order to find the best position.Generally speaking, PSO algorithm represents an optimization tool that finds its application in the investigations of solar cells, electrical machines, electronic systems etc. [20][21][22][23].The PSO algorithm is established on the population (swarm) of candidate solutions.Also, each particle represents one candidate solution to the problem and moves around in the search spaces by using its experience, as well as the experience of other particles.The movement of each candidate solution (particle) is defined by the speed that is constantly changing in order to find a better feasible solution.Therefore, each particle is flying through n-dimensional search space in finding the right position according to the mathematical formulation.The aim of the iterative procedure is to enable the particles to find better positions (Figure 2).For solving different optimization problems, an objective function J should be proposed.In this study, we also define the PSO parameters and variables.The objective function is defined in each particle of search space A as follows: This function shows that for each particle of search space A an appropriate value of function J is assigned.The value of variable (position of particle with its velocity) is limited due to constraints in the search space that can be found in each iteration.Since we treat the minimization problem, it means that while the value of objective function is lower, than the position of particle is better.In this phase, we have personal best and global best minimum (value and position).It is worth mentioning that the value of global minimum is common for each particle and very close to the minimum of the objective function.
If we define xi to be position vector and vi to be velocity vector of particle i, Pi represents its best position while g is a current global optimum, then moving among the search space can be formulated as   ( + 1) =  •   () +  1  1 (  () −   ()) +  2  2 (() −   ()) (8)   ( + 1) =   () +   ( + 1) where r1 and r2 are arbitrary positive numbers between 0 and 1, c1 and c2 represent accelerate constants, w is an inertia weight coefficient and t is a current iteration number.Accelerate constants c1 and c2 have a huge impact on the convergent speed because in the case that the values of constants are small, the particle swarm slowly converges to the solution.Otherwise, in a situation where the values of constants are relatively high, the whole optimization process may become unstable.
In this study, we estimated the values of four parameters while the objective function is mean square error of the reference signal and estimated signal value.Therefore, the ISE (Integral Square Error) function has been selected as the optimum function, with its mathematic form: where tis time, and e(t)is the difference between the desired ship heading angle (ψd) and actual ship heading angle (ψ).In this paper we determined the PID parameters for step change of desired ship heading angle of ψd=10 [deg].
However, beside the proposed optimum function used in [17], here we propose the following objective function: that deals with the maximal value of rise.So, the objective and priority are to minimize the value of rise.In this paper, the value of coefficient G is set to be 10000.
The constraints of the used optimization technique in the paper are (kc, Tc, Tc' and T1) which must be set within some pre-specified limits.These limits may be bounded by where the superscripts min and max speak for the minimum and the maximum values of the respective variables.The procedure of determining the optimal values of PID controller parameters is described as follows.In its basis, PSO algorithm generates the values of PID controller parameters.Upon that, the value of objective function is reported for the input signal.In the next step (iteration), PSO algorithm generates new values of PID controller parameters with the new value of objective function.In the case that this objective function value is lesser, the algorithm is taking the corresponding PID controller parameter values.The procedure is repeated until the best value of objective function is obtained or upon the total number of reported iterations is finished.
However, during the optimization process, we tested the value of rudder angle ().Namely, if its value is greater than 35, the obtained combination of parameters is rejected.In that manner the contribution of the methodology provided in this paper differs from those proposed in [17] which gives an added value in the research area.

Simulation results
The proposed method (PSO algorithm, with limitation of rudder angle , together with novel optimization function) is used for PID parameters determination of a ship model whose parameters are as follows: kp=-0.0834,Tp=5.98 [15].In addition, it is assumed that the natural frequency  0 is 0.1 rad/s while damping coefficient  is 0.9 [15].
The estimated PID parameters values, determined by using several methods, are presented in Table I.Namely, it shows the results obtained by using Nicolau [15], Calasan [17], as well as by using the proposed method based on the use of PSO algorithm together with objective functions OF1 and OF2.The step responses of the closed-loop transfer function for all four cases are illustrated in Figure 3a.The corresponding the rudder angle responses are presented in Figure 3b.As it can be seen, in both cases (step and ramp input signal), PID autopilot assures null stationary error for both step and ramp variations on reference inputs.However, it can be seen that the OF2 enables obtaining much better signal in terms of overshoot.Also, it can be seen that in all analyzed cases the maximal value of rudder angle is less than the prescribed value.Likewise, the higher change of the desired course angle value leads to higher changes of rudder angle.
In addition to the above mentioned, this paper gives a comparison of the results of the system's step response with the effect of the disturbance and with some results obtained by applying other methods known from the literature.The results are shown in Table 2.As can be seen, the Calasan [17] method and the proposed OF1 method have the largest settling time.However, the delay time, the maximum time and the rise time are the least for the proposed methods OF1 and OF2.Moreover, the overshoot value in case of using OF2 is less than the overshoot value obtained when using the Lyapunov [19] or Nicolau [15] methods.Therefore, since the response rate is important for the response quality (low rise time value and low overshoot time value), with the lowest possible overshoot value, it is clear that the proposed method based on OF2 has very good performance.Although the overshoot value that occurs in the case of using the parameters obtained with the proposed OF2 is greater than zero (i.e.greater than the ESO -Extended state observer [18] and IOL -Input-Output Linearization [18] methods), it should be noted that the rise time of the IOL and ESO methods is significantly higher.It is important to point out that in case when steering machine limitations (rudder angle saturation) is not applied, the following results will be obtained: Kc=-85.8305,Tc=20.6428,Tc ' =7.6052 and T1=0.Although the results guarantee the ideal responsealmost minimal overshoot with a very short time-delay, they are not realistic, since the complex ship system dynamics cannot follow the change of the inputcontrol signal with adequate speed.

Robustness analysis
The observed real system contains different kinds of uncertainties and various disturbances due to its complexity.For that reason, in this paper, the robustness analysis of the observed system with tuned parameters was carried out in three waysby step changing of reference signal (desired ship heading angle), by combined step and ramp changing of reference signal and by adding certain disturbance signal on the output side of the diagram (on ship heading anglesee Figure 1).
In the first case, experiential values of step changes of input signal (desired ship heading angle) were made several times (Figure 5).First, the reference value of yaw angle was reduced by 30%, then after a certain time this value was increased by 50%, and finally the current value was decreased by 20%.As can be seen, for all given changes of reference values, both positive and negative, the best responses were provided by the proposed method OF2.It is clear that the speed of establishing a new stationary state is the highest, while the overshoot value for all the step changes of the input signal is the smallest.Also, the values of rudder angle changes are in permitted limits (see Figure 5b).
In the second case (Figure 6) the referent value of desired course is firstly changed with step signal and after that with ramp signal (see Figure 6a).Just like in the first case the best responses were provided by the proposed method OF2, while in all cases the rudder angle is within the permitted limits (see Figure 6b).
In the case of testing the effect of the step disturbance at the measured value of the actual course angle, the corresponding results are shown in Figure 7.In this case, the step disturbances were added at the output signal (see Fig. 1 disturbance signal).As can be seen, the system closely follows all the changes at the output.It can be noticed that the fastest system response is achieved when the parameters used were determined by the proposed method OF2.Moreover, after the disturbance, the system quickly returns to the stationary state (see Figure 7a and 7b).Note, at starting time the step change of desired course angle is also realized.Therefore, based on all of the above, it can be concluded that the proposed method for PID parameters design enables very secure tracking of the reference signal as well as very secure disturbance attenuation, without an unallowed value of rudder angle.

Conclusion
This paper deals with the design of the PID controllers for autopilots.For that purpose, a block diagram (of the ship and the autopilot controller) was observed, while the design was realized by using a PSO method.
However, unlike previous works in this field, when designing the parameters of the PID regulator, the importance of taking into account the dynamics (limitations) of the system is emphasized.Namely, by taking the steering dynamics limitations into account, the procedure for selecting the parameters of the PID controller is also defined.In addition to criterion functions for determining the parameters of the controller known from the literature, a new criterion function is proposed which takes into account the maximum overshoot value during the rapid change of the control signal.Moreover, the obtained response results for the step disturbance of the input signal are compared with the responses obtained by using several methods know from the literature.It has been shown that the selected parameters of the controller meet the stability criterion, while providing a fast and efficient system response to the effect of the input step and ram disturbances.
In the future work the authors plan to determine the optimal values of PID parameters for different desired values of ship heading angles.Also, we will test different optimization techniques for this purpose.

Fig. 2
Fig. 2 Flowchart of PSO algorithm PSO-based PID Controller Design for Ship Tatijana Dlabač, Martin Ćalasan, Course-keeping Autopilot Maja Krčum, Nikola Marvučić 7 Step response of the closed-loop system, b) Corresponding rudder angle responses.The ramp responses of the proposed system are illustrated in Figure4a.The corresponding the rudder angle responses are presented in Figure4b.a) PSO-based PID Controller Design for Ship Tatijana Dlabač, Martin Ćalasan, Course-keeping Autopilot Maja Krčum, Nikola Marvučić b) Fig. 4 a) Ramp response of the closed-loop system, b) Corresponding rudder angle responses.
Heading course responses on step changes of desired course angle value, b) Corresponding rudder angle responses.Tatijana Dlabač, Martin Ćalasan, PSO-based PID Controller Design for Ship Maja Krčum, Nikola Marvučić CourseSystem response on combined step and ramp changes of desired course, b) Corresponding rudder angle responses.
Additional signal and system responses, b) Corresponding rudder angle response Tatijana Dlabač, Martin Ćalasan, PSO-based PID Controller Design for Ship Maja Krčum, Nikola Marvučić Course-keeping Autopilot 14

Table 1
Comparison of results in terms of parameters value

Table 2
Characteristics of obtained signals