Generating Fuzzy Controllers for Ship Steering
Juan Contreras
Department of Naval Engineering
Escuela Naval Almirante Padilla
Cartagena, Colombia
[email protected]
Abstract— In this paper we present a new method to generate
fuzzy controller from training data. The antecedent partition
uses triangular sets with 0.5 interpolations avoiding the presence
of complex overlapping that happens in other methods. Singleton
consequents are employed and least square method is used to
adjust the consequents. This approach is not a hybrid system and
does not employ other techniques, like neural network or genetic
algorithm. The applicability of the proposed approach is
demonstrated by application for controlling the directional
heading of a cargo ship
Keywords: fuzzy identification; fuzzy control; ship steering
dynamics; ship control
I.
INTRODUCTION
A ship is characterized by a nonlinear function describing
the static maneuvering characteristics. The ship course control
influences the maneuverability, economy and security of ship
navigation and the combat capacity of warship. So far, Nomoto
linear model [1] has been widely used in most ship motion
control designs. However, the linear Nomoto model is only
valid if the ship make small deviations from a straight line path
(δ<5°) and for low frequencies of rudder action. Under some
steering conditions like a course-changing operation, it is
necessary to consider the hydrodynamic nonlinearities. Hence,
the ship control system model becomes nonlinear [2]. Over the
past twenty years a number of new methods were developed
for designing controllers to control non-linear dynamic systems
[3].
Navigation in low speed regimes is difficult due to
manoeuvring problems connected with a relatively big mass of
the ship and a limited dimension of the rudder, which must be
significantly deflected to obtain the required change in the
ship’s course [4], [5].
The construction of fuzzy controllers involves the selection
and tuning of many parameters as the shape and distribution of
ownership functions of input variables, rule base, logic
operators used, shape and distribution of consequents, etc. The
great number of parameters needed to obtain a fuzzy model has
obstructed the development of a unique technique for
modeling, especially in the case of fuzzy identification from
experimental input and output data.
One of the first proposals to automatically design a fuzzy
system from data was the table look-up écheme [6]. However,
when the number of inputs and membership functions are huge,
the number of fuzzy rules increases exponentially [7]. Sugeno
and Yasukawa [8] proposed a methodology to identify fuzzy
model parameters using singleton consequents, but it requires
many rules and presents a poor description capacity.
This paper presents a new approach for the development of
fuzzy controllers from data. The approach has been used in
system identification [9], [10].
The methodology used in this paper to get the fuzzy
controller from input and output data is presented in two
phases: At the first, the inference error method is presented and
then the fuzzy identification algorithm to generate a fuzzy
model; at the second phase, the method is applied to a set of
simulated data for obtaining a fuzzy controller for steering a
ship on the course.
II.
FUZZY IDENTIFICATION APPROACH
A. Inference Error
A fuzzy rule: “if u is A, then y is B ”, where u and y
represent two numeric variables, and A ⊂ U and B ⊂ Y, are
two fuzzy input and output sets respectively, defined at the
universes U and Y, is equivalent to the equation:
u A ( u ) ≤ u B ( y)
(1)
The inference error ε, is given by
0
u A (u ) ≤ u B ( y)
⎧
∈≈ ⎨
⎩u A (u ) − u B ( y ) … u A (u ) > u B ( y )
(2)
There are an infinite number of solutions which satisfy (2).
Hence, we will look for a unique solution: a fuzzy rule of the
kind “If u is A, then y is B” with a null inference error, must
fulfill the condition
u A ( u ) = u B ( y)
(3)
In this approach, the consequent u B ( y) will be a singleton.
It is because fuzzy models with singleton consequents can be
easily understood and adjusted [11].
978-1-61284-968-3/11/$26.00 ©2011 IEEE
If the system has n inputs, it must be represented by rules of
the kind “If u1 is A1 and u2 is A2 and …and um is Am, then y is
B”, and the generated system must fulfill the condition
((u A1 ( x k ) ∧ (u A 2 ( x k ) ∧ ... ∧ (u A m ( x k )) = u B ( y k )
(4)
C. Fuzzy Identification Algorithm
Given a collection of experimental input and output data
{xk, yk}, k =1, ..., N, where xk is the p-dimensional input array
x 1k , x k2 , … , x kn and y yk is the one-dimensional output array, the
algorithm is defined by the following steps:
1.
where ∧ represents a t-norm, or an aggregation operator,
of fuzzy logic
{
}
(i )
x ∈ ℜ are input arrays and y are output scalars.
See Fig. 1.
(i )
k
B. Fuzzy Model Structure
1) Membership Functions
The universe partitioning of the input variables in the
learning process will be done with normalized triangular sets
with specific overlapping of 0.5. The triangular membership
functions allow the reconstruction of the linguistic value at the
same numeric value after a defuzzyfication method has been
applied [12]. In addition, the overlapping in 0.5 assures that the
supports of the fuzzy sets are different. The fuzzy sets
generated by the output variable will be a singleton
Organization of the N pair set of input – output data
with i = 1...N ; k = 1,..., p ,, where
x k( i ) , y ( i )
2.
p
Determination of universe ranges of each variable,
according to maximum and minimum values of
associated data xk− , xk+ , y − , y + .
[
] [
]
2) Distribution of the Membership Functions
The triangular fuzzy sets of input variables will be
distributed symmetrically at each respective universe
3) Operators
For combining the antecedents OWA operators will be used
[13].
4) Inference Method
L
f ( x (i ) ) =
∑y
j
Fig. 1. Data organization
3.
Distribution of triangular membership functions over
each universe. As a general condition the vortex with
ownership value one (modal value) falls at the middle
of the region covered by the membership function
while the other two vortexes, with membership values
equal to zero, fall in the middle of the two neighboring
regions. See Fig 2
4.
Calculate the position of the modal values from the
input variable(s), according to
( )
m j x (i )
j =1
L
(5)
∑ m j (x (i ) )
j =1
where
m j ( x (i ) ) = u
j
A1
( x1(i ) ).u
j
A2
( x 2(i ) ).….u
j
An
( xn(i ) )
(6)
if u
( )
Akn
ysk( n ) =
j
is the output grade of the jth rule of a Sugeno fuzzy system, y
is the singleton value corresponding to rule j. Because we use
fuzzy partition with normalized triangular sets with specific
output space of data x evaluation of the k-th input
variable at the n-th set of the corresponding partition.
The output value corresponding to this projection is
given by the value of the i-th position of output array
y. See Fig. 3.
i
j
j =1
Then, (5) can be expressed as
∑ y m (x( ) )
j
i
j
f ( x (i ) ) =
y[i ]
(i )
∑ m (x( ) ) = number of input variables.
L
(8)
end
where ysk(n ) corresponds to the projection over the
L
overlapping of 0.5,
( x k(i ) ) = 1
j =1
p
when p is the number of input variables.
(7)
5.
Rule determination. Initially, the number of rules are
equal to the number of sets of each input variable
multiplied by the number of variables; in other words,
n × k . The membership function associated with a
consequent will be the antecedent of this rule.
Antecedents of rules with the same consequent are
merged using OWA operator, thus reducing the
number of rules as seen in Fig. 4.
6.
Model validation
described by (7)
using
the
inference
rules with sufficient excitation. This problem can be
solved using recursive least square (RLS). The
algorithm RLS looks like [14]
method
Fig. 2. Triangular sum-1 partition
Fig. 4. Generating rules
θ ( k + 1) = θ (k ) + γ (k )[ y (k + 1) − Wk +1θ (k )]
where
{
Wk = w1k , w2k ,… wLk
γ (k ) =
Parameters adjust, relocating the output singletons
using the least squares method. Equation (7) can be
expressed in the form:
( )
f x (i ) =
L
∑y
j
(9)
( )
w j x (i ) =
( )
m j x (i )
= wij
p
(10)
Output values can be represented as Y = Wθ + E , that,
in matrix form is given by
⎡ y1 ⎤ ⎡ w11
⎢ 2⎥ ⎢ 2
⎢ y ⎥ = ⎢ w1
⎢ ⎥ ⎢
⎢ L⎥ ⎢ n
⎢⎣ y ⎥⎦ ⎢⎣ w1
Y
… w1L ⎤ ⎡ y ⎤ ⎡ e1 ⎤
⎥⎢ 2⎥ ⎢ ⎥
… wL2 ⎥ ⎢ y ⎥ ⎢e2 ⎥
+
⎥⎢ ⎥ ⎢ ⎥
⎥
⎢
⎥
⎢ ⎥
… wLn ⎥⎦ ⎢⎣ y L ⎥⎦ ⎣en ⎦
1
w12
w22
w2n
W
θ
(11)
(15)
(16)
(17)
with the initial value P(0) obtained in step 4 of this
algorithm.
8.
w j ( x (i ) )
j =1
where
P( k )Wk +1
Wk +1 P (k )WkT+1 + 1
P (k + 1) = [1 − γ ( k )Wk +1 ]P (k )
Fig. 3. Generating consequents
7.
}
(14)
Finish if either the square error measure MSE is not
greater than a previously established value or the
number of membership functions is more than 9. In
any other case, increment by 1 the number of sets in
the input variable (the number of partition member)
and turn back to step 3.
III.
NONLINEAR MODEL OF SHIP STEERING
A. Example I
The linear Nomoto model has been widely accepted in
designing ship course controller [2]
••
•
T ψ (t ) + ψ (t ) = Kδ (t )
(18)
E
where E is the approximation error, which should be
minimized. Using the quadratic error norm, we have:
W TY
θ = T = (W TW )−1W T Y
(12)
W W
The solution is valid if and only if
(13)
rank (W T W ) −1 = dim(θ )
Equation (13) implies that all rules have to receive
enough excitation during training but in practice it is
not always guaranteed so the application of this
method will generate catastrophic results for those
rules with low excitation and a significant bias in the
where ψ (t) is the yaw angle, δ is ruder angle, T is time
constant, K is rudder gain. However, the linear Nomoto model
is only valid if the ship make small deviations from a straight
line path (δ<5°) and for low frequencies of rudder action. In
order to better describe the ship steering dynamic behavior so
that steering equation is also valid for rapid and large rudder
angles, the following nonlinear equation is suggested.
⎛ 1 1 ⎞ ••
1
⎛• ⎞
+ ⎟⎟ψ (t ) +
H N ⎜ψ (t ) ⎟ =
T1T2
⎝
⎠
⎝ T1 T2 ⎠
•••
ψ (t ) + ⎜⎜
K
T1T2
(19)
•
⎛
⎞
⎜ T3 δ (t )+ δ (t ) ⎟
⎝
⎠
•
δ max = 35[deg], 2.3 ≤ δ max ≤ 7[deg/ s]
•
where H N (ψ (t )) is a nonlinear function of the angular
•
•
velocityψ (t ) . The function H N (ψ (t )) expresses the steadystate
•••
set rudder angle, δz(t), while the output signal is the current
rudder angle, δ(t). For the majority of ships the rudder angle
and the speed of its change are kept within certain limits [17],
where
relation
••
δ (t )
between
•
and
ψ (t )
,
when
•
ψ (t ) =ψ (t ) = δ (t ) = 0.
It is usually required for the steering blade to move from one
limiting position to another in a time shorter than 30 [s]. In
this article it is assumed that the rate of rudder motion is
approximately limited to ˙δmax = 6 [deg/s] until |δz − δ| ≤ 3
[deg], when the rudder operates in the linear region of the
characteristic. The maximum rudder angle is δmax = 35 [deg].
For this assumption the steering gear dynamic characteristic
was given by the following equation:
The experiment performed to determine the shape of the
•
curve H N (ψ (t )) is called a “spiral test” and for the tanker
examined in the present article it is approximated by the
following function:
•
•
⎛• ⎞
H N ⎜ψ (t ) ⎟ = α ψ (t ) + β ψ (t )
⎠
⎝
3
•
K
1
δ (t ) = R δ z (t ) − δ (t )
TR
TR
(23)
where TR = 156 [s] and KR = 96 [deg].
(20)
The parameters α and β are real constants, such that α is
always positive, and determined from the “spiral test”. They
are chosen to be 1 in this paper: α = β = 1 in the model. The
parameters K, T1, T2, T3 are defined as
⎛u⎞
K = K0 ⎜ ⎟
⎝L⎠
Fig. 5. Block diagram of the steering gear system.
(21)
IV.
⎛L⎞
Ti = Ti 0 ⎜ ⎟, i = 1,2,3,
⎝u⎠
(22)
where u is the longitudinal speed of the ship in [m/s], and L is
the ship length in [m]. The mathematical model of the
dynamic characteristics of the ship was taken from a model
tanker described by [15] and modelled by a nonlinear thirdorder differential equation, referred to as Bech and Wenger’s
model.
RESULTS
The nonlinear plant is guided by the difference equations
(18) - (23). A simulation test was performed using
Matlab/Simulink. Fig. 6 shows the results of simulation:
desired yaw angle and real yaw angle. Fig.7 shows the rudder
angle
For the simulation the model parameters take on the following
values [16]:
K0 = -3.86, T10 = 5.66, T20 = 0.38, T30 = 0.89.
The model parameters were determined for the speed u = 5
[m/s]. The length of the tanker is L = 161 [m].
The model of the dynamic characteristics of the ship was
complemented by the model of the steering gear, as
schematically shown in Fig. 5. The input signal passed to the
steering gear comes from the autopilot and has the form of the
Fig. 6. Desired yaw angle (continue) and real yaw angle (--)
The array of singleton consequents is:
⎡− 34.375 ⎤
⎢+ 34.375 ⎥
⎢
⎥
⎢+ 0.229⎥
θ (k ) = ⎢
⎥
⎢− 0.226⎥
⎢− 0.127⎥
⎢
⎥
⎣⎢+ 0.128⎦⎥
Then, the output of the fuzzy control can be calculated using
Y=W* θ(k), where
Fig. 7. Input of the nonlinear ship steering process: rudder angle
For the training process, past values of: rudder angle δz(k2), error ψe(k-1) and change in error ψc(k-1), between the
desired yaw angle and the ship heading, are inputs of the fuzzy
controller. The output is the present value of rudder angle δ(k)
The structure of the fuzzy model obtained is showed in
Fig. 8. It is not difficult to assign linguistic terms to each other
membership functions. The labels S, and L denote,
respectively, the linguistic terms “Small” and “Large”. The
MSE achieved is 0.0175. With 2 input variables and 2
triangular membership functions for each input variable, 6
consequents (and 6 rules) are generated. (step 5 in fuzzy
identification algorithm). The output of the obtained fuzzy
control and the testing results are shown in Fig. 9.
⎡u S (δ Z (k − 2))
⎢ ( ( − 2))
⎢u L δ Z k
⎢u S (ψ e (k − 1))
W =⎢
⎢u L (ψ e (k − 1))
⎢u (ψ (k − 1))
⎢ S C
⎣⎢u L (ψ C (k − 1))
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦⎥
T
Figure 9 shows a comparison between the real rudder angle
and the output of the fuzzy control.
Fig. 9. Real rudder angle (solid) and output of the fuzzy control (dotted).
Fig. 8. Partitions of δz (k-2), ψe (k-1) and ψc (k-1) with 2 triangular
membership functions
V. CONCLUSION
A new approach for the development of fuzzy controllers
from experimental data was developed in this paper. The fuzzy
identification algorithm proposed uses triangular membership
function with 0.5 interpolations for antecedent partition
avoiding the presence of complex overlapping that happens in
other methods. This approach does not require other techniques
(neural network, genetic algorithm, etc.) for learning process.
A fuzzy singleton controller for ship steering system has
been obtained from data. Results reveal that the proposed
approach capture the system’s dynamic behavior quickly, and
track the system’s characteristics accurately.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
Tzeng, Ch-Y., Chen, J.F. “Fundamental Properties of Linear Ship
Steering Dynamic Models”, Journal of Marine Science and Technology,
Vol. 7, No. 2, pp. 79-88. 1999.
Du, J., Guo, Ch. “Nonlinear Adaptive Ship Course Tracking Control
Based on Backstepping and Nussbaum Gain”. Proceeding of the 2004
American Control Conference Boston, Massachusetts, pp. 3845-3850,
July, 2004
Witkowska, A., Smierzchalski, R., “Nonlinear Backsteeping Ship
Course Controller”, International Journal of Automation and Computing
Vol. 6, No. 3, pp.: 277-284, 2009
Witkowska, A., Tomera, M., Smierzchalski, R., “A Bacsteeping
Approach to Ship Course Control”, Int. Journal Appl. Math. Comput.
Sci., Vol. 17, No. 1, pp. 73–85, 2007
Fossen, T. I. “Marine Control Systems. Guidance, Navigation, and
Control of Ships, Rigs and Underwater Vehicles”. Marine Cybernetics.
Trondheim, Norway. 2002
L-X Wang , J.M. Mendel, “Generating fuzzy rules by learning form
examples”, IEEE Transactions System, Man and Cybernetics, vol. 22,
pp. 1414-1427, Nov. 1992
W. Yu, F. Ortiz_Rodriguez and M. Moreno-Armendariz. “Hierarchical
Fuzzy CMAC for Nonlinear System Modeling, IEEE Trans. Fuzzy
Systems, Vol. 16, No. 5, pp. 1302 –1314. Oct. 2008
M. Sugeno, T. Yasukawa, “A fuzzy logic based approach to qualitative
modeling”. Transactions on Fuzzy Systems, vol. 1, No. 1, pp. 7-31. 1993
J. Contreras, R. Misa, L. Murillo. “Obtención de Modelos Borrosos
Interpretables de Procesos Dinámicos”. RIAI: Revista Iberoamericana
de Automática e Informática Industrial, vol. 5, No. 3, pp. 70-77. Jul.
2008
J. Contreras, R. Misa, L. Murillo. “Interpretable Fuzzy Models from
Data and Adaptive Fuzzy Control: A New Approach”. IEEE
International Conference on Fuzzy Systems. IEEE Computational
Intelligence Society. Pags.: 1591-1596. Jul. 2007
Y.Chae, K. Oh, W. Lee and G. Kang. “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
Pedriycz, W. Why Triangular Membership Functions?”, IEEE Trans.
Fuzzy Sets and System, vol. 64, pp.21-30, 1994
Babuska, R. Fuzzy and Neural Control. Disc Course Lecture Notes.
Delft University of Technology. Delft, the Netherlands. 2001.
J. Espinosa, J. Vandewalle. Constructing Fuzzy Models with Linguistic
Integrity from Numerical Data-Afreli Algorithm, IEEE Trans. Fuzzy
Systems, Vol. 8, No. 5, pp. 591 – 600. Oct. 2000
Åström K.J. and Wittenmark B. Adaptive Control. Reading, MA:
Addison Wesley. 1989.
Passino, K, y Yurkovich, S. Fuzzy Control. Addison-Wesley. California.
(pp. 301-390). 1998
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