Continuous
Systems And Sampled Systems
Background
More
Complex Systems (2nd Order, Real Poles)
Implementing
Digital Control
Background
Many control systems are implemented digitally. The usual control
process goes something like this.
-
The controller is really
a program that performs the measurements, control computations and control
implementation.
-
The first step is to measure
the system output - the variable to be controlled.
-
In the process of measurement,
an analog variable is converted to a digital number inside the program.
-
Next, the measured value
is used - along with the desired value of the controlled variable - to
calculate a control signal.
-
Finally, the calculated
control signal is output - through a D/A - to control the system.
-
The output of the D/A
is held at a constant value until a new value is calculated, effectively
producing zero-order-hold (ZOH) action.
-
Here is a block diagram
representation of a control system that embodies these features.
If we want to predict the behavior of a system that performs as described
above, then we need to be able to work with systems that contain both discrete
time parts (described in the language of Z-transforms) and continuous time
systems (described in the language of Laplace transforms). Here are
the steps that you have to be concerned with.
-
If the control signal
looks like a ZOH signal, then you need to describe the continuous time
portion of the complete system at the sample instants, meaning that you
are going to describe that part of the system at the sample times using
Z-transforms.
-
If the control computations
have any dynamical components (e.g. computing an integral, a derivative
or digitally implementing a compensator) then those computations performed
in the control program must be described by a Z-transform. You will
do those computations in some sort of computer code (C, Visual Basic, etc.)
but they should be expressible as difference equations.
That's the process. We'll look at a simple
example to discover how each of these steps unfolds.
The first step in the process is to describe the continuous system when
it is driven by a zero-order-hold (ZOH) signal. If you aren't sure
of how that works, click here to
see how to get a sampled description of a continuous time, first order
system.
We will begin with a very simple system.
-
We will use G(s)
= 1/(s + 1). That's as simple as we
can make it.
-
We will use a sampling
period of a half second, i.e. Ts = 0.5 sec.
-
We will use the simplest
type of control - proportional control.
Next, we construct a block diagram to represent
this system. Here's what we get.

We can get the equivalent transfer function
in the z-domain for the transfer function we have - G(s) = 1/(s + 1).
For a first order linear system, the general
form is:
G[z] = (1 - e-Ts/t)/(z
- e-Ts/t)
With:
-
Ts = 0.5 sec, and;
-
t
= 1 sec.
-
G[z] = (1 - 0.607)/(z
- 0.607)
Now, we can examine the performance of this
system. We can see some aspects of how the system performs by looking
at a root locus. Note the following:
-
The block diagram above
expresses exactly the same algebraic relationships as the block diagram
of a proportional control system in a continuous time system.
-
We can compute a closed
loop transfer function - a function of z, not of s - and the result is:
-
Gcl[z]
= Kp/(1 + KpGeq[z])
-
Except for the z - instead
of the s - this is exactly the same as we have when we have a function
of s.
-
We can conclude that the
root locus plots will look exactly as they would in a continuous system.
-
The thing to watch for
is that the region of stability for a sampled system is the interior
of the unit circle in the z-plane, not the right half of the s-plane.
That means that our example system will have
a root locus like this one.

Note the following about this root locus.
-
The open- loop pole is
at z = 0.607.
-
The root locus has one
segment and that segment starts at the pole and goes to infinity along
the negative real axis. That's pretty standard root locus behavior.
-
At some point - actually
at z = -1 - the root locus crosses the unit circle, and and that point
the closed loop system would become unstable.
-
In continuous systems,
a proportional control system like this could never become unstable, but
the sampled system can easily become unstable.
More
Complex Systems
The example system is pretty simple. There are lots of ways the system
can become more complex. Here are some things to consider.
-
The system to be controlled
can be more complex. It can be higher order. It can have complex
poles. It can have zeroes.
-
The controller might be
more complex. We can have integral control that is implemented within
a program, or we might have some sort of compensator - lead or lag.
We will look at these two possibilities and
we will look at more complex systems first.
If the system is more complex, you will still have the problem of determining
how the system responds when driven by a ZOH element. That's important
for the following reasons.
-
When control is implemented
digitally, a control signal is computed within a program.
-
After the control signal
is computed, the control signal is usually generated with a D/A converter.
-
The output of the D/A
is a constant value until the next control signal is applied.
-
That means that we always
need to consider the controlled system driven by a ZOH.
-
We need to get an equivalent
transfer function that takes the ZOH effect into account.
There are easy ways to compute the ZOH equivalent.
This is an important enough problem that you can find a function in Matlab
that will do the computation. We'll show that with an example system.
Here is the block diagram of our system again.

