Fuzzy PID Control Jan Jantzen [email protected] 2013 1.

26
Fuzzy PID Control Jan Jantzen [email protected] www.inference.dk 2013 1

Transcript of Fuzzy PID Control Jan Jantzen [email protected] 2013 1.

Page 1: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

1

Fuzzy PID Control

Jan Jantzen

[email protected]

www.inference.dk

2013

Page 2: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

2

Summary

• Reduce design choices• Tuning

Page 3: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

3

Design Procedure

• Build and tune a conventional PID controller first.• Replace it with an equivalent linear fuzzy controller.• Make the fuzzy controller nonlinear.• Fine-tune the fuzzy controller.

Relevant whenever PID control is possible, or already implemented

Page 4: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

4

Single Loop Control

Load Noise

The controller should preferably be able to follow the reference r, reject load changes l and noise disturbances n, but these requirements are in conflict with each other. We would like to transfer PID tuning methods to the fuzzy controller in order to have a tuning method.

Page 5: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

5

Rule Base With 4 Rules

1. If error is Neg and change in error is Neg then control is NB3. If error is Neg and change in error is Pos then control is Zero7. If error is Pos and change in error is Neg then control is Zero9. If error is Pos and change in error is Pos then control is PB

The four rules can handle many cases, and they are sufficient for a linear controller.

Page 6: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

6

Textbook PID Controllers

t

di

p t

eTe

TeKu

0 d

dd

1

n

j s

nndsj

inpn T

eeTTe

TeKu

1

11

sn

innpn Te

TeeKu

11

Continuous version

Discrete version

Incremental, discrete version

Page 7: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

7

Fuzzy P controller

f

Rule base

uGU

UGE

Ee

GUneGE

GUneGEfnU

)(

)()(

GUGEK p

Gain on error

Gain on control

Provided that the rule base acts like the identity function

By comparison with the P controller equation

Page 8: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

8

FP Rule Base

1. If E(n) is Pos then u(n) is 100

2. If E(n) is Neg then u(n) is -100

With a proper choice of membership functions the controller will act like a linear P controller

Page 9: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

9

Fuzzy PD Controller

GE

GCETGUGEK

neGE

GCEneGUGE

GUneGCEneGE

GUneGCEneGEfnU

dp

,

))()((

))()((

)(),()(

eGE

GCE

f

Rule base

E

CE

uGU

U

de/dt

Provided that the rule base acts like a summation

Now we know what the gains do

Page 10: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

10

FPD Rule Base

1. If E(n) is Neg and CE(n) is Neg then u(n) is -2003. If E(n) is Neg and CE(n) is Pos then u(n) is 07. If E(n) is Pos and CE(n) is Neg then u(n) is 09. If E(n) is Pos and CE(n) is Pos then u(n) is 200

With a proper choice of membership functions the controller will act like a linear PD controller. Four rules are sufficient.

Page 11: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

11

Fuzzy PD+I Controller

CE

eGE

f

PD rules

GCE

++ GU

E

GIEIE

u Ude/dt

edt

GUTjeGIEneGCEneGEfnUn

js

1

)()(),()(

It is better that the integral action bypasses the rule base. It saves rules.

Page 12: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

12

Fuzzy Incremental Controller

eGE

GCE

f

Rule base

E

CEGCU 1/s U

CUcu

de/dt

n

jsTGCUneGCEneGEfnU

1

)(),()(

The output is a change to the previous state

This is an integrator. It could be a valve position, for instance.

The increment. It is a change to the sum of all previous signals.

Page 13: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

13

Fuzzy - PID Gain Relation

Controller Kp 1/Ti Td

FP GE×GU

FInc GCE×GCU GE/GCE

FPD GE×GU GCE/GE

FPD+I GE×GU GIE/GE GCE/GE

It tells what each fuzzy gain does to the proportional gain, the derivative gain, and the integral gain. Conversely, given values for Kp, Ti and Td we can find one or more sets of values for the fuzzy gains. Very important table.

Page 14: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

14

Tuning

lKK

Knr

KK

KKx

pp

p

11

Process gain

If we increase Kp, we suppress load changes.

If we increase Kp, the response will be more sensitive to noise.

If we increase Kp too much, the system might oscillate or even become unstable

Page 15: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

15

Ziegler-Nichols Tuning

• Increase Kp until oscillation, Kp = Ku

• Read period Tu at this setting

• Use Z-N table for approximate controller gains

Page 16: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

16

Ziegler-Nichols (freq. method)

Controller Kp Ti Td

P 0.5Ku

PI 0.45Ku Tu/1.2

PID 0.6Ku Tu/2 Tu/8

Given values for Ku and Tu, the table provides the gains in the three controller cases. Easy, but often the result is a poorly damped system.

Page 17: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

17

Z-N oscillation of 1/(1+s)3

The ultimate gain Ku = 8, and the ultimate period is Tu = 15/4 s

Page 18: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

18

PID control of 1/(1+s)3 Response to a reference step

Response to a load step

Page 19: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

19

Fuzzy FPD+I control of 1/(1+s)3

The response is the same as for PID control Trajectory on

the control surface, which is a plane

The membership functions are linear

Page 20: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

20

Hand-Tuning

1. Set Td = 1/Ti = 0

2. Tune Kp to satisfactory response, ignore any final value offset

3. Increase Kp, adjust Td to dampen overshoot

4. Adjust 1/Ti to remove final value offset

5. Repeat from step 3 until Kp large as possible

Page 21: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

21

Quick reference to controllers

Controller Advantage Disadvantage

FP Simple Maybe too simple

FPD Less overshoot Noise sensitive, derivative kick

FInc Removes steady state error, smooths control signal Slow

FPD+I All in oneWindup, derivative kick

Page 22: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

22

Scaling

eGE

GCE

f

Rule base

E

CE

uGU

α

1/αde/dt

1 GUneGCEneGEGUneGCEneGE

The linear controller is invariant towards scaling. In the nonlinear controller we can use it to avoid saturation in the input universes.

Page 23: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

23

Summary

1. Design crisp PID

2. Replace it with linear fuzzy

3. Make it nonlinear

4. Fine-tune it

Page 24: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

24

ADVANCED SECTION

Page 25: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

25

Nyquist 1/(s+1)3 with PID

-2 0 2-2

-1

0

1

2Kp = 4.8, Ti = 15/8, Td = 15/32

Page 26: Fuzzy PID Control Jan Jantzen jj@inference.dk  2013 1.

26

Tuning Map 1/(s+1)3

-2 0 2-2

0

2000

a)-2 0 2

-2

0

2001

b)-2 0 2

-2

0

2010

c)-2 0 2

-2

0

2011

d)

-2 0 2-2

0

2100

e)-2 0 2

-2

0

2101

f)-2 0 2

-2

0

2110

g)-2 0 2

-2

0

2111

h)