Adaptive System for Steering a Ship Along the Desired Route

An adaptive ship steering system along a preset track is an example of an intelligent system. An optimal linear quadratic regulator (LQR) regulator with a symmetric indicator of control quality was adopted as the control algorithm. The model identification was based on the continuous version of the least squares method. A significant part of the article presents the proof of the stability of the proposed system. The results of the calculation experiments are provided to confirm the effective and correct working of the system.


Introduction
The design of a control system is usually based on a mathematical model of the object as the basis for the synthesis.In reality, the determination of the exact structure of the model and values of its parameters is not an easy task.The parameters may change in time under the influence of the properties of the object itself or as a result of changing environmental conditions.This entails the need to create adaptive control algorithms, which are characterized by learning capacity, a large range of autonomy in responding to changes in the system and the ability to perform in complex conditions.Algorithms of this type are the essence of intelligent control systems.
An example of the above problem is the steering of a ship, a complex dynamic object subject to strong disturbances.The scope and sensitivity of the steering panel operation changes as sailing conditions change (ship speed, water depth, wind force, current, waves, loading condition, etc.), but a skilled helmsman is able to allow for the changes and perform as instructed.Changing conditions, however, create great difficulties in designing autopilots because a well-designed autopilot, to perform a control task, will have to change its parameters in time based on the identified parameters of the model or even make use of the variable structure of the model.
One of the classic problems in this field is automatic ship steering along a preset route, generally defined in the form of a broken line, joining a series of preset waypoints.The ship's track-keeping ability is crucial, because improper control of the rudder results in the reduction of the average speed, longer track and time of the voyage and, consequently, higher fuel consumption, leading to higher total operating costs.The associated operational problem is steering gear overload, which may lead to a critical breakdown.Most importantly, uncontrollable yawing, especially on waterways with increased traffic, adversely affects the level of safety, increasing the risk of collision [1].
A common feature found in publications on strategies of ship control along a preset track is their strong dependence on the reliability of the mathematical model describing the maneuvering dynamics of the ship (linear quadratic Gaussian control [2][3][4][5], H-infinity control [6], sliding mode control [7,8], backstepping control [9][10][11][12], and modal control [13]).To avoid the above difficulties, which stem from the application of an exact mathematical model of ship dynamics, other control strategies have been developed, including the theory of fuzzy sets [14][15][16] or artificial neural networks [17][18][19].
The alternative solution presented herein is an adaptive system of ship control along a set track (trajectory autopilot) using the method of indirect adaptation.In the first stage of the method the model parameters are identified (it is assumed that the model structure is known), then, using the certainty equivalence principle we take the model as an exact representative of the controlled object.For these considerations, an optimal linear quadratic regulator (LQR) with a symmetric indicator of control quality was chosen.The model identification was based on the continuous version of the least squares method.
The proposed solution effectively stabilized the ship's trajectory relative to the desired track, and the whole process ran in the online mode.This is important for the implementation of the developed system.Implementation often seems to be very difficult in the cases presented in the literature on the subject.This limitation is a consequence of the assumptions made in these methods.The proposed adaptive algorithm for the automatic track-keeping of a ship is a functional solution, characterized by the high control quality combined with the possibility of effective implementation in marine navigational systems.

Adaptive Control System-The General Case
Let the dynamics of a continuous object be described by a linear equation of state: .
where A-a matrix with the size n × n and fixed elements independent of time; B-a matrix with the size n × p and fixed elements independent of time; x-n-dimensional vector of state; .
x-n-dimensional vector of derivatives versus time (t); u-p-dimensional vector of control signals.
with the initial condition: while the symmetric control quality indicator has this form: where R x -symmetric, positive semidefinite matrix, with dimensions n × n and fixed elements independent of time; R u -symmetric, positive definite matrix, with dimensions p × p and fixed elements independent of time.
The optimal control u * (LQR), that meets Equations ( 1) and ( 2) and minimizes the control quality criterion (3) takes the form [20]: where the matrix P (symmetrical and negative specified) is determined from the algebraic Riccati equation: where 0-zero matrix with n × n dimensions.The previous considerations referred to a situation where the matrices of the model coefficients are known and constant, that is, they are time-independent.However, this is generally not the case, and then it is necessary to continuously identify the said matrix elements, which translates into the need for the adaptation of regulator gain (4).The problem to be solved in this case is how to continuously and as accurately as possible estimate the model representing a real object (1): .
assuming only that the state vector is measurable.Equation (1) will be considered as an accurate (but unknown and non-stationary) description of an object, while its model will be the estimation (6).
The idea of the method used for solving the formulated problem can be described as follows.Based on the error stemming from the actual state x, and the state estimated from the model x m , unknown elements of the matrices A and B are identified.Then, based on the results, the LQR regulator (4) is tuned (Figure 1).The previous considerations referred to a situation where the matrices of the model coefficients are known and constant, that is, they are time-independent.However, this is generally not the case, and then it is necessary to continuously identify the said matrix elements, which translates into the need for the adaptation of regulator gain (4).The problem to be solved in this case is how to continuously and as accurately as possible estimate the model representing a real object (1): assuming only that the state vector is measurable.Equation (1) will be considered as an accurate (but unknown and non-stationary) description of an object, while its model will be the estimation (6).
The idea of the method used for solving the formulated problem can be described as follows.
Based on the error stemming from the actual state x, and the state estimated from the model m x , unknown elements of the matrices A and B are identified.Then, based on the results, the LQR regulator ( 4) is tuned (Figure 1).
where the Euclidean standard is described by the formula: assuming there exists a linear relationship: where m θ -k-dimensional vector of estimates of identified elements of matrices A and B (its coordinates are part of the matrix m A and m B ); The Equation ( 7) can be written in the form of: The continuous version of the least squares method was used to identify the looked-for elements of the matrices A and B. The estimation is based on the minimization of the integral from the squared standard error (e = x − x m ): where the Euclidean standard is described by the formula: assuming there exists a linear relationship: where θ m -k-dimensional vector of estimates of identified elements of matrices A and B (its coordinates are part of the matrix A m and B m ); Φ-measurement matrix, regressor (with dimensions k × n).
The Equation ( 7) can be written in the form of: Therefore, vector θ m is determined from the relationship (derived by comparing the derivative versus θ m from Equation (10) to zero): which after transformation (provided that for a set t the vector θ m is treated as a constant) and has this form: where ΦΦ T dτ-a regular matrix (where the initial condition is a positive definite matrix) with k × k dimensions.Differentiating Equation ( 12) with respect to time we obtain: .
where after substitution: .
and simple transformations we get a formula for the identification of model parameters: By means of the model parameters identified using the Formula (15) we can determine the LQR (4) gain, which will assure the system adaptation.

