You are on page 1of 18

Introduction to Digital Control ( 2005 M.

Tham)

INTRODUCTION TO DIGITAL CONTROL


The use of computers in process plant operations dates back to the mid-1960's. Nowadays,
process computer s are now common place in the process industries, performing a variety of
manufacturing tasks. Several examples are given in the following schematics.

PROCESS COMPUTER IMPLEMENTATION STRATEGIES

STORAGE
CHEMICAL PROCESS RAW or DERIVED
MEASUREMENTS or
PROCESS COMPUTER DATA
DISPLAY

Data Acquisition System

STORAGE
CHEMICAL PROCESS RAW or DERIVED
MEASUREMENTS
DATA
or
PROCESS COMPUTER
DISPLAY

ANALOG
CONTROLLERS

Operator Guideline System

CHEMICAL PROCESS
MEASUREMENTS
PROCESS COMPUTER

ANALOG
SETPOINTS
CONTROLLERS

Supervisory Control System

1 of 18
Introduction to Digital Control ( 2005 M. Tham)

ANALOG
CONTROLLERS

MEASUREMENTS
CHEMICAL PROCESS
PROCESS COMPUTER
CONTROL SIGNALS

Direct Digital Control (DDC) with Analog Backup

Management
Computer

Scheduling
Computer

Optimising Optimising
Computer Computer

Supervisory DDC Supervisory DDC


Computer 1 Computer 1 Computer 2 Computer 2

Hierarchical Computer Based Operation

We are interested in the use of computers to control process plants, within either a DDC or
Supervisory control framework. The principles of controller design are identical in both cases.
Typical scenarios where computer based process control may be beneficial are:

Plants with large throughput - because utilities consumption is approximately proportional to


throughput, a small improvement can result in large savings

Plants subject to frequent upsets - some plants requires quick responses to process upsets that
operators can not provide

Complex plants -some processes are too complex for operators to deal with the relationships
between process variables and hence are unable to determine the best operating conditions, and
maintaining consistent operation is difficult

Batch processes - some batch processes require frequent cycling or changes in product
specification, and computer control can increase production rate and decrease labour cost

2 of 18
Introduction to Digital Control ( 2005 M. Tham)

New processes - in plants with 40-50 control loops, a DCS may prove to be cheaper than an
equivalent analog system.

SAMPLED DATA SYSTEMS

Because of the nature of digital devices, signals from plant have to be converted into a suitable
form before it can be transferred for processing by a computer. Similarly, signals generated by a
computer must be presented in a form suitable for receipt by the plant. The important pieces of
hardware that achieve these tasks are the:

sampler

analog-to-digital converter (ADC)

digital-to-analog converter (DAC)

signal hold devices

The Sampler

The sampler is essentially a switch, operating usually at fixed intervals of time. When
the 'switch' closes, it grabs or samples the output of the transmitting device. It then
transfers the sampled signal to a receiver. The sampler can operate on both continuous or
discrete signals.

Thus if the source signal is continuous, the output of the sampler is a series of pulses,
and the magnitude of each pulse is equal to the magnitude of the continuous signal at the
instant of sampling as shown in the figure below.

Ts
Ts
Ts
Ts

CONTINUOUS SAMPLING AT Ts SAMPLED


SIGNAL INTERVALS SIGNAL

ADCs and DACs

ADCs converts sampled voltage or current signals to their binary equivalent while DACs
converts binary signals to continuous signals such as voltages or currents. These
converters provide the interface between a computer and the external environment.

Signal Hold Devices

The output of a sampler is a train of pulses, regardless of whether the source is


continuous or discrete. Thus the output of a computer after digital-to-analog conversion
is also a train of pulses. If this is a control signal, then unless the device receiving this
signal, say a pump or valve, has integration capabilities, then the process will be driven
by pulses. This is obviously not acceptable. So, in process control applications, the
signal from the DAC is always 'held' using hardware known as signal hold devices. The

3 of 18
Introduction to Digital Control ( 2005 M. Tham)

most common is the Zero-Order-Hold, where each pulse is held until the next pulse
comes along, that is:

Ts
Ts
COMPUTER

SAMPLING AT Ts SAMPLED SIGNAL


INTERVALS

Ts
Ts ZERO-
ORDER
HOLD
HELD SIGNAL
Result of Zero-Order-Hold

