Particle Swarm Optimization of a Passivity-Based Controller for Dynamic Positioning of Ships

: Dynamic positioning (DP) control system is an essential module used in offshore ships for accurate maneuvering and maintaining of ship’s position and heading (ﬁxed location or pre-determined track) by means of thruster forces being generated by controllers. In this paper, an interconnection and damping assignment-passivity based control (IDA-PBC) controller is developed for DP of surface ships. The design of the IDA-PBC controller involves a dynamic extension utilizing the coordinate transformation which adds damping to some coordinates to ensure asymptotic stability and adds integral action to enhance the robustness of the system against disturbances. The particle swarm optimization (PSO) technique is one of the the population-based optimization methods that has gained the attention of the control research communities and used to solve various engineering problems. The PSO algorithm is proposed for the optimization of the IDA-PBC controller. Numerical simulations results with comparisons illustrate the effectiveness of the new PSO-tuned dynamic IDA-PBC controller.


Introduction
Marine vessels and ships have been widely used for offshore exploration, deep-sea mining, military operations, rigs-drilling and offshore wind farm constructions [1]. For such activities to be operated under safe and stable conditions, the vessels need to be equipped with advanced motion-control systems [2]. This has led to increasing demands for dynamic positioning (DP) systems to regulate the vessels' plane motions in order to maintain its position and heading. The dynamic positioning systems automatically control and maintain the ship's position and heading by means of computers, thrusters, propellers, filters, sensors and other components [3]. The capability of the ship for maneuvering and maintaining its position precisely depends on the efficiency and capacity of the components of the DP system. Precise operations require expensive hardware components (sensors, filters, etc) whose functionality and performance are degraded over time as the vessel maneuvers in the water [4]. Furthermore, the complexity and nonlinearity of the vessel dynamics and the fact that environment conditions of the sea/ocean (due to wind, waves and currents) are changeable and unpredictable have brought about new challenges on the design of DP systems [4]. The obvious alternative solution is the design of advanced and intelligent control system.
Various advanced control techniques have been thoroughly discussed in literature and successfully applied to DP systems. A comprehensive literature survey for the control methods of DP systems until 2011 have been discussed in [3]. Further review and comparison of different control techniques have been presented in the recent review in [1]. The single-input-single-output PID control is a first reported method used for DP system regulation [1,5]. A low-pass filter was combined to the PID controller to control the motion of the DP system in the 3-degrees-of-freedom (DOF) horizontal plane. PID controllers have also been used in the nonlinear PID-control approach as proposed in [6], and model free multivariable PID controller tuning method with a capability of online tuning of DP control systems [7]. The emergence of Kalman filter and optimal theories was utilized to establish more advanced control design in [8] which was adopted and further improved and extended in the works of [9][10][11][12] and the references therein.
To deal with the exact dynamics of the vessel/ship (i.e., ship's nonlinear hydrodynamics), a number of nonlinear control methods have been proposed. State and input/output feedback linearization control methods have been discussed in [6,13,14]. Lyapunov-based design techniques including: nonlinear (passive) observer based on Lyapunov theory with wave filtering and full-scale experimental results [15], Asymmetric Barrier Lyapunov Function with Neural Networks have been deployed to control a vessel with output constraints and uncertainties [16], a combination of backstepping technique and Barrier Lyapunov Function with a passive observer to estimate some states [17]. Considering the robustness of DP system to variations in environmental and loading conditions, sliding mode control has been developed in [18,19].
Fuzzy-logic and neural network algorithm methods have the ability to reduce the complex nonlinear characteristics of the DP system controller (by means of approximation of nonlinear function) without heavy/tedious online computation requirements [20,21]. This enables online estimation with time-saving in case of dynamics variations of the DP systems due to ex. disturbances which clarifies the wide use of such methods in various control-related problems of the DP systems as in [2,5,22,23] and the references therein. Model-predictive control (MPC) is another popular control method that has recently been reported in the literature by a number of authors. Enhancement in control performance of the DP systems can be achieved deploying this method due to its systematic way in handling various (inputs, outputs and states) constraints [24], its model/performance optimization capabilities as well as its robustness against external disturbances and unmodeled dynamics [1,4]. The tracking MPC control problem of underactuated surface vessels has been proposed in [20]. In [24], both linear and nonlinear MPC approaches have been investigated for the trajectory tracking problem of autonomous vessels. Considering uncertain environmental disturbances, measurement errors and partially measured states, two robust control methods based on MPC and using a simple Luenberger observer for DP systems control problem of autonomous surface vessels have been discussed in [4].
Passivity-based control (PBC) is another class of nonlinear control methods that have received a lot of interest due to its advantages in reducing the complexity in the control design [3] exploiting intrinsic system properties. By invoking the physically motivated principles of energy dissipation and transformation, the stabilization of the dynamical system is achieved fulfilling its passivity property which is related to the stability properties of the systems [25]. The PBC problem aims at making the closed loop system passive by shaping both the energy and internal interconnection structure of the system. The most notable example of the PBC approach is the interconnection and damping assignment-passivity based control (IDA-PBC) which has already been successfully applied to various dynamical systems adopting port-Hamiltonian (PH) formalism [26]. In addition to energy and structural shaping of the PH model, damping is injected by means of feedback control to ensure asymptotic stability of the closed-loop system. Passivity theory has been used in [6] to establish a passive nonlinear observer and in [27] a passivity-based controller based on IDA-PBC method has been proposed to stabilize a DP system of ship.
Focusing on enhancement of the control performance, optimization techniques have been widely used and applied. They provide systematic procedure for designing of controllers, tuning the parameters and gains, and online estimation/calibration for unknown parameters caused by environmental changes or disturbances [21,28]. In the literature, various optimization algorithms have been developed to improve the quality of the closed-loop system such as Artificial Bee Colony (ABC) algorithm [29], Ant Colony Optimization (ACO) algorithm [30], Bacterial Foraging Optimization (BFO) algorithm [31], Multi-Verse Optimization (MVO) algorithm [32] and Gravitational Search Algorithm (GSA) [33]. Particle Swarm Optimization (PSO) is one of the effective optimization methods that has been successfully used in tuning PID controllers as in [34], for quadrotor stabilization based on integral backstepping control design [35], for tuning the parameters of fuzzy PD controller with minimization of integral square error cost function in [36], to improve the performance of an ultrasonic transducer [28]. For the control of DP systems, authors in [21] have deployed the PSO method to optimize the fuzzy function/parameters to enhance the quality and performance of the DP system of the ship.
In this paper, we propose a dynamic IDA-PBC controller that stabilizes the ship/vessel. It introduces a modified version of the IDA-PBC controller which was proposed in [27] by adopting the state-transformation to obtain a dynamical feedback controller with robustness capability due to the incorporation of the integral action controller. In addition, damping is injected in both the position and momenta states to ensure asymptotic stability. Furthermore, the design and selection of parameters/gains of nonlinear controllers are generally obtained using trial and error which relies mainly on experience, and usually requires tedious computations. Here, we make use of PSO algorithm to obtain the gains of the IDA-PBC controller which provides an effective way to select/tune these gains thus improving the control performance of DP system of the ship. Moreover, we provide full proofs for stability and matching between the open-loop and closed-loop models necessary to prove that the Hamiltonian structure and passivity properties are preserved despite the deployment of state-transformation method in the course of controller design procedures. Finally, we show that the proposed method guarantees robustness of DP system with respect to environmental disturbances induced by wind, waves and currents in seas and oceans.
The rest of the paper is organized as follows: Section 2 describes the dynamical model of the ship based on the PH formalism. In Section 3, the dynamic controller based on IDA-PBC method is proposed. Section 4 introduces the PSO algorithm and the suggested cost function used to tune the gains of the IDA-PBC controller. The proposed control scheme and tuning algorithm are simulated and compared in Section 5 to verify the performance of the newly PSO-tuned IDA-PBC controller. Finally, concluding remarks and future work are given in Section 6.

The Port-Hamiltonian Modeling of the Surface Ship
DP system of a vessel is a unit in a ship which automatically maintains its position (fixed location or predetermined track) and heading by means of thruster force [3]. The primary role of this unit is maintaining the vessel position within a given operational area with high accuracy essential to perform offshore operations in such areas. First we will give a brief description to the DP system followed by the model of the surface ship.

The DP System Overview
Conventional DP systems for vessels are usually designed to achieve reliable and accurate position/station keeping capabilities. It compromises the following main components being a set of dedicated modules which are a combination of propulsion and maneuvering devices and controllers [1,3]: 1.
Power System. It compromises all components and units responsible to supply the DP system with its power requirements including: Prime movers, Generators, Switchboards, Electrical distribution system (cabling and piping), transformers. It may also include more advanced subsystems for energy storage and power management purposes. 2.
Thruster system. The vessel's horizontal motion is influenced and controlled by means of thrusters and propellers which are also the sole source of position/heading keeping. They supply the DP system with thrust force and direction and it includes thrusters with electronic drive units, propellers and rudders, cabling and piping and other associated auxiliary subsystems.

3.
Control System. it compromises all hardware and software components including processors and computers, joystick control unit, Sensors and instrumentation and signal processing units, Position and heading reference systems (navigation, acoustic, microwaves and laser systems), operator and display panels.

The Mathematical Model
The motion of the marine vessel whether in maneuvering or sea-keeping state is described in 6-DOF model as shown in Figure 1 [24]. The first 3-DOF is to define translations and the other 3-DOF to define the orientation accounting for the 6 typical motion components of the marine vessels; longitudinal motion (surge), transverse (sideways) motion (sway), rotation around the vertical axis (yaw), rotation about the longitudinal axis (roll), rotation about the transverse axis (pitch), and vertical motion (heave). Typically, the position and orientation of a ship are expressed relative to two coordinate frames: the earth coordinate frame (inertial fixed frame) with origin O and (X,Y,Z) coordinates, and the body coordinate frame, which is fixed to the ship and moves along with it, with b origin and (x, y, z) coordinates. In most DP system control applications, which are featured by low-frequency and low-speed motion, rolling and pitching actions induce negligible motions and thus roll, pitch and heave motions are ignored and the control problem is reduced to a 3-DOF vessel model having a coupled surge-sway-yaw components [24,37]. An illustration of the ship model with a motion described in a horizontal plane is shown in Figure 2, with the 3-DOF (surge, sway, yaw) described in the two-coordinate frames.
The nonlinear mathematical model for vessel dynamics in horizontal plane can be expressed as [38,39]: where η = [X, Y, ψ] is the configuration variables vector gives the position and heading angle (orientation) in the earth coordinate frame, the vector v = [u, v, r] represents the velocity vector expressed in the vessel's body coordinate frame. τ ∈ R 3 is the control vector of the forces and moments produced by the ship's propulsion system and b ∈ R 3 is the disturbances vector. The transformation matrix T represents the rotation matrix that gives the relative orientation of the inertial and body frames, the damping matrix D and the mass matrix M are all given by: where 0 3×3 is the 3 × 3 zero matrix. The PH formalism for general nonlinear systems is given by [25]: H is the Hamiltonian (total energy ) of the system, G(x) is the input matrix and ∇H is the gradient vector of the Hamiltonian. The ship model (1) can be described by pH form as [27]: is the state vector of the system, with the configuration states vector q = [q 1 , q 2 , q 3 ] and the momenta vector p = [p 1 , p 2 , p 3 ] = Mv. I 3 is the 3 × 3 identity matrix. The Hamiltonian of the system is given by by its kinetic energy function

The IDA-PBC Controller Design
In this section, we design a control law for DP system of the ship using the classical IDA-PBC and by incorporating a state-transformation which enables adding an integral action and damping controllers to achieve asymptotic stabilization. This method is resulted in a dynamic control law while preserving the PH structure. In the IDA-PBC method, the control law can be found by matching the open loop system (3) with the desired closed-loop model: is the desired damping matrix and H d is the desired Hamiltonian. The following proposition establishes procedures for the design of the controller: Proposition 1. Consider the PCH system (4). Define the coordinates transformation Define the desired Hamiltonian function where Ψ(z 1 ) is desired potential energy function which has a minimum at z 1 = 0. Then the closed-loop PCH system is obtained as   ż and the dynamic control law with the update lawż (asymptotically) stabilized the ship at the desired equilibrium point (z 1 , z 2 , z 3 ) = (0, 0, 0).

Remark 1.
In the closed-loop model (9), K q = diag{k q 1 , k q 2 , k q 3 } > 0 and K p = diag{r 1 , r 2 , r 3 } > 0 are the damping matrices injected in the configuration z 1 and momenta z 2 coordinates, respectively, which ensure asymptotic stability. K I = diag{k i 1 , k i 2 , k i 3 } > 0 is a constant integral matrix which improves the robustness of the closed-loop system against external disturbances and steady-state errors.
Proof of Proposition 1. Considering the function (8) as a candidate Lyapunov function, the time derivative of this function along the trajectories of (9) is given by: Using a quadratic energy function where C > 0 is the gain matrix such that the quadratic function has its minimum at z 1 = 0 and substituting (13) into (12) we obtaiṅ Using the norm-notation defined as y A := y Ay [25], (14) can be expressed as the following inequality which ensures stability of the system at its desired equilibrium. Asymptotic stability at the desired equilibrium point can be satisfied using the following detectability condition (the detectability condition has been used in [40] although not exactly in the same context): is a detectable output of the dynamics (9).
The realization of the closed-loop dynamics (9) via the coordinate-transformation (7) can be verified by matching the states of the open-loop system (4) with their corresponding states in the closed-loop system (9). That is, for the position statė q in (4) ≡ż 1 in (9) Substituting ∇ p H from (5) and ∇ z 2 H d , ∇ z 3 H d from (8), we obtain Finally, substituting z 2 from (7), the left-hand and right-hand sides are equivalent. Similarly, the equivalency between p and z 2 states that established the control law (10) can be found by differentiating the transformation (7) with respect to time and using d dt (AB) = dA dt B + A dB dt and d dt (T −1 ) = −T −1 d dt (T)T −1 : Substituting (ż 2 ,ż 3 ,ṗ) from the dynamics (4), (9) yields: Substituting z 2 from (7) and rearranging, we obtain the dynamic controller (10).

Remark 2.
Here, we have shown that the proposed method stabilized the ship at its desired equilibrium position and orientation using the states (coordinates)-transformation without destroying the PH structure nor the passivity properties.

The PSO Method for DP of Ship
Similar to most nonlinear control approaches, the gains and parameters of the IDA-PBC control law (10) are generally obtained using trial and error which relies mainly on experience, and usually results in tedious computations. Here, we utilize the PSO algorithm to obtain the optimal gains of this controller which provides an effective way to tune these gains thus improving the control performance of DP system of the ship.

An Overview of PSO Method
Since its introduction in [41], particle swarm optimization (PSO) algorithm has received wide attention and has been widely used for various optimization applications. Inspired by the social and intelligent collective behavior of animals (such as insects, herds, birds and fishes) and the learning experiences they develop conforming cooperatively some ways in searching for food [42,43]. The PSO design is a population-based stochastic optimization algorithm which has the advantages of simple implementation and simple integration with other optimization methods as well as its rapid convergence capability [43]. In this algorithm, a group of particles called population moves in the search-space looking for the optimal value of a performance index (fitness function). The position and the velocity of each particle is updated according to mathematical equations which are: where x n ij is the position of the particle i at the current iteration in the j dimension, x n+1 ij is the position of the particle at the next iteration, v n ij is the velocity of the particle i at the current iteration, v n+1 ij is the velocity of the next iteration, w is the inertia weight, c 1 is the self-weight acceleration coefficient, c 2 is the social-weight acceleration coefficient, r 1 and r 2 are uniformly distributed numbers, p n ij is the best previous position (with minimum fitness value) of the particle i in the j dimension until the current iteration n and g n j is the position of the best particle in the dimension j at the current iteration. The flow-chart of the PSO algorithm is illustrated in Figure 3.

Application of PSO Algorithm for DP of Ship
In this work, the PSO was used to tune the modified passivity-based controller for improving the performance of a dynamic positioning system in a surface ship. The design space is the controller gains which are the diagonal elements in ex. K q matrix: The objective that used in this optimization is the performance index integral square error (ISE) which can be defined for the three outputs (x-position, y-position and yaw angle (ψ)): e x (t) is the error in the x-position, e y (t) is the error in the y-position and e ψ (t) is the error in the yaw angle. We used this method (the summation of the three errors) in preparing the performance index as in [36].

Convergence to the Optimal Solution Using PSO Method
In terms of convergence of the function to the optimal solution, optimization methods can be split into two groups; local and global optimization methods. The local optimization could ensure the function/algorithm convergence to the local optimal solution while the global methods could guarantee a convergence to a global solution among multiple local optima. Moreover and based on the local or global convergence condition, optimization techniques can be decomposed into two main methods: the metaheuristic and deterministic methods following their tendency to converge towards a local or global optimum, respectively [44].
Most metaheuristic methods are naturally or biologically motivated mimicking the behavioral characteristics and/or interactions of living agents such as worms, fish, birds, bees [45]. Metaheuristic methods are gaining popularity in several application domains including in control system, neural network training and function optimization due to their ease of implementation, rapid convergence capability without requiring high mathematical preparation and computational complexity [42,46]. The most popular metaheuristic methods, which have been used to solve a wide range of real-life optimization problems, are differential evolution, artificial bee colony, particle swarm optimization, genetic algorithm, simulated annealing, gravitational search algorithm and firefly algorithm [44,46]. On the other hand, deterministic methods follow a definite trajectory to the closest minimum from random initial solution(s), which ensure more accurate results. However, these methods require sophisticated mathematics and extensive computation. They also need a lot of memory for sampling and lengthy simulations [46,47]. Charactarized by the fact that the selected objective function must satisfy the Lipschitz condition, a number of approaches have been proposed in the literature; the DIRECT method and its locally-biased version DIRECT-L, and the approach based on adaptive diagonal curves [46], and the geometric global optimization methods [44].
To guarantee that our proposed PSO approach converges to the optimal value, we used the PSO algorithm implemented in the Global Optimization Toolbox in Matlab. This toolbox examines several basins of attraction to find the global optima [48]. This Global Optimization Toolbox "provides functions that search for global solutions to problems that contain multiple maxima or minima. This gives some confidence that particleswarm reports a local minimum and that the final obtained value is the global solution [49]". Furthermore, and based on the comprehensive discussion and analysis in [44], PSO methods manifest a better performance as well as being less sensitive to the accuracy increment with respect to the other tested metaheuristics. In addition, trial points generated by PSO were distributed in a smarter manner with respect to the other metaheuristics and even better than some global methods [44]. Motivated by these points and due to the fact that PSO method solves the optimization problem in a computationally efficient manner, we have adopted this method among other optimization methods. It's effectiveness will be verified in the next section.

Numerical Simulations
Three sets of numerical simulations based on the 3-DOF planar model of the ship (vessel) were carried out to demonstrate the effectiveness of the proposed control design. The first set of simulations demonstrates the improved design, the second shows the role of PSO tuning method, and the third shows the robustness of the closed-loop against external disturbances. All the simulations have been implemented in the Matlab/Simulink environment.

A Comparison between the Modified and the Original Controllers
To show the effectiveness of the proposed controller, we have compared it with the original proposed in [27]. The values of the model parameters M and D are [27]: and the controller gains have been selected as: The initial state (initial position and orientation of the ship) has been chosen as −10 m for both positions (q 1 , q 2 ) and 4 rad for yaw angle (q 3 ). The aim is to stabilize the ship at its desired equilibrium (0,0,0). Figures 4 and 5 show the time histories of the position states q 1 (position in x coordinate) and q 2 (position in y coordinate,) and Figure 6 shows the time history of the orientation (heading) q 3 (yaw angle). The figures show simulations using both the original and proposed controllers. The performance (time response characteristics) for both controllers are shown in Table 1. The improvement on the performance of the closed-loop system using the proposed controller over the classical one has been demonstrated evident by faster response, less overshoot in the x and y directions as well as an improved undershoot in the yaw angle.

The PSO Tuning of the Proposed Controller
Here, we show the procedures to tune the controller gains as discussed in Section 4. We use the same model parameters as in the previous subsection. The algorithm parameters are shown in Table 2 Table 3. We can see that PSO method improved the response of the system achieving a faster settling while reducing the overshoot (undershoot) as well as avoiding a long and time-consuming trial and error procedure to find the optimal gains. The improvement can be also shown from the trajectories for the two cases (with and without using the PSO method) in Figure 11 which clearly shows better trajectory profile and more convenient path in the case of PSO-tuned controller.

The Robustness of the Proposed Controller
A vessel operating in the sea or ocean is subjected to different disturbances due to different sea and ocean states. Such environmental disturbances due to wind, waves, and currents play an important role in the stabilization and performance of the DP system of the vessel which may cause the vessel to drift from the desired position and heading and/or oscillate [50,51]. Therefore, the disturbance rejection becomes a crucial issue in the design of DP controller.
Environmental changes cause changes to the disturbance characteristics (such as the current and wind speed, waves elevation and frequencies) of the controlled system. Such disturbances induced by wind, waves, and currents can be separated into components at lower frequencies (LF) due to the second-order waves also called slow wave drift forces [39], and components at wave-frequency (WF) disturbances due to the first-order waves. LF and WF comprises the main disturbances affecting the ship motion with LF responsible for drifting and WF for oscillation of the vessel [50]. The WF disturbances are typically tackled by wave-filtering techniques in advance [52], and DP systems can then deal with the LF disturbances which can be represented with a series of sinusoidal components with different frequencies, amplitudes and phases [51]. Different disturbances due to different sea states were described in the Code of sea state in Table 4 which are characterized by wave spectra [39]. Mathematically, the vector (b ∈ R 3 ) in Equation (1) denotes the disturbance vector consisting of equivalent LF disturbance forces b 1 (t) in surge, disturbance force b 2 (t) in sway and disturbance moment b 3 (t) in yaw.
Here, we show the capability of the proposed dynamic control law, by incorporating the integral action term, in rejecting externally induced disturbance , hence, achieving robust bounded control performance. We demonstrated our proposed design with two sets of simulations for two different scenarios; in the first scenario a vessel has been disturbed (at T = 0 s) by constant wind and current speeds and constant wave height, then being suddenly disturbed by stronger wind and current, and higher wave at (T = 1500 s). Figures 12-14 show the response of the closed-loop system in presence of disturbances which have been induced to the system at time (T = 1500 s). As shown, the proposed controller has rejected the environmental disturbances and forced the ship to return back to its desired position (equilibrium) demonstrating its effectiveness and robustness in spite of disturbances.   In the second scenario, the vessel started in the slight sea state (code no. 3 in Table 4) and then environmental changes associated with moderate sea state (code no. 4) disturbed the vessel at time (T = 1200 s). The values of wave height, peak frequency and direction, and wind/current speeds angles and directions have been taken from [51] adopting the Jonswap spectrum which has been discussed in [39]. As depicted in Figures 15-17, the ship position and heading in the x, y, ψ coordinates have been affected by the environmental disturbances (sea state changes) as expected, however, the controller quickly suppressed the disturbances and the ship returned back to its desired position and orientation.

Conclusions and Future Work
In this paper, a dynamic IDA-PBC controller has been proposed for the dynamic positioning of surface ships. The tuning of the gains of the IDA-PBC controller based on the PSO method has also been discussed. Moreover, we employed the dynamic extension on the PCH model to improve the IDA-PBC controller for DP of ships. Asymptotic stabilization of the system is achieved by injecting damping on the position and momenta states while robustness of the closed-loop system against disturbances is ensured by the integral action control. Finally, the effectiveness of the proposed controller using the PSO tuning method has been verified through simulations which revealed improved convergence speed and less overshoots. Future work includes using multi-objective optimization and further investigation to the adaptive and robust control problems associated with the uncertainties and time-varying disturbances.