16
Dr.-Ing. Erwin Sitompul President University Lecture 10 Introduction to Neural Networks and Fuzzy Logic President University Erwin Sitompul NNFL 10/1 http://zitompul.wordpress.com

Solution: Homework 7

  • Upload
    gyan

  • View
    67

  • Download
    3

Embed Size (px)

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 Presentation

Citation preview

Page 1: Solution:  Homework  7

Dr.-Ing. Erwin SitompulPresident University

Lecture 10

Introduction to Neural Networksand Fuzzy Logic

President University Erwin Sitompul NNFL 10/1

http://zitompul.wordpress.com

Page 2: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/2

Solution: Homework 7Fuzzy ControlFuzzy Logic

Page 3: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/3

Solution: Homework 7 (Cont.)Fuzzy ControlFuzzy Logic

Page 4: Solution:  Homework  7

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

in1 2ah q ghA A

Page 5: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/5

Single Tank System: 3 Rules

Liquid level [cm]0 1 5 9 14

okay highlow1

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.

Page 6: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/6

Single Tank System: 3 Rules

Liquidlevel

Valvecontrolsignal

Valveopening

Simulation in Simulink

Fuzzy ControlFuzzy Logic

Page 7: Solution:  Homework  7

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

Page 8: Solution:  Homework  7

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.

Page 9: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/9

Single Tank System: 3 Rules

“overshoot” too large

slow response

Evaluation

Fuzzy ControlFuzzy Logic

Page 10: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/10

Valve control signal [%/s]

no c

hang

e

open

fast

close

fast

–30 –20 –10 0 10 20 30

1 open

slow

close

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 highlow1

Fuzzy ControlFuzzy Logic

Page 11: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/11

Single Tank System: 5 Rules

FC with 5 Rules

no c

hang

e

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 positivenegative1 op

en fa

st

close

fast

open

slow

close

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.

Page 12: Solution:  Homework  7

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

10.1 1

G ss

Page 13: Solution:  Homework  7

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 Rulesacceptable “overshoot”

faster response

Fuzzy ControlFuzzy Logic

Liquidlevel

Valvecontrolsignal

Valveopening

Page 14: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/14

outq

inq

h

Single Tank System: Feedback Control

LI

FVSet point

r +–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

Page 15: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/15

Valve control signal [%/s]

no c

hang

e

open

fast

close

fast

–30 –20 –10 0 10 20 30

1 open

slow

close

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 positivenegative1

e > 0e < 0

Fuzzy ControlFuzzy Logic

e < 0. e > 0.

Page 16: Solution:  Homework  7

President University Erwin Sitompul NNFL 10/16Method SettingsReference trajectory

0 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.