MATHEMATICS OF SAMPLED DATA SYSTEMS

Before proceeding into a discussion on digital controller design, the mathematical tools required
will first be covered. The design and analysis of continuous time control systems are usually
done using Laplace Transforms, simplifying tremendously, the solution of equations involving
time-differentials. Laplace Transforms are therefore continuous transforms.

There are two routes to the design and analysis of Digital Controllers. One is to approximate the
Laplace operator s to derive difference equations while the other is to use a variant of the
Laplace Transforms that is applicable to sampled data systems. These are respectively known as:

a) Approximation of differentials

b) z-Transforms

Approximation of Differentials

The use of this technique has its roots in numerical integration, and the two commonly used
approaches are:

backward difference method

bilinear transformation

a) Backward Difference Method

Starting in the Laplace domain, the Laplace operator s is replaced by a first order difference
operator, i.e.

(1 z 1 )
s =
t Ts

where x ( t ) = x ( t ) x ( t Ts ) ,

4 of 18
Introduction to Digital Control ( 2005 M. Tham)

and Ts is the sampling interval.

't' denotes current time, and the term z 1 is regarded as a time shift operator. The index indicates
how many integer multiples of the sampling interval is involved in the time shift, with the sign
of the index denoting whether it is a forward (plus sign) or backward (minus sign) shift. For
example,

z n x(t ) = x(t nTs ) or z n x (t ) = x (t + nTs )

To simplify notation, this can be written as

z n x (t ) = x (t n) or z n x (t ) = x (t + n)

that is, the sampling interval is treated as a 'unit' of time.

d
Since the Laplace operator s is equivalent to the differential operator in the time domain, it
dt
should be obvious that the backward difference method is the well known Euler's approximation
to a differential. As such, the use of this approximation suffers from the same accuracy
limitations. The sampling interval must be sufficiently small for accurate conversion from the
continuous time domain to the discrete time domain. A more forgiving conversion, especially
with high order systems, is the Bilinear Transform.

b) Bilinear Transform

The Bilinear Transform is also known as Tustin's Rule as well as the more familiar Trapezoidal
Rule used in numerical integration. Here, the Laplace operator s is replaced by:

2(1 z 1 )
s
Ts (1 + z 1 )

where the z 1 term has the same meaning as before. Using this transformation, the sampling
interval can be much larger, although the ensuing algebraic manipulations become more tedious.
The benefit of using this transformation is only obvious with high order systems that have poles
of quite different magnitudes.

Example:

As an example, consider a first-order ODE, relating some output y(t) to an input u(t),

dy(t )
+ y(t ) = Ku(t )
dt

This system has the following Laplace transfer function:

Y ( s) K
=
U ( s) 1 + s

5 of 18
Introduction to Digital Control ( 2005 M. Tham)

a) using the backward difference method,

y (t ) K KTs
= =
u( t ) 1 z 1 Ts + (1 z 1 )
1 +
Ts

[ ]
i.e. y (t ) Ts + = KTs u(t ) = Ts y (t ) + y (t ) y (t 1)

Rearrangement gives the recursive difference equation

T
y (t ) = y (t 1) + s Ku(t )
Ts + Ts +

b) using the Bilinear Transform,

y (t ) K KTs (1 + z 1 ) KTs (1 + z 1 )
= = =
u( t ) 2 1 z 1 Ts (1 + z 1 ) + 2 (1 z 1 ) (Ts + 2 ) + ( Ts 2 ) z 1
1+
Ts 1 + z 1

(2 T ) y(t 1) + KT [u(t ) + u(t 1)]


i.e. y (t ) =
s s

(T + 2 )
s

Therefore, given the Laplace transfer function of a continuous system, the application of either
approximation method will quickly yield discretised models. Both methods are useful in that
any continuous time controller design may be quickly discretised using either conversion
techniques.

The z-Transform

Here we consider the most commonly used tool for the analysis of sampled data systems.
Suppose we sample a continuous time variable f(t). Because the sampled signal exists only at the
sampling instants, the sequence of pulses can be represented mathematically as:

f (t ) for n = 0,1,2,...
f (nTs ) =
0 otherwise

Again, to simplify notation, let the sampled sequence be denoted by f * (t ) . Now the Laplace
transform of f(t) is defined as:

F ( s) = f (t )e st dt
0

Since the sampled signal f * (t ) is a subset of f(t), we can also apply the Laplace transform to it:

6 of 18
Introduction to Digital Control ( 2005 M. Tham)

F ( s) = f * (t )e st dt
*

Since f * (t ) only exists at sampling instants, this means that we can replace the integral with a
summation, that is,

F ( s) = f (t )e dt = f (nTs ) e snTs
* * st

0 n=0

Defining: z = e sTs , then



F * ( s) = f (nTs )e snTs = f (nTs ) z n = F ( z )
n=0 n=0

This is the definition of the z-transform of a continuous time signal f(t) sampled with a sampling
interval of Ts, i.e.

Z{ f ( t )} = F ( z ) = f ( nTs ) z n
n=0

Thus, the z-transform is merely the Laplace Transform of a sampled data sequence and as such,
inherits many of the properties of the Laplace Transform.

Properties

Some of the more important properties of the z-transforms are as follows:

a) Linearity

The z-transform is a linear transform. That is, given constants a and b and time variables
f(t) and g(t):

Z {af (t ) + bg (t )} = aZ { f (t )} + bZ { g (t )} = aF ( z) + bG( z)

b) z-transforms of time delays

If f(t-kTs) is f(t) delayed by k sampling intervals (k is an integer), and f(t) = 0 for t < 0,
then the z-transform of f(t-kTs) is given by:

Z { f (t kTs )} = z k F ( z)

c) Final Value Theorem

This theorem allows the calculation of the final value of a z-transformed function and is
stated as:

lim f (t ) = lim(1 z 1 ) F ( z)
t z1

7 of 18
Introduction to Digital Control ( 2005 M. Tham)

Relationship with the s-plane

The mapping from the s-plane to the z-plane is accomplished through the relationship

z = e sTs

This function maps the whole of the left side of the s-plane to a unit circle on the z-plane/

s-plane z-plane

1
z-transform

In the case of Laplace transfer functions, systems are stable if they do no possess poles on the
right half of the s-plane. In the case of sampled data systems, they are stable if they do not
possess poles that lie outside the unit-circle in the z-plane.

Example z-transforms

a) z-transform of a unit step function

0 t < 0
The time domain representation of a unit step function is: f ( t ) =
1 t 0

Thus Z { f (t )} = F ( z ) = f (nTs ) z n
n=0

F ( z ) = f (0) + f (Ts ) z 1 + f (2Ts ) z 2 +K+ f (nTs ) z n +K


That is,
= 1 + z 1 + z 2 +K+ z n +K

which is an infinite series, illustrating that the z-transforms operates on an infinite sequence.
Fortunately, there is also a 'closed-form' equivalent, as it can be shown that

1 1 z
1 = 1 + z + z 2 +K+ z n +K =
1 z z 1

and this is the form that is always presented in z-transform tables.

8 of 18
Introduction to Digital Control ( 2005 M. Tham)

b) z-transform of an exponential decay

The time function in this case is: f ( t ) = exp( t / )


Thus F ( z ) = exp( nTs / ) z n = 1 + exp( Ts / ) z 1 + exp( 2Ts / ) z 2 +K
n=0

which is another infinite series. Again the closed-form solution is available and can be verified
by long division to be:

1 z
F ( z) = 1 =
1 exp( Ts / ) z z exp( Ts / )

Inversion of z-transforms

Like Laplace transforms, z-transforms can be inverted back into the time domain. Given a
transfer function, we can either apply long division to obtain the series form of the sampled
signal or make use of the tables. The first is simple but tedious and the result may not be suitable
for further analysis. Thus tables are often used. In this case, the transfer function is factored into
lower order components using partial fraction expansion, and tables are used to look up the
corresponding time functions of each component. The final result is obtained by adding up these
individual time function.

However, due to the nature of the problem, it is not often that z-transform functions need to be
converted back to the time domain. Given the range of simulation tools available nowadays, it is
usually simpler to simulate the response of the discrete system to enable visualisation of
response characteristics.

Relationship to Approximation Methods

With both the backward difference and bilinear transform discretisation methods, a stable
continuous system will map to a stable discrete system, with stability in the discrete domain
meaning that there are no system poles that lie outside the unit circle in the z-plane. However,
the manner in which the mapping to the z-plane occurs is very different.