Stability of the Adaptive Control System
The stability of the proposed system will be proved below.The system (1) with feedback (4) is stable [20], and therefore for a symmetric and positive definite matrix Q, the matrix is non-positive definite and symmetric.This results from the Lapunov equation for a stable dynamic linear system (in the Lapunov sense).
Taking into account the feedback in Equation ( 6), it will be transformed to this form: .
where A m , B m -matrices A, B identified by means of Formula (15); P m -solution of the Equation ( 5) for A = A m , B = B m .The derivative of error e with respect to time can be written as: . e = .
x − x m x .
x + x m x .
For clarity, the second term of the sum in Equation ( 18) will be omitted (as being limited) which yields: .
Let the positive definite quadratic form: V(e) = e T Qe (20) be the Lapunov function of the system in question.The time derivative of the function has this form: .
and by substituting the relationship ( 19) we get: .
Therefore, because the matrix this relation exists: .
which proves the stability of the adaptive control system herein considered.If we also take into account the second term of Equation (18), to obtain the system stability we have to use the sliding mode control [21], which consists of adding a properly selected signal to the control, which will guarantee the inequality (23) to take place.This is successfully done when we know the vector's A − A m + BR u −1 B T P − B m R u −1 B m T P m x m component constraints and we additionally assume that only one element of the matrix B is non-zero (then B is an n-element vector, while the control is a scalar).In such a case, the control signal in Equation ( 16) will be: where (b m ) j -j-th vector B m element, where j means the non-zero vector B element numeral.It will be noted in further considerations that inequality (23) will occur, which has been shown.

Trajectory Autopilot
The track along which the ship should be steered is defined as a broken line defined by n preset waypoints P 1 (x 1 , y 1 ), P 2 (x 2 , y 2 ), . . . ,P i (x i , y i ), . . . ,P n (x n , y n ) (1 ≤ i ≤ n).To formalize the problem of keeping track of the ship, two reference systems will be introduced (Figure 2):

•
global, stationary to the ground (X, Y); • relative (mobile) (X r , Y r ), with the origin located in the latest reached waypoint P i (x i , y i ), and the vertical axis along the section P i P i+1 (ϕ ro -the angle of the relative reference system rotation).which defines the subsequent displacements and rotations of the global reference system depending on the current track leg.The system rotation angle is defined as follows: The rotation of the system is made after the condition is met: where R -radius reaching the waypoint, a positive value determined arbitrarily.
Let the model describing the ship's movement dynamics be a Nomoto model [22].Then, to be consistent with the form (1), the following denotations are made:  which defines the subsequent displacements and rotations of the global reference system depending on the current track leg.The system rotation angle is defined as follows: The rotation of the system is made after the condition is met: where R-radius reaching the waypoint, a positive value determined arbitrarily.Let the model describing the ship's movement dynamics be a Nomoto model [22].Then, to be consistent with the form (1), the following denotations are made: where a, c-coefficients determined from model tests (different for different types of vessels); u-longitudinal speed of the ship (as an approximation the actual speed can be accepted); r-rate of turn; δ-rudder angle.
The control quality, when the track for the ship to follow has been set, is most commonly expressed by the indicator: where λ y , λ ψ , λ δ -coefficients greater than zero, arbitrarily determined, which, after introducing the matrices: will take the form (3).
If we assume that the coefficients a, c are known and fixed (and not time-dependent), the optimal control of track-keeping can be found from the relation (4).
Let the equation describing the object (ship) be the Nomoto model, but not taking into account the deviation from the course as a component of the state: .
and a m , c m (established arbitrarily) will be the estimated model parameters.To use the identification Formula ( 15), first the Laplace transformation will be applied (for initial zero conditions) in Equation ( 31), then two filtered signals will be substituted: after transformation and returning to the time domain, we obtain: By introducing the denotations: we get a conformity of (33) with the form (15). Formula (15) can now be used for the continuous identification of the parameters of the Nomoto model.With the identified vector θ m of the Nomoto model parameters, the optimal control of track-keeping is determined from relation (4).
It should be noted that the control quality of the presented trajectory autopilot can depend on the parameters λ y , λ ψ , λ δ , R and the initial estimates a, c.The assumption here is that they are adopted arbitrarily.The automatic selection of these parameters goes beyond the framework of this work and will be examined in the future.

