14
© 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control and Estimation Tools Group The MathWorks, Inc.

© 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

Embed Size (px)

Citation preview

Page 1: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

© 2

009

The

Mat

hWor

ks, I

nc.

® ®

Introduction to PID Controller Designwith examples in MATLAB and Simulink

Dr. Bora Eryılmaz

Engineering Manager

Control and Estimation Tools Group

The MathWorks, Inc.

Page 2: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

2

® ®

What is a PID Controller?

A special type of controller C(s) with Proportional Integral Derivative

terms acting on the error signal E(s).

Step

P(s)

Process ModelPlant Output

C(s)

PID Controller

U(s)R(s) E(s) Y(s)

Page 3: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

3

® ®

What is a PID Controller? (cont.)

Ideal (standard) form:

Series (cascade) form:

Main point is: any second-order controller of the form

is a PID controller.

)(1

)( sEs

sK

s

KKsU

D

DIP

)(1

11)( sEsD

sD

s

IKsU

SS

SSS

12

012

2)(dsds

nsnsnsC

Page 4: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

4

® ®

PID Controllers Are Everywhere…

More than 90% of all controllers used in process industries are PID controllers.

A typical chemical plant has 100s or more PID controllers.

PID controllers are widely used in: Chemical plants Oil refineries Pharmaceutical industries Food industries Paper mills Electronic equipments

Page 5: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

5

® ®

Some History: Fluid Level Control

and at steady state

: in flow

: cross-sectional area

: liquid level

inq

A

h

( )

( ) ( )

G s

kA

kA

Y s R ss

Process Dynamics

1/A

sGain

k

Desired liquid level Actual level

r(t) error q_in(t)

h(t)=y (t)h(t)=y (t)

(0) 1G

1in

in

A dh q dt

h qA

Page 6: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

6

® ®

More History: Flyball Governor in Steam Engines

Proportional control Speed control for engines used

proportional control. See the flyball governor by James Watt in 1788.

dJw bw T T

w(t)

speedSet point - Desired Speed Gain

k

Engine Dynamics

1

J.s+b

Disturbance torque

r(t) error T(t)

Td(t)

: inertia

: friction coefficient

: disturbance torqued

J

b

T

Page 7: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

7

® ®

Many Types of “PID” Controllers…

Proportional (P):

Integral (I):

Proportional + Integral (PI):

Proportional + Derivative (PD):

You might see other combinations with different parameters than Kp, Ki, and Kd.

)()( sEKsU P

)()( sEs

KsU I

)()( sEs

KKsU IP

)(1

)( sEs

sKKsU

D

DP

Page 8: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

8

® ®

Low-Order Process Models

Many industrial processes can be modeled using simple stable transfer functions.

First-order process with delay:

Second-order process with delay:

There are many variations of these models, with or without time delays, with transfer functions zeros, ...

We can design PI/PID controllers based on these models.

1)(

0

00

s

eKsP

s

2000

20

2)(

0

ss

eKsP

s

Page 9: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

9

® ®

Desirable first-order responses with a tuning parameter K Remember the open-loop transfer function is given by

Design your PID controller so that L(s) looks like

Then the closed-loop transfer function will look like

)()()( sCsPsL

s

KsL )(

1)/(

1

)(1

)()(

KsKs

K

sL

sLsT

Step

P(s)

Process ModelPlant Output

C(s)

PID Controller

U(s)R(s) E(s) Y(s)

Page 10: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

10

® ®

Designing a PI controller for a first-order process model

PI controller for a first-order process model

Remember, given K, we want:

Our PI parameters:

Let’s put this in MATLAB and Simulink…

s

KKsC

s

KsP I

P

)( and 1

)(0

0

00

0 and K

KK

K

KK IP

s

KsCsPsL )()()(

Page 11: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

11

® ®

Desirable second-order responses with tuning parameters K and α Design your PID controller so that L(s) looks like

Then the closed-loop transfer function will look like

K and α are our design parameters.

1)/1()/(

1

)(1

)()(

22

sKsKKss

K

sL

sLsT

Step

P(s)

Process ModelPlant Output

C(s)

PID Controller

U(s)R(s) E(s) Y(s)

)1()()()(

ss

KsCsPsL

Page 12: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

12

® ®

Designing a PID controller for a second-order process model

PID controller for a second-order process model

Remember, given K and α, we want:

Let’s put this in MATLAB and Simulink…

1)( and

2)(

2000

20

s

sK

s

KKsC

ss

KsP

D

DIP

)1()()()(

ss

KsCsPsL

DDIP K

KK

K

KK

K

KK , 2-1 , , 2 2

02

0000

202

0000

Page 13: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

13

® ®

MATLAB and Simulink Helper

MATLAB commands useful for control design:• P = tf(num, den)• C = zpk(z, p, K)• L = minreal(P*C)• K = dcgain(P)• T = feedback(L,1)• bode(P,L), step(T)• sisotool(P)

Simulink blocks useful for control design:• Transfer Fcn• Zero-Pole• Integrator• Gain, Sum• Transport Delay (time

delay)• PID Controller

Page 14: © 2009 The MathWorks, Inc. ® ® Introduction to PID Controller Design with examples in MATLAB and Simulink Dr. Bora Eryılmaz Engineering Manager Control

14

® ®

Exam Question (10 points)

How to design PI/PID controllers for higher-order plants? Key idea is to shape first- or second-order “dominant” plant

dynamics. That is, you can ignore fast poles in the model. Find a first- or second-order model, P(s), that has a similar

response as the original model, Po(s). For example, you can use step(P, Po) or bode(P, Po) to compare responses. Similar poles and zeros can be ignored to simplify the model.

Question: Design a PI controller, using the technique of slides 9 & 10, for the plant

Can you get a closed-loop settling time less than 50 sec?

20 )1.01)(1)(201(

)151(2)(

sss

ssP