Uncertain System Control: An Engineering Approachzak/ECE680/FuzzyLogicControl...2 Fuzzy Logic...
Transcript of Uncertain System Control: An Engineering Approachzak/ECE680/FuzzyLogicControl...2 Fuzzy Logic...
Uncertain System Control: An Engineering Approach
Stanisław H. Żak
1
Stanisław H. Żak
School of Electrical and Computer Engineering
ECE 680 Fall 2017
Fuzzy Logic=Computing With Words
� The term Fuzzy Set introduced by Lotfi A. Zadeh in his paper “Fuzzy Sets” published in Information and Control, Vol. 8, No. 3, pp. 338--353, June 1965
3
353, June 1965� The motivation for the notion of a fuzzy set---to
provide a framework for “a natural way of dealing with problems in which the source of imprecision is the absence of sharply defined criteria of class membership rather than the presence of random variables.”
What is a Set?
� A set is a collection of objects. An element belongs to the set or it does not
� Example
{ }6: >= xxX
4
� If x greater than 6, then x belongs to the set X, otherwise x does not belong to the set
� Unambiguous set boundary
{ }6: >= xxX
Characteristic Function� Characteristic function of a set---If an element
belongs to the set, then the function value is 1, if an element does not belong to the set, then the function is 0
� Can represent a set X, using its characteristic function, as a set of ordered pairs (x,0) or (x,1),
5
function, as a set of ordered pairs (x,0) or (x,1),where (x,0) meanswhile (x,1) means Xx ∈
Xx ∉
An ordinary set can be represented as An ordinary set can be represented as a collection of ordered pairsa collection of ordered pairs�
Crisp Set
� Crisp set (“ordinary” set)---a collection of objects. An element is a member of theset or it is not
� An example of a crisp set---fast cars
6
Zadeh’s Definition of Fuzzy Set
“A fuzzy set is a class of objects with a continuum of grades of membership. Such a
7
continuum of grades of membership. Such a set is characterized by a membership (characteristic) function which assigns to each object a grade membership ranging between zero and one.”---L.A. Zadeh, 1965, p. 338
Example of Fuzzy Set� Fuzzy sets allow for partial membership
in a set� Example of a fuzzy set---fast cars
8
Crisp versus Fuzzy
� Notation: ---collection of objects, universe� ---membership function� Crisp set
Uµ
9
� Fuzzy set
{ }1,0: →Uµ
[ ]1,0: →Uµ
Formal Definition of Fuzzy Set� Denote a generic element of the universe
� A fuzzy set in is a set of ordered pairs:
u U
UF
10
( )( ){ }UuuuF F ∈= :, µ
Fuzzy Set Example
� Discrete universe
{ }8,7,6,5,4=U
11
� Fuzzy set---”a number close to 6”
( ) ( ) ( ) ( ) ( ){ }0.0,8,5.0,7,0.1,6,5.0,5,0.0,4
Possible Membership Functions
0
0.2
0.4
0.6
0.8
1
1.2
Mem
bers
hip G
rade
s
(a) Trianguler MF
0
0.2
0.4
0.6
0.8
1
1.2
Mem
bers
hip G
rade
s
(b) Trapezoidal MF
12
0 20 40 60 80 1000
0 20 40 60 80 1000
0 20 40 60 80 1000
0.2
0.4
0.6
0.8
1
1.2
Mem
bers
hip G
rade
s
(c) Gaussian MF
0 20 40 60 80 1000
0.2
0.4
0.6
0.8
1
1.2
Mem
bers
hip G
rade
s
(d) Generalized Bell MF
Special Types of Fuzzy SetsA fuzzy set F is convex if for any x, y from the universe X and for any
[ ]1,0∈λ
13
we have[ ]1,0∈λ
( )( ) ( ) ( )( )yxyx FFF µµλλµ ,min1 ≥−+
Convex and Nonconvex Fuzzy Sets
0.8
1
1.2
Me
mb
ers
hip
Gra
de
s
(a) Two Convex Fuzzy Sets
0.8
1
1.2
Me
mb
ers
hip
Gra
de
s
(b) A Nonconvex Fuzzy Set
14
0
0.2
0.4
0.6
Me
mb
ers
hip
Gra
de
s
0
0.2
0.4
0.6
Me
mb
ers
hip
Gra
de
s
Normal Fuzzy Set and Fuzzy Number
� A fuzzy set is normal if there is a point in
the universe such that
F x
X
( ) 1=xµ
15
� A fuzzy number is a fuzzy set that is both
normal and convex
( ) 1=xFµ
Linguistic Variable
� Linguistics variable---a variable whosevalues are fuzzy numbers
� Examples of linguistic variables:
16
(i) SPEED---it can take its values from the set of fuzzy numbers{very slow, slow, medium, fast, very fast}(ii) TEMPERATURE---possible values
{cold, cool, warm, hot}
More Examples of Linguistic Variables
ERROR{LN, SN, ZE, SP, LP}
LN---large negative
17
LN---large negativeSN---small negativeZE---zeroSP---small positiveLP---large positive
Another Example of a Linguistic Variable
CHANGE-IN-ERROR{LN, SN, ZE, SP, LP}
LN---large negative
18
LN---large negativeSN---small negativeZE---zeroSP---small positiveLP---large positive
Fuzzy Rules
� A fuzzy IF-THEN rule
IF x is A THEN y is B
19
� Examples:(i) IF speed is low THEN brake is zero(ii) IF error is large negative THEN
control action is large positive
Linguistic Description of Control Action
� Instead of a math model of the plant we may have available fuzzy IF-THEN rules:
RULE 1: IF error is ZE and change-in-error is SP then u is SN
20
then u is SNRULE 2: If error is SN and change-in-error is SN THEN u is SP
� Use the given linguistic description in the form of the IF-THEN rules to design a controller
Defuzzification: Moving From Fuzzy Rules to Numbers
� Computing with words--- Convert the given fuzzyIF-THEN rules into controller action
� Inference engine, or defuzzifier, uses fuzzy rules to generate crisp numbers
21
� Center average defuzzifier (product inference rule)
( ) ( )( ) ( )ee
eeu
ll
ll
B
M
l A
lcB
M
l A
∆
∆=∑∑
=
=
µµ
θµµ
1
1
Center average defuzzifier (product inference rule)
1 1 1
Rule 1
product
1ξ
11F
µ 1uF
µ12F
µ
22
Rule 2
1 11product
Center averagedefuzzification
21
2211
ξξθξθξ
++=u
e ∆e
Input variables
Control action
1ξ
2ξ
1θ
2θ
1uF
µ22F
µ21F
µ
Defuzzifier for q InputsCenter average defuzzification for q input controller
== ∑∑ ∏
∏∑ ∏∑ ∏ == =
m
lm q
q
j jA
m q
lj
m
l
q
j A
v
v
v
vu
lj
lj 11 1
)(
)(
)(
)(θ
µ
µ
µ
θµ
23
ξθT=
∑∑ ∏∑ ∏ =
= == =l
l
j
m
l
q
j Aj
m
l
q
j Avv l
jlj
11 11 1
)()( µµ
q is the number of inputsm is the number of fuzzy rules
[ ] [ ] , 2121TT
ξ ,θ mm ξξξθθθ ⋯⋯ ==where
Center -of-Gravity Defuzzifier
( ) ( ){ }∑ ×∆ lMee ,min θµµ
24
( ) ( ){ }( ) ( ){ }∑
∑
=
=
∆
×∆= M
l BA
lc
M
l BA
ee
eeu
ll
ll
1
1
,min
,min
µµ
θµµ
Center-of-Gravity Defuzzifier
1 1 1
Rule 1
min
1ξ
11F
µ 1uF
µ12F
µ
25
Rule 2
1 11min
Center-of-gravitydefuzzification
e ∆e
Input variables
Control action
2ξ1θ
2θ
1uF
µ22F
µ21F
µ
21
2211
ξξθξθξ
++=u
Computing With Words ---Example� Our example uses data from the paper by
Y.F. Li and C.C. Lau, “Development of fuzzyalgorithms for servo systems,” IEEE Control Systems Magazine, pp. 65--72, April 1989
� Rule #1: IF the error is ZE and the error change is SP THEN the control is SN
26
THEN the control is SN� Rule #2: IF the error is ZE and the error change is ZE
THEN the control is ZE� Rule #3: IF the error is SN and the error change is SN
THEN the control is SP� Rule #4: IF the error is SN and the error change is ZE
THEN the control is LP
Defuzzification: Moving From Fuzzy Rules to Numbers
� Contribution of Rule #1
27
� Center-of-gravity---0.6×(-2)� Center average defuzzifier--- 0.6×0.8×(-2)
Defuzzification: Contribution of Rule #2
28
� Center-of-gravity---0.2×0� Center average defuzzifier--- 0.6 × 0.2×0
Defuzzification: Contribution of Rule #3
29
� Center-of-gravity---0×2� Center average defuzzifier--- 0.6×0×2
Defuzzification: Contribution of Rule #4
30
� Center-of-gravity---0.2×4� Center average defuzzifier--- 0.6×0.2×4
Combining All Contributions Together� Center-of-gravity
4.02.002.06.0
42.02002.0)2(6.0 −=+++
×+×+×+−×=u
31
� Center average defuzzifier (product inference rule)2.002.06.0 +++
67.012.0012.048.0
412.020012.0)2(48.0 −=+++
×+×+×+−×=u
Designing a Fuzzy Logic Controller for DC Motor---Control Objective
� Design a controller that forces the closedloop system output x(t) to track a givenreference signal x (t)
32
reference signal xd(t)
� Force the tracking error e(t) = x – xd toasymptotically decay to 0
Fuzzy Logic Controller (FLC)in the Loop
xex Plant
ηηηηDisturbance
u
33
xexd
PlantReferencesignal Fuzzy Logic ControllerFuzzy Logic Controller
u
FLC Design Algorithm� Identify ranges of the controller inputs� Identify ranges of the controller output� Create fuzzy sets for each input and output� Translate the interaction of the inputs and
outputs into IF-THEN rules, and then form the
34
outputs into IF-THEN rules, and then form the rules matrix
� Decide on the defuzzifier, and then use it to generate the control surface
� Implement the controller, test it, and modify it if necessary
More On the Control Objective and the Plant
� DC motor--- Electro-Craft Corporation MOTOMATIC system
� Control objective---design a simple fuzzy logic tracking controller, simulate the
36
logic tracking controller, simulate the dynamical behavior of the closed-loop and test the design in the lab
� Math model of the DC motor needed for simulations
Tracking Error Fuzzy Sets
0.6
0.7
0.8
0.9
1ERROR fuzzy sets
Mem
bers
hip
37
−0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.150
0.1
0.2
0.3
0.4
0.5
0.6
Universe
Mem
bers
hip
CHANGE-IN-ERROR Fuzzy Sets
0.6
0.7
0.8
0.9
1CHANGE−IN−ERROR fuzzy sets
Mem
bers
hip
38
−0.01 −0.005 0 0.005 0.010
0.1
0.2
0.3
0.4
0.5
0.6
Universe
Mem
bers
hip
Control Action Fuzzy Sets
0.6
0.7
0.8
0.9
1CONTROL fuzzy sets
Mem
bers
hip
39
−200 −150 −100 −50 0 50 100 150 2000
0.1
0.2
0.3
0.4
0.5
Universe
Mem
bers
hip
Rules Matrix
Change-in-error LN N ZE P LP
Error
Large Negative (LN) LN LN LN N ZE
40
Large Negative (LN) LN LN LN N ZE
Negative (N) LN LN N ZE P
Zero (ZE) N N ZE P P
Positive (P) N ZE P LP LP
Large Positive (LP) ZE P LP LP LP
Center Average Inference System
1 1 1
Rule 1
product
1ξ
11F
µ 1uF
µ12F
µ
41
Rule 2
1 11product
Center averagedefuzzification
21
2211
ξξθξθξ
++=u
e ∆e
Input variables
Control action
1ξ
2ξ
1θ
2θ
1uF
µ22F
µ21F
µ
DefuzzifierCenter average defuzzifier for a two-input controller
( ) ( )( ) ( )ee
eeu ll
M
lcB
M
l A
∆
∆=∑∑ =
µµ
θµµ1
42
where is the centroid of the control action fuzzy set and is the number of fuzzy rules
( ) ( )eell B
M
l A ∆∑ =µµ
1
lcθ
M
Control Surface
0
50
100
150
cont
rol
43
−0.01−0.005
00.005
0.01
−0.2
−0.1
0
0.1
0.2−200
−150
−100
−50
0
errorchange−in−error
cont
rol
Improving the Performance of FLC
� Excessive overshoot� Fine tune the controller� Good results when changed the error range of the
tracking error from
46
tracking error from
to[ ]15.0,15.0−
[ ]1.0,1.0−
New Tracking Error Fuzzy Sets
0.6
0.7
0.8
0.9
1ERROR fuzzy sets
Mem
bers
hip
47
−0.1 −0.05 0 0.05 0.10
0.1
0.2
0.3
0.4
0.5
0.6
Universe
Mem
bers
hip
Summary
Fuzzy Logic Control: � incorporates linguistic description of the
controller action, rather than a mathematical plant model, to compute the control action---computing with words
49
� different ways to achieve high controller performance---use a two-range controller consisting of coarse and fine parts to regulate the large tracking error and small tracking error
� use more fuzzy sets, this in turn requires more fuzzy rules