Calculation Experiments
The experiments were made in the Matlab/Simulink environment.A de Witt-Oppe model [23] was used as an object (vessel), incorporating the dynamics of the steering gear [22]: . x 1 = x 5 cos x 3 − x 6 sin x 3 .
In order to take account of disturbances, the simulations included a signal characteristic of wind-induced sea waves (the wind direction conforms with the direction of the Y axis) [22].
The calculation experiments were conducted to compare the performance of the proposed adaptive system and the LQR regulator without the identification of the model parameters.The values λ y = 1/2000, λ ψ = 1, λ δ = 5, R = 500 (m) were arbitrarily accepted as the LQR regulator parameters.Figure 3 shows an example simulation result for the case where the initial estimates of the Nomoto model parameters assumed the values a 0 = 0.02 (1/s) and c 0 = 0.002 (1/s 2 ) (nominal values a = 0.018(1/s), c = 0.001(1/ s 2 )).Preliminary estimates of the Nomoto model parameters were used for the determination of the LQR regulator's gain and as input data for the adaptive algorithm.The charts illustrate, respectively, the simulation results: ship movement trajectory, control quality indicator, rudder angle, and deviation from the course.It can be observed that both the control by the proposed method and by LQR lead to the ship correctly stabilizing its position relative to the planned track.However, the proposed method had a significantly higher control quality.This applies to the value of the control quality indicator (lower for the proposed method) and to oscillations and overshoots (lower in the proposed method).It should be noted that the oscillation of the presented system (the lower left chart) can depend on the parameters λ y , λ ψ , λ δ , which is interpreted as a compromise between the deviation from the route and the rudder angle (steering gear load).The automatic selection of these parameters goes beyond the framework of this work and will be examined in the future.
the determination of the LQR regulator's gain and as input data for the adaptive algorithm.The charts illustrate, respectively, the simulation results: ship movement trajectory, control quality indicator, rudder angle, and deviation from the course.It can be observed that both the control by the proposed method and by LQR lead to the ship correctly stabilizing its position relative to the planned track.However, the proposed method had a significantly higher control quality.This applies to the value of the control quality indicator (lower for the proposed method) and to oscillations and overshoots (lower in the proposed method).It should be noted that the oscillation of the presented system (the lower left chart) can depend on the parameters      , , y , which is interpreted as a compromise between the deviation from the route and the rudder angle (steering gear load).The automatic selection of these parameters goes beyond the framework of this work and will be examined in the future.The situation presented in the experiment is typical of this kind of research.In all cases considered, the value of the quality indicator for the ship controlled by the proposed adaptive system was lower than in the case of the LQR regulator without the identification of the model parameters.The method led to a reduction of the control quality indicator value to 15%, depending on the assumed initial estimates of the Nomoto model parameters.The situation presented in the experiment is typical of this kind of research.In all cases considered, the value of the quality indicator for the ship controlled by the proposed adaptive system was lower than in the case of the LQR regulator without the identification of the model parameters.The method led to a reduction of the control quality indicator value to 15%, depending on the assumed initial estimates of the Nomoto model parameters.

Figure 1 .
Figure 1.Structure of the proposed system for course stabilisation of the ship.

Figure 1 .
Figure 1.Structure of the proposed system for course stabilisation of the ship.

Figure 2 
Figure 2 also depicts the ship's gyrocompass course ψ and the relative course ψ r .The relative position of the ship, and its relative course are obtained by transformation:    x r y r ψ r

Figure 2 Figure 2 .
Figure 2 also depicts the ship's gyrocompass course  and the relative course r  .The relative position of the ship, and its relative course are obtained by transformation:

Figure 2 .
Figure 2. Global and relative reference systems.

Figure 3 .
Figure 3.An example outcome of the comparison of the proposed adaptive system (continuous line) and linear quadratic regulator (LQR) regulator without model parameter identification (dashed lined).

Figure 3 .
Figure 3.An example outcome of the comparison of the proposed adaptive system (continuous line) and linear quadratic regulator (LQR) regulator without model parameter identification (dashed lined).