24
pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 - Human experience can be easily incorporated 3 - It is robust 4 - Can adapt to process changes 5 - It is parsimonious because with a limited number of rules can control very complex systems 1 - No detailed insight into the problem 2 - No possibility of transferring "classical" control techniques, at least in the Mamdani approach 3 - It is heuristic (no theoretical justification) at least in the Mamdani form 4 - Cannot be guaranteed to be optimal Advantage s Disadvanta ges

Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

Embed Size (px)

Citation preview

Page 1: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 1S. Marsili-Libelli: Controllo Fuzzy

Why Fuzzy Control?

1 - No detailed mathematical model required

2 - Human experience can be easily incorporated

3 - It is robust

4 - Can adapt to process changes

5 - It is parsimonious because with a limited number of rules can control very complex systems

1 - No detailed insight into the problem

2 - No possibility of transferring "classical" control techniques, at least in the Mamdani approach

3 - It is heuristic (no theoretical justification) at least in the Mamdani form

4 - Cannot be guaranteed to be optimal

Advantages Disadvantages

Page 2: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 2S. Marsili-Libelli: Controllo Fuzzy

Generic control loop

PROCESSREGULATORintposety y

-

+ e u

Controlerror

Controlsignal

The regulator is intended to generate a control signal so that the process output is as close as possible to the set-point, even in the presence of disturbances

Usually the regulator uses the control error and its derivative In the fuzzy case, the inference set is composed of rules with

the form

UisuTHENDEisdt

deANDEiseIF

Page 3: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 3S. Marsili-Libelli: Controllo Fuzzy

Structure of the fuzzy regulator

It is based on the following quantities

o A set of membership functions (both for inputs and outputs)

o A fuzzification procedure

o A set of rules relating the antecedents (inputs) to the

consequents (outputs)o A set of connectives implementing the rules

o A defuzzification procedure

o A set of normalization/denormalization gains

Page 4: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 4S. Marsili-Libelli: Controllo Fuzzy

Structure of a Fuzzy Regulator

The regulation is based on the error e(t) and its derivative e(t).Generally an external integral action is introduced after the fuzzy part to ensure good

set-point tracking, because the fuzzy regulator cannot provide this

S o

S r

S e

11- z- 1

Fuzzycontrolrules

+-

ysp(k)

y(k)

Normalizationgains

Fuz

zifi

cazi

one

Def

uzzi

fica

zion

e

Fuzzy Part

Denormalizationgain

deterministicintegrator

Process

u(t)u(t 1) u(t)The control rules can be specified according

to a general template (metarules)

)k(e

)k(e

sT

)1k(e)k(e)k(e

)k(u)k(uSo )k(u)k(u~

)k(e~

)k(e~

Page 5: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 5S. Marsili-Libelli: Controllo Fuzzy

Control metarules

The control rules must obey some general principles, called metarules

These guidelines assure that the regulator consistently provides a stabilising action

MR1 If the error e(t) and its derivative e(t) are about zero, maintain the present action

MR2 If the error e(t) tends to zero with a satisfactory rate (self-correcting), maintain the present action

MR3 If the error e(t) is not self-correcting, then the contorl action u(t) depends on the sign and magnitude of e(t) and e(t)

MR1 If the error e(t) and its derivative e(t) are about zero, maintain the present action

MR2 If the error e(t) tends to zero with a satisfactory rate (self-correcting), maintain the present action

MR3 If the error e(t) is not self-correcting, then the contorl action u(t) depends on the sign and magnitude of e(t) and e(t)

Set-point

MR3

MR2

MR1

Page 6: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 6S. Marsili-Libelli: Controllo Fuzzy

Control rule table If the error e(t) and its derivative e(t) are used as antecedents the control

implication can be represented by a look-up table

The cross between each value of e(t) and e(t) indicates which rule is to be activated.

The degree of activation of the control rule depends on the combined degree of truth of the corresponding antecedents.

ePB PS ZZ NS NB

PB PB PB PS PS ZZ PS PB PS PS ZZ NS

e ZZ PS PS ZZ NS NS NS PS ZZ NS NS NB NB ZZ NS NS NB NB

Linguistic labels of the antecedents

PB = Positive BigPS = Positive SmallZZ = ZeroNS = Negative SmallNB = Negative Big

Page 7: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 7S. Marsili-Libelli: Controllo Fuzzy

Use of the control rule table Example: Suppse that e(t) is PS with dot 0.6: µPS(e) = 0.6 and e is NS with dot 0.4:

µNS(e) = 0.4, then the degree of activation of the corresponding rule ZZ is 0.4, using the MIN operator

ePB PS ZZ NS NB

PB PB PB PS PS ZZ PS PB PS PS ZZ NS

e ZZ PS PS ZZ NS NS NS PS ZZ NS NS NB NB ZZ NS NS NB NB

µNS (e) = 0.4

µPS(e) = 0.6

4.04.0,6.0min)e(),e(min)u( NSPSZZ

ZZisuTHENNSiseANDPSiseIF )u()e()e( ZZNSPS

1

)e(PS

1 1e

6.0

1

)e(NS

1 1e

4.0

4.0

Page 8: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 8S. Marsili-Libelli: Controllo Fuzzy

Of course more than one rule is activated

1

)e(PS

1 1e

6.0

2.0

)e(PB

1)e(NS

1 1e

3.0

)e(ZZ

8.0

ePB PS ZZ NS NB

PB PB PB PS PS ZZ PS PB PS PS ZZ NS

ZZ PS PS ZZ NS NS NS PS ZZ NS NS NB NB ZZ NS NS NB NB

8.0

6.0

e3.0

2.0

6.02.0

Page 9: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 9S. Marsili-Libelli: Controllo Fuzzy

Normalization/Denormalization

Normalization/Denormalization gains are required to conform the variables to their operating ranges

FyzzyInference

Rules-1 +1 -1 +1

supporto normalizzato

Antecedent Consequent

Input Range Output Range

supporto normalizzato

Ki Kout

Operating range

3e

2.0Ki

1.0Ki

Operating range

Page 10: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 10S. Marsili-Libelli: Controllo Fuzzy

Effect of Normalization/Denormalization

The choice of N/DN coefficients can have dramatic effects of the regulator performance

0

0.5

1

1.5

0

0.5

1

1.5

0 5 10 15 20

y

u

y

u

0 5 10 15 20

time time

ysp ysp

Kin = 0.23Kout = 0.075

Kin = 1.0Kout = 0.2

Page 11: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 11S. Marsili-Libelli: Controllo Fuzzy

Lack of integral action in the fuzzy regulatorUnlike deterministic regulators integral action cannot guarantee set-point tracking.

This is because of the “granularity” of the increments provided by the fuzzy regulator

If the error is in the ZZ band, only that qualifier will be activated and this yields a 0 output. So for that range of errors no contribution will be summed by the integrator

and corrective action will result

Rimedy: Shrink the dead-band by increasing the overlapping between mf

0

0.2

0.4

0.6

0.8

1

1.2

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

-0.4

-0.2

0

0.2

0.4

-0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4errore

N = 5, b = 0.3

ZZ PS PBNSNB

du

Dead band

In this zone the only contribution is given by ZZ

Input/Output characteristicsof the fuzzy regulator

Page 12: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 12S. Marsili-Libelli: Controllo Fuzzy

a) Proportional-Integral (PI)

