Fuzzy Logic Control
Fuzzy Logic Control
Fuzzy Logic Control
K. Craig
Introduction
What is Fuzzy Logic?
Introductory Example: Fuzzy vs. Non-Fuzzy
Control
Overview
Conventional Control System Design
Fuzzy Control System Design
K. Craig
Introduction
Choosing Fuzzy Controller Inputs and Outputs
Putting Control Knowledge into Rule Bases
Fuzzy Quantification of Knowledge
Matching: Determining Which Rules to Use
Inference Step: Determining Conclusions
Converting Decisions into Actions
Tuning via Scaling Universes of Discourse
Tuning Membership Functions
The Nonlinear Surface of the Fuzzy Controller
Summary: Basic Design Guidelines
K. Craig
References
Fuzzy Control
Kevin Passino and Stephen Yurkovich
Addison Wesley, 1998
K. Craig
Introduction
There has been a rapid growth in the number and
variety of applications of fuzzy logic:
Consumer Products, e.g., cameras, camcorders, washing
machines, microwave ovens
Industrial Process Control
Medical Instrumentation
K. Craig
K. Craig
K. Craig
K. Craig
K. Craig
Black
Box
Output Space
K. Craig
10
K. Craig
11
K. Craig
12
K. Craig
13
Introductory Example:
Fuzzy vs. Non-Fuzzy
Lets look at two different approaches to the same
problem: linear and fuzzy.
Consider the restaurant tipping problem:
What is the right amount to tip your waitperson in a
restaurant?
Given a number between 0 and 10 (where 10 is
excellent) that represents the quality of service at a
restaurant, what should the tip be?
The average tip for a meal in the U.S. is 15%.
Fuzzy Logic & Fuzzy Control
K. Craig
14
Non-Fuzzy Approach
Suppose that the tip always equals 15% of the total bill.
0.25
0.2
Tip = 15%
tip
0.15
0.1
0.05
10
service
K. Craig
15
0.20
tip =
service + 0.05
10
tip
0.2
0.15
0.1
0.05
10
service
K. Craig
16
K. Craig
17
K. Craig
18
=
+
tip ServiceRatio
service 0.05
10
0.20
food + 0.05
+ (1 ServiceRatio )
10
K. Craig
19
K. Craig
20
MatLab Code
x = service
x=0:.5:10;
for i=1:length(x)
if x(i)<3
tip(i)=(0.10/3)*x(i)+0.05;
elseif x(i)<7,
tip(i)=0.15;
elseif x(i)<=10,
tip(i)=(0.10/3)*(x(i)-7)+0.15;
end
end
K. Craig
21
0.25
tip
0.2
0.15
0.1
0.05
10
service
Fuzzy Logic & Fuzzy Control
K. Craig
22
MatLab Code
x = service
y = food
x=0:.5:10;
y=0:.5:10;
for i=1:length(x)
for j=1:length(y)
if x(i)<3
tip(i,j)=((0.1/3)*x(i)+0.05)*0.8+0.2*
(0.2/10*y(j)+0.05);
elseif x(i)<7,
tip(i,j)=0.15*0.8+0.2*(0.2/10*y(j)+0.
05);
else,
tip(i,j)=((0.10/3)*(x(i)7)+0.15)*0.8+0.2*(0.2/10*y(j)+0.05);
end
end
end
K. Craig
23
K. Craig
24
K. Craig
25
Fuzzy Approach
It would be nice if we could just capture the essentials of
this problem, leaving aside all the factors that could be
arbitrary.
If we make a list of what really matters in this problem,
we might end up with the following rule descriptions:
K. Craig
26
These three rules are the core of our solution. These are
the rules for a fuzzy logic system. If we give
mathematical meaning to the linguistic variables, we
would have a complete fuzzy inference system.
Of course, there is a lot left to the methodology of fuzzy
logic, e.g.,
How are the rules all combined?
How do I define mathematically what an average tip is?
K. Craig
27
tip
20
15
10
10
5
food
10
service
K. Craig
28
Control
Overview
When confronted with a control problem for a
complicated physical process, there is a relatively
systematic control design procedure:
Gain an intuitive understanding of the plants dynamics and
establish the design objective.
Develop a physical and mathematical model of the plant
dynamics.
Use the mathematical model, or a simplified version of it,
to design a controller.
K. Craig
29
K. Craig
30
K. Craig
31
E(s)
B(s)
D(s)
+
+
G c (s)
G(s)
C(s)
H(s)
K. Craig
32
K. Craig
33
There are certain properties of the plant that the control engineer
often seeks to identify early in the design process, e.g., stability
of the plant, effects of certain nonlinearities, controllability of
the plant, observability of the plant. These properties have a
fundamental impact on our ability to design effective controllers.
In addition, the engineer will try to make a general assessment
of how the plant behaves under various conditions, how the
plant dynamics may change over time, and what random effects
are present.
K. Craig
34
Disturbance-rejection properties
Insensitivity to plant parameter variations
Stability
Rise-time
Overshoot
K. Craig
35
Settling time
Steady-state error
Cost
Computational complexity
Manufacturability
Reliability
Maintainability
Adaptability
Understandability
Politics
K. Craig
36
K. Craig
37
Controller Design
Conventional control has provided numerous methods
for constructing controllers for dynamic systems:
PID control: Over 90% of the controllers in operation today are
PID controllers. This approach is often viewed as simple,
reliable, and easy to understand. Often, like fuzzy controllers,
heuristics are used to tune PID controllers (e.g., the ZeiglerNichols tuning rules)
Classical Control: lead-lag compensation, Bode and Nyquist
methods, root-locus design,
State-Space Methods: state feedback, observers,
Optimal Control: linear quadratic regulator,
Robust Control: H2 and H methods, loop shaping,
Nonlinear Methods: feedback linearization, sliding mode
control, backstepping,
Fuzzy Logic & Fuzzy Control
K. Craig
38
K. Craig
39
K. Craig
40
Mathematical Analysis
In mathematical analysis you may seek to prove that the system
is stable, controllable, or that other closed-loop specifications
such as disturbance rejection, rise time, overshoot, settling time,
and steady-state errors have been met.
Clearly, however, there are several limitations to mathematical
analysis.
First, it always relies on the accuracy of the mathematical
model, which is never a perfect representation of the plant, so
conclusions that are reached from the analysis are in a sense
only as accurate as the model that they are developed from.
Mathematical analysis proves that properties hold for the
mathematical model, not for the real physical system.
Second, existing theory is somewhat lacking for the analysis of
complex nonlinear control systems, particularly when there are
significant nonlinearities, a large number of inputs and outputs,
and stochastic effects.
Fuzzy Logic & Fuzzy Control
K. Craig
41
Simulation-Based Analysis
In simulation-based analysis we seek to develop a simulation
model of the physical system. This can entail using physics to
develop a mathematical model and perhaps real data can be used
to specify some of the parameters of the model (e.g., via system
identification or direct parameter measurement). The simulation
model can be made quite accurate and this truth model will be
more complex than the model used for control design.
There are always limitations on what can be achieved in
simulation-based analysis.
First, as with the mathematical analysis, the model that is
developed will never be perfectly accurate.
Second, some properties simply cannot be fully verified via
simulation studies, e.g., asymptotic stability of an ordinary
differential equation (simulations can only run for a finite
amount of time and only a finite number of initial conditions can
be tested for these finite-length trajectories).
Fuzzy Logic & Fuzzy Control
K. Craig
42
Experimental Investigations
To conduct an experimental investigation of the performance of a
control system, you implement the control system for the plant and
test it under various conditions.
This can require significant resources, and for some plants you
would not even consider doing an implementation until extensive
mathematical and simulation-based investigations have been
performed.
Experimental evaluation does shed some light on issues like cost,
reliability, and maintainability.
Limitations include problems with repeatability of experiments and
variations in physical components.
Getting the system to actually work does enhance ones confidence!
Fuzzy Logic & Fuzzy Control
K. Craig
43
K. Craig
44
K. Craig
45
Questions ?
How much of the success can be attributed to the use of
modeling and conventional control design, and how
much should be attributed to the clever heuristic tuning
that the control engineer uses upon implementation?
If we exploit the use of heuristic information throughout
the entire design process, can we obtain higher
performance control systems?
Fuzzy Logic & Fuzzy Control
K. Craig
46
K. Craig
47
Reference
Input
r(t)
Fuzzification
Fuzzy Controller
Inference
Mechanism
Inputs
Process
Rule
Base
u(t)
Outputs
y(t)
K. Craig
48
K. Craig
49
K. Craig
50
K. Craig
51
K. Craig
52
K. Craig
53
K. Craig
54
Performance Evaluation
The ideas presented on performance evaluation for
conventional controllers applies here as well, because the
fuzzy controller is a nonlinear controller, so many
conventional modeling, analysis, and design ideas apply
directly.
What value does fuzzy logic control have relative to
conventional methods? Detailed comparative analyses are
few, and, moreover, most work in fuzzy control to date has
focused only on its advantages and has not taken a critical
look at what possible disadvantages there could be to using
it.
The following questions are cause for concern when you
employ a strategy of gathering heuristic control knowledge:
Fuzzy Logic & Fuzzy Control
K. Craig
55
Will the behaviors that are observed by a human expert and used
to construct the fuzzy controller include all situations that can
occur due to disturbances, noise, or plant parameter variations?
Can the human expert realistically and reliably forsee problems
that could arise from closed-loop system instabilities or limit
cycles?
Will the human expert be able to effectively incorporate stability
criteria and performance objectives into a rule base to ensure
that reliable operation can be obtained?
K. Craig
56
Application Areas
In engineering potential application areas include:
Aircraft/Spacecraft
Flight control, engine control, failure diagnosis, navigation,
satellite attitude control
Automobiles
Brakes, transmission, suspension, and engine control
Autonomous Vehicles
Ground and underwater
Manufacturing Systems
Scheduling and deposition process control
Fuzzy Logic & Fuzzy Control
K. Craig
57
Power Industry
Motor control, power control/distribution, load estimation
Process Control
Temperature, pressure, and level control, failure diagnosis,
distillation column control, and desalination processes
Robotics
Position control and path planning
K. Craig
58
K. Craig
59
Reference
Input
r(t)
Fuzzification
Fuzzy Controller
Inference
Mechanism
Inputs
Process
Rule
Base
u(t)
Outputs
y(t)
K. Craig
60
K. Craig
61
m, I
x
y
Pulley and Encoder
Pulley Radius = r
mr , A , Ir
Pulley
Pulley Radius = r
Encoder
Rails
Cart - Mass M
Motor
K. Craig
62
K. Craig
63
K. Craig
64
K. Craig
65
K. Craig
66
K. Craig
67
error is poslarge
error is negsmall
error is zero
error is poslarge and rate-of-change in error is possmall
error is negsmall and rate-of-change in error is possmall
K. Craig
68
K. Craig
69
K. Craig
70
error
force
-2
-1
0
1
2
-2
2
2
2
1
0
-1
2
2
1
0
-1
0
2
1
0
-1
-2
1
1
0
-1
-2
-2
2
0
-1
-2
-2
-2
K. Craig
71
K. Craig
72
1.0
( / 2) = 0 0.5
( / 8) = 0.5
( / 4) = 1.0
( / 2) = 0
Fuzzy Logic & Fuzzy Control
e(t) (rad)
universe
of
discourse
K. Craig
73
K. Craig
74
Membership Functions:
The only condition a membership function must really
satisfy is that it must vary between 0 and 1. The function
itself can be an arbitrary curve whose shape we can
define as a function that suits us from the point of view
of simplicity, convenience, speed, and efficiency.
The simplest membership functions are formed using
straight lines. The simplest is the triangular membership
function a collection of three points forming a triangle.
The trapezoidal membership function has a flat top and
really is just a truncated triangle curve.
These straight-line membership functions have the
advantage of simplicity.
K. Craig
75
K. Craig
76
K. Craig
77
trapmf
gbellmf
trimf
gaussmf
gauss2mf
smf
0.8
0.6
0.4
0.2
0
zmf
psigmf
dsigmf
pimf
sigmf
0.8
0.6
0.4
0.2
0
K. Craig
78
K. Craig
79
K. Craig
80
Butter
Monday
Thursday
Saturday
Liberty
K. Craig
81
Sunday
Friday
Butter
Thursday
Saturday
Liberty
Fuzzy Set: Days of the Weekend
Friday feels like part of the weekend, but technically it
should be excluded. Friday sits on the fence fence sitting
is part of life.
Fuzzy Logic & Fuzzy Control
K. Craig
82
K. Craig
83
1.0
Weekend-ness
0.0
Thursday Friday Saturday Sunday Monday
Days of the Weekend: Two-Valued Membership
1.0
Weekend-ness
Membership
Function
0.0
Thursday Friday Saturday Sunday Monday
Days of the Weekend: Multi-Valued Membership
K. Craig
84
K. Craig
85
Sharp-Edged
Membership
Function for
Tall
Continuous
Membership
Function for Tall
Fuzzy Logic & Fuzzy Control
K. Craig
86
K. Craig
87
Note that for the inputs e(t) and de(t)/dt the outermost
membership functions saturate at a value of one. This
makes intuitive sense as at some point the human expert
would just group all large values together in a linguistic
description such as poslarge.
For the output u, the membership functions at the
outermost edges cannot be saturated for the fuzzy system
to be properly defined since we seek to take actions that
specify an exact value for the process input. We do not
generally indicate to a process actuator, any value
bigger than say, 10, is acceptable.
We see that the membership functions quantify the
meaning of linguistic statements that describe timevarying signals.
Fuzzy Logic & Fuzzy Control
K. Craig
88
Fuzzification
For most fuzzy controllers the fuzzification process
is very simple and can be virtually ignored. It is
simply the act of obtaining a value of an input
variable (e.g., e(t)) and finding the numeric values
of the membership function(s) that are defined for
that variable.
Fuzzy Logic & Fuzzy Control
K. Craig
89
dt
K. Craig
90
K. Craig
91
K. Craig
92
K. Craig
93
K. Craig
94
e(t) =
e(t) =
dt
32
K. Craig
95
K. Craig
96
K. Craig
97
K. Craig
98
K. Craig
99
e(t)
force
-2
-1
0
1
2
-2
2
2
2
1
0
-1
2
2
1
0
-1
0
2
1
0
-1
-2
de(t)/dt
1
1
0
-1
-2
-2
2
0
-1
-2
-2
-2
K. Craig
100
K. Craig
101
K. Craig
102
K. Craig
103
K. Craig
104
K. Craig
105
K. Craig
106
K. Craig
107
K. Craig
108
crisp
=
i
(i)
(i)
109
Defuzzification Methods
1
0.8
centroid
0.6
bisector
0.4
0.2
Methods:
centroid of area
bisector of area
mean of maximum
smallest of maximum
largest of maximum
0
-10
mom
lom
-8
som
-6
-4
-2
10
1
0.8
centroid
0.6
bisector
0.4
mom
0.2
0
-10
som
-8
-6
-4
-2
lom
4
K. Craig
10
110
h2
wh
2
K. Craig
111
crisp
(0)(4.375) + (10)(9.375)
=
= 6.81 N
4.375 + 9.375
K. Craig
112
Summary:
Graphical Depiction
of
Fuzzy Controller Operations
Fuzzy Logic & Fuzzy Control
K. Craig
113
K. Craig
114
K. Craig
115
K. Craig
116
K. Craig
117
K. Craig
118
K. Craig
119
K. Craig
120
volts
1
0
-1
-2
1
0.5
0
-0.5
thetadot
-1
-0.2
-0.1
0.1
0.2
theta
K. Craig
121
1.5
1
volts
0.5
0
-0.5
-1
-1.5
1
0.5
0.4
0.2
0
-0.5
xdot
-0.2
-1
-0.4
K. Craig
122
K. Craig
123
K. Craig
124
K. Craig
125
K. Craig
126