Generating fuzzy autopilot for ship maneuvering

This paper introduces a method to generate autopilots for ship headings by using issues from the observation of control actions performed by human operators. The controller is designed based on fuzzy logic and uses triangular membership functions for the antecedent and consequent functions for Singleton type. For an automatic adjustment of the consequential, the recursive least squares method was used. This method is used to generate and validate the course driver of a 350-m tanker, at different load conditions.

On ships, the autopilot is used to control the direction of the rudder to reduce the error between the desired heading and the actual angles.Problems in maneuvering of vessels by the action of the rudder are related to the relatively high mass of the vessel with respect to the limited size of the rudder, which should be significantly deflected to obtain the required change in the ship's heading.(Fosse, 2002;Witkowska et al., 2007).
These autopilots are designed to help improve efficiency in fuel consumption and reduce wear on components.(Witkowska and Smierzchalski, 2008).Often, autopilots use classical control systems, such as Proportional Integral Derivative (PID) control.However, to compensate disturbances, like wind and currents, acting on the ship, as well as the characteristic nonlinear dynamics, permanent adjustments of the PID parameters are required.
The PID controller, once its parameters have been adjusted, performs well but only for small variations under operation conditions.Ship dynamics are constantly changing due to various reasons, such as variations in speed, trim, load, wind, currents, depth, among others, requiring continuous adjustment of the PID controller parameters.In many boats, this parameter setting is done manually, which becomes an additional burden on the crew and does not guarantee optimal performance of the controller at each operating point.
The methodology used in this section to obtain the fuzzy controller based on input and output data is presented in three phases: in the first, we present the nonlinear mathematical models that describe the dynamics in the course of the vessel; the second describes the fuzzy identification method used to generate fuzzy controller from experimental data; and in the third, we present an application to obtain the fuzzy controller in the direction of a cargo-type vessel.
The Nomoto linear model (Tzeng, and Chen, 1999) has been widely accepted to design ship heading controllers (Du, and Guo, 2004).
Where ψ(t) is the yaw angle, δ is the rudder angle, T is the time constant, and K is the rudder gain.Nonetheless, the Nomoto linear model is only valid for small deflections of rudder angle (δ < 5°) and low frequency of the action itself.For a better representation of the dynamic behavior of the ship's course, also valid at large and rapid movements of the rudder, the nonlinear equation proposed by Wenger and Bench has been proposed (Fossen, 2002;Casado and Ferreiro, 2005): Where H N (ψ(t)) is a nonlinear function of the angular velocity (t) ψ(t) .The function H N (ψ(t)) expresses the relationship between steady state δ(t) and ψ(t), when ψ(t) = ψ(t) = δ(t) = 0. To determine the shape of the curve H((t)) N•ψ, a "spiral test" experiment was conducted on the tanker, the object

Introduction
Nonlinear model of the dynamics of a ship's course (1) Parameters α and β are real constants obtained from the "spiral test"; also, α is always taken as a positive value.Herein, we assigned to these parameters the values of 1: α = β = 1 (Witkowska et al., 2007).Parameters K, T1, T2, T3 are defined by: Where u is the longitudinal speed of the vessel [m/s] and L is the length in [m].The mathematical model of the vessel's dynamic characteristics was taken from a tanker model described by (Åström and Wittenmark, 1989) and modeled by a Bech and Wenger third-order equation, nonlinear model.For the simulation, the following parameters were considered (Passino and Yurkovich, 1998): These parameters were determined for a velocity u = 5 m/s and a length of L = 161 m.
The model of the vessel's dynamic characteristics was complemented by the steering system model (Fig. 2).The input signal to the rudder system is Autopilot.In most vessels, speed and rudder angle should be kept within limits (Amerongen, 1982), where, It has been estimated that the rudder blade moves from a limit position to another during a time period not greater than 30 seconds.This article assumes a maximum speed of movement of the rudder of δ max = 6 -°/s.The maximum angle the rubber blade can reach is δ max = 35 degrees.In summary, the dynamic of the rudder is expressed as: Where T R = 156 seconds and K R = 96 degrees.
The algorithm to generate fuzzy operators uses the weighted average rate (Babuska, 2001) for the combination, rather than T-norm type operators.
The user should only introduce the data from the input and output variables.The algorithm determines the ranges of each variable, distributes the membership functions in the universes of each input variable, locates the Singleton-type consequents (Chae et al., 1999) in the output space, determines the rules, and adjusts the location of the consequents, using least squares to minimize the approximation error.
The algorithm stops when reaches a metric error lower than that required by the user or when the number of fuzzy sets for the input variable is greater than nine.The distribution of membership functions in each input universe is uniform to ensure that the resulting partition sum is 1, i.e., the sum of the degrees of membership of an entry in an input variable is always equal to 1 (Contreras, et al., 2007(Contreras, et al., , 2008)).
Given a collection of input and output experimental data {(x k i , y k )}, with i = 1...N; k = 1,..., p , where p , and y i is the one-dimensional output vector.  n) corresponds to the projection on the outlet space of the assessment of data x (i) de la k-th input variable in the n-th corresponding partition set.The value of the output that corresponds to the said projection is given by the value of the i-th position of the output vector y. 5. Determination of the rules.The number of rules initially obtained is equal to the number of sets from each input variable multiplied by

