SlideShare a Scribd company logo
FUZZY LOGIC
Menoufia University
Faculty of Electronic Engineering
4/2020
2 of 57
References08
07 Fuzzy on Simulink
05 Fuzzy at the Cmd line
06 PID – Fuzzy controller
Agenda
Introduction to Fuzzy01
Fuzzification &
Defuzzification
02
Fuzzy application03
04 FIS tool
3 of 57
0
0.5
1
0 1 2 3 4 5 6 7 8 9 10
𝞵(x)
x
Classical control
theory
1 0
On off
Yes No
4 of 57
Classical set
theory
𝐴 = 0.1,0.3,0.5 & 𝐵 = {0.2,0.3,0.5,0.7}
𝒖𝒏𝒊𝒐𝒏 ∶ 𝐴 ∪ 𝐵 = {0.1,0.2,0.3,0.5,0.7}
𝒊𝒏𝒕𝒆𝒓𝒔𝒆𝒄𝒕𝒊𝒐𝒏 ∶ 𝐴 ∩ 𝐵 = {0.3,0.5}
𝒅𝒊𝒇𝒇𝒆𝒓𝒆𝒏𝒄𝒆 ∶ 𝐴 − 𝐵 = {0.1}
𝒄𝒐𝒎𝒑𝒍𝒆𝒎𝒆𝒏𝒕: ҧ𝐴 = 0.9,0.7,0.5
𝒄𝒂𝒓𝒕𝒆𝒔𝒊𝒂𝒏 𝒑𝒓𝒐𝒅𝒖𝒄𝒕 ∶ 𝐴 × 𝐵
𝒅𝒆𝒎𝒐𝒓𝒈𝒆𝒏′
𝒔 𝒍𝒂𝒘 ∶ 𝐴 ∩ 𝐵 ′
= 𝐴′ ∪ 𝐵′
0.1
0.3
0.5
A
0.7
0.2
B
5 of 57
Crisp set Vs Fuzzy set
6 of 57
What Fuzzy Systems?
Confused
vague
blurred
7 of 57
Fuzzy
he wrote that to handle biological systems "we need a radically
different kind of mathematics, the mathematics of fuzzy or cloudy
quantities which are not describable in terms of probability distributions"
1962
1965
Classical
control
Is a 160 m person is tall ?
True
Possibly True
8 of 57
Types of membership function
𝝁 𝒙 =
𝟎 , 𝒙 ≤ 𝒂
𝒙 − 𝒂
𝒃 − 𝒂
, 𝒂 ≤ 𝒙 ≤ 𝒃
𝒄 − 𝒙
𝒄 − 𝒃
, 𝒃 ≤ 𝒙 ≤ 𝒄
𝟎 , 𝒙 ≥ 𝒄
Triangular
𝝁 𝒙 =
𝟎 , 𝒙 ≤ 𝒂
𝒙 − 𝒂
𝒃 − 𝒂
, 𝒂 ≤ 𝒙 ≤ 𝒃
𝟏 , 𝒃 ≤ 𝒙 ≤ 𝒄
𝒄 − 𝒙
𝒄 − 𝒃
, 𝒄 ≤ 𝒙 ≤ 𝒅
𝟎 , 𝒙 ≥ 𝒅
Trapezoidal
𝝁 𝒙 = 𝒆𝒙𝒑
− 𝒙 − 𝒄 𝟐
𝟐𝝈 𝟐
Gaussian
9 of 57
speed [m/s]
Human
knowledge-based
Rule-based
Fuzzy
IF AND
THEN
distance
speed
acceleration
small
speed is declining
maintain
IF distance perfect AND
speed is declining
THEN increase acceleration
10 of 57
a self-parking car in 1983
Nissan has a patent saves
fuel
F U Z Z Y
App.
The fuzzy washing machines
were the first major consumer
products in Japan around
1990
the most advanced subway
system on earth in 1987
11 of 57
Fuzzy Logic
Controller
Sensor
Fuzzification
Fuzzy
Inference
System
to be
controlled
Defuzzification
Membership
function of
input fuzzy set
Rule Base
Membership
function of
output fuzzy set
Feedback
12 of 57
Defuzzification Methods
Centre of
largest area
Mean–max
membership
Maxima
(MOM)
Max-membership Centre
of sums
Centroid
method
Approx. Centroid
method
13 of 57
Mean of Maxima (MOM) 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 1 2 3 4 5 6 7 8
𝞵
Z
𝒁∗
=
𝒂 + 𝒃
𝟐 𝒁∗ =
𝟔 + 𝟕
𝟐
= 𝟔. 𝟓 𝒎
14 of 57
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 1 2 3 4 5 6 7 8
𝞵
Z
Centroid Method 2
also called center of area, center of gravity).
it is the most prevalent and physically appealing
of all the defuzzification methods
𝒁∗
=
𝟎. 𝟑 × (𝟏 + 𝟐 + 𝟑) + 𝟎. 𝟓 × (𝟒 + 𝟓) + 𝟏 × (𝟔 + 𝟕)
(𝟎. 𝟑 × 𝟑) + (𝟎. 𝟓 × 𝟐) + (𝟏 × 𝟐)
𝒁∗
= 𝟑. 𝟑𝟑 𝒎
𝒁∗ =
σ 𝝁(𝒁) 𝒁
σ 𝝁(𝒁)
15 of 57
The approximate COA 3
𝒁∗ =
σ 𝝁(𝒁) 𝑪
σ 𝝁(𝒁)
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 1 2 3 4 5 6 7 8
𝞵
Z
𝒁∗
=
𝟎. 𝟑 × 𝟐. 𝟓 + 𝟎. 𝟓 × 𝟓 + (𝟏 × 𝟔. 𝟓)
𝟎. 𝟑 + 𝟎. 𝟓 + 𝟏
= 𝟓. 𝟒𝟏 𝒎
16 of 57
Autonomous driving car
distance
speed
acceleration
13 m
-2.5 m/s
?
Knowledge
Rule base
Distance to next car [ m ]
v.small small perfect big v.big
Speed
Change
[ 𝒎 𝟐
]
declining -ve small zero +ve small +ve big +ve big
constant -ve big -ve small zero +ve small +ve big
growing -ve big -ve big -ve small zero +ve small
speed [m/s]
17 of 57
speed [m/s]
Knowledge
Rule base
Distance to next car [ m ]
v.small small perfect big v.big
Speed
Change
[ 𝒎 𝟐
]
declining -ve small zero +ve small +ve big +ve big
constant -ve big -ve small zero +ve small +ve big
growing -ve big -ve big -ve small zero +ve small
0.4 0.25
0.4
0.6
0.6
0.75
0.75
0.25
0.25
0.4
0.25
0.6
Rule 1: IF distance is small AND speed is declining
THEN acceleration zero
Rule 2: IF distance is small AND speed is constant
THEN acceleration negative small
Rule 3: IF distance is perfect AND speed is declining
THEN acceleration positive small
Rule 4: IF distance is perfect AND speed is constant
THEN acceleration zero
max
Take
min
18 of 57
Defuzzification using approximate COA
19 of 57
Washing Machine
20 of 57
Washing Machine
40
30
?0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
𝞵(weight)
Weight (g)
v.Light light Heavy V.heavy
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
μ(Dirtiness)
Dirtiness (%)
Almost Clean Dirty Soiled Filthy
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
μ(detergent)
Detergent (%)
v.Light little Much V.Much Maximum
Knowledge
Rule base
Weight [ Kg ]
V.Light Light Heavy V.Heavy
Dirtiness
Almost
Clean
V.Little Little Much Much
Dirty Little Little Much V.Much
Soiled Much Much V.Much Maximum
Filthy V.Much Much V.Much Maximum
weight
dirtiness
amount of
detergent output
21 of 57
heavy dirty Much
heavy soiled V.Much
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
μ(Dirtiness)
Dirtiness (%)
Almost Clean Dirty Soiled Filthy
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
𝞵(weight)
Weight (g)
v.Light light Heavy V.heavy
Light dirty little
Light soiled Much
0.4
0.4
0.40.8 0.80.6
0.60.2 0.20.2
0.6
0.2
Little 0.4
Much 0.6
V.Much 0.2
IF weight is light(0.4) AND dirtiness is dirty(0.8)
THEN detergent is little(0.4)
IF weight is light(0.4) AND dirtiness is soiled(0.2)
THEN detergent is Much(0.2)
IF weight is heavy(0.6) AND dirtiness is dirty(0.8)
THEN detergent is Much(0.6)
IF weight is heavy(0.6) AND dirtiness is soiled(0.2)
THEN detergent is V.Much(0.2)
22 of 57
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100μ(detergent)
detergent
v.Light little Much V.Much Maximum
𝒁∗ =
𝟒𝟎 + 𝟔𝟎
𝟐
= 𝟓𝟎%
𝒁∗
=
𝒂 + 𝒃
𝟐
𝒁∗
=
𝟎. 𝟒 × 𝟐𝟓 + 𝟎. 𝟔 × 𝟓𝟎 + (𝟎. 𝟐 × 𝟕𝟓)
𝟎. 𝟒 + 𝟎. 𝟔 + 𝟎. 𝟐
𝒁∗ = 𝟒𝟓. 𝟖𝟑 %
𝒁∗ =
σ 𝝁(𝒁) 𝒁
σ 𝝁(𝒁)
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
μ(detergent)
Detergent (%)
v.Light little Much V.Much Maximum
approximate
COA
MOM
(Mean of Maxima )
23 of 57
24 of 57
Inputs
Output
25 of 57
Service = 3
Food = 8
Rule 1 : IF Service is poor OR Food is rancid
THEN Tip is cheap
Rule 2 : IF Service is good THEN Tip is average
Rule 3 : IF Service is excellent OR Food is
delicious THEN Tip is generous
0.125
0.4
0
0
0.5
0.5
0.4
0.125
26 of 57
Build Fuzzy
using
Fuzzy Logic Designer
27 of 57
28 of 57
Build Fuzzy
at
the Command Line
29 of 57
Generate new fuzzy01
Add the first input (service)02
Add its membership functions03
30 of 57
04
31 of 57
Add the rules to the FIS05
Rule 1 : IF Service is poor OR Food is rancid
THEN Tip is cheap
Rule 2 : IF Service is good THEN Tip is average
Rule 3 : IF Service is excellent OR Food is
delicious THEN Tip is generous
1 - Index of membership function for first input
5 - Fuzzy operator (1 for AND, 2 for OR)
2 - Index of membership function for second input
3 - Index of membership function for output
4 - Rule weight
32 of 57
Evaluate fuzzy06
33 of 57
Plotting07
34 of 57
35 of 57
PID Fuzzy
Controller
System
36 of 57
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 …
P- like FLC1
37 of 57
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌)
𝐨𝐮𝐭𝐩𝐮𝐭: ∆ 𝐮 𝐤
𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 ∆𝐮 𝐤 𝐢𝐬 …
PI- like FLC2
38 of 57
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 …
PD- like FLC3
39 of 57
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌 , Σ 𝒆(𝒌)
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐚𝐧𝐝 Σ𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 …
PID- like FLC3
40 of 57
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌)
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌)
𝐨𝐮𝐭𝐩𝐮𝐭: ∆ 𝐮 𝐤
𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌 , Σ 𝒆(𝒌)
𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
41 of 57
Consider a system model is describe by:
𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏)
PI-Like FLC is designed to regulate this system around a set point of R=2. Five fuzzy sets are used
to represent the linguistic variables NB, NS, Z, PS and PB for the controller both input and output
variables. Triangular membership functions are used to represent these fuzzy sets and defined on the
normalized domain [-1,1] as shown in Fig. 1. The suggested rule-base is depicted in table. If the
measured parameters are obtained as y(k-1)=1.5 and u(k-1)=0.5,find the controller output signal
taking into account the actual domain of the controller variables is [-2, 2].
Knowledge
Rule base
e(k)
NB NS Z PS PB
∆ 𝒆(𝒌)
NB NB NB NB NS Z
NS NB NB NS Z PS
Z NB NS Z PS PB
PS NS Z PS PB PB
PB Z PS PB PB PB
42 of 5742 of 24
𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏)
𝒂𝒄𝒕𝒖𝒂𝒍 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ −𝟐, 𝟐
𝒕𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍𝒍𝒆𝒓 𝒐𝒖𝒕𝒑𝒖𝒕 𝒔𝒊𝒈𝒏𝒂𝒍
find
𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ [−𝟏, 𝟏]
𝑷𝑰 − 𝑳𝒊𝒌𝒆 𝑭𝑳𝑪
𝒚 𝒌 = 𝟎. 𝟔 × 𝒚 𝒌 − 𝟏 + 𝒖 𝒌 − 𝟏
= 𝟎. 𝟔 × 𝟏. 𝟓 + 𝟎. 𝟓 = 𝟏. 𝟒
𝒆(𝒌) = 𝑹(𝒌) − 𝒚(𝒌)
= 𝟐 − 𝟏. 𝟒 = 𝟎. 𝟔
𝜟𝒆 (𝒌) = 𝒆 (𝒌) − 𝒆 (𝒌 − 𝟏)
= 𝑹 𝒌 − 𝒚 𝒌 − 𝑹 𝒌 − 𝒚 𝒌 − 𝟏
= 𝒚 𝒌 − 𝟏 − 𝒚 𝒌
= 𝟏. 𝟓 − 𝟏. 𝟒 = 𝟎. 𝟏
𝑻𝒉𝒆 𝒂𝒄𝒕𝒖𝒂𝒍 𝒔𝒚𝒔𝒕𝒆𝒎 𝒐𝒖𝒕𝒑𝒖𝒕 𝒇𝒐𝒓 𝒕𝒉𝒆 𝒎𝒆𝒂𝒔𝒖𝒓𝒆𝒅 𝒗𝒂𝒍𝒖𝒆𝒔:
𝒚 𝒌 − 𝟏 = 𝟏. 𝟓
𝒖 𝒌 − 𝟏 = 𝟎. 𝟓
43 of 5743 of 24
𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏)
𝒚 𝒌 = 𝟏. 𝟒
𝒂𝒄𝒕𝒖𝒂𝒍 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ −𝟐, 𝟐
𝒕𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍𝒍𝒆𝒓 𝒐𝒖𝒕𝒑𝒖𝒕 𝒔𝒊𝒈𝒏𝒂𝒍
find
𝒆 𝒌 = 𝟎. 𝟔
𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ [−𝟏, 𝟏]
𝑷𝑰 − 𝑳𝒊𝒌𝒆 𝑭𝑳𝑪
∆𝒆 𝒌 = 𝟎. 𝟏
𝑻𝒉𝒆 𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒊𝒏𝒑𝒖𝒕 𝒗𝒂𝒍𝒖𝒆𝒔 𝒇𝒐𝒓 𝑭𝑳𝑪 𝒘𝒊𝒍𝒍 𝒃𝒆:
𝑮 𝒆 =
𝟏
𝟐
= 𝟎. 𝟓 , 𝑮∆𝒆 =
𝟏
𝟐
= 𝟎. 𝟓 , 𝑮∆𝒖 =
𝟐
𝟏
= 𝟐
𝑻𝒐 𝒐𝒃𝒕𝒂𝒊𝒏 𝒔𝒄𝒂𝒍𝒊𝒏𝒈 𝒇𝒂𝒄𝒕𝒐𝒓𝒔:
𝒆 𝒏 𝒌 = 𝑮 𝒆 × 𝒆 𝒌
= 𝟎. 𝟓 × 𝟎. 𝟔 = 𝟎. 𝟑
∆𝒆 𝒏(𝒌) = 𝑮∆𝒆 × ∆𝒆 𝒌
= 𝟎. 𝟓 × 𝟎. 𝟏 = 𝟎. 𝟎𝟓
44 of 57
𝒇𝒖𝒛𝒛𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏 ∶
𝝁 𝒁_𝒆 𝒏(𝒌) =
𝟏
𝟑
− 𝟎. 𝟑
𝟏
𝟑
− 𝟎
= 𝟎. 𝟏
𝝁 𝑷𝑺_𝒆 𝒏(𝒌) =
𝟎. 𝟑 − 𝟎
𝟏
𝟑
− 𝟎
= 𝟎. 𝟗
𝝁 𝒁_∆𝒆 𝒏(𝒌) =
𝟏
𝟑
− 𝟎. 𝟎𝟓
𝟏
𝟑
− 𝟎
= 𝟎. 𝟖𝟓
𝝁 𝑷𝑺_𝒆 𝒏(𝒌) =
𝟎. 𝟎𝟓 − 𝟎
𝟏
𝟑
− 𝟎
= 𝟎. 𝟏𝟓
45 of 57
PS Z PS
PS PS PB
Z Z Z
Z PS PS
0.1
0.1
0.10.85 0.850.9
0.90.15 0.150.1
0.85
0.15
IF e (k) is Z (0.1) AND ∆𝒆(𝒌) is Z (0.85)
THEN ∆u(𝒌) is Z (0.1)
IF e (k) is Z (0.1) AND ∆𝒆(𝒌) is PS (0.15)
THEN ∆u(𝒌) is PS (0.1)
IF e (k) is PS (0.9) AND ∆𝒆(𝒌) is Z (0.85)
THEN ∆u(𝒌) is PS (0.85)
IF e (k) is PS (0.9) AND ∆𝒆(𝒌) is PS (0.15)
THEN ∆u(𝒌) is PB (0.15)
Knowledge
Rule base
e(k)
NB NS Z PS PB
∆ 𝒆(𝒌)
NB NB NB NB NS Z
NS NB NB NS Z PS
Z NB NS Z PS PB
PS NS Z PS PB PB
PB Z PS PB PB PB
Z 0.1
PS 0.85
PB 0.15
46 of 57
∆𝒖 𝒏 𝒌 =
𝟎. 𝟏 × 𝟎 + 𝟎. 𝟖𝟓 ×
𝟏
𝟑
+ (𝟎. 𝟏𝟓 ×
𝟐
𝟑
)
𝟎. 𝟏 + 𝟎. 𝟖𝟓 + 𝟎. 𝟏𝟓
∆𝒖 𝒏 𝒌 = 𝟎. 𝟑𝟓
∆𝒖 𝒏 𝒌 =
σ 𝝁(∆𝒖 𝒏) 𝑪
σ 𝝁(∆𝒖 𝒏)
approximate
COA
𝒅𝒆𝒇𝒖𝒛𝒛𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏 ∶
∆𝒖 𝒌 = 𝑮∆𝒖 × ∆𝒖 𝒏 𝒌
= 𝟐 × 𝟎. 𝟑𝟓 = 𝟎. 𝟕
𝒖 𝒌 = 𝒖 𝒌 − 𝟏 + ∆𝒖 𝒌
= 𝟎. 𝟓 + 𝟎. 𝟕 = 𝟏. 𝟐
𝑻𝒉𝒆 𝒂𝒄𝒕𝒖𝒂𝒍 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒐𝒖𝒕𝒑𝒖𝒕 𝜟𝒖 𝒌 𝒐𝒇 𝑭𝑳𝑪:
𝑻𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒔𝒊𝒈𝒏𝒂𝒍 𝒖 𝒌 𝒘𝒊𝒍𝒍 𝒃𝒆:
Build Fuzzy
using
Simulink
48 of 57
Tank Level Control System
5 cm ?
0
0.25
0.5
0.75
1
1.25
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
𝞵(Level)
Liquid level (cm)
low okay high
0
0.5
1
-30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30
𝞵(valvecontrol)
Valve control signal (%/s)
close fast no change open fast
Rule 1 : IF level is okay THEN valve is no change
Rule 2 : IF level is low THEN valve is open fast
Rule 3 : IF level is high THEN valve is close fast
Liquid level
Valve control
signal
49 of 57
𝑻𝒂𝒏𝒌 𝑺𝒚𝒔𝒕𝒆𝒎
𝑺𝒊𝒎𝒖𝒍𝒂𝒕𝒊𝒐𝒏
50 of 57
𝑺𝒖𝒃𝒔𝒚𝒔𝒕𝒆𝒎 𝑽𝒂𝒍𝒗𝒆
𝑺𝒖𝒃𝒔𝒚𝒔𝒕𝒆𝒎 𝑻𝒂𝒏𝒌
ሶℎ =
1
𝐴
𝑞𝑖𝑛 −
𝑎
𝐴
2𝑔ℎ
𝑨 = 𝟎. 𝟒 𝒎 𝟐
𝒂 = 𝟎. 𝟎𝟏𝟐 𝒎 𝟐
𝒒𝒊,𝒎𝒂𝒙 = 𝟐𝟎 𝒍/𝒔
𝐴: 𝑐𝑟𝑜𝑠𝑠 − 𝑠𝑒𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑎𝑟𝑒𝑎 𝑜𝑓 𝑡ℎ𝑒 𝑡𝑎𝑛𝑘
𝑎: 𝑐𝑟𝑜𝑠𝑠 − 𝑠𝑒𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑎𝑟𝑒𝑎 𝑜𝑓 𝑡ℎ𝑒 𝑝𝑖𝑝𝑒
51 of 57
𝒍𝒊𝒒𝒖𝒊𝒅 𝒍𝒆𝒗𝒆𝒍
𝒗𝒂𝒍𝒗𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍
𝒗𝒂𝒍𝒗𝒆 𝒐𝒑𝒆𝒏𝒊𝒏𝒈
52 of 57
𝑻𝒂𝒏𝒌 𝑺𝒚𝒔𝒕𝒆𝒎 𝑺𝒊𝒎𝒖𝒍𝒂𝒕𝒊𝒐𝒏
With reference
53 of 57
𝒍𝒊𝒒𝒖𝒊𝒅 𝒍𝒆𝒗𝒆𝒍
𝒗𝒂𝒍𝒗𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍
𝒗𝒂𝒍𝒗𝒆 𝒐𝒑𝒆𝒏𝒊𝒏𝒈
54 of 57
With referenceWithout reference
55 of 57
References
[1] L.-X. Wang, A Course in Fuzzy Systems and Control. Prentice Hall PTR, 1997.
[2] S. N. Sivanandam, S. Sumathi, and S. N. Deepa, Introduction to Fuzzy Logic using MATLAB.
Springer, 2006.
[3] T. J. Ross, Fuzzy Logic with Engineering Applications, 2nd ed. Wiley, 2004.
[4] Essam Nabil, “Autonomous driving car,” March,2019, pp. 1–13.[presentation].
[5] Essam Nabil, “Fuzzy logic control system applications,” March,2019, pp. 1-30 .[presentation].
[6] Essam Nabil, “Tipping problem,” March,2019, pp. 1–18.[presentation].
56 of 57
References
[7] “Build Fuzzy Systems Using Fuzzy Logic Designer - MATLAB & Simulink.” [Online]. Available:
https://www.mathworks.com/help/fuzzy/building-systems-with-fuzzy-logic-toolbox-
software.html. [Accessed: 22-Nov-2019].
[8] “Build Fuzzy Systems at the Command Line - MATLAB & Simulink.” [Online]. Available:
https://www.mathworks.com/help/fuzzy/working-from-the-command-line.html.
[Accessed: 22-Nov-2019]
[9] Essam Nabil, “Tank control system” March,2019, pp. 1–18.[presentation].
[10] Essam Nabil, “PID - Like Fuzzy Logic control” March,2019, pp. 1–39.[presentation].
57 of 57
Thank You
Nourhan Selem Salm
FUZZY