a) Backward difference

Noting that z = e sTs , then the first-order series expansion will give

1 z 1
z 1 = exp( sTs ) 1 sTs s =
Ts

Thus, the backward difference discretisation method is a first order series approximation to
the z-transform and this discretisation maps the left-half of the s-plane to a circle of radius
on the right half of the z-plane.

9 of 18
Introduction to Digital Control ( 2005 M. Tham)

s-plane z-plane

1 z 1 z 1
s =
Ts zTs

5
0.
b) Bilinear Transform

If we use the first order Pade approximation for z-1 instead of a first-order series
approximation, then

Ts
1 s 2 (1 z 1 )
z 1 = exp( sTs ) 2 s=
Ts Ts (1 + z 1 )
1+ s
2

The mapping from the s-plane to the z-plane is shown in the following diagram.

s-plane z-plane

2 (1 z 1 ) 2 ( z 1)
s =
Ts (1 + z 1 ) Ts ( z + 1)
1

Like the z-transform, the bilinear transform maps the left-half of the s-plane to the entire unit
circle in the z-plane. In this sense, it is a better approximation to use, although it still does not
preserve the frequency response characteristics of the original z-transform.

10 of 18
Introduction to Digital Control ( 2005 M. Tham)

BLOCK DIAGRAM MANIPULATION

The manipulation of block diagrams of sampled data systems are very similar to that for block
diagrams of systems expressed in the Laplace domain. However, because of the presence of
samplers, some extra rules have to be adhered to. Consider a continuous process under digital
control via the classical feedback framework. The detailed block diagram of this system
including the presence of the samplers is,

E(z) U(z) Y(s)


W(z)
Ts Ts
W(s) D(z) ZOH(s) Gp(s)

CONTROLLER PROCESS

Y(z) Ts

Note that the samplers determine the type of signal propagating through the system. Hence the
position of the samplers are important. In particular, note that the transfer function between Y(z)
and U(z) for the following two systems are different.

System A

U(z) Ts Ts Ts Y(z)
F(s) G(s)

Here, the relationship between Y(z) and U(z) is given by:

Y ( z) = Z { F ( s)} Z {G ( s)}U ( z ) = F ( z )G ( z)U ( z)

System B

U(z) Ts Ts Y(z)
F(s) G(s)

With this system, the relationship between Y(z) and U(z) is given by:

Y ( z) = Z { F ( s)G ( s)}U ( z ) = FG ( z )U ( z)

In general, Z { F ( s)} Z {G ( s)} Z { F ( s)G ( s)} .

11 of 18
Introduction to Digital Control ( 2005 M. Tham)

DISCRETISED PID CONTROLLERS

Before discussing the design of digital control algorithms, let us consider discrete equivalents of
analog controllers. Analog control refers to the design and implementation of controllers in the
continuous domain. This includes electronic controllers, which although discrete in nature,
implements control by emulating the continuous nature of analog control strategies. A typical
example is the electronic PI/PID algorithm. There are a number of ways by which this
ubiquitous controller can be implemented in discretised form.

a) PI/PID Controller Design from the Time domain

Consider the ideal PID controller written in the continuous time domain form:
t
K de(t )
u(t ) = Kc e(t ) + c e(t )dt + Kc Td + uo
Ti 0 dt

To discretise the controller, we need to approximate the integral and the derivative terms to
forms suitable for computation by a computer. From a purely numerical point of view, we can
use:

de( t ) e( t ) e( t 1)
t t

dt

Ts
and e(t )dt Ts e(i)
0 0

The discretised PID algorithm is therefore:

KT t
K c Td ( e( t ) e( t 1))
u( t ) = K c e( t ) + c s
Ti
e(i ) +
i=0 Ts
+ u0

which is now in the form of a difference equation, suitable for coding in an appropriate
programming language. This particular form of the PID algorithm is known as the
'positional' PID controller, because the control signal is calculated with reference to a base
level, uo.

b) PI/PID Controller Design from the Laplace Domain

We can also formulate discrete PID controllers directly from the Laplace domain. Here, the
PID algorithm is written as:

U ( s) 1
= Kc 1 + + Td s
E ( s) Ti s

Now we can apply either the backward difference or bilinear transform methods to get an
equivalent discrete PID controller. Say we apply the backward difference method. Then,