b) Proportional-Derivative (PD)

c) Full PID

Formal similarities of PID actions

titpPIdet

1ttfuzzyfuzzy

eKeKu:PI

e,efe,efu:PI

tdtpPDdet

1ttfuzzyfuzzy

eKeKu:PD

e,efe,efu:PD

2t31t2t1PIDdet

2t1ttfuzzyfuzzy

eKeKeKu:PID

e,e,efu:PID

Page 13: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 13S. Marsili-Libelli: Controllo Fuzzy

Fuzzy tuning of a deterministic PID

A set of fuzzy rules can be designed to adjust the PID coefficients during operation

ysp + y-

+

dedt

K1

K2

Deterministic PID

FUZZY TUNING

t

0i d)(eK

dt

)t(deKd

)t(eK p

PROCESS

Fuzzyrules

Defuzz.Fuzz.

Page 14: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 14S. Marsili-Libelli: Controllo Fuzzy

Progetto di Regolatori Fuzzy in Matlab/Simulink

RATEO di LIVELLO

SISTEMA DI REGOLEINFERIENZIALI FUZZY

VALVOLA

LIVELLO

Insieme di regole fuzzy = regolatore

Obiettivo: regolazione del livello di un serbatoio mediante apertura della valvola di alimentazione

FLC

hsp

Page 15: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 15S. Marsili-Libelli: Controllo Fuzzy

L’ambiente Fuzzy Toolbox di MATLAB

Page 16: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 16S. Marsili-Libelli: Controllo Fuzzy

Lo schema Simulink per il problema del serbatoio

Try the demo

"sltank2"

PID

PID

Controller

Scope1

animtank

S-Function

0.5

tank max

inflow

Signal

Generator

1

Constant

Controllore Fuzzy

Switch

-1

const+

-

Sum1

+-

errorMux

Mux1

change

scope

change

du/dt

Derivative

VALVE

Subsystem

WATERTANK

SERBATOIO

Scope2

Mux

Mux2

Page 17: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 17S. Marsili-Libelli: Controllo Fuzzy

Paragone fra le prestazioni di regolatori fuzzy

0 2 0 4 0 6 0 8 0 1 0 00 . 2

0 . 4

0 . 6

0 . 8

1

1 . 2

1 . 4

1 . 6

1 . 8

te m p o (s )

R e g o la to r e P ID

l iv e llo (m )

0 2 0 4 0 6 0 8 0 1 0 00 .4

0 .6

0 .8

1

1 .2

1 .4

1 .6

te m p o ( s )

liv e l lo (m )

0 2 0 4 0 6 0 8 0 1 0 00 .4

0 .6

0 .8

1

1 .2

1 .4

1 .6

te m p o (s )

liv e llo (m )

MAMDANI SUGENO

Page 18: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 18S. Marsili-Libelli: Controllo Fuzzy

Differenze nei conseguenti

no_changeclose_slow

close_fastopen_slow

open_fast

valvola

-1 0 +1

MAMDANI

no_changeclose_slow

close_fastopen_slow

open_fast

valvola

-1 0 +1

SUGENO

-0.5 0.3

0.3-0.5

Page 19: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 19S. Marsili-Libelli: Controllo Fuzzy

Controllo fuzzy del DO Si vuole mantenere costante la concentrazione di ossigeno disciolto basandosi

sull’errore (DOsp – DO) ed agendo sul sistema di aerazione

Si definiscono i seguenti qualificatori Errore DO: Negative Big (NB);

Negative Small (NS), Zero (Z), Positive Small (PS), Positive Big (PB)

Portata d’aria: Zero (Z), Small (S), Medium (M), Large (L), Very Large (LL)

Nota: la portata d’aria è da intendersi comeincremento e non valore assoluto

Il regolatore fuzzy comprenderà le seguenti semplici regole:

1. If (DO is Z) then (Ua is M) (1) 2. If (DO is NB) then (Ua is Z) (1) 3. If (DO is PB) then (Ua is LL) (1) 4. If (DO is NS) then (Ua is S) (1) 5. If (DO is PS) then (Ua is L) (1)

Page 20: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 20S. Marsili-Libelli: Controllo Fuzzy

Attivazione delle regole

quando l’errore è zero, l’incremento di uscita è anch’esso zero

Vista dell’attivazione delle regole Vista della funzione di controllo(ingresso/uscita)

questa curva rappresenta l’uscita (Ua) calcolata dal regolatore fuzzy in funzione dell’errore di DO.

Page 21: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 21S. Marsili-Libelli: Controllo Fuzzy

Schema Simulink con controllo DO fuzzy

(1+r)*q

ricircolo DO

(1+r)*q

ricircolo

errore

1/s

X_int

DO_err

To Workspace1

Mono

To Workspace

Sum3

Sum2

Sum

Saturation

1/s

S_int

Product

Kd

Kd

1s

Integrator

Mu*u[1]*u[2]/(Ks+u[1])

Fcn

0

Display

[t_in,S_in]

Dati di ingresso

1/s

DO_int

DO_Fuzzy

DOsp

DO set-point

Csat

DO sat

Clock

Kg

s+aAttuazione

areatori

Ka

Areazione

(1-Y)/Y

1/Y2

q

1/Y1

-1/Y

1/Y

modello delprocesso

regolatore fuzzy

DO_Fuzzy=readfis('DO_Fuzzy')integratoreesterno

Page 22: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 22S. Marsili-Libelli: Controllo Fuzzy

Prestazione del regolatore fuzzy

0 100 200 300 400 500 600 7000

2

4B

OD

(m

g/L

)

0 100 200 300 400 500 600 7001000

2000

3000

X H (

mg/

L)

0 100 200 300 400 500 600 7000

2

4

DO

(m

g/L)

0 100 200 300 400 500 600 7000

500

1000

Ua (

m3 /h

)

tempo (ore)

Page 23: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 23S. Marsili-Libelli: Controllo Fuzzy

Attivazione delle regole durante la regolazione

1 2 3 4 50

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Regole

Per

c. A

ttiva

zion

eIf (DO is Z) then (Ua is M)

If (DO is NB) then (Ua is Z)

If (DO is PB) then (Ua is LL)

If (DO is NS) then (Ua is S)

If (DO is PS) then (Ua is L)

queste regole sono le meno usate perché quasi mai l’errore è grande (positivo o negativo)

Page 24: Pag. 1 S. Marsili-Libelli: Controllo Fuzzy Why Fuzzy Control? 1 - No detailed mathematical model required 2 -Human experience can be easily incorporated

pag. 24S. Marsili-Libelli: Controllo Fuzzy

Bibliografia

Yager R.R. e Filev D.P. (1994) Essentials of Fuzzy Modelling and Control, Wiley.

Klir. G.J. e T.A. Folger (1988) Fuzzy Sets, Uncertainty, and Information, Prentice-Hall.

Ross T.J. (1995) Fuzzy Logic with Engineering Applications, McGraw-Hill.

Driankov D, Hellendoorn H., Reinfrank M. (1993) An introduction to Fuzzy Control, Springer-Verlag.

Patyra M.J. e Mlynek D.M. (editors) (1996) Fuzzy Logic, Implementation and Applications, Wiley Teubner.

Nguyen H.T., Sugeno M., Tong R. Yager R.R. (editors) (1995) Theoretical Aspects of Fuzzy Control, Wiley.

Yager R.R. e Zadeh L.A. (editors) (1994) Fuzzy Sets, Neural Networks, and Soft Computing, Van Nostrand Reinhold.

Wang, L. X. (1994) Adaptive Fuzzy Systems and Control. PTR Prentice Hall.