More Related Content

PPT
HCI - Chapter 6
PPT
Unit 6 interconnection structure
PPTX
Fuzzy Logic Controller
PPTX
Supervised and Unsupervised Learning In Machine Learning | Machine Learning T...
PPTX
Artificial bee colony algorithm
PPTX
Random Forest
PPTX
Natural language processing
PPTX
Graph Theory
HCI - Chapter 6
Unit 6 interconnection structure
Fuzzy Logic Controller
Supervised and Unsupervised Learning In Machine Learning | Machine Learning T...
Artificial bee colony algorithm
Random Forest
Natural language processing
Graph Theory

What's hot (20)

PPT
Fuzzy logic control
PPTX
Fuzzy logic control of washing m achines
PPTX
Fuzzy logic control system
PPTX
Chapter 5 - Fuzzy Logic
PPTX
Lu Decomposition
PDF
Fuzzy Logic in the Real World
PPTX
Interpolation
PPTX
Fuzzy sets
PPTX
Mathematical Modelling of Control Systems
PDF
Control of non linear system using backstepping
PDF
EENG519FinalProjectReport
PDF
Lecture: Monte Carlo Methods
PPTX
Fuzzy inference
PDF
Latent Dirichlet Allocation
PDF
Fuzzy+logic
PPT
Fuzzy logic
PDF
Classical and Modern Control Theory
PPTX
state space representation,State Space Model Controllability and Observabilit...
PDF
Quadratic programming (Tool of optimization)
PDF
fuzzy fuzzification and defuzzification
Fuzzy logic control
Fuzzy logic control of washing m achines
Fuzzy logic control system
Chapter 5 - Fuzzy Logic
Lu Decomposition
Fuzzy Logic in the Real World
Interpolation
Fuzzy sets
Mathematical Modelling of Control Systems
Control of non linear system using backstepping
EENG519FinalProjectReport
Lecture: Monte Carlo Methods
Fuzzy inference
Latent Dirichlet Allocation
Fuzzy+logic
Fuzzy logic
Classical and Modern Control Theory
state space representation,State Space Model Controllability and Observabilit...
Quadratic programming (Tool of optimization)
fuzzy fuzzification and defuzzification
Ad