U ( s) 1 backward difference Ts (1 z 1 )
= K c 1 + + Td s u(t ) = e(t ) K c 1 + + T
Ti (1 z )
1 d
E ( s) Ti s Ts

12 of 18
Introduction to Digital Control ( 2005 M. Tham)

Simplification yields:

u(t ) = u(t 1) + K c [e( t ) e( t 1)] + [e(t ) 2e(t 1) + e(t 2)]


K c Ts K c Td
e( t ) +
Ti Ts

This PID controller is different in structure to that obtained from time-domain considerations
and is known as the 'velocity' PID algorithm. As opposed to the fixed control reference used
in the positional algorithm, here, the calculation of current control uses the previous control
value as reference. In essence, the control is calculated as a change, hence the term 'velocity
form'. Application of the Bilinear Transform will yield a similar velocity form algorithm, due
to the presence of the (1 z 1 ) term in the approximation.

Positional and Velocity PID Algorithms

Although the structures of the positional and velocity PID algorithms appear very different, they
are in fact related. The positional algorithm as derived is:

Kc Ts t
Td (e(t ) e(t 1))
u ( t ) = K c e( t ) +
Ti
e(i ) +
i =0 Ts
+ u0

Time shifting back one sampling interval, we obtain

K c Ts t 1
Td (e(t 1) e(t 2))
u(t 1) = Kc e(t 1) +
Ti
e(i ) +
i =0 Ts
+ u0

Subtracting this from the original, we end up with the velocity form, i.e.

u(t ) = u(t 1) + K c [e( t ) e( t 1)] + e( t ) + c d [e(t ) 2e( t 1) + e( t 2)]


K c Ts KT
Ti Ts

Implementation and Performance of Discrete PID Controllers

a) Commissioning discrete PID Controllers

To calculate control, the positional PID requires knowledge of uo, which is some steady-state
control output level. This may have implications during commissioning. With the velocity
form however, the previous control can be set to any reasonable arbitrary level, and hence
commissioning is simpler.

b) Integral Windup

A more important aspect is the use of a summation to calculate the contribution of the
integral term. This can lead to problems leading to a phenomenon known as integral windup,
causing long periods of overshoots in the controlled response. This can be caused by a poorly
tuned controller or the controller output is overly constrained (for some safety reasons or
inappropriately sized final control element say), or a combination of both factors.

What happens is this. Say a positive set-point change occurs, and the controlled process has a
positive gain. The controller will then try to reduce the error between set-point and output,

13 of 18
Introduction to Digital Control ( 2005 M. Tham)

which is initially positive. The integral component will sum these positive errors to generate
the necessary integral action. An overshoot occurs, whereupon the errors become negative.
However, the direction of the control signal will not change to compensate if the sum of
previously positive error dominates, in which case the overshoot becomes prolonged. The
direction of control action will change only when the contribution of negative errors cancels
the accumulated positive errors sufficiently.

This phenomenon is illustrated in the following figures, where the set on the right has a
tighter limit on the control signal (1.5 instead of 2) and shows clearly, the effects of integral
windup.

Output without control limit set at 2 Output with control limits set at 1.5

Control signal with limit set at 2 Control signal with limit set at 1.5

With the velocity PID algorithm, because it does not make use of a sum of errors to generate
integral action, the problem of integral windup will not occur, even if the control signal is
constrained. This difference is illustrated in the following set of figures which shows the
performances of the positional and velocity PID algorithms applied to the same process, and
constrained by the same control limits.

14 of 18
Introduction to Digital Control ( 2005 M. Tham)

Positional PID (control limit at 1.5) Velocity PID (control limit at 1.5)

1.4 1.4

1.2 1.2

1 1
Output and Setpoint

Output and Setpoint


0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0 0
0 50 100 150 0 50 100 150
Sample number Sample number

Controlled output Controlled output

1.5 1.5

1 1
Control signal
Control signal

0.5 0.5

0 0
0 50 100 150 0 50 100 150
Sample number Sample number

Control signal Control signal

c) Proportional and Derivative Kicks