Fuzzy modeling algorithms
the number of variables, that is, equal to n x k.
The membership functions associated to each consequent will form the antecedents of the rules.An algorithm to reduce the number of rules is shown ahead.
6. Validation of the model, or calculation of the approximation, by using the inference method described by where is the solitary value that corresponds to rule j. 7. Parameter adjustment, relocating the solitary output, using the least squares method.To do this, we proceeded to represent equation ( 2 Where E is the approximation error, which must be minimized, and θ is the consequent vector.Using the least squares method The solution to this least squares problem by adjusting the consequent is given by This solution is valid if (W T W ) is not singular, which means that all the rules should receive sufficient excitation (persistent excitation) during the training.In practice, this is not always possible, so it is advisable to resort to the application of recursive least squares, seeking to ensure that the adjustment only affects the excited rules (Contreras, 2006;Espinosa andVandewalle, 2000, 2005). Where, The initial value P(0) was obtained in step (4) of the algorithm.8. Determine whether the measure of mean square error MSN is less than one, as previously established.Otherwise, increase n by 1 set of variable input and return to step 3.
It is possible to accomplish a greater approximation ("fine adjustment") if upon ending the process mentioned we apply the gradient descent method to only adjust the location of the modal values of the triangular sets of the antecedent, retaining the partition sum 1 and, hence, the interpretability of the system.The consequent arrangement is given by: The output of fuzzy controller (autopilot) is calculated by using equation (9).Fig. 9 shows a comparison between the rudder angle commanded by the autopilot and the rudder angle used in training.Rudder angle δz (k-2), error ψe (k-1), and variation in error ψc (k-1) were used for the training process as inputs to the past values of the fuzzy controller.The controller output is the current value, and the rudder angle δ (k) is necessary to achieve the desired course.

Partition
The structure of fuzzy controller or autopilot obtained is shown in Fig. 8.The labels "S" and "L" denote the linguistic terms "small" and "Large", respectively.The mean square error MSE of 0.0175 is reached.With three variables and two input triangular membership functions for each input variable, we generated six Consequences (6 rules), according to step 5 of the fuzzy identification algorithm.A new method is presented for the generation of vessel auto pilots.The pilot or automatic control generated is a fuzzy controller with triangular membership functions, normal and with overlap at 0.5, for input variables.The membership functions of the consequents are singleton type and are obtained by using the recursive least squares method.The method does not require the use of any other artificial intelligence techniques.
The results show that the method accurately captures the high dynamics of maneuvering the vessel when it is implemented in the generated fuzzy autopilot.In addition, the system is easily adaptable to new states of the vessel by adjusting the consequent.Industrial, vol. 5, No. 3, pp. 70-77. Jul. 2008.

Fig. 1 .
Fig. 1.Variables defining the course of the vessel

Fig. 2 .
Fig. 2. Block diagram of the rudder system

Fig
Fig. 3. Distribution of the triangular membership functions process of inference, the n output values can be represented as Y =Wθ + E, which in matrix form is given by Technology -Vol. 5 -n.° 9 -(107-114) July 2011 -Cartagena(Colombia)

Fig. 6
Fig. 6 shows the result of a simulation by using Matlab/Simulink, which shows a comparison between the desired yaw angle (solid line) and the actual yaw angle for the implementation of the steering angle variation shown in Fig 7. The difference between these two signals is called the signal error.

Fig. 7 .
Fig. 7. Input applied to nonlinear system: rudder angle Technology -Vol. 5 -n.° 9 -(107-114) July 2011 -Cartagena (Colombia) 1. Scheduling of all N pairs of input -output {(x i , y i ) | i=1,2,..., N}where p i x ∈ℜ are input vectors and are scalar output.2. Determination of the range of universes for each variable according to the maximum values of the associated data [x - i , x + AMERONGEN J., Adaptive steering of ship.A model reference approach to improved manoeuvering and economical course keeping.Ph.D. thesis, Delft University of Technology, the Netherlands.1982.ÅSTRÖM K.J. AND WITTENMARK B. Adaptive Control.Reading, MA: Addison Wesley.1989.BABUSKA, R. Fuzzy and Neural Control.Disc Course Lecture Notes.Delft University of Technology.Delft, the Netherlands.2001.CHAE, Y., OH, K., LEE, W. AND KANG, G.. "Transformation of TSK fuzzy system into fuzzy system with singleton consequents and its application".IEEE International Conference on Fuzzy Systems.IEEE Computational Intelligence Society, Vol.2,.pp.: 969-973.1999.