solution: homework 7
DESCRIPTION
Fuzzy Logic. Fuzzy Control. Solution: Homework 7. Fuzzy Logic. Fuzzy Control. Solution: Homework 7 (Cont.). Fuzzy Logic. Fuzzy Control. LI. FV. Single Tank System. Desired liquid level: 5 cm ( 0.05 m ). Required inflow rate: ? 0.0119 m 3 /s ( 11.9 l /s ). - PowerPoint PPT PresentationTRANSCRIPT
Dr.-Ing. Erwin SitompulPresident University
Lecture 10
Introduction to Neural Networksand Fuzzy Logic
President University Erwin Sitompul NNFL 10/1
http://zitompul.wordpress.com
President University Erwin Sitompul NNFL 10/2
Solution: Homework 7Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/3
Solution: Homework 7 (Cont.)Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/4
outq
inq
h
Single Tank System2
2
,max
0.4 m0.012 m20 si
Aa
q l
A : cross-sectional area of the tanka : cross-sectional area of the pipe
Desired liquid level:5 cm (0.05 m)
LI
FV
Required inflow rate: ?0.0119 m3/s (11.9 l/s)
Fuzzy ControlFuzzy Logic
in
12
ah q gh
A A
President University Erwin Sitompul NNFL 10/5
Single Tank System: 3 Rules
Liquid level [cm]0 1 5 9 14
okay highlow
1
Valve control signal [%/s]
no change open fastclose fast
–30 –10 0 10 30
1
FC with 3 Rules
Desired liquid level
Fuzzy ControlFuzzy Logic
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.
President University Erwin Sitompul NNFL 10/6
Single Tank System: 3 Rules
Liquidlevel
Valvecontrolsignal
Valveopening
Simulation in Simulink
Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/7
Single Tank System: 3 Rules
Subsystem Valve Subsystem Single-Tank
• Double-click a subsystem block to see the elements inside
Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/8
Fuzzy Logic Controller in SimulinkFuzzy ControlFuzzy Logic
In Matlab workspace, design the fuzzy controller using fuzzy inference system (FIS) editor.
Export the fuzzy logic controller to workspace, give name.File > Export > To Workspace, (i.e. : STFC_3)
In Simulink, create a new model. Open the Fuzzy Logic Toolbox and
drag “Fuzzy Logic Controller” to the new model.
Double-click the “FLC” and insert the name given to the controller above.
President University Erwin Sitompul NNFL 10/9
Single Tank System: 3 Rules
“overshoot” too large
slow response
Evaluation
Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/10
valve control signal [%/s]
no
chan
ge
ope
n fa
st
clos
e fa
st
–30 –20 –10 0 10 20 30
1 o
pen
slow
clos
e slow
rate of liquid level [cm/s]
zero positivenegative
–4 –0.5 0 0.5 4
1
Single Tank System: 5 Rules
liquid level [cm]0 1 5 9 14
okay highlow
1
Fuzzy ControlFuzzy Logic
President University Erwin Sitompul NNFL 10/11
Single Tank System: 5 Rules
FC with 5 Rules
no
chan
ge
0 1 5 9 14 –4 –0.5 0 0.5 4valve control signal [%/s]
–30–20 –10 0 10 20 30liquid level [cm] rate of liquid level [cm/s]
okay highlow1
zero positivenegative
1 o
pen
fast
clos
e fa
st
ope
n slow
clos
e slow
1
Fuzzy ControlFuzzy Logic
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.Rule 4: IF level is okay AND rate is negative,
THEN valve is open slow.Rule 5: IF level is okay AND rate is positive,
THEN valve is close slow.
President University Erwin Sitompul NNFL 10/12
FIS Editor Simulink
Derivation, to obtain the rate of liquid level
Low pass filter,to smooth the derivation result
Single Tank System: 5 RulesFuzzy ControlFuzzy Logic
1
0.1 1G s
s
President University Erwin Sitompul NNFL 10/13
With all other factors stay the same, a better fuzzy control behavior and performance can be achieved by the combination of:Redefining existing
membership functions.Refining existing rule.Adding new membership
functions and new rules.
Single Tank System: 5 Rules
acceptable “overshoot”
faster response
Fuzzy ControlFuzzy Logic
Liquidlevel
Valvecontrolsignal
Valveopening
President University Erwin Sitompul NNFL 10/14
outq
inq
h
Single Tank System: Feedback Control
LI
FV
Set pointr
+–Error
e
Fuzzy ControlFuzzy Logic
How if the desired liquid level should be changed to 10 cm? 7 cm? 12 cm?
Practical solution: Error signal as the input to the fuzzy controller.
Measured variabley
President University Erwin Sitompul NNFL 10/15
Valve control signal [%/s]
no
chan
ge
ope
n fa
st
clos
e fa
st
–30 –20 –10 0 10 20 30
1 ope
n slow
clos
e slow
Rate of error [cm/s]
zero positivenegative
–4 –0.5 0 0.5 4
1
Single Tank System: Feedback Control
Error of liquid level [cm]–10 –2 0 2 10
zero positivenegative
1
e > 0e < 0
Fuzzy ControlFuzzy Logic
e < 0.
e > 0.
President University Erwin Sitompul NNFL 10/16
Method SettingsReference trajectory0 40 80 120
r [cm]
654
t [s]
Fuzzy ControlFuzzy Logic
Homework 8 Implement the fuzzy logic
controller as a feedback control for the single tank system in Matlab-Simulink.
Apply the 5 rule version with the corresponding membership functions.
Test the control loop to follow the reference trajectory as shown below.