We are going to consider a more complex,
G(s). In particular, we will look at what happens when G(s) is a
second order system with two real poles. The example we will use
is:
G(s) = 1/(s + 1)(s
+ 2)
We need a way to convert this system to the ZOH equivalent. We could
try to represent the system as two parallel systems using a partial fraction
representation. However the simplest way is to use Matlab to convert
it. Here's the Matlab code that not only converts G(s) to Geq[z],
but also plots the root locus for the system.
Num =
1
Den = [ 1 3 2]
Sys = tf(Num,Den)
SysD = c2d(Sys,TS,'zoh')
rlocus (SysD)
zgrid
The discrete version of the system is given
by the form below, using the Matlab output format.
Transfer function:
0.07741 z +
0.04695
-----------------------
z2
- 0.9744 z + 0.2231
Sampling time: 0.5
Then, using this transfer function, we can plot
the root locus, and obtain the following root locus.

This root locus looks interesting because
is shows that this second order system can also become unstable for high
enough gains, although there comes a time when one pole re-enters the unit
circle. However, it is still unstable at that point because there
is still one pole outside the unit circle.
For higher order systems, the process is the same. If someone has
programmed the conversion algorithm take advantage of that and use it.
Control
Algorithms
If we are trying to implement something like integral control, for example,
we might use code like the following:
// I
= Integral
I = I + Ts*Error;
ControlSignal
= Ki*I;
This code really implements a difference equation:
Ik
= Ik-1 + Ts*Errork-1
Then, we can take the Z-transform of this
difference equation for the integral computation. (We will assume
zero initial conditions since we are trying to determine a transfer function.)
I[z] = z-1I[z]
+ z-1Ts*Error[z]
So,
I[z](1 - z-1)
= z-1Ts*Error[z]
and:
I[z] = z-1Ts*Error[z]/(1
- z-1)
and:
I[z] = Error[z]*{Ts/(z
- 1)}
The transfer function of this digital integrator is then given by:
Gint[z]
= Ts/(z - 1)
How do we use this result? Well, if
you implement digital control in a program - as above - then, the equivalent
block diagram for that digital implementation is the one shown below.

In this system, the digital integration is
shown with Gint[z].
Let's go back to our particular example above. Here are the details
of the system we used.
-
The continuous system
has a transfer function G(s) = 1/(s + 1).
-
The sampling period is
a half second, i.e. Ts = 0.5 sec.
-
In this cas we will use
integral
control.
Next, we refer to the block diagram above, and
we note that we need the equivalent transfer function for the continuous
system in the sampled representation. That equivalent transfer function
is given by:
G[z] = (1 - e-Ts/t)/(z
- e-Ts/t)
With:
-
Ts = 0.5 sec, and;
-
t =
1 sec.
-
G[z] = (1 - 0.607)/(z
- 0.607)
The block diagram for
the equivalent system is the one shown below.

Note that the numerator
of the integral controller block has a term .5*Ki. That
term is really Ts*Ki, but the process transfer function, G(s),
was transformed assuming that the sampling period was 0.5 second.
You have to use the same sampling period in the calculation of the integral.
Now, you can do some analysis of the equivalent system. Doing a root
locus, we find some interesting things can happen in this system also.
Here is the root locus for this system.

In this root locus,
we again see that the system can become unstable. To calculate the
gain at which the system becomes unstable, we first calculate the root
locus gain as the product of pole distances to the point on the locus where
the poles exit the unit circle. That's shown in the plot below.

We need to determine
the length of the two lines shown in purple on the plot. Actually,
they are both the same length, and each length is about 0.6. Taking
that value, we calculate the root locus gain.
KRL
= (0.6)2 = 0.36
Then, we have (Check
the block diagram above.):
KRL
= 0.5*Ki * 0.393
So, the integrator
gain, Ki, at which the system becomes stable is:
Ki
= 0.36/(0.5 * 0.393)
or:
Ki
= 1.83
Some
Reflections On The Integral Control System Implementation
There are some interesting things going on in the integral control system,
and they can be confusing.
-
The continuous system
is driven by a ZOH, and when we get a Z-transform representation for that
part of the system, we use a ZOH conversion algorithm.
-
The integral control is
actually implemented in a program, and when we get a Z-transform representation
for that part of the system, we just take the Z-transform of the difference
equation that is implemented in the control algorithm.
-
We end up with a sampled
representation for the complete system that has two subsystems that used
different algorithms to compute the sampled (Z-transform) representation.
-
Even though we have two
different algorithms, each one is appropriate for the part of the system
it is applied to. There is no reason to expect that the same algorithm
must be applied to the entire system - a frequent expectation when this
phenomenon is first encountered. Each algorithm is needed to give
a description of what actually takes place in that part of the system.
Now, there are some other unposed questions that will require you to go
to another lesson. Here's the most important question.
-
What do you need to do
to implement a compensator inside a control program?
Click
here to go to that lesson.