Kicks refer to a sudden and large change in control signal and is usually the result of a sudden
change in either the setpoint or a disturbance. Compared to the positional PID, the velocity PID
is quite susceptible to kicks. In the velocity PID, the proportional and derivative components
act on differenced error signals. In particular, the derivative component acts on a doubly
differenced error signal. These error differences can be significant when a large step change in
set-point is introduced and will cause the controller to compute large changes in control
manipulations which may perturb the controlled process excessively.

Fortunately, because ofKicks can be mitigated by making a slight modification to the velocity
PID algorithm. In the derivation of the velocity algorithm, assume that set-point remains
constant for at least 2 sampling instants, i.e.

w( kT ) = w( kT T ) = w( kT 2T ) .

Then,

15 of 18
Introduction to Digital Control ( 2005 M. Tham)

e( kT ) e( kT T ) = w( kT ) y ( kT ) w( kT T ) + y ( kT T ) = y ( kT ) + y ( kT T )

Using this in the formulation of the velocity PID controller lead to the so-called PYID
algorithm, viz.

u( kT ) = u( kT T ) K c [ y ( kT ) y ( kT T )]
Kc D
[ y( kT ) 2 y( kT T ) + y( kT 2T )]
Kc T
+ e( kT )
I T

The difference in performances between the velocity PID and PYID controllers are shown in the
figures below. Note that both controllers were implemented with the same settings.

Velocity PID PYID

1.5 1.5

1 1
Output and Setpoint

Output and Setpoint

0.5 0.5

0 0
0 50 100 150 0 50 100 150
Sample number Sample number

Controlled output Controlled output

3.5 3.5

3 3

2.5 2.5
Control signal

Control signal

2 2

1.5 1.5

1 1

0.5 0.5

0 0
0 50 100 150 0 50 100 150
Sample number Sample number

Control signal Control signal

When the setpoint change occurred, the signal from the velocity PID controller went beyond 3
whereas the PYIDs control signal was significantly smaller. These are reflected in the
respective controlled output responses where the overshoot from the PYID controlled process is
smaller. Both closed loops have almost identical settling times.

16 of 18
Introduction to Digital Control ( 2005 M. Tham)

d) Controller tuning

All the tuning procedures for continuous time PID controllers apply. These range from the
empirical Ziegler-Nichol ultimate gain method, to the recipe based integral of error criteria.
With recipe based methods, a factor of 0.5Ts is usually added to the process dead-time to
account for the delay caused by the sampler.

Choice of Sampling Interval

Another important aspect in sampled data control systems is the choice of sampling intervals.
With electronic controllers that emulate continuous time algorithms, this choice is simple:
sample as fast as possible. This is because of the approximations that are used to generate the
difference equations describing the controllers. Smaller sampling intervals mean that the
properties of the underlying controller design will be less distorted, hence more predictable and
better performances. A good example is the discretised PID controllers. They perform best when
sampling intervals are small.

However, too fast a sampling is wasteful of resources.

the cost of implementation will increase because more capable components must be installed

a DCS typically has many hundreds of input-output channels to administer. The functioning
of the DCS will degrade significantly if every control loop is to sample at the highest
frequency possible.

fast sampling intervals will mean that high frequency components such as noise will also be
captured in the signal, and this is not necessarily beneficial to the performance of the control
loop.

If the sampling interval is too long, then signal loss will occur. An extreme case is the
phenomenon known as 'aliasing'. This is a situation whereby the sampled versions of two very
different signals are indistinguishable. As illustrated in the figure below, the sampled
representation of a step (dotted horizontal line) and a periodic wave are identical.
1.5

0.5
Ts
0
0 1 2 3 4 5 6

-0.5

-1

-1.5

Many rules-of-thumb have been published, including the following recommendations:

17 of 18
Introduction to Digital Control ( 2005 M. Tham)

Flow loops 1s

Level loops 5s

Temperature loops 30s to 10 mins.

These are however, merely rough guidelines. The choice of an appropriate sampling interval
should be based on the dynamics of the process being controlled. The sampling operation must
return the key dynamic characteristics of the process. From experience, a sampling interval of
approximately 10% of the dominant time constant works well in practise.

The position of the poles and zeros of the discrete transfer functions depend on the sampling
interval used. Although this characteristic is not of great significance in PID type algorithms, it
becomes important when discrete process models are used directly in the design of digital
controllers. We shall cover this in more detail when we discuss model based digital controller
design.

18 of 18

You might also like