Fuzzy Logic Control • Fuzzy Logic Control FLC or sometimes known as Fuzzy Linguistic Control is a knowledge based control strategy that can be used - when either a sufficient accurate
Trang 1CS 561, Sessions 22-23 1
What is fuzzy logic?
• A super set of Boolean logic
• Builds upon fuzzy set theory
• Graded truth Truth values between True and
black/white, on/off etc.
• Grades of membership Class of tall men,
class of far cities, class of expensive things,
etc.
• Lotfi Zadeh, UC/Berkely 1965 Introduced FL
to model uncertainty in natural language
Tall, far, nice, large, hot, …
• Reasoning using linguistic terms Natural to express expert knowledge
clothing
Trang 2CS 561, Sessions 22-23 2
Why use fuzzy logic?
Pros:
• Conceptually easy to understand w/ “natural” maths
• Tolerant of imprecise data
• Universal approximation: can model arbitrary nonlinear functions
• Intuitive
• Based on linguistic terms
• Convenient way to express expert and common sense knowledge
Cons:
• Not a cure-all
• Crisp/precise models can be more efficient and even convenient
• Other approaches might be formally verified to work
Trang 3Issues of Fuzzy logic Control
• Requires tuning of membership functions
• Fuzzy Logic control may not scale well to large or complex problems
• Deals with imprecision, and vagueness, but not uncertainty
Trang 4CS 561, Sessions 22-23 4
Limitations of fuzzy logic
• How to determine the membership functions? Usually requires fine-tuning of parameters
• Defuzzification can produce undesired results
Trang 5Application (2)
Fuzzy Logic Control
Trang 7Conventional Control System
The dynamic filter compute all the system dynamics: x (state variables) consists of selected elements of e = r – y, de/dt, or ∫edτ
.
Plant
Conventional PID Controller Architecture
y u
Dynamic Filter
r x
PID Controller Algorithm
Mathematical Model
Trang 8Fuzzy Logic Control
• Fuzzy Logic Control (FLC) or sometimes known as Fuzzy Linguistic
Control is a knowledge based control strategy that can be used
- when either a sufficient accurate and yet not unreasonably
complex model of the plant is unavailable, or
- when a (single) precise measure of performance is not meaningful
or practical.
• FLC design is based on empirically acquired knowledge regarding the
operation of the process
• This knowledge, cast into linguistic, or rule-based form, is the core of
the FLC system.
• FLC is particularly useful when the plant model is unknown or difficult
to develop
Trang 9FLC Architecture
The rule base (knowledge base) provides nonlinear transformations without any built-in dynamics
Decoder (Defuzzifier)
Knowledge Base
Encoder (Fuzzifier)
Plant Inference
Engine
Fuzzy Logic Controller Architecture
y u
Dynamic Filter
r x
Trang 10Fuzzification
Fuzzy quantization of the state variables For example, the state
variable "Angle" may be quantified into a set of linguistic variables,
with two parameters, polarity and size:
Fuzzification converts a crisp sensor reading (value of state variable),
x = xo, into the membership to these linguistic variables:
Trang 11Control Rule Base
• General form of rule:
IF x1 is A1 AND • • • AND xM is AM, Antecedent THEN y1 is B1 AND • • • AND yN is BN Consequent
• The rule base form a fuzzy partition of the
multi-dimensional space
A3 A2
A1 B1
Trang 12Fuzzy Inference
• When input variables are fuzzified, each rule in the rule base
will be used to determine its degree of activation using fuzzy logic operations, e.g union, intersection, and complement
• For rules which has a non-zero activation value, the output fuzzy variables will be combined (fuzzy union) yielding a resultant fuzzy set
0 0.1
C
z is 2 (0.2)
0 0.5 1
C
z is 3 (0.5)
Z Z
Trang 13• The resultant fuzzy set needs to be quantified into a crisp
signal as the control output
• For example, a certain voltage should be determined to drive
a motor
Fuzzy Set Crisp Value
Trang 14Example: automotive driving
Design a control to keep distance between cars.
distance Current speed
Adjust
Speed?
Trang 15Example: automotive driving
Keep distance between cars:
Step 1: construction of control rules:
Rule 1: IF distance between cars is short
AND speed is slow
THEN hold the gas pedal steady (maintain the speed).
Rule 2: IF distance between cars is short
AND speed is fast
THEN step on the brake (reduce the speed)
Rule 3: IF distance between cars is long
AND speed is slow
THEN step on the gas pedal (increase the speed)
Rule 4: IF distance between cars is long
AND speed is fast
THEN hold the gas pedal steady (maintain the speed)
Trang 16Example: automotive driving
Step 2: Define fuzzy sets and rewrite the control rules accordingly
Fuzzy sets:
• Distance X(0-40m): A1 - “short”; A2 - “long”
• Speed Y(0-100km/h): B1 - “slow”; B2 - “fast”
• Driving Z(-20-20km/h2): C1 - “maintain”; C2 - “reduce”; C3:
Trang 17Example: automotive driving
Step 3: fuzzy inference for control
1) Fuzzification: based on the sensor inputs, measure the
adaptability of the premise of rules
2) Fuzzy inference: from the adaptability, infer the conclusion
of each rule
3) Defuzzification: aggregate the individual conclusions to
obtain the overall conclusion
Fuzzy controller
Inference engine
Rule
Defuzzi-fication
Control Signals
fication Sensor
Fuzzi-Signals
Trang 18Example: automotive driving
Reasoning process (Mamdani’s Method):
Trang 19Example: automotive driving
Defuzzification:
The fuzzy control set has to be converted into a definite
value
Take the centre of gravity of the fuzzy set for conclusion
Action: “Reduce speed somewhat”- between “keep speed”
and “reduce speed”
0
( ) ( )
c
c
z zdz z
z dz
µ µ
= ∫
Centre of gravity: -4.45 km/h 2
Trang 20Fuzzy PI Control
• Introduction
• PI-like Fuzzy Logic Controller
• PI Fuzzy Logic Controller
• Conclusions
Trang 21• Input of PID controller:
• Output of PID controller:
• PID FLC:
– The rules base is about
– The gains are tuned on-line with fuzzy reasoning.– This requires more experience with the system
) ,
, ( ),
, ( ),
K 1
z
z K
K ( )
k (
− +
=
Fuzzy PID control: Introduction
e e
e , ∆ , ∆2
e e
e , ∆ , ∆2
Trang 22Fuzzy Rules for Computation of
r +
- ∆e
Ge G
e
e
∆
Fuzzy PI control
Trang 23PI Fuzzy Logic Control
• PI controller:
• The proportional gain and integral time constant are adjusted on-line by fuzzy reasoning
Fuzzy reasoning
e
e
∆
Fuzzy reasoning PI
z T
1 1 ( K 1 z
z K K ) z (
H
i p
i p
− +
=
− +
=
p
Trang 24PI Fuzzy Logic Control
• Fuzzy rules for
\ ) k (
\ ) k (
e ∆
Trang 25CS 561, Sessions 22-23 25
Fuzzy Rules
• Example: “If our distance to the car in front is small, and the distance is decreasing slowly, then decelerate quite hard”
– Fuzzy variables in blue
– Fuzzy sets in red
• QUESTION: Given the distance and the change in the distance,
what acceleration should we select?
Trang 26CS 561, Sessions 22-23 26
Fuzzification: Set Definitions
distance
v small small perfect big v big
Delta (distance change)
Trang 27CS 561, Sessions 22-23 27
Fuzzification: Instance
• Distance could be considered small or perfect
• Delta could be stable or growing
Trang 29Distance is small, then you slow down.
Question: What is the weight to slow down?
acceleration
slow present fast fastest brake
Trang 30CS 561, Sessions 22-23 30
Rule Evaluation
distance
small o.55
Clipping approach (others are possible):
Clip the fuzzy set for “slow” (the consequent) at the height given by our belief in the
premises (0.55)
We will then consider the clipped AREA (orange) when making our final decision
Rationale: if belief in premises is low, clipped area will be very small
But if belief is high it will be close to the whole unclipped area
acceleration
slow
Trang 34How do we make a final decision? From each rule we have
Obtained a clipped area But in the end we want a single
Number output: our desired acceleration
Trang 35In the rule aggregation step, we merge all clipped areas into
One (taking the union).
Intuition: rules for which we had a strong belief that their premises were satisfied
Will tend to “pull” that merged area towards their own central value, since their
Clipped areas will be large
Trang 36In the last step, defuzzification, we return as our acceleration
Value the x coordinate of the center of mass of the merged area
-2.3m/s^2
Trang 37CS 561, Sessions 22-23 37
Rule Aggregation: Another case
• Convert our belief into action
– For each rule, clip action fuzzy set by belief in rule
Trang 38CS 561, Sessions 22-23 38
Rule Aggregation: Another case
• Convert our belief into action
– For each rule, clip action fuzzy set by belief in rule
acceleration
present slow fast
Trang 39CS 561, Sessions 22-23 39
Matching for Example
• Relevant rules are:
– If distance is small and delta is growing, maintain speed
– If distance is small and delta is stable, slow down
– If distance is perfect and delta is growing, speed up
– If distance is perfect and delta is stable, maintain speed
Trang 40CS 561, Sessions 22-23 40
Matching for Example
• For first rule, distance is small has 0.75 truth, and delta is
growing has 0.3 truth
– So the truth of the and is 0.3
• Other rule strengths are 0.6, 0.1 and 0.1
Trang 43slow present fast fastest brake
Trang 44Instead of clipping, another approach is to scale the fuzzy set
By the belief in the premises
Clipping:
Scaling:
Trang 452 Apply fuzzy operator:
If there are multiple parts, apply logical operators to
determine the degree of support for the rule
Trang 46CS 561, Sessions 22-23 46
Summary: If-Then rules
3 Apply implication method:
Use degree of support for rule to shape output fuzzy set of the consequence
How do we then combine several rules?
Trang 47CS 561, Sessions 22-23 47
Multiple rules
• We aggregate the outputs into a single fuzzy
set which combines their decisions
• The input to aggregation is the list of truncated fuzzy sets and the output is a single fuzzy set for each variable.
• Aggregation rules: max, sum, etc.
• As long as it is commutative then the order of rule exec is irrelevant.
Trang 48CS 561, Sessions 22-23 48
Defuzzify the output
• Take a fuzzy set and produce a single crisp
number that represents the set.
• Practical when making a decision, taking an