Similar to Fuzzy logic (20)

PDF
Giới thiệu lý thuyết và ứng dụng của ogic mờ
DOCX
ELEG 421 Control Systems Transient and Steady State .docx
PPTX
Normal probability distribution
PDF
Lecture 5 backpropagation
PPTX
Ideal Bose Systems
PPTX
Static Models of Continuous Variables
PPTX
EASY WAY TO CALCULATE MODE (STATISTICS)
PDF
APPROXIMATE CONTROLLABILITY RESULTS FOR IMPULSIVE LINEAR FUZZY STOCHASTIC DIF...
PDF
APPROXIMATE CONTROLLABILITY RESULTS FOR IMPULSIVE LINEAR FUZZY STOCHASTIC DIF...
PPTX
09-FL Defuzzyfication I.pptx
PDF
simple linear regression - brief introduction
PPTX
The Trapezoidal rule is the first of the Newton-Cotes closed integration form...
PDF
SDF Hysteretic System 1 - Differential Vaiana Rosati Model
PPTX
14th_Class_19-03-2024 Control systems.pptx
PPT
Deconvolution
PPTX
numericai matmatic matlab uygulamalar ali abdullah
PPT
function power point presentation for class 11 and 12 for jee
PDF
Sparsenet
PDF
Discrete Nonlinear Optimal Control of S/C Formations Near The L1 and L2 poi...
PPTX
An Introduction to Fuzzy Logic and Neural Networks
Giới thiệu lý thuyết và ứng dụng của ogic mờ
ELEG 421 Control Systems Transient and Steady State .docx
Normal probability distribution
Lecture 5 backpropagation
Ideal Bose Systems
Static Models of Continuous Variables
EASY WAY TO CALCULATE MODE (STATISTICS)
APPROXIMATE CONTROLLABILITY RESULTS FOR IMPULSIVE LINEAR FUZZY STOCHASTIC DIF...
APPROXIMATE CONTROLLABILITY RESULTS FOR IMPULSIVE LINEAR FUZZY STOCHASTIC DIF...
09-FL Defuzzyfication I.pptx
simple linear regression - brief introduction
The Trapezoidal rule is the first of the Newton-Cotes closed integration form...
SDF Hysteretic System 1 - Differential Vaiana Rosati Model
14th_Class_19-03-2024 Control systems.pptx
Deconvolution
numericai matmatic matlab uygulamalar ali abdullah
function power point presentation for class 11 and 12 for jee
Sparsenet
Discrete Nonlinear Optimal Control of S/C Formations Near The L1 and L2 poi...
An Introduction to Fuzzy Logic and Neural Networks
Ad

