PID Handout
PID Handout
1 Introduction
The proportional-integral-derivative (PID) controllers are without a doubt the most widely
used controllers in industry today. Åström and Hägglund [1, p. 198] regard the PID con-
troller as the “bread and butter” of control engineering. Knospe [3] estimates that over
90% of control loops employ PID control. The PID control strategy is most useful when a
mathematical model of the process to be controlled is not available to the control engineer.
To better appreciate the effectiveness of the PID control strategies, we first discuss a
general control design principle referred to as the internal model principle (IMP).
Controller Plant
Nr (s) #
R(s) = Dr (s) @ E(s) Y (s)-
- @ - Nc (s) - Np (s)
+ −@
"!
@ Dc (s) Dp (s)
r(t) e(t) ?
y(t)
6
Gc (s) Gp (s)
1
Using basic rules of the block diagram algebra yields
Nc (s)
Our objective is to design a controller Gc (s) = Dc (s)
so that
lim e(t) = 0
t→∞
if and only if
2. Dr (s) is a factor of the open-loop characteristic polynomial Dp (s)Dc (s), that is,
there is a polynomial, say Q(s), such that Dp (s)Dc (s) = Q(s)Dr (s).
The second condition of the IMP an be interpreted as follows: the controller, Gc (s), must
be chosen in such a way that the open-loop transfer function, Gp (s)Gc (s), contains a model
2
Controller Plant
1 #
R(s) = s E(s) Y (s)-
- @
+@−@ - - 1
Gc (s) =?
"!
@ s+2
e(t) ?
y(t)
6
Nc (s)
Gc (s) = Dc (s)
of the reference signal to be tracked. If none of the poles of R(s) is a pole of the plant’s
transfer function, Gp (s), then we can restate the IMP as follows:
Any good tracking controller must stabilize the closed-loop system and must contain
a model of the reference signal.
For an alternative approach to the IMP, we recommend Wolovich [7, pp. 254–255].
We now illustrate the IMP with two numerical examples.
Example 1 For the closed-loop system shown in Figure 2, our objective is to construct a
transfer function Gc (s) such that limt→∞ e(t) = 0. The Laplace transform of the error is
1 1 (s + 2)Dc (s) 1
E(s) = 1 Nc (s)
= .
1+ s+2 Dc (s)
s (s + 2)Dc (s) + Nc (s) s
3
Controller Plant
1 #
R(s) = s2 E(s) Y (s)-
- @
+@−@ - - 1
Gc (s) =?
"!
@ s+2
e(t) ?
y(t)
6
Nc (s)
Gc (s) = Dc (s)
4
Finally, let us try a controller of the form
Nc (s) s+a
Gc (s) = = 2 , (2)
Dc (s) s
where a is a design parameter that should be chosen to satisfy the both conditions of the
IMP. Note that the above controller contains the model of the reference signal. Thus, we
only need to select the design parameter a so that the CLCP, Pc (s), has its zeros in the open
left half-plane, where
and
s+2
E(s) =
s3
+ 2s2 + s + 1
We can now apply the final value theorem to E(s) to obtain, limt→∞ e(t) = 0.
The selection of a = 1 results in the desired steady-state behavior of the closed-loop
system. However, the above controller may, or may not, guarantee the desired transient
performance of the closed-loop system. Thus further tuning of the parameter a may be
necessary.
In industrial applications, control engineers usually specify the performance of the con-
trolled system based on the system step response. In such a case r(t) is a step function,
which sometimes is also referred to as the constant set-point, which can be represented as
0 for t < 0
r(t) =
A for t ≥ 0,
where A is the constant set-point value. Recall that the Laplace transform of the above
signal is
A
R(s) = L(r(t)) = .
s
5
Taking the above into account it is easy to see that the integral (I) controller contains the
model of the unit step function as well as any scalar multiple of it. If, in addition, the zeros
of the CLCP are all in the open left-half plane, then e(∞) = 0 for any step input. For this
reason, the I controller is often referred to as as reset controller because it automatically
ensures e(∞) = 0 without an operator manually altering or “resetting” the set-point value
to achieve a desired output value.
6
• The derivative term, uD , is
de(t)
uD (t) = KP TD , (7)
dt
where TD is the derivative time constant.
The derivative term is especially effective for plants with significant dead-time resulting
in a poor representation of previous control actions in the current tracking error. This,
in turn, as pointed out by Knospe [3], may lead to large transient error when PI control
is used. The derivative action combats this problem by generating its action based on
a prediction of future tracking error. But there is a cost to be paid—the derivative
term amplifies higher frequencies sensor noise. To alleviate the problem, a filtering of
the differentiated signal is employed thus resulting in a PID controller with a derivative
filter referred to as a PIDF controller. We present a PIDF controller in a section on
implementing PID controllers.
Combining the above terms together, we obtain the type A PID control action, in the time
domain,
U(s) 1
GP ID (s) = = KP 1 + + TD s , (9)
E(s) TI s
where U(s) = L(u(t)) is the Laplace transform of u(t) and E(s) = L(e(t)) is the Laplace
transform of the tracking error e(t). In Figure 4, we show a PID-controlled system with the
type A PID controller in the forward path.
7
Desired # Actual
output - @ output -
+@−@ - KP 1 + -
1
+ TD s Plant
"!
TI s
Reference @
input 6
Plant
u(t) y(t)
Figure 5: Open-loop test on the plant—measuring the step response of the plant.
Y (s) Ke−Ls
= Gd (s) = . (10)
U(s) Ts + 1
We illustrate the procedure of approximating a system with an S-shaped step response using
a first-order transfer function with transportation delay given by (10) with the following
example.
8
y(t)
Tangent line at
inflection point
0 t
L T
Figure 6: An S-shaped step response and its characterization using three parameters.
transfer function
10 10
Gp (s) = = 2 . (11)
(s + 1)(s + 5) s + 6s + 5
Using the procedure illustrated in Figure 6, we approximate the second-order transfer func-
tion (11) using the first-order transfer function with transportation delay,
Ke−Ls 2e−0.053s
Gd (s) = = . (12)
Ts + 1 0.798s + 1
In Figure 7, we compare the step responses of the above two transfer functions. One can see
that approximating the S-shaped step step response of a dynamic system using a first-order
transfer function with transportation delay is a challenging problem. Global optimization
methods, such as genetic algorithms and particle swarm optimizers are the tools that can
be used here effectively to determine parameters L and T that result in Gd (s) that “best”
approximates a given Gp (s).
Ziegler and Nichols proposed a set of tuning rules, formulas, using the parameters that
characterize the step response of the plant modeled by the transfer function (10). These
tuning formulas are shown in Table 1.
Substituting the tuning parameters given in Table 1 into the transfer function of the PID
controller gives
1
GP ID (s) = KP 1 + s + TD s
TI
T 1
= 1.2 1+ + 0.5Ls
L 2Ls
9
2 Step responses of two models
1.5
0.5
0
0 1 2 3
Approximation error
0.3
0.2
0.1
0
0 1 2 Time t 3
Figure 7: Comparison of step responses of the second-order system and its approximation
using a first-order system with transportation delay in Example 3.
Table 1: Ziegler-Nichols tuning formulas based on the step response of the plant (open-loop
method).
Controller KP TI TD
T
P L
∞ 0
PI 0.9 TL L
0.3
0
PID 1.2 TL 2L 0.5L
2
1
s+ L
= 0.6T . (13)
s
Thus the type A PID controllers tuned using the formulas of the open-loop method can be
parameterized by two parameters, T and L.
The ACT controller manufacturer, as well as Li, Ang, and Chong [4], present slightly
modified Ziegler-Nichols open-loop tuning formulas shown in Table 2. The only difference
between the formulas shown in Table 1 and those in Table 2 is in the first column where
all the column elements of the first column of Table 2 are obtained by dividing by K the
corresponding elements of Table 1.
10
Table 2: Modified Ziegler-Nichols tuning formulas based on the step response of the plant
(open-loop method).
Controller KP TI TD
T
P LK
∞ 0
T L
PI 0.9 LK 0.3 0
T
PID 1.2 LK 2L 0.5L
rt
( ) ut ( ) yt
( )
+
_
Kp Plant
Figure 8: Experimental setup to determine the critical gain, Kcr and critical period of
oscillation, Pcr .
yt
( )
Pcr
0 t
11
Nichols proposed tuning formulas depicted in Table 3. Substituting the tuning parameters
Table 3: Ziegler-Nichols tuning formulas based on critical gain Kcr and critical period Pcr
(closed-loop method).
Controller KP TI TD
P 0.5Kcr ∞ 0
Pcr
PI 0.45Kcr 1.2
0
PID 0.6Kcr 0.5Pcr 0.125Pcr
from Table 3 into the transfer function of the type A PID controller, we obtain
1
GP ID (s) = KP 1 + s + TD s
TI
1
= 0.6Kcr 1 + + 0.125Pcr s
0.5Pcr s
2
4
s+ Pcr
= 0.075Kcr Pcr . (14)
s
As in the open-loop method, the type A PID controllers tuned using the formulas of the
closed-loop method can be parameterized by two parameters; this time by Kcr and Pcr .
In summary, both the open-loop and closed-loop Ziegler-Nichols tuning rules allow us
to parameterize the type A PID controllers using just two parameters. That is, we can
represent a family of type A PID controllers as
(s + a)2
GA−P ID = Kc , (15)
s
where Kc and a are design parameters. The above representation can be used to computa-
tionally obtain parameters’ values that satisfy design specifications.
12
5.1 PIDF Controller
In the PIDF controller, the pure differentiator is approximated with the pure differentiator
cascaded with a first-order low-pass filter. Thus the pure derivative term is replaced by the
approximate differentiator and so the derivative term contribution would take the form,
TD s
UD (s) = E(s), (16)
γTD s + 1
where γ is a small parameter, for example, γ = 0.1. The transfer function of the type A
PIDF controller has the form
!
1 TD s
GP IDF = KP 1+ s+ . (17)
TI γTD s + 1
For a step reference, the PIDF controller output will involve a sharp pulse rather than
an impulse function. This is referred to as the set-point kick phenomenon.
Example 4 In this example, we use the open-loop Ziegler-Nichols tuning formulas given in
Table 1 to tune the PIDF controller for plant models in Example 3. We first apply the PIDF
controller to the second-order transfer function given by (11). We add that the proportional
gain was tuned as
T
KP = 1.2 = 18.068
L
T
because for the modified gain, KP = 1.2 LK , the closed-loop system becomes unstable. The
remaining parameters are:
The plant output and the control signal plots versus time are shown in Figure 10. The
system output is very oscillatory and takes long time to settle down. We can observe the
set-point kick phenomenon in the plot of the control effort versus time.
We then applied the type A PIDF controller to the transfer function given by (12). Here,
T
on the other hand, we used KP = 1.2 LK because for KP = 1.2 TL the closed-loop system
becomes unstable. The plant output and the control signal plots versus time are shown in
Figure 11. Here, as in the previous case, we can observe a set-point kick phenomenon. The
closed-loop system is much faster here but the overshoot is at unacceptable level.
We conclude that the open-loop Ziegler-Nichols tuning rules do not necessarily yield ex-
cellent performance of the PID-controlled system. The controller requires careful additional
tuning. To illustrate this point, we doubled the values of KP , TI , and TD . The re-tuned
13
Plant output
1.5
0.5
0
0 1 2 3
Control signal
200
100
0
0 1 2 Time t 3
Figure 10: PIDF-controlled second-order system’s step response of Example 4, where the
reference input is a step function delayed by 0.5 s in order to better observe the set-point
kick phenomenon.
14
Plant output
2
0
0 0.5 1 1.5
100 Control signal
50
0
0 0.5 1 1.5
Effect of delay on control signal
100
50
0
0 0.5 1 Time t 1.5
Figure 11: Step response of the PIDF-controlled first-order system with transportation delay
in Example 4.
PIDF controller performance applied to the second-order plant is shown in Figure 12. This
re-tuning was suggested by Ogata [6, p. 165]. However the re-tuned controller does not work
for the first-order plant with transportation delay. The closed-loop system driven by this
controller is in fact unstable.
As we observed before, in addition to the transient performance, the designer has to deal
with the set-point kick phenomenon. We address this issue next.
15
Plant output
0.5
0
0 0.5 1 1.5
Control signal
400
300
200
100
0
0 0.5 1 Time t 1.5
Figure 12: Step response of the closed-loop system with re-tuned PIDF controller and second-
order plant in Example 4.
To illustrate the issue, consider Example 4. Suppose now that the actuator saturation limits
are ±10, that is,
|u(t)| ≤ 10
These constraints are violated in the above example because of the set-point kick phe-
nomenon. Let us now impose the constraints on the control action and see how this affects
the closed-loop system behavior.
Example 5 First, we consider the second-order plant (11) simulated in the previous ex-
ample. We now impose constraints on the actuator, |u(t)| ≤ 10. The PIDF controller
parameters are the same as the ones we used in the simulation shown in Figure 12. The
output of the closed-loop system is shown in Figure 13.
As can be seen in Figure 13 and 14, in both cases the control signal saturates in the
moment the reference input is applied. The input to the plant remains saturated in the
sense that the feedback loop is broken because the controller’s output is not responding to
16
1.5 Plant output
1
0.5
0
0 0.5 1 1.5
10 Control signal
5
0
-5
0 0.5 1 1.5
Integral term output
0.4
0.2
0
0 0.5 1 Time t 1.5
Plant output
1.5
1
0.5
0
0 0.5 1 1.5
10 Control signal
0
0 0.5 1 1.5
Effect of delay on control signal
10
0
0 0.5 1 Time t 1.5
Figure 14: Plant output of the PIDF-controlled first-order plant with with transportation
delay and constraints on input.
17
Actuator
model
Es
+
Us
TDs
( )
KP
( ) +
- +
1 + 1
TI s
+
TA
its input. The output of the integral term continues to increase because the tracking error is
positive. The output of the integral term starts decreasing when the plant’s output becomes
larger than the reference input. However, the controller stays saturated for some time because
of the excessively large output of the integral term. As a result of the integral term excessive
output, the plant’s output has a large overshoot. This phenomenon of excessive integrator
term output resulting in the large overshoot of the plant’s output is called the integrator
windup.
We can avoid or reduce the integrator windup by reducing the integral term output when
the actuator saturates. A possible anti-windup scheme is shown in Figure 15. This anti-
windup mechanism is referred to as tracking or back calculation. In Figure 16, we show the
output of the PIDF-controlled second-order plant with the anti-wind, where TA = TI /0.075.
In Figure 17, we show the output of the first-order plant with transportation delay controlled
with a PIDF controller with the integrator windup. The PIDF controller parameters are the
same as in the simulation of Figure 11, and TA = 0.21.
18
Plant output
0.8
0.4
0
0 0.5 1 1.5
Control signal
10
0
0 0.5 1 1.5
Integral term output
0
-0.2
-0.4
-0.6
0 0.5 1 Time t 1.5
Figure 16: Plant output of the PIDF-controlled second-order plant with the integrator ani-
windup circuit.
7 Digital Implementation
In this section we present a method of implementing PID controllers using a computer. To
obtain a computer implementation, we need to discretize the continuous-time differential
equation describing a controller at hand. We now discuss discretization of different terms of
the type A PIDF controller. The types B and C PIDF controllers can be easily obtained by
19
Reference input and plant output
1
0.5
0
0 0.2 0.4 0.6
Control signal
10
0
0 0.2 0.4 0.6
Effect of transportation delay on control signal
10
0
0 0.2 0.4 Time t 0.6
Figure 17: Plant output of the PIDF-controlled first-order plant with transportation delay
and the integrator ani-windup.
Rs
( ) Es
( ) Ys
( )
1 +
KP Gp s
TIS
+ + ( )
_
+
TDS
Rs
( ) Es
( ) Ys ( )
1 +
KP Gp s
TS
+ + ( )
_ _
I
TDS
20
Rs
( ) Ys
( )
1
KP Gp s
TS
+ + ( )
_ _
I
1 TDS
modifying the A PIDF architecture. In our discussion, we assume that the sampling instants
are equally spaced. We denote the sampling period as h, and sampling instants as tk , where
k = 0, 1, 2, . . . .
• The discrete-time version of the proportional term, uP (tk ), has the form
Combining (18), (19), and (22), we obtain a discrete-time approximation of the type A PIDF
controller,
uP (tk ) = KP e(tk )
γTD KP
uD (tk ) = γTD +h uD (tk−1 ) + γTD +h (e(tk ) − e(tk−1 ))
(23)
u(tk ) = uP (tk ) + uI (tk ) + uD (tk )
uI (tk+1 ) = uI (tk ) + KTPI h e(tk )
To implement the above controller, one can use the zero-order hold.
8 Notes
The first PID controllers for industrial applications were introduced in 1939 by the Taylor
Instrument Company and the Foxboro Instrument Company. For an account of the PID
controller development along with an overview of early process control devises, we recom-
mend Bennett [2]. For an account of recent advances in PID control, see an article by Li,
Ang, and Chong [4].
Many engineers are familiar with PID controllers and prefer to enhance the performance
of a well-known solution through additional capabilities rather than switch to an untested
solution. Knospe [3] observers that even alternative digital control methods have not sup-
planted PID’s primacy in industrial control with a possible exception of model predictive
control, where the control action is calculated on the fly. Knospe [3] adds that PID control
still has a role even in this case by handling lower level loops.
References
[1] K. J. Åström and T. Hägglund. PID Control. In W. S. Levine, editor, The Control
Handbook, chapter 10.5, pages 198–209. CRC Press in cooperation with IEEE Press,
Boca Raton, Florida 33431, 1996.
22
[2] S. Bennett. Development of the PID controller. IEEE Conrol Systems Magazine,
13(6):58–65, December 1993.
[3] C. Knospe. PID control—Introduction to the special section. IEEE Conrol Systems
Magazine, 26(1):30–31, February 2006.
[4] Y. Li, K. H. Ang, and G. C. Y. Chong. PID control system analysis and design: Problems,
remedies, and future directions. IEEE Conrol Systems Magazine, 26(1):32–41, February
2006.
[5] K. Ogata. Modern Control Engineering. Prentice Hall, Upper Saddle River, New Jersey
07458, third edition, 1997.
[6] K. Ogata. Solutions Manual to Modern Control Engineering. Prentice Hall, Upper Saddle
River, New Jersey 07458, third edition, 1997.
[7] W. A. Wolovich. Automatic Control Systems: Basic Analysis and Design. Saunders
College Publishing, Harcourt Brace College Publishers, Fort Worth, 1994.
[8] J. G. Ziegler and N. B. Nichols. Optimum settings for automatic controllers. Transactions
of the American Society of Mechanical Engineers, 64:759–768, November 1942.
23