Click to see the effects noted above.
Now, here's a video that puts a lot
of things together.
In this video, there is
a system with two open loop poles at - 1 and -2.
We've put a compensator
zero at -3.
We put a variable compensator
pole in the system. It starts at -3 (effectively cancelling the zero
there, effectively no compensator for that situation) and moves to the
left.
In
the video, we can see the effects we discussed earlier - and some others.
The centroid (center of
gravity) shifts to the left and the asymptotes for the branches going to
infinity shift to the left. As all that happens, the root locus can
undergo some interesting transmogrifications. In the video, the root
locus branches going to infinity change to branches that come back to the
real axis, move some more, and then different branches go to infinity.
As the pole moves away
from the zero, the two branches the leave the real axis curl in toward
the zero, and they are the ones that eventually come back to the real axis
as the pole is placed further to the left.
There
are some interesting ways we can use the insight obtained from what we
have done so far. Let's look at an example problem. We'll use
the same system we considered earlier. That system is again shown
below.
We are going to assume that we have some specifications for the system,
and we will discuss them in more detail later. In brief, we want
the following:
Settling time <
0.5 sec .
%Overshoot <
5% .
We
need to interpret these specifications somewhat.
The Rise Time specification
implies that the poles of the closed loop system must lie to the left of
a point such that:
Re(s) < - 2.3/0.5 =
-4.6
Click
here for to see why that relationship holds
The %Overshoot specification
implies that the poles must have a damping ratio that is larger than about
0.7.
In turn, that means that
the poles have to lie at an angle from the real axis of less
than 45^{o} .
Here's the root locus for the system when proportional
control is used.
Click the green button
to display where the poles must lie.
A 45^{o}
line will also be shown.
Perhaps you noted that
the poles are never, ever within the allowed region.
We
do know, however, that we can get the poles within the allowable region.
Here is the clip with a lead compensator with a variable pole. You
saw this clip just above. The lead compensator has a zero at s =
-5, and a variable pole.
Play the clip here. You can set the pole to any value from -3 to
the limit of the graph.
Using the clip you should
see the following.
There is a location for
the compensator pole that will put portions of the root locus within the
region (see above) where the response is within specifications.
If you can get a portion
of the root locus in an acceptable area, it is possible to choose a gain
that will put the closed loop poles (on the root locus) in the acceptable
area.
When you add the compensator
you add a third pole to the system. That closed loop pole will lie
on the segment of the root locus that lies on the real axis between the
added zero and the added pole.
That means that the design
process can be thought of in these terms.
Select a compensator.
That means you choose a pole and a zero, keeping in mind the effects on
the root locus noted above. Your choice of compensator should produce
a root locus with closed loop poles in the regions that will produce acceptable
transient behavior.
Select a gain that produces
poles at the desired positions on the root locus.
Now,
what do you do if you don't have a ready made movie? It is still
possible to compute parameters that will produce a pole in a given location.
Here's the process and an example system.
Plot the system poles
(and zeroes) if any. Here the poles are at -1 and -4.
Assume a value for a compensator
zero. Here we have assumed the zero is at -5.
Place a pole at an arbitrary
location - p.
Here is the plot of the two open-loop poles
for the example system.
Note the location of the
desired pole. It's a red dot on the plot above.
The red dot is really
a point where we want a set of closed loop poles to be, so that point has
to be a point on the root locus for the system.
As it stands, without
compensation, the root locus will not go through the point shown on the
plot.
To
get the root locus to go through that point - after adding a compensator
- you need to apply a root locus rule. Remember, for a point to lie
on the root locus the sum of the angles must be an odd multiple of 180^{o} .
The algorithm is pretty
simple. You adjust the pole location so that the angles add up to give
a point on the root locus that is where you want the closed loop pole to
be - at the red dot here.
We will walk through this, one singularity at
a time.
For the pole at -1, draw
a line from the pole to the desired closed loop pole location and measure
the angle.
Click the green button
to the right of the plot below to show the angle that you need to measure.
Here,
we can compute the angle. The desired pole location is at -4 + 3j.
That means that the angle shown above is 135^{o} .
Since this is a pole, it's in the denominator of the transfer function
and so the net contribution to the calculation is -135^{o} .
Look at the next singularity, the pole at -4.
For the pole at -4, draw a line from the pole
to the desired closed loop pole location and again measure the angle.
This plot/button lets you see the angle for
this pole.
Compute
the angle from this pole.
In this case, the angle
is clearly 90^{o} .
We have a total of -225^{o}
from the two poles in the system.
The compensator that we
add will have to make up 45^{o} in order to get the root
locus to go through this point.
To
this point the computation has been straightforward. But, now we
need to add something - a lead compensator? - that will change the angle
at the point we want on the root locus by 45^{o} .
Let's examine what happens when we add a zero.
Imagine a zero close to
the pole at s = -4.
You can see a zero like
that by clicking on the green button in the plot below.
If you look at the zero,
you can see that the angle contributed by the zero - which
will negate the effects of the angles contributed by the poles -
is more than 45^{o} .
Since you have to add
a third pole when you add the zero, any excess can be taken care of by
proper placement of the pole, and you can choose a pole that will make
the red dot a point on the root locus.
Imagine a zero further
to the left.
You can see a zero like
that by clicking on the red button in the plot below.
If you look at the zero,
you can see that the angle contributed by the zero - which
will negate the effects of the angles contributed by the poles -
is less than 45^{o} .
Since you have to add
a third pole when you add the zero, that third pole will make the situation
even worse and you won't be able to get the red point on the root locus.
Q1
What is the furthest point to the left where you can put the zero?
Now, you have the limits on where the zero can't be placed, so you can
design a compensator. Here's what you need to do.
Choose a zero location
in the region that will work.
Calculate the angle for
the zero, and then calculate the total angle from the added zero and the
two original poles.
Add a third pole (in the
compensator) that gives just enough angle to make the total angle equal
to -180^{o} .
Example
We'll continue with the example system we have been using. You should
have found that you cannot put the compensator zero to the left of -7.
At s = -7 you get an added 45^{o} from the zero.
Add a zero at s = -5.
The compensator transfer
function will then be:
Gc(s) = Kc(s + 5)/(s -
p)
Now you need to determine where the pole will
be.
If the zero is at -5,
and the desired location for the root locus is at -4 + 3j, then the angle
contributed by the zero ( a
in the figure below) is:
tan^{-1} (3/1)
= 71.56^{o} .
The excess over 45^{o}
is 26.56^{o} .
To compute where to place
the pole, consider the plot below.
We must have:
tan(26.56^{o} )
= 3/(-4 - p) = .5
So, p
= -10.
And, the compensator transfer
function is:
Gc(s) = Kc(s + 5)/(s +
10)
What remains is to determine the gain, Kc, that
will put the closed loop poles where we want them. We'll start on
that by looking at a root locus for the compensated system. That's
shown below.
Check out features of the root locus plot.
The root locus - with
the compensator - does, in fact, go through the point at -4 +/- 3j, as
desired.
We can compute the root
locus gain for the system using the expression for the root locus gain.
Root Locus Gain = Product
of Pole Distances/Product of Zero Distances.
Q2
What is the root locus gain for the system above?
What we have discovered in this section is a fairly powerful technique
for producing response that we want. Here's the technique.
Given a desired closed
loop pole location,
Assume a zero at an arbitrary
location on the negative real axis.
Calculate the angular
contributions of all the singularities including the zero just added.
Add a pole that makes
the total angle equal -180^{o} .
Caution! This technique
may not always work. When you compute where the pole has to be, you
may get a nonsensical answer. If that's the case, it may not be possible
to get the pole where you want it - at least for the zero position you
used. You could try another zero location, but success is not guaranteed.
What if you fail? There are other options.
You can try a PID controller.
That gives other options that can be interpreted as adding a pole at the
origin and two zeroes wherever you want.
You can try a compensator
with two poles and two zeroes - a double lead network.
In
any event, the technique here is not infallible, but can often help.
Try it, and if it works it may work very well.
Bode
Plot Effects
If we add a lead compensator to a system, we can also interpret effects
on the Bode' plot for the system. In this section, we'll do that.
First, we need the Bode' plot for the original system. The system
we want to control has two poles at s = -1 and s = -4. The transfer
function we will use for the Bode' plot is:
G(s) = 10/(s + 1)(s + 4).
Here's the Bode' plot for the system we want
to control.
This system - as shown - has a DC gain of about 7.5 db, and the phase asymptotically
approaches -180^{o} .
Now, let's examine the effect of adding a lead network. On this plot
you can see the effect of adding the lead network. We have added
the same lead compensator as we used for the root locus demonstration.
That compensator has a zero at -5 and a pole at -10.
At first glance, it doesn't seem like the magnitude of the effect is very
large when viewed on the Bode' plot. However, consider designing
for some given phase margin.
Let's look at designing for a 30^{o} phase margin.
This plot below shows how to obtain a phase margin of 30^{o} .
The purple line shows the -150^{o} crossing and the corresponding
gain - which is about -17 db. We could raise the gain by 17 db and
have a 30^{o} phase margin.
The plot below is the Bode' plot for the system with lead compensation.
Again, the purple line is placed at -150^{o} .
For the system with lead
compensation, we can raise the gain by about 22 db.
That gives a system with
less SSE because the open loop DC gain will be higher.
That also gives a system
with faster response - since the 0 db crossing would be at a higher frequency.
The example we just examined shows most of the things you expect to happen
when you use lead compensation.
Because you add phase
lead, the phase does not fall off as quickly, so you can get the zero-db
crossing in the final system to occur at a higher frequency.
That means you will have
a system that responds quicker than the original system.
Because the gain portion
of the Bode' plot is "lifted" it will probably be possible to get a higher
DC gain, so you will have a system that has better SSE performance.
A
System Design Example
Here's a model of a chemical process.
This process has three time constants and three gains.
K_{1} =
2 K_{2} = 1
K_{3} = 0.1
t _{1}
= .5s t _{2}
= 4s t _{3}
= 2s
We
want to control this system to meet several specifications.
The first specification
is that we want the closed loop system to have a SSE
of 2% or less .
If
possible, we would like to use proportional control since that would be
the simplest solution.
Q3
What proportional gain, Kp, do we need to get 2% SSE?
For a SSE of 2%, we need an open loop gain (DC) of about 50 (49 actually!).
Since:
K_{1} =
2 K_{2} = 1
K_{3} = 0.1
K_{1} x
K_{2} x K_{3} x K_{p} = 0.2
x K_{p}
That means the proportional
gain needs to be 250, to get:
K_{1} x
K_{2} x K_{3} x K_{p} = 50
We'd like to show you a simulation for a gain,
Kp, of 250. This is what we have. It's not pretty.
The system looks like
it is unstable!
The computed response
is a growing sinusoid and after about 5 seconds it's off the scale on the
plot.
We should check that conclusion
of instability before committing to it completely.
The complete transfer function is:
G(s) = K_{1}
K_{2} K_{3} K_{p} /[(.5s +
1)(4s + 1)(2s + 1)]
G(s) = 0.25 K_{1}
K_{2} K_{3} K_{p} /[(s + 2)(s
+ 0.25)(s + 0.5)]
G(s) = 0.05 K_{p} /[(s
+ 2)(s + 0.25)(s + 0.5)]
G(s) = K_{RL} /[(s
+ 2)(s + 0.25)(s + 0.5)]
We can plot a root locus to determine the gain
at which the system becomes unstable. From the above calculation,
we know that:
K_{RL}
= 0.05 K_{p} = 0.05 x 250 = 12.5
Here's
the root locus, and the points at a root locus gain of 4.1 are emphasized
because that is the gain at which the closed loop poles enter the right
half of the s-plane. Clearly, for a root locus gain of 12.5 the system
is unstable, and that's what we already learned from the calculation of
the step response.
The
conclusion we reach is this.
A SSE of 2% cannot be
achieved because the gain required also makes the closed loop system unstable.
The smallest SSE that
can be achieved is just at the edge of instability. At that point,
the root locus gain is 4.1, and the DC gain at that point is 16.4.
A gain of 16.4 will produce
a SSE of 1/17.4 = .057 or 5.7%.
We
ought to verify things on using a Bode' plot. Here's the Bode' plot
for the system. This Bode' plot is drawn for a DC gain of 1.0 for
the open loop system.
We can see that we can
increase the gain by about 25 db.
That is a factor of 17.8.
A gain of 17.8 will produce
a SSE of 1/18.8 = .053 or 5.3%.
Any increase in gain beyond
that will produce instability, so the smallest SSE is 5.3%.
NOTE: There is pretty good agreement between
the root locus and Bode' plot estimates (5.3% and 5.7%) and given that
we are using graphical techniques to estimate this, that is very good agreement.
There's one other conclusion we can draw from the Bode' plot and root locus
analysis.
We cannot meet the SSE
specification. The system is unstable for the gain that would produce
the SSE.
Clearly,
we need to do something if we want to control this system. Now consider
the possibility of adding a lead compensator. We will examine how
we can change the system's behavior with this compensator.
We will start by considering
the effect on a root locus.
Next, you can look at the root locus for this
system. The approach we will take is that we will add a pole - in
the lead compensator - at s = -7, and vary the location of the zero that
we add in the lead compensator. We'll use a video to show how the
location of the zero affects things.
Note the following.
We selected the pole arbitrarily.
It could be elsewhere, but we need to start somewhere.
When the video loads you
can see the original root locus because we put the compensator zero on
top of the compensator pole. It stays there until you you play the
video.
Kind of reminds you of
Jonah entering the jaws of the whale, right? That zero just gets
gobbled up. Does it help us? That's the question.
Let's look at that root locus again. There
are several different things that happen that are interesting and can be
used to get more insight into how compensators affect systems that are
a little more complex.
When the zero is between
-7 and -2 the compensator has only a slight effect, although the large
gain asymptotes change because the centroid is changing.
When the zero moves to
the right of -2, and especially as it approaches the leftmost of the pole
pair it begins to "attract" the complex branches of the locus.
At that point we begin
to see portions of the locus with poles much further into the LHP, and
that means that it is possible to produce faster responses.
When the zero gets to
the point that there is only one pole to the right of the zero we get back
to a situation similar to the original locus. However, at that point,
the locus has moved much further into the LHP again leading to even more
improvement in speed of response.
The
real question is this. Can we get a stable system with acceptable
SSE? We're really not getting help on that from this information.
It's going to be hard to extract that kind of information from the root
locus plot even though we are getting some insight into how to speed up
the closed loop system.
At this point, we should consider looking at frequency domain information.
Here's a copy of the Bode' plot for the uncompensated system. Here
you can see that the -180^{o} crossing occurs when the magnitude
is at about -24 db at a frequency near 0.2 Hz.. We could increase
the gain by a maximum of 24 db. Thats about a factor of 15.8.
That will not produce a very good SSE - something more than 5%..
Now, we can work from this Bode' plot and the root locus to design a compensator.
We'll use the root locus insight and start by choosing the pole and zero
at:
Next, plot the Bode' plot for the system+compensator.
We chose the gain for the Bode' plot to give a DC gain of 1.0 (0db).
In the compensated system,
it appears that phase reaches -180^{o} at a frequency of
about 0.63 Hz.
For the uncompensated
system, that point was more like f = 0.2 Hz.
For whatever gain we choose
in this system, we will probably have a higher frequency zero db crossing,
and that implies that the closed loop system will be faster.
On this plot, it appears
we can add about 36 db before the onset of instability.
In the uncompensated system
we found we could add 24 db.
We are about 12 db (a
factor of about 4) better here.
We should be able to get
a smaller SSE in this closed loop system.
Now,
let's consider how well we can get the system to perform. If we add
36 db, then.
A gain of 36 db corresponds
to a gain factor of about 63.
The system, as shown,
has a DC gain of 1.
Adding a gain of 63 (36db)
will produce a SSE of 1/63 or less than 2%.
But, that is right on
the edge of stability.
If we set the gain to
49 or 50 - to get 2% SSE - we are not that far under the gain that will
produce instability, and we will have a low gain margin. In other
words, there is very little margin for error in our gain setting if we
aim for 2% SSE, even though we can do it.
Now, let's go back to the root locus and check
how this plays out there.
At the onset of instability,
the closed loop poles on the imaginary axis are at +/- 3.5j or thereabouts.
They are marked with the black dots on the diagram.
At that point, the Root
Locus gain (product of poles divided by product of zeroes) is 109.
A root locus gain of 109,
in turn, produces a DC gain of 62.4.
(That's 109/(2x.25x.5x7).)
At
this point, we have good agreement between our root locus analysis and
our Bode' plot analysis. In both cases, the DC gain for the onset
of instability is a little over 60.
We can conclude that the
proposed compensator - (s+1)/s+7) - can produce a stable system that gives
less than the required 2% SSE.
We don't know how the
system will behave, however. It may be too close to instability.
To check behavior, we
can do a simulation to calculate step response, to see how a system behaves
for a gain that produces 2% SSE, for example.
Here
is a simulation of the system with the gain set to give 2% SSE.v The system
is stable.
The response of the system
is certainly not acceptable. It has excessive overshoot with slowly
decaying oscillations.
We conclude that, although
the system has acceptable SSE, we still have to work to improve this response.
We
need to consider some options for what we can do. Some options include
the following..
Consider using two lead
networks instead of one. We made considerable progress toward a satisfactory
solution with one lead, and we should be able to get satisfactory performance
using two. We did manage to produce a stable system that met the
SSE specs, and we couldn't do that with the uncompensated system.
We could try another lead
network. The one chosen is fairly arbitrary.
Taking the second approach above - using another lead network - a second
lead network was tried. For this trial we worked from the lead compensator
we had been considering above. However, instead of a pole at s =
-7, we argued in the following way.
The zero at s = -1 adds
phase lead starting around w
= 1.
The pole starts to take
back that lead phase around w
= 7.
If we moved the pole higher
in frequency, we might keep that phase lead longer and be able to move
the zero db crossing higher in frequency.
Reasoning that way, we
simply moved the pole to s = -20 and simulated the system.
The result is shown below.
Note that several features
of the response have greatly improved.
The system is much
faster. Pick any measure you like, settling time, rise time, etc.,
the response is settled out well before two
seconds have elapsed.
The overshoot is now approximately
25%
and the system is well damped.
The SSE is still right
around 2% .
There may be some drawbacks to this approach. It might require a
very large control effort to achieve these results. You'll have to
know your system well. In some systems you just can't get a large
enough control effort. In aircraft, for example, there are limits
on how far you can more the aileron, etc. In a motor, the drive amplifier
might saturate. You get the message. You'll have to know what
is reasonable for your system when you drive it that hard, but the linear
analysis says that you can get where you want with enough control effort.
Designing
Lead Compensators
If you need to design a lead compensator, you will need to choose the pole
and zero location. Click here for a short
note on how to compute the pole and zero location.
Implementing
Digital Lead Compensators
There will be times when you need a lead compensator, and the appropriate
place to put the lead compensator is in lines of code within the control
program. That presents a problem that we need to solve and it defines
the goal of this section.
Given
an analog compensator transfer function Compensator Transfer Function:
Determine an equivalent digital compensator transfer function expressed
as a function of z.
We're going to assume that you are familiar
with integral control and how to implement an integral controller digitally.
Click
here to go to the lesson on implementing integral control digitally.
We're
going to work with the idea that you can replace s with (z - 1)/(z T) in
moving from analog/continuous systems to digital/sampled systems.
We will assume that you have a compensator transfer function of the form
below.
G_{comp} (s)
= Gc( t _{z} s+
1 )/( t _{p} s+
1 )
The algorithm is simple.
Replace every s in the
transfer function with the z-equivalent, (z - 1)/(zT).
The variable, T, is the
sample period in your system.
Then, simplify to polynomial
form.
From the polynomial form
you can get a difference equation.
The difference equation
will lead directly to a simple code implementation.
Assume
that we have a lead compensator. The transfer function we will assume
we have is of this form.:
We choose particular values
G(s) = [ s/3 + 1]/[
s/15 + 1}
or
G(s) = (15/3) [ s +
3 ]/[ s + 15 ]
We choose this transfer function only because
it has numbers that won't get confusing as we go along. We start
with the first step in the algorithm.
Replace every s in the
transfer function with the z-equivalent, (z - 1)/(zT).
We immediately realize that we need to know
the sampling period, T. This system has a time constant of 1/15 sec.
and the sampling period should be less than that. Let's assume that
we are sampling at a rate of 50 samples/second, so:
T = 0.02
Replacing s, we get:
Next, we have to simplify
to polynomial form. We get the result below by multiplying numerator
and denominator by zT.
Then, we're on to the
difference equation.
From the polynomial form
you can get a difference equation.
Rewriting
the expression for the transfer function, we note that the transfer function
is the ratio of the lead compensator output to the lead compensator input
in the z-domain. Manipulating the expression above, we get:
where:
Y[z] is the output of the lead compensator,
and
U[z] is the input of the lead compensator.
The
expression - in the z-domain - relating the input and output of the compensator
can give us the difference equation we want. This difference equation
is easy to implement in code."
Here's the difference equation. It's not hard at all. Start
by cross multiplying the equation above to get:
[(1 + 15T) zY[z] - Y[z]] = [15/3][(1
+ 3T) zU[z] - U[z]]
Then, take the inverse transform of both
sides to obtain:
[15/3][(1 + 3T) u_{k+1} -
u_{k} ] = [(1 + 15T) y_{k+1} - y_{k+1} ]
or:
y_{k+1} = [5(1 + 3T)u_{k+1}
- 5u_{k} + y_{k} ]/[1 + 15T]
OldInput =
0.; /* Initialize OldInput and OldOutput */
OldOutput = 0.;
.
.
NewInput = Error;
NewOutput = (OldOutput
+ NewInput*5*(1+3*T) - 5*OldOutput)/(1 + 15*T);
OldOutput = NewOutput;
OldInput = NewInput;
Note the following for the code.
The code in blue would
be inside a control loop. Note how the code directly corresponds
to the difference equation just above the code.
The variables "Input"
and "Output" are the input and output of the compensator, and NewInput
refers to the most recent value of the compensator input, etc.
We
haven't given you the whole story here. There are other methods for
transforming continuous systems - like compensators - into computer implementations
using z-transform methods.
Some
Questions About Controllers etc.
So far you have looked at controllers and compensators for systems.
In all cases the approach has been to find a transfer function that will
make the system perform well - in some sense. However, consider these
facts.
Most control systems today
are computer controlled systems. You may think that implies conversion
to z-transform format for the transfer function you find.
Once you have a computer
in the system you can make decisions depending upon conditions - and you
may want to control differently if the system is close to being in a dangerous
state - like a high pressure or temperature in a boiler.
There's nothing in what
we have done that says a linear controller is the best one.
You
may want to consider control algorithms that are nonlinear. Controllers
that make decisions are inherently nonlinear.
There's a whole world of nonlinear controllers out there. In this
lesson set we haven't done much with them - nor will we. But we do
talk about a very different kind of controller - a fuzzy controller - and
you may want to consider that approach.
Click here
to go to the basic lesson on fuzzy systems.
Click here
if you want to go directly to the lesson on fuzzy controllers.
Problems
Return
to Table of Contents
Send
us your comments on these lessons .