11 - Fuzzy Control FUZZY CONTROL CONVENTIONAL CONTROL Example: design a cruise control system After...
Transcript of 11 - Fuzzy Control FUZZY CONTROL CONVENTIONAL CONTROL Example: design a cruise control system After...
1
FUZZY CONTROL
CONVENTIONAL CONTROL
Example: design a cruise control system
After gaining an intuitive understanding of the plant’s dynamics and establishing the design objectives, the control engineer typically solves the cruise control problem by doing the following:
1. Developing a model of the automobile dynamics (which may model vehicle and power train dynamics, tire and suspension dynamics, the effect of road grade variations, etc.).
2. Using the mathematical model, or a simplified version of it, to design a controller (e.g., via a linear model, develop a linear controller with techniques from classical control).
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
3. Using the mathematical model of the closed-loop system and mathematical or simulation-based analysis to study its performance (possibly leading to redesign).
4. Implementing the controller via, for example, a microprocessor, and evaluating the performance of the closed-loop system (again, possibly leading to redesign).
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Mathematical model of the plant:
– never perfect
– an abstraction of the real system
– “is accurate enough to be able to design a controller that will work.”!
– based on a system of differential equations
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Performance Objectives:
1. Disturbance rejection properties (e.g., for the cruise control
problem, that the control system will be able to dampen
out the effects of winds or road grade variations).
2. Insensitivity to plant parameter variations (e.g., for the
cruise control problem, that the control system will be
able to compensate for changes in the total mass of the
vehicle that may result from varying the numbers of
passengers or the amount of cargo).
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
2
CONVENTIONAL CONTROL
Performance Objectives:
3. Stability (e.g., in the cruise control problem, to guarantee
that on a level road the actual speed will converge to the
desired set-point).
4. Rise-time (e.g., in the cruise control problem, a measure of
how long it takes for the actual speed to get close to the
desired speed when there is a step change in the set-
point speed).
5. Overshoot (e.g., in the cruise control problem, when there is
a step change in the set-point, how much the speed will
increase above the set-point).“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Performance Objectives:
6. Settling time (e.g., in the cruise control problem, how much
time it takes for the speed to reach to within 1% of the set-
point).
7. Steady-state error (e.g., in the cruise control problem, if you
have a level road, can the error between the set-point and
actual speed actually go to zero; or if there is a long
positive road grade, can the cruise controller eventually
achieve the set-point).
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Design Constraints:
Cost: How much money will it take to implement the controller,
or how much time will it take to develop the controller?
Computational complexity: How much processor power and
memory will it take to implement the controller?
Manufacturability: Does your controller have any extraordinary
requirements with regard to manufacturing the hardware
that is to implement it?
Reliability: Will the controller always perform properly? What is
its “mean time between failures?”
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Design Constraints:
Maintainability: Will it be easy to perform maintenance and
routine adjustments to the controller?
Adaptability: Can the same design be adapted to other similar
applications so that the cost of later designs can be
reduced?
Understandability: Will the people that implement it or test it be
able to fully understand it?
Politics: Is your boss biased against your approach? Is your
approach too novel and does it thereby depart too much
from standard practice?“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Controller Design:
Proportional-integral-derivative (PID) control: Over 90% of the
controllers in operation today are PID controllers. Often,
like fuzzy controllers, heuristics are used to tune PID
controllers (e.g., the Zeigler-Nichols tuning rules).
Classical control: Lead-lag compensation, Bode and Nyquist
methods, root-locus design, and so on.
State-space methods: State feedback, observers, and so on.
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
CONVENTIONAL CONTROL
Controller Design:
Optimal control: Linear quadratic regulator, use of Pontryagin’s
minimum principle or dynamic programming, and so on.
Robust control: H2 or H∞ methods, quantitative feedback
theory, loop shaping, and so on.
Nonlinear methods: Feedback linearization, Lyapunov
redesign, sliding mode control, backstepping, and so on.
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
3
CONVENTIONAL CONTROL
Controller Design:
Adaptive control: Model reference adaptive control, self-tuning
regulators, nonlinear adaptive control, and so on.
Stochastic control: Minimum variance control, linear quadratic
gaussian (LQG) control, stochastic adaptive control, and
so on.
Discrete event systems: Petri nets, supervisory control,
infinitesimal perturbation analysis, and so on.
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
FUZZY CONTROL
Fuzzy control provides a formal methodology for
representing, manipulating, and implementing a
human’s heuristic knowledge about how to control a
system.
“Fuzzy Control” Kevin M. Passino and Stephen Yurkovich
FUZZY CONTROL
Useful cases:
(1) The control processes are too complex to analyze by
conventional quantitative techniques.
(2) The available sources of information are interpreted
qualitatively, inexactly, or uncertainly.
Advantages of FLC:
(1) Parallel or distributed control multiple fuzzy rules – complex
nonlinear system
(2) Linguistic control. Linguistic terms - human knowledge
(3) Robust control. More than 1 control rules – a error of a rule
is not fatal.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Four main components of a fuzzy controller:
(1) The fuzzification interface : transforms input crisp values
into fuzzy values
(2) The knowledge base : contains a knowledge of the
application domain and the control goals.
(3) The decision-making logic :performs inference for fuzzy
control actions
(4) The defuzzification interface
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Step 1: Choice of state and control variables
State variables
– input variables of the fuzzy control system
– state, state error, state error deviation, and state error integral
are often used
Control variables
– output variables of the fuzzy control system
– selection of the variables depends on expert knowledge on the
process
http://if.kaist.ac.kr/lecture/cs670/textbook/
Step 2: Select inference method.
• Mamdani
• Larsen
• Tsukamoto
• TSK (Takagi Sugeno Kang)
• Other methods (such as SAM)
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
4
Inference method: Mamdani– minimum operator for a fuzzy implication
– max-min operator for the composition
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
0 0
0
0 0 0
01
1 1
1 1 1
1
u
u
v
v
w
wmin
α1
α2
A1A′ B′
A′ B′
B1 C1
A2 B2 C2
Inference method: Larsen
– product operator(•) for a fuzzy implication
– max-product operator for the composition
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
0 0
0
0 0 0
01
1 1
1 1 1
1
u
u
v
v
w
wmin
α1
α2
Inference method: Tsukamoto
– the consequent part : fuzzy set with
a monotonic membership function
– The rule base has the form: Ri: if u is Ai and v is Bi, then w is Ci,i = 1, 2, … , n where Ci is a monotonic function.
– the result of rule Ri :
– the aggregated result :
weighted sum – no defuzzification
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
)(ziC
µ )(ziC
µ
)(1 iCi iz αµ −= )(1 iCi iz αµ −=
21
2211
αααα
++
=′zz
z21
2211
αααα
++
=′zz
z
FUZZY CONTROL
Inference method: Tsukamoto
Graphical representation of Tsukamoto method
http://if.kaist.ac.kr/lecture/cs670/textbook/
Min
µ µ µ
u v
v
w
wu
AAAA1111BBBB1111
CCCC1111
AAAA2222BBBB2222
CCCC2222
u0
α1111
w2222
w1
α2222
Weighted AverageWeighted AverageWeighted AverageWeighted Averagev0
21
22110 αα
αα++
=ww
w
FUZZY CONTROL
Inference method: TSK (Takagi-Sugeno-Kang)
- the consequent part is given as a function of input variables.
Ri: if x is Ai and y is Bi then z is fi(x, y)
where z = f(x, y) is a crisp function of input variables x and y.
- When input data are singletons x0 and y0, then the inferred
result of rule Ri is fi(x0, y0).
- The aggregated result : weighted average using the
matching degree αi
http://if.kaist.ac.kr/lecture/cs670/textbook/
21
00220011 ),(),(
αααα
++
=′yxfyxf
z21
00220011 ),(),(
αααα
++
=′yxfyxf
z
FUZZY CONTROL
Inference method: TSK (Takagi-Sugeno-Kang)
http://if.kaist.ac.kr/lecture/cs670/textbook/
Minµ
µ
µ
µ
u v
vu
A1 B1
A2 B2
u0
α1
α2
w1=p1u0+q1v0+r1
w2=p2u0+q2v0+r2
Weighted Average
v0
21
22110 αα
αα++
=ww
w
5
Step 3: Fuzzification. Process of
making a crisp quantity fuzzy
• If it is assumed that input data
do not contain noise of
vagueness, a fuzzy singleton
can be used
• If the data are vague or
perturbed by noise, they
should be converted into a
fuzzy number
1
x0
µF(x)
x
1
x0
µF(x)
xbase
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
Step 3: Fuzzification. Process of
making a crisp quantity fuzzy
Fuzzification function
x = fuzzifier (x0)
- x0 is a observed crisp value
- x is a fuzzy set
Fuzzifier() represents a
fuzzification operator
1
x0
µF(x)
x
1
x0
µF(x)
xbase
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Step 4: Design the knowledge base.
The knowledge base consists of two parts:
1. Data base. Partition of the variable spaces
2. Rule base. Fuzzy control rules.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Data base design.
Discretization of the
universe of discourse.
http://if.kaist.ac.kr/lecture/cs670/textbook/
Range Level No.
x ≤ −2.4 −6−2.4 < x ≤ −2.0 −5
−1.6 < x ≤ −0.8 −4
−0.8 < x ≤ −0.4 −3
−0.4 < x ≤ −0.2 −2
−0.2 < x ≤ −0.1 −1
−0.1 < x ≤ +0.1 0
+0.1 < x ≤ +0.2 1
+0.2 < x ≤ +0.4 2
+0.4 < x ≤ +0.8 3
+0.8 < x ≤ +1.1 4
+1.1 < x ≤ +1.4 5
+1.4 < x 6
Example: A universe of discourse is discretized into 13
levels (-6, -5, -4, … , 0, 1, … , 5, 6).
FUZZY CONTROL
Data base design. Normalization
of the universe of discourse.
• A discretization into a
normalized universe.
• The normalized universe
consists of finite number of
segments.
• The scale mapping can be
uniform, non-uniform, or both.
http://if.kaist.ac.kr/lecture/cs670/textbook/
Range Normalized
segments
Normalized
universe
[−6.9, −4.1] [−1.0, −0.5]
[−4.1, −2.2] [−0.5, −0.3]
[−2.2, −0.0] [−0.3, 0.0] [−1.0, +1.0]
[−0.0, +1.0] [0.0, +0.2]
[+1.0, +2.5] [+0.2, +0.6]
[+2.5, +4.5] [+0.6, +1.0]
the universe of discourse [-6.9, +4.5]
is transformed into the normalized
closed interval [-1, 1].
FUZZY CONTROL
Data base design. Fuzzy partition.
• determines how many terms should
exist in a term set.
• to find the number of primary fuzzy
sets (linguistic terms)
http://if.kaist.ac.kr/lecture/cs670/textbook/
+1−1 0
Z
PN
6
FUZZY CONTROL
Data base design. Fuzzy partition.
7 linguistic terms are often used
• NB: negative big
• NM: negative medium
• NS: negative small
• ZE: zero
• PS: positive small
• PM: positive medium
• PB: positive big
http://if.kaist.ac.kr/lecture/cs670/textbook/
−1 0 +1
NM PS PM PBNS ZENB
FUZZY CONTROL
Data base design. Fuzzy partition.
The number of fuzzy terms in the
input space determines the
maximum possible number of
control rules.
http://if.kaist.ac.kr/lecture/cs670/textbook/
NB NS ZO PS PB
NB
NS
ZO
PS
x1
x2
A fuzzy partition in a 2-dimensional input space.
The maximum number of control rules = 20 (5x4)
Practical design principles for designing the
data base:
– Each membership function should overlaps
only with the closest neighboring membership
functions;
– For any possible input, its membership values
in all relevant fuzzy sets should sum to 1 (or
nearly)
* Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall
FUZZY CONTROL FUZZY CONTROL
A Membership Function that violates the second principle
* Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall
FUZZY CONTROL
A Membership Function that violates both principles
* Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall
FUZZY CONTROL
Asymmetric Membership Function that follows the guidelines
* Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall
7
FUZZY CONTROL
Data base design. Membership
functions of primary fuzzy
sets.
Various types of MFs:
- Triangular
- Trapezoidal
- Gaussian
- Bell
- etc. Example of triangular membership functions
FUZZY CONTROL
Rule base design.
Source of fuzzy control rules:
1. Expert knowledge and control engineering knowledge.
2. Observation of operator’s actions.
3. Fuzzy model of the process: linguistic description of the
dynamic properties
4. Learning: learning from example or self-organizing
learning.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Rule base design. Types of fuzzy control rules.
State evaluation fuzzy rules: state variables in the antecedent part, control variables in the consequent part.
– a collection of rules of the form(MISO version)
R1: if x is A1, … and y is B1 then z is C1…
Rn: if x is An, … and y is Bn then z is Cn
where x, … y and z are linguistic variables representing the process state variable and the control variable. Ai, … Bi and Ci are linguistic values of the variables x, … y and z in the universe of discourse U, … V and W, respectively i = 1, 2, … , n.That is, x ∈ U, Ai ⊂ U, …, y ∈ V, Bi ⊂ V, z ∈W, Ci ⊂W
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Rule base design. Types of fuzzy control rules.
General representation of state evaluation fuzzy rules:
Ri: if x is Ai, … and y is Bi then z = fi(x, … y)
- The state evaluation rules evaluate the process state (e.g. state, state error, change of error) at time t and compute a fuzzy control action at time t.
- In the input variable space, the combination of input linguistic term may give a fuzzy rule.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Rule base design. Types of fuzzy control rules.
A set of fuzzy rules
Ri: if x is Ai, and y is Bi then z is Ci, i = 1, 2, … , n
Can be represented as a rule table
http://if.kaist.ac.kr/lecture/cs670/textbook/
C1 C2 …
C3 C4 C4
Cn C5 C5
C6
A1 A2 … An
B1
B2
Bn
…
y
x
C7
FUZZY CONTROL
Rule base design. Types of fuzzy control rules.
Object evaluation fuzzy rules: predictive fuzzy control.
A collection of rules of the form
R1: if (z is C1 → (x is A1 and y is B1)) then z is C1.
…
Rn: if (z is Cn → (x is An and y is Bn)) then z is Cn.
– A control action is determined by an objective evaluation that satisfies
the desired states and objectives.
– x and y are performance indices for the evaluation and z is control command.
– Aiand B
iare fuzzy values such as NM and PS.
– The most likely control rule is selected through predicting the results (x, y) corresponding to every control command C
i, i = 1, 2, … , n.
http://if.kaist.ac.kr/lecture/cs670/textbook/
8
Step 5: Select defuzzification method.
• In many practical applications, a control command is given as a crisp value.
• a process to get a non-fuzzy control action that best represents the possibility distribution of an inferred fuzzy control action.
• no systematic procedure for choosing a good defuzzification strategy
• select one in considering the properties of application case
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Defuzzification methods.
• Centroid
• Mean-of-maximum
• Weighted average
http://if.kaist.ac.kr/lecture/cs670/textbook/
∑=
=k
j
j
k
zz
1
0 ∑=
=k
j
j
k
zz
1
0
Step 6: Test and tuning.
- Adjust data base
- Adjust rule base
- Try different inference methods
- Try different defuzzification methods
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
Step 7: (Optional) Produce a Lookup table.
• Due to the problem of time complexity, it may take a long time to compute the fuzzy inference and defuzzification.
• A lookup table shows relationships between the input variables and control output actions.
• A lookup table can be constructed after making the FLC and identifying the relationships between the input and output variables.
• In general, it is extremely difficult to get an acceptable lookup table of a nonlinear control system without constructing a corresponding FLC.
FUZZY CONTROL
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Step 7: (Optional) Produce a Lookup table.
The control surface can be represented as a table
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
Review of the design procedure.
Step 1: Determination of state variables and control
variables
Step 2: Selection of the inference method
-Mamdani
-Larsen
-Tsukamoto
-TSK
Step 2: Selection of the fuzzification method
http://if.kaist.ac.kr/lecture/cs670/textbook/
9
FUZZY CONTROL
Review of the design procedure.
Step 4: Determination of the knowledge base
- Discretization and normalization of state variable space
- Partition of variable space.
- Selection of the MF shapes
- Design of the rule base
Step 5: Selection of defuzzification strategy
Step 6: Test and tuning
Step 7: Construction of a lookup table
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
• Servomotors are used in many automatic
system including drivers for printers, floppy
disks, tape recorders, and robot manipulations.
• The servomotor process shows nonlinear
properties
• The goal is to apply the fuzzy logic control to the
motor control.
• The task of the control is to rotate the shaft of
the motor to a set point without overshoot.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
1) Determination of state variables and control variable
(1) State variables (input variable of FLC):
- Error : the set point minus the process output (e).
- Change of error (ce) : the error from the process output minus the error from the last process output.
(2) Control variable (output variable of FLC):
- Control input (v) : the voltage applied to the process.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
2) Determination of inference method
- The Mandani inference method is selected for its simplicity
3) Determination of fuzzification method
- fuzzy singleton : measure the state variables without uncertainty
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Discretization and normalization
– The shaft encoder of the motor has a resolution of 1000.
– The universes of discourse are as follows:
−1000 ≤ e ≤ 1000 −100 ≤ ce ≤ 100– The servo amplifier has an output range of 30 V and thus the control variables (v) are in the range −30 ≤ v ≤ 30
– We discretize and normalize the input variables in the range [−1, +1] (next slide).
– The control variable v is normalized in the range [−1, +1] with the equation
http://if.kaist.ac.kr/lecture/cs670/textbook/
vv30
1=′ vv30
1=′
10
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Discretization and normalization
http://if.kaist.ac.kr/lecture/cs670/textbook/
error (e) error change (ce) quantized level
−1000 ≤ e ≤ −800 −100 ≤ ce ≤ −80 −1.0
−800 < e ≤ −600 −80 < ce ≤ −60 −0.8
−600 < e ≤ −400 −60 < ce ≤ −40 −0.6
−400 ≤<e ≤ −200 −40 < ce ≤ −20 −0.4
−200 < e ≤ −100 −20 < ce ≤ −10 −0.2
−100 < e ≤ 100 −10 < ce ≤ 10 0
100 < e ≤ 200 10 < ce ≤ 20 0.2
200 < e ≤ 400 20 < ce ≤ 40 0.4
400 < e ≤ 600 40 < ce ≤ 60 0.6
600 < e ≤ 800 60 < ce ≤ 80 0.8
800 < e ≤ 1000 80 < ce ≤ 100 1.0
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Partition of input and output spaces
- Partition space of each input and output variable into seven regions.
- Each region is associated with a linguistic term
- The maximum number of possible fuzzy rules is 49.
http://if.kaist.ac.kr/lecture/cs670/textbook/
NM NS ZE PS PM PB
−1
NB
0 +1 e cev
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Determination of the shapes of fuzzy sets
- Input and output variables are normalized on the interval[-1, +1]
- The input and partitioned into seven linguistic terms
- Select triangular fuzzy sets
http://if.kaist.ac.kr/lecture/cs670/textbook/
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 1.00.4 0.6 0.8
NB NM PBNS PMPSZE
0.5
1
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Construction of the rules– We interviewed with an expert of the servomotor control, and we
collect knowledge such as:
“If the error is zero and the error change is positive small, then the control input is negative small”
(1) If e is PB and ce is any, then v is PB.
(2) If e is PM and ce is NB, NM, or NS, then v is PS.
(3) If e is ZE and ce is ZE, PS, or PM, then v is ZE.
(4) If e is PS and ce is NS, ZE, or PS, then v is ZE.
(5) If e is NS and ce is NS, ZE, PS, or PM, then v is NS.
(6) If e is NS or ZE and ce is PB, then v is PS.
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
4) Construction of the rules
http://if.kaist.ac.kr/lecture/cs670/textbook/
NB NM PMPSZENS PB
NB
NM
NS
ZE
PS
PM
NB
PB PB
PSPM
ZENS
NM
NSPS
ce
e
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
5) Select centroid defuzzification
6) Test and tune. Compare performance to classical control
http://if.kaist.ac.kr/lecture/cs670/textbook/
11
FUZZY CONTROL EXAMPLE-
SERVOMOTORS
Design procedure for servomotor control
7) Construction the look-up table
http://if.kaist.ac.kr/lecture/cs670/textbook/
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Harder formulation:
Back-up a truck-trailer to a dock
Simple formulation:
Back-up a truck to a dock.
Approach the dock at 90º angle!
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Truck-and-trailer
dynamics:
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Truck dynamics:
Θ - steering angle
ϕ - truck angle
x,y – truck position
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Assumption: The truck
travels at constant
velocity V and truck
length is L.
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
The truck dynamics can
be represented in
complex form:
Θ=
Θ=
+=
−
sin
)(cos 2
L
V
dt
d
eVdt
dp
jyxp
j
ϕ
πϕ
Θ=
Θ=
+=
−
sin
)(cos 2
L
V
dt
d
eVdt
dp
jyxp
j
ϕ
πϕ
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
12
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
In MATLAB:
function ds=trukmod(s,u) % s(1) =x, s(2)=y, s(3)=f, u = q
% Angles are in radians.
% CONSTANTS
L = 1; % Length of truck.
v = 1; % Velocity of truck.
% STATES
pos = s(1) + sqrt(-1)*s(2); angle = s(3);
% DERIVATIVES
dpos = v*cos(u)*exp(j*(angle-pi/2)); dangle = v*sin(u)/L;
ds = [real(dpos); imag(dpos); dangle];
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
The universe of
discourse:
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy sets for horizontal position:
- far left, left, center, right, far right
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy sets for truck angle:
- 0, 60, 120, 180, 240, 300, 360
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy sets for steering angle:
- hard left, left, soft left, center, soft right, right, hard right
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy rules:
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
13
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy rules:
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
MATLAB simulation:
% assume time step = 0.2 second
dt = 0.2;
For I=1:100
if rem(I,5) == 1
% Evaluate controller once a second
% (5 time steps *0.2 seconds)
theta = frule(A,C,Z,[s(1);s(3)]);
end
s = s + dt * truckmod (s,theta);
end
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
MATLAB simulation: trukcon1
Problem: the truck takes too long toget exactly to thecenter line
Reason: coarsedefinition of thehorizontal position
Solution: redefine
fuzzy sets for the horizontal position
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
Fuzzy sets for horizontal position:
- far left, left, center, right, far right
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
MATLAB simulation:trukcon2
Redefinition of the fuzzy sets
for the horizontal position
significantly improved
the results
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth
FUZZY CONTROL EXAMPLE-
TRUCK BACKER-UPPER
JAVA simulation: FuzzyTruck.html
http://www.iit.nrc.ca/IR_public/fuzzy/FuzzyTruck.html
14
SUMMARY
Classical control does not provide a “perfect” solution
Fuzzy control is a formal methodology for implementing control systems based on human’s heuristic knowledge
Design procedure:
Step 1: Determination of state variables and control variables
Step 2: Selection of the inference method
Step 2: Selection of the fuzzification method
SUMMARY
Step 4: Determination of the knowledge base
- Discretization and normalization of state variable space
- Partition of variable space.
- Selection of the MF shapes
- Design of the rule base
Step 5: Selection of defuzzification strategy
Step 6: Test and tuning
Step 7: Construction of a lookup table