Fuzzy Logic Controller

Download Report

Transcript Fuzzy Logic Controller

Artificial Intelligence – CS364
Fuzzy Logic
Lectures on Artificial Intelligence – CS364
Fuzzy Control
25th October 2005
Dr Bogdan L. Vrusias
[email protected]
Artificial Intelligence – CS364
Fuzzy Logic
Contents
•
•
•
•
Definitions
Controllers
Fuzzy Logic Controller
Example
25th October 2005
Bogdan L. Vrusias © 2005
2
Artificial Intelligence – CS364
Fuzzy Logic
Definition of Fuzzy Control
• The term control is generally defined as a mechanism used
to guide or regulate the operation of a machine, apparatus
or constellations of machines and apparatus.
• Often the notion of control is inextricably linked with
feedback: a process of returning to the input of a device a
fraction of the output signal.
• Feedback can be negative, whereby feedback opposes and
therefore reduces the input, or feedback can be positive
whereby feedback reinforces the input signal.
25th October 2005
Bogdan L. Vrusias © 2005
3
Artificial Intelligence – CS364
Fuzzy Logic
Conventional Feedback Control
•
Feedback control is thus a mechanism for guiding or regulating the
operation of a system or subsystems by returning to the input of the
(sub)system a fraction of the output.
w
e
C
u
S
y
• The machinery or apparatus etc., to be guided or regulated is denoted
by S, the input by W and the output by y, and the feedback controller
by C. The input to the controller is the so-called error signal e and the
purpose of the controller is to guarantee a desired response of the
output y.
25th October 2005
Bogdan L. Vrusias © 2005
4
Artificial Intelligence – CS364
Fuzzy Logic
Fuzzy Logic Controllers
• By a fuzzy logic controller (FLC) we mean a control law that is
described by a knowledge-based system consisting of IF...THEN rules
with vague predicates and a fuzzy logic inference mechanism.
• The rule base is the main part of the FLC. It is formed by a family of
logical rules that describes the relationship between the input e and the
output u of the controller.
• The main difference between a conventional control system and a
fuzzy logic controlled system is not only in the type of logic (Boolean
or fuzzy) but in the inspiration.
– The former attempts to increase the efficiency of control algorithms;
– the latter is based on the implementation of human understanding and
human thinking in control algorithms.
25th October 2005
Bogdan L. Vrusias © 2005
5
Artificial Intelligence – CS364
Fuzzy Logic
Fuzzy Logic Controllers
• Logical rules with vague predicates can be used to derive
inference from vaguely formulated data.
• The idea of linguistic control algorithms was a brilliant
generalisation of the human experience of using linguistic
rules with vague predicates in order to formulate control
actions.
• The main paradigm of fuzzy control is that the control
algorithm is a knowledge-based algorithm, described by
the methods of fuzzy logic.
25th October 2005
Bogdan L. Vrusias © 2005
6
Artificial Intelligence – CS364
Fuzzy Logic
Fuzzy Logic Vs Conventional Controllers
w
e
C
u
y
S
Conventional Control System
e(t)
-1
D u(t)
FLC
Internal
Structure
e(t)
D e(t)
Z
Z
u(t)
-1
Fuzzy-logic based Control System
25th October 2005
Bogdan L. Vrusias © 2005
7
Artificial Intelligence – CS364
Fuzzy Logic
Fuzzy Logic Controller
• A fuzzy controller is a device that is intended to manage
some vaguely known or vaguely described process.
• The controller can be used with the process in two modes:
– feedback mode when the fuzzy controller will act as a control
device;
– feedforward mode where the controller can be used as a prediction
device.
• All inputs to, and outputs from, the controller are in the
form of linguistic variables. In many ways, a fuzzy
controller maps the input variables into a set of output
linguistic variables.
25th October 2005
Bogdan L. Vrusias © 2005
8
Artificial Intelligence – CS364
Fuzzy Logic
Fuzzy Logic Controller
• A typical fuzzy logic controller is described by the
relationship between change of control u(t), at a given time
t, on the one hand
Du(t) = f(e(t), De(t))
and the change in the error e(t)
De(t) = e(t) – e (t – 1)
25th October 2005
Bogdan L. Vrusias © 2005
9
Artificial Intelligence – CS364
Fuzzy Logic
Example
• Consider the task of driving a car. As you drive along, you notice that
the stoplight ahead is red and the car in front of you is braking. Your
(very rapid) thought process might be something like this: "I see that I
need to stop. The road is wet because it's raining. The car is only a
short distance in front of me. Therefore, I need to apply significant
pressure to the brake pedal immediately." This reasoning takes place
subconsciously, of course, but that's the way our brains work—in fuzzy
terms.
• Human brains do not base such decisions on the precise distance to the
car ahead or the exact coefficient of friction between the tires and the
road, as an embedded computer might. Likewise, our brains do not use
a Kalman filter to derive the optimal pressure that should be applied to
the brakes at a given moment. Our brains use common-sense rules,
which seems to work pretty well.
(from http://www.embedded.com/showArticle.jhtml?articleID=10700619)
25th October 2005
Bogdan L. Vrusias © 2005
10
Artificial Intelligence – CS364
Fuzzy Logic
Example
• When we finally get around to pressing the brake pedal, we apply an
exact force, let's say 23.26 pounds. So although we reason in fuzzy
terms, our final actions are considerably less so.
• Let's think about how a fuzzy cruise control system might work. The
cruise controller maintains a constant vehicle speed in spite of
neverending changes in road grade, wind resistance, and other
variables. The controller does this by comparing the commanded speed
with the actual speed. We can call the difference between commanded
and actual speed current error. The error change is the difference in
error from one sample period to the next.
• If the current error is a small positive number—vehicle speed is slower
than commanded—the controller needs to slightly increase the throttle
angle in order to speed up the vehicle appropriately.
25th October 2005
Bogdan L. Vrusias © 2005
11
Artificial Intelligence – CS364
Fuzzy Logic
Example
• If both current error and error change are positive, the vehicle is going
too slowly and decelerating. In this case, the controller needs to
increase the throttle angle by a larger amount to achieve the desired
speed.
[Current Error]
-------------------------------------------------------------------------------[Error Change] | Negative
Zero
Positive
Negative
| Large Negative Negative
Zero
Zero
| Negative
Zero
Positive
Positive
| Zero
Positive
Large Positive
• The controller inputs are the variables current error and error change.
The output represents a fuzzy specification of how much to change the
throttle.
25th October 2005
Bogdan L. Vrusias © 2005
12
Artificial Intelligence – CS364
Fuzzy Logic
Example
• Suppose current error is -5 mph and error change is -1 mph/s. We
might define a speed error of -5 mph as 75% "negative" and 25%
"large negative." Similarly, we might define an error change of -1 mph
as 50% "zero" and 50% "negative".
• We then follow the 4 standard Fuzzy Inference steps to calculate the
throttle change.
• We measure the new speed and we accordingly chanege the inputs.
25th October 2005
Bogdan L. Vrusias © 2005
13
Artificial Intelligence – CS364
Fuzzy Logic
Closing
•
•
•
•
Questions???
Remarks???
Comments!!!
Evaluation!
25th October 2005
Bogdan L. Vrusias © 2005
14