Recently uploaded (20)

PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
composite construction of structures.pdf
DOCX
573137875-Attendance-Management-System-original
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Geodesy 1.pptx...............................................
PPTX
web development for engineering and engineering
PDF
Well-logging-methods_new................
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Digital Logic Computer Design lecture notes
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Internet of Things (IOT) - A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
composite construction of structures.pdf
573137875-Attendance-Management-System-original
Operating System & Kernel Study Guide-1 - converted.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Lecture Notes Electrical Wiring System Components
Geodesy 1.pptx...............................................
web development for engineering and engineering
Well-logging-methods_new................
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Digital Logic Computer Design lecture notes
CYBER-CRIMES AND SECURITY A guide to understanding

Fuzzy logic

  • 1. FUZZY LOGIC Menoufia University Faculty of Electronic Engineering 4/2020
  • 2. 2 of 57 References08 07 Fuzzy on Simulink 05 Fuzzy at the Cmd line 06 PID – Fuzzy controller Agenda Introduction to Fuzzy01 Fuzzification & Defuzzification 02 Fuzzy application03 04 FIS tool
  • 3. 3 of 57 0 0.5 1 0 1 2 3 4 5 6 7 8 9 10 𝞵(x) x Classical control theory 1 0 On off Yes No
  • 4. 4 of 57 Classical set theory 𝐴 = 0.1,0.3,0.5 & 𝐵 = {0.2,0.3,0.5,0.7} 𝒖𝒏𝒊𝒐𝒏 ∶ 𝐴 ∪ 𝐵 = {0.1,0.2,0.3,0.5,0.7} 𝒊𝒏𝒕𝒆𝒓𝒔𝒆𝒄𝒕𝒊𝒐𝒏 ∶ 𝐴 ∩ 𝐵 = {0.3,0.5} 𝒅𝒊𝒇𝒇𝒆𝒓𝒆𝒏𝒄𝒆 ∶ 𝐴 − 𝐵 = {0.1} 𝒄𝒐𝒎𝒑𝒍𝒆𝒎𝒆𝒏𝒕: ҧ𝐴 = 0.9,0.7,0.5 𝒄𝒂𝒓𝒕𝒆𝒔𝒊𝒂𝒏 𝒑𝒓𝒐𝒅𝒖𝒄𝒕 ∶ 𝐴 × 𝐵 𝒅𝒆𝒎𝒐𝒓𝒈𝒆𝒏′ 𝒔 𝒍𝒂𝒘 ∶ 𝐴 ∩ 𝐵 ′ = 𝐴′ ∪ 𝐵′ 0.1 0.3 0.5 A 0.7 0.2 B
  • 5. 5 of 57 Crisp set Vs Fuzzy set
  • 6. 6 of 57 What Fuzzy Systems? Confused vague blurred
  • 7. 7 of 57 Fuzzy he wrote that to handle biological systems "we need a radically different kind of mathematics, the mathematics of fuzzy or cloudy quantities which are not describable in terms of probability distributions" 1962 1965 Classical control Is a 160 m person is tall ? True Possibly True
  • 8. 8 of 57 Types of membership function 𝝁 𝒙 = 𝟎 , 𝒙 ≤ 𝒂 𝒙 − 𝒂 𝒃 − 𝒂 , 𝒂 ≤ 𝒙 ≤ 𝒃 𝒄 − 𝒙 𝒄 − 𝒃 , 𝒃 ≤ 𝒙 ≤ 𝒄 𝟎 , 𝒙 ≥ 𝒄 Triangular 𝝁 𝒙 = 𝟎 , 𝒙 ≤ 𝒂 𝒙 − 𝒂 𝒃 − 𝒂 , 𝒂 ≤ 𝒙 ≤ 𝒃 𝟏 , 𝒃 ≤ 𝒙 ≤ 𝒄 𝒄 − 𝒙 𝒄 − 𝒃 , 𝒄 ≤ 𝒙 ≤ 𝒅 𝟎 , 𝒙 ≥ 𝒅 Trapezoidal 𝝁 𝒙 = 𝒆𝒙𝒑 − 𝒙 − 𝒄 𝟐 𝟐𝝈 𝟐 Gaussian
  • 9. 9 of 57 speed [m/s] Human knowledge-based Rule-based Fuzzy IF AND THEN distance speed acceleration small speed is declining maintain IF distance perfect AND speed is declining THEN increase acceleration
  • 10. 10 of 57 a self-parking car in 1983 Nissan has a patent saves fuel F U Z Z Y App. The fuzzy washing machines were the first major consumer products in Japan around 1990 the most advanced subway system on earth in 1987
  • 11. 11 of 57 Fuzzy Logic Controller Sensor Fuzzification Fuzzy Inference System to be controlled Defuzzification Membership function of input fuzzy set Rule Base Membership function of output fuzzy set Feedback
  • 12. 12 of 57 Defuzzification Methods Centre of largest area Mean–max membership Maxima (MOM) Max-membership Centre of sums Centroid method Approx. Centroid method
  • 13. 13 of 57 Mean of Maxima (MOM) 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 1 2 3 4 5 6 7 8 𝞵 Z 𝒁∗ = 𝒂 + 𝒃 𝟐 𝒁∗ = 𝟔 + 𝟕 𝟐 = 𝟔. 𝟓 𝒎
  • 14. 14 of 57 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 1 2 3 4 5 6 7 8 𝞵 Z Centroid Method 2 also called center of area, center of gravity). it is the most prevalent and physically appealing of all the defuzzification methods 𝒁∗ = 𝟎. 𝟑 × (𝟏 + 𝟐 + 𝟑) + 𝟎. 𝟓 × (𝟒 + 𝟓) + 𝟏 × (𝟔 + 𝟕) (𝟎. 𝟑 × 𝟑) + (𝟎. 𝟓 × 𝟐) + (𝟏 × 𝟐) 𝒁∗ = 𝟑. 𝟑𝟑 𝒎 𝒁∗ = σ 𝝁(𝒁) 𝒁 σ 𝝁(𝒁)
  • 15. 15 of 57 The approximate COA 3 𝒁∗ = σ 𝝁(𝒁) 𝑪 σ 𝝁(𝒁) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 1 2 3 4 5 6 7 8 𝞵 Z 𝒁∗ = 𝟎. 𝟑 × 𝟐. 𝟓 + 𝟎. 𝟓 × 𝟓 + (𝟏 × 𝟔. 𝟓) 𝟎. 𝟑 + 𝟎. 𝟓 + 𝟏 = 𝟓. 𝟒𝟏 𝒎
  • 16. 16 of 57 Autonomous driving car distance speed acceleration 13 m -2.5 m/s ? Knowledge Rule base Distance to next car [ m ] v.small small perfect big v.big Speed Change [ 𝒎 𝟐 ] declining -ve small zero +ve small +ve big +ve big constant -ve big -ve small zero +ve small +ve big growing -ve big -ve big -ve small zero +ve small speed [m/s]
  • 17. 17 of 57 speed [m/s] Knowledge Rule base Distance to next car [ m ] v.small small perfect big v.big Speed Change [ 𝒎 𝟐 ] declining -ve small zero +ve small +ve big +ve big constant -ve big -ve small zero +ve small +ve big growing -ve big -ve big -ve small zero +ve small 0.4 0.25 0.4 0.6 0.6 0.75 0.75 0.25 0.25 0.4 0.25 0.6 Rule 1: IF distance is small AND speed is declining THEN acceleration zero Rule 2: IF distance is small AND speed is constant THEN acceleration negative small Rule 3: IF distance is perfect AND speed is declining THEN acceleration positive small Rule 4: IF distance is perfect AND speed is constant THEN acceleration zero max Take min
  • 18. 18 of 57 Defuzzification using approximate COA
  • 19. 19 of 57 Washing Machine
  • 20. 20 of 57 Washing Machine 40 30 ?0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 𝞵(weight) Weight (g) v.Light light Heavy V.heavy 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 μ(Dirtiness) Dirtiness (%) Almost Clean Dirty Soiled Filthy 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 μ(detergent) Detergent (%) v.Light little Much V.Much Maximum Knowledge Rule base Weight [ Kg ] V.Light Light Heavy V.Heavy Dirtiness Almost Clean V.Little Little Much Much Dirty Little Little Much V.Much Soiled Much Much V.Much Maximum Filthy V.Much Much V.Much Maximum weight dirtiness amount of detergent output
  • 21. 21 of 57 heavy dirty Much heavy soiled V.Much 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 μ(Dirtiness) Dirtiness (%) Almost Clean Dirty Soiled Filthy 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 𝞵(weight) Weight (g) v.Light light Heavy V.heavy Light dirty little Light soiled Much 0.4 0.4 0.40.8 0.80.6 0.60.2 0.20.2 0.6 0.2 Little 0.4 Much 0.6 V.Much 0.2 IF weight is light(0.4) AND dirtiness is dirty(0.8) THEN detergent is little(0.4) IF weight is light(0.4) AND dirtiness is soiled(0.2) THEN detergent is Much(0.2) IF weight is heavy(0.6) AND dirtiness is dirty(0.8) THEN detergent is Much(0.6) IF weight is heavy(0.6) AND dirtiness is soiled(0.2) THEN detergent is V.Much(0.2)
  • 22. 22 of 57 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100μ(detergent) detergent v.Light little Much V.Much Maximum 𝒁∗ = 𝟒𝟎 + 𝟔𝟎 𝟐 = 𝟓𝟎% 𝒁∗ = 𝒂 + 𝒃 𝟐 𝒁∗ = 𝟎. 𝟒 × 𝟐𝟓 + 𝟎. 𝟔 × 𝟓𝟎 + (𝟎. 𝟐 × 𝟕𝟓) 𝟎. 𝟒 + 𝟎. 𝟔 + 𝟎. 𝟐 𝒁∗ = 𝟒𝟓. 𝟖𝟑 % 𝒁∗ = σ 𝝁(𝒁) 𝒁 σ 𝝁(𝒁) 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50 60 70 80 90 100 μ(detergent) Detergent (%) v.Light little Much V.Much Maximum approximate COA MOM (Mean of Maxima )
  • 25. 25 of 57 Service = 3 Food = 8 Rule 1 : IF Service is poor OR Food is rancid THEN Tip is cheap Rule 2 : IF Service is good THEN Tip is average Rule 3 : IF Service is excellent OR Food is delicious THEN Tip is generous 0.125 0.4 0 0 0.5 0.5 0.4 0.125
  • 26. 26 of 57 Build Fuzzy using Fuzzy Logic Designer
  • 28. 28 of 57 Build Fuzzy at the Command Line
  • 29. 29 of 57 Generate new fuzzy01 Add the first input (service)02 Add its membership functions03
  • 31. 31 of 57 Add the rules to the FIS05 Rule 1 : IF Service is poor OR Food is rancid THEN Tip is cheap Rule 2 : IF Service is good THEN Tip is average Rule 3 : IF Service is excellent OR Food is delicious THEN Tip is generous 1 - Index of membership function for first input 5 - Fuzzy operator (1 for AND, 2 for OR) 2 - Index of membership function for second input 3 - Index of membership function for output 4 - Rule weight
  • 32. 32 of 57 Evaluate fuzzy06
  • 35. 35 of 57 PID Fuzzy Controller System
  • 36. 36 of 57 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤 𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 … P- like FLC1
  • 37. 37 of 57 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌) 𝐨𝐮𝐭𝐩𝐮𝐭: ∆ 𝐮 𝐤 𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 ∆𝐮 𝐤 𝐢𝐬 … PI- like FLC2
  • 38. 38 of 57 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤 𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 … PD- like FLC3
  • 39. 39 of 57 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌 , Σ 𝒆(𝒌) 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤 𝐑𝐮𝐥𝐞: 𝐢𝐟 𝐞 𝐤 𝐢𝐬 … 𝐚𝐧𝐝 ∆ 𝒆 𝒌 𝒊𝒔 … 𝐚𝐧𝐝 Σ𝒆 𝒌 𝒊𝒔 … 𝐭𝐡𝐞𝐧 𝐮 𝐤 𝐢𝐬 … PID- like FLC3
  • 40. 40 of 57 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌) 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆(𝒌) 𝐨𝐮𝐭𝐩𝐮𝐭: ∆ 𝐮 𝐤 𝐈𝐧𝐩𝐮𝐭: 𝐞 𝐤 , ∆ 𝒆 𝒌 , Σ 𝒆(𝒌) 𝐨𝐮𝐭𝐩𝐮𝐭: 𝐮 𝐤
  • 41. 41 of 57 Consider a system model is describe by: 𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏) PI-Like FLC is designed to regulate this system around a set point of R=2. Five fuzzy sets are used to represent the linguistic variables NB, NS, Z, PS and PB for the controller both input and output variables. Triangular membership functions are used to represent these fuzzy sets and defined on the normalized domain [-1,1] as shown in Fig. 1. The suggested rule-base is depicted in table. If the measured parameters are obtained as y(k-1)=1.5 and u(k-1)=0.5,find the controller output signal taking into account the actual domain of the controller variables is [-2, 2]. Knowledge Rule base e(k) NB NS Z PS PB ∆ 𝒆(𝒌) NB NB NB NB NS Z NS NB NB NS Z PS Z NB NS Z PS PB PS NS Z PS PB PB PB Z PS PB PB PB
  • 42. 42 of 5742 of 24 𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏) 𝒂𝒄𝒕𝒖𝒂𝒍 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ −𝟐, 𝟐 𝒕𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍𝒍𝒆𝒓 𝒐𝒖𝒕𝒑𝒖𝒕 𝒔𝒊𝒈𝒏𝒂𝒍 find 𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ [−𝟏, 𝟏] 𝑷𝑰 − 𝑳𝒊𝒌𝒆 𝑭𝑳𝑪 𝒚 𝒌 = 𝟎. 𝟔 × 𝒚 𝒌 − 𝟏 + 𝒖 𝒌 − 𝟏 = 𝟎. 𝟔 × 𝟏. 𝟓 + 𝟎. 𝟓 = 𝟏. 𝟒 𝒆(𝒌) = 𝑹(𝒌) − 𝒚(𝒌) = 𝟐 − 𝟏. 𝟒 = 𝟎. 𝟔 𝜟𝒆 (𝒌) = 𝒆 (𝒌) − 𝒆 (𝒌 − 𝟏) = 𝑹 𝒌 − 𝒚 𝒌 − 𝑹 𝒌 − 𝒚 𝒌 − 𝟏 = 𝒚 𝒌 − 𝟏 − 𝒚 𝒌 = 𝟏. 𝟓 − 𝟏. 𝟒 = 𝟎. 𝟏 𝑻𝒉𝒆 𝒂𝒄𝒕𝒖𝒂𝒍 𝒔𝒚𝒔𝒕𝒆𝒎 𝒐𝒖𝒕𝒑𝒖𝒕 𝒇𝒐𝒓 𝒕𝒉𝒆 𝒎𝒆𝒂𝒔𝒖𝒓𝒆𝒅 𝒗𝒂𝒍𝒖𝒆𝒔: 𝒚 𝒌 − 𝟏 = 𝟏. 𝟓 𝒖 𝒌 − 𝟏 = 𝟎. 𝟓
  • 43. 43 of 5743 of 24 𝒚 (𝒌) = 𝟎. 𝟔 × 𝒚 (𝒌 − 𝟏) + 𝒖(𝒌 − 𝟏) 𝒚 𝒌 = 𝟏. 𝟒 𝒂𝒄𝒕𝒖𝒂𝒍 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ −𝟐, 𝟐 𝒕𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍𝒍𝒆𝒓 𝒐𝒖𝒕𝒑𝒖𝒕 𝒔𝒊𝒈𝒏𝒂𝒍 find 𝒆 𝒌 = 𝟎. 𝟔 𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒅𝒐𝒎𝒂𝒊𝒏 ∈ [−𝟏, 𝟏] 𝑷𝑰 − 𝑳𝒊𝒌𝒆 𝑭𝑳𝑪 ∆𝒆 𝒌 = 𝟎. 𝟏 𝑻𝒉𝒆 𝒏𝒐𝒓𝒎𝒂𝒍𝒊𝒛𝒆𝒅 𝒊𝒏𝒑𝒖𝒕 𝒗𝒂𝒍𝒖𝒆𝒔 𝒇𝒐𝒓 𝑭𝑳𝑪 𝒘𝒊𝒍𝒍 𝒃𝒆: 𝑮 𝒆 = 𝟏 𝟐 = 𝟎. 𝟓 , 𝑮∆𝒆 = 𝟏 𝟐 = 𝟎. 𝟓 , 𝑮∆𝒖 = 𝟐 𝟏 = 𝟐 𝑻𝒐 𝒐𝒃𝒕𝒂𝒊𝒏 𝒔𝒄𝒂𝒍𝒊𝒏𝒈 𝒇𝒂𝒄𝒕𝒐𝒓𝒔: 𝒆 𝒏 𝒌 = 𝑮 𝒆 × 𝒆 𝒌 = 𝟎. 𝟓 × 𝟎. 𝟔 = 𝟎. 𝟑 ∆𝒆 𝒏(𝒌) = 𝑮∆𝒆 × ∆𝒆 𝒌 = 𝟎. 𝟓 × 𝟎. 𝟏 = 𝟎. 𝟎𝟓
  • 44. 44 of 57 𝒇𝒖𝒛𝒛𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏 ∶ 𝝁 𝒁_𝒆 𝒏(𝒌) = 𝟏 𝟑 − 𝟎. 𝟑 𝟏 𝟑 − 𝟎 = 𝟎. 𝟏 𝝁 𝑷𝑺_𝒆 𝒏(𝒌) = 𝟎. 𝟑 − 𝟎 𝟏 𝟑 − 𝟎 = 𝟎. 𝟗 𝝁 𝒁_∆𝒆 𝒏(𝒌) = 𝟏 𝟑 − 𝟎. 𝟎𝟓 𝟏 𝟑 − 𝟎 = 𝟎. 𝟖𝟓 𝝁 𝑷𝑺_𝒆 𝒏(𝒌) = 𝟎. 𝟎𝟓 − 𝟎 𝟏 𝟑 − 𝟎 = 𝟎. 𝟏𝟓
  • 45. 45 of 57 PS Z PS PS PS PB Z Z Z Z PS PS 0.1 0.1 0.10.85 0.850.9 0.90.15 0.150.1 0.85 0.15 IF e (k) is Z (0.1) AND ∆𝒆(𝒌) is Z (0.85) THEN ∆u(𝒌) is Z (0.1) IF e (k) is Z (0.1) AND ∆𝒆(𝒌) is PS (0.15) THEN ∆u(𝒌) is PS (0.1) IF e (k) is PS (0.9) AND ∆𝒆(𝒌) is Z (0.85) THEN ∆u(𝒌) is PS (0.85) IF e (k) is PS (0.9) AND ∆𝒆(𝒌) is PS (0.15) THEN ∆u(𝒌) is PB (0.15) Knowledge Rule base e(k) NB NS Z PS PB ∆ 𝒆(𝒌) NB NB NB NB NS Z NS NB NB NS Z PS Z NB NS Z PS PB PS NS Z PS PB PB PB Z PS PB PB PB Z 0.1 PS 0.85 PB 0.15
  • 46. 46 of 57 ∆𝒖 𝒏 𝒌 = 𝟎. 𝟏 × 𝟎 + 𝟎. 𝟖𝟓 × 𝟏 𝟑 + (𝟎. 𝟏𝟓 × 𝟐 𝟑 ) 𝟎. 𝟏 + 𝟎. 𝟖𝟓 + 𝟎. 𝟏𝟓 ∆𝒖 𝒏 𝒌 = 𝟎. 𝟑𝟓 ∆𝒖 𝒏 𝒌 = σ 𝝁(∆𝒖 𝒏) 𝑪 σ 𝝁(∆𝒖 𝒏) approximate COA 𝒅𝒆𝒇𝒖𝒛𝒛𝒊𝒇𝒊𝒄𝒂𝒕𝒊𝒐𝒏 ∶ ∆𝒖 𝒌 = 𝑮∆𝒖 × ∆𝒖 𝒏 𝒌 = 𝟐 × 𝟎. 𝟑𝟓 = 𝟎. 𝟕 𝒖 𝒌 = 𝒖 𝒌 − 𝟏 + ∆𝒖 𝒌 = 𝟎. 𝟓 + 𝟎. 𝟕 = 𝟏. 𝟐 𝑻𝒉𝒆 𝒂𝒄𝒕𝒖𝒂𝒍 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒐𝒖𝒕𝒑𝒖𝒕 𝜟𝒖 𝒌 𝒐𝒇 𝑭𝑳𝑪: 𝑻𝒉𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒔𝒊𝒈𝒏𝒂𝒍 𝒖 𝒌 𝒘𝒊𝒍𝒍 𝒃𝒆:
  • 48. 48 of 57 Tank Level Control System 5 cm ? 0 0.25 0.5 0.75 1 1.25 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 𝞵(Level) Liquid level (cm) low okay high 0 0.5 1 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 𝞵(valvecontrol) Valve control signal (%/s) close fast no change open fast Rule 1 : IF level is okay THEN valve is no change Rule 2 : IF level is low THEN valve is open fast Rule 3 : IF level is high THEN valve is close fast Liquid level Valve control signal
  • 49. 49 of 57 𝑻𝒂𝒏𝒌 𝑺𝒚𝒔𝒕𝒆𝒎 𝑺𝒊𝒎𝒖𝒍𝒂𝒕𝒊𝒐𝒏
  • 50. 50 of 57 𝑺𝒖𝒃𝒔𝒚𝒔𝒕𝒆𝒎 𝑽𝒂𝒍𝒗𝒆 𝑺𝒖𝒃𝒔𝒚𝒔𝒕𝒆𝒎 𝑻𝒂𝒏𝒌 ሶℎ = 1 𝐴 𝑞𝑖𝑛 − 𝑎 𝐴 2𝑔ℎ 𝑨 = 𝟎. 𝟒 𝒎 𝟐 𝒂 = 𝟎. 𝟎𝟏𝟐 𝒎 𝟐 𝒒𝒊,𝒎𝒂𝒙 = 𝟐𝟎 𝒍/𝒔 𝐴: 𝑐𝑟𝑜𝑠𝑠 − 𝑠𝑒𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑎𝑟𝑒𝑎 𝑜𝑓 𝑡ℎ𝑒 𝑡𝑎𝑛𝑘 𝑎: 𝑐𝑟𝑜𝑠𝑠 − 𝑠𝑒𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑎𝑟𝑒𝑎 𝑜𝑓 𝑡ℎ𝑒 𝑝𝑖𝑝𝑒
  • 51. 51 of 57 𝒍𝒊𝒒𝒖𝒊𝒅 𝒍𝒆𝒗𝒆𝒍 𝒗𝒂𝒍𝒗𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒗𝒂𝒍𝒗𝒆 𝒐𝒑𝒆𝒏𝒊𝒏𝒈
  • 52. 52 of 57 𝑻𝒂𝒏𝒌 𝑺𝒚𝒔𝒕𝒆𝒎 𝑺𝒊𝒎𝒖𝒍𝒂𝒕𝒊𝒐𝒏 With reference
  • 53. 53 of 57 𝒍𝒊𝒒𝒖𝒊𝒅 𝒍𝒆𝒗𝒆𝒍 𝒗𝒂𝒍𝒗𝒆 𝒄𝒐𝒏𝒕𝒓𝒐𝒍 𝒗𝒂𝒍𝒗𝒆 𝒐𝒑𝒆𝒏𝒊𝒏𝒈
  • 54. 54 of 57 With referenceWithout reference
  • 55. 55 of 57 References [1] L.-X. Wang, A Course in Fuzzy Systems and Control. Prentice Hall PTR, 1997. [2] S. N. Sivanandam, S. Sumathi, and S. N. Deepa, Introduction to Fuzzy Logic using MATLAB. Springer, 2006. [3] T. J. Ross, Fuzzy Logic with Engineering Applications, 2nd ed. Wiley, 2004. [4] Essam Nabil, “Autonomous driving car,” March,2019, pp. 1–13.[presentation]. [5] Essam Nabil, “Fuzzy logic control system applications,” March,2019, pp. 1-30 .[presentation]. [6] Essam Nabil, “Tipping problem,” March,2019, pp. 1–18.[presentation].
  • 56. 56 of 57 References [7] “Build Fuzzy Systems Using Fuzzy Logic Designer - MATLAB & Simulink.” [Online]. Available: https://www.mathworks.com/help/fuzzy/building-systems-with-fuzzy-logic-toolbox- software.html. [Accessed: 22-Nov-2019]. [8] “Build Fuzzy Systems at the Command Line - MATLAB & Simulink.” [Online]. Available: https://www.mathworks.com/help/fuzzy/working-from-the-command-line.html. [Accessed: 22-Nov-2019] [9] Essam Nabil, “Tank control system” March,2019, pp. 1–18.[presentation]. [10] Essam Nabil, “PID - Like Fuzzy Logic control” March,2019, pp. 1–39.[presentation].
  • 57. 57 of 57 Thank You Nourhan Selem Salm FUZZY