PID

®
®
Introduction to PID Controller Design
Dr. Bora Eryılmaz
Engineering Manager
Control and Estimation Tools Group
The MathWorks, Inc.
© 2009 The MathWorks, Inc.
with examples in MATLAB and Simulink
®
®
What is a PID Controller?
A special type of controller C(s) with
 Proportional
 Integral
 Derivative
terms acting on the error signal E(s).
R(s)
Step
E(s)
C(s)
U(s)
PID Controller
P(s)
Y(s)
Process Model
Plant Output
2
®
®
What is a PID Controller? (cont.)
 Ideal (standard) form:

KI
KDs 

 E ( s)
U ( s)   K P 

s  Ds 1

 Series (cascade) form:
 I
U ( s)  K S 1  S
s

DS s 


 E ( s)
1


  S DS s  1 
 Main point is: any second-order controller of the form
n2 s 2  n1s  n0
C (s) 
sd 2 s  d1 
is a PID controller.
3
®
®
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
4
®
®
Some History: Fluid Level Control
r(t)
k
error
Desired liquid level
1/A
q_in(t)
Gain
h(t)=y (t)
h(t)=y (t)
s
Process Dynamics
Actual level
G(s)
Y (s) 
k
A
s
k
R( s)
A
and at steady state
G(0)  1
A  dh  qin  dt
h
1
qin
A
qin : in flow
A : cross-sectional area
h: liquid level
5
®
®
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.
Jw  bw  T  Td
J : inertia
b : friction coefficient
Td : disturbance torque
Disturbance torque
Td(t)
r(t)
Set point - Desired Speed
error
k
Gain
1
T(t)
w(t)
J.s+b
Engine Dynamics
speed
6
®
®
Many Types of “PID” Controllers…
 Proportional (P):
U ( s)  K P E ( s)
 Integral (I):
KI
E ( s)
s
U (s) 
 Proportional + Integral (PI):
K

U (s)   K P  I
s

 Proportional + Derivative (PD):

 E (s)


KDs 

 E ( s)
U ( s)   K P 
 Ds 1

 You might see other combinations with different
parameters than Kp, Ki, and Kd.
7
®
®
Low-Order Process Models
 Many industrial processes can be modeled using simple
stable transfer functions.
K 0 e  s
 First-order process with delay: P( s) 
 0s 1
0
K 0 e  s 0
 Second-order process with delay: P( s)  2
s  2 00 s  02
 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.
8
®
®
Desirable first-order responses with a
tuning parameter K
 Remember the open-loop transfer function is given by
L( s)  P( s )C ( s)
 Design your PID controller so that L(s) looks like
K
L( s ) 
s
 Then the closed-loop transfer function will look like
T ( s) 
R(s)
Step
L( s )
K
1


1  L( s ) s  K ( s / K )  1
E(s)
C(s)
U(s)
PID Controller
P(s)
Y(s)
Process Model
Plant Output
9
®
®
Designing a PI controller for a first-order
process model
 PI controller for a first-order process model
P( s) 
K0
K
and C ( s )  K P  I
 0s 1
s
 Remember, given K, we want:
 Our PI parameters: K P 
 0K
K0
L( s )  P( s )C ( s ) 
and
KI 
K
s
K
K0
 Let’s put this in MATLAB and Simulink…
10
®
®
Desirable second-order responses with
tuning parameters K and α
 Design your PID controller so that L(s) looks like
K
L( s)  P( s)C ( s) 
s(s  1)
 Then the closed-loop transfer function will look like
L( s )
K
1
T ( s) 
 2

1  L( s) s  s  K ( / K ) s 2  (1 / K ) s  1
 K and α are our design parameters.
R(s)
Step
E(s)
C(s)
U(s)
PID Controller
P(s)
Y(s)
Process Model
Plant Output
11
®
®
Designing a PID controller for a secondorder process model
 PID controller for a second-order process model
P( s) 
K0
s 2  2 00 s  02
and C ( s )  K P 
KI
K s
 D
s  Ds 1
 Remember, given K and α, we want: L( s)  P( s)C ( s) 

K
s(s  1)
2
K

K
K
0
KP 
2 00  02 , K I 
, KD 
1 - 2 00   202 ,  D  
K0
K0
K0




 Let’s put this in MATLAB and Simulink…
12
®
®
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
13
®
®
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
2(1  15s)
P0 ( s) 
(1  20s)(1  s)(1  0.1s) 2
 Can you get a closed-loop settling time less than 50 sec?
14