Professional Documents
Culture Documents
MSD Part 1 - Control Notes 2014 PDF
MSD Part 1 - Control Notes 2014 PDF
Contents
1 Introduction ......................................................................................................................................... 3
1.1 Open Loop vs. closed loop systems ............................................................................................. 3
1.2 Non‐unity feedback ..................................................................................................................... 4
1.3 External disturbances .................................................................................................................. 4
1.4 A practical control system ........................................................................................................... 4
1.5 Control System Design ................................................................................................................ 5
2 Modelling of Dynamic Systems ........................................................................................................... 6
2.1 Differential equations of motion ................................................................................................. 6
2.2 Electric motor speed control: 1st Order System – Time Constant ............................................... 8
2.3 1st Order System – Pure integration ........................................................................................... 9
2.4 Higher Order System – cascade of simple elements ................................................................. 10
3 Laplace Transforms ........................................................................................................................... 11
3.1 Complex frequency variable ...................................................................................................... 13
3.2 Solving equation of motion using Laplace transforms .............................................................. 14
3.3 Transfer function ....................................................................................................................... 15
3.4 Natural modes of response in the s‐plane ................................................................................ 15
Example 3.1 – Transfer function poles and zeros ............................................................................. 16
4 The Root Locus Method .................................................................................................................... 18
4.1 Closed loop poles ...................................................................................................................... 18
4.2 Root locus construction ............................................................................................................. 19
4.3 Using the Root Locus for Control Analysis and Design .............................................................. 22
1
Example 4.1 – Aircraft roll‐angle control system .............................................................................. 24
5 Steady State Errors ............................................................................................................................ 27
Example 5.1 –Time constants ............................................................................................................ 27
Example 5.2 –Additional integration ................................................................................................. 28
Example 5.2 –External loads ............................................................................................................. 28
5.1 System Class .............................................................................................................................. 29
6 Frequency Response Analysis ........................................................................................................... 30
6.1 Transfer function in the frequency domain .............................................................................. 30
6.2 Bode diagram ............................................................................................................................ 31
Example 6.1: Aircraft roll‐angle control system – Bode diagram .................................................... 33
6.3 Stability Investigation ................................................................................................................ 36
6.3.1 Stability criterion ............................................................................................................... 36
6.3.2 Measures of Stability: Phase and Gain Margins ................................................................ 38
6.3.3 2nd order system: GM, PM and Closed Loop Transient Response ..................................... 38
Example 6.1 (continued): Aircraft roll control system ................................................................... 40
7 Compensation ................................................................................................................................... 43
7.1 Improved Bode diagram (frequency response characteristic) .................................................. 43
7.2 Proportional‐Integral‐Derivative (PID) Controller ..................................................................... 44
7.3 PID filter characteristics ............................................................................................................ 46
7.3.1 PD: High‐pass filter ............................................................................................................ 46
7.3.2 PI: Low‐pass filter ............................................................................................................. 47
7.3.3 PID: Notch filter ................................................................................................................. 47
7.3.4 PID Tuning ............................................................................. Error! Bookmark not defined.
7.4 PID Design Examples ‐ DC Motor Position Control .................................................................... 49
7.4.1 DC Motor Model ................................................................................................................ 49
7.4.2 PID controller design using simulation (time response) ................................................... 50
7.4.3 PID Controller Design Using Root Locus ............................................................................ 55
Tutorial question sheets will be issued when appropriate.
September 2014
2
1 Introduction
Control systems are dynamic systems, very much like the mass‐spring‐damper and other mechanical
systems. However, control systems are not restricted to being only mechanical and they can be
electrical, hydraulic or any other type or mix.
What makes control systems somewhat special is that we are always interested in controlling a physical
variable, or the response, of our dynamic system. In an IC engine or an electric motor we may want to
maintain constant shaft speed under variable load. In an industrial robot or a CNC machine tool we
want to control instantaneous positions of its axes of movement (degrees of freedom) such that the
tool moves along a prescribed trajectory. The autopilot on a ship is employed to maintain constant
heading in the presence of various disturbances such as wind and waves. Autopilot on an aircraft does
very much the same thing, except there are more degrees of freedom involved.
Control theory involves the development of completely general mathematical tools and analysis
methods that can be applied to any type of dynamic system. At the heart lies the fact that system
dynamics are always governed by the corresponding differential equation of motion, but the analysis
methods aim to avoid the hard work of explicitly solving this equation. Instead, there are various
graphical and semi‐graphical methods that can be used to analyse the system more efficiently.
Apart from a few exceptions (e.g. stepper motors) it is not practical to control the output in an open
loop fashion, as this requires precise knowledge of the system behaviour and the control performance
would be ruined by any disturbances and system parameter uncertainties. Therefore, for the purposes
of controlling the output, we always employ negative feedback of the output signal. The concept of
negative feedback was introduced in the ME2 Mechatronics Course and it is the fundamental concept
in automatic control. This means that the signal driving the system is the error e(t) between the
demanded and the actual (measured) value of the output. The error signal is always of the
correct sign to drive the system towards the demanded value .
Input, u(t)
Output, x(t)
Fig. 1.1: Negative feedback of the output signal acts to drive the system output towards the target value .
3
1.2 Non‐unity feedback
The transfer function in the feedback path does not have to be unity ( 1). Typically, the output signal
(e.g. position) will be measured using a suitable sensor and the sensor signal (typically voltage,
sometimes filtered) will provide the feedback signal. However, it is often much easier mathematically to
deal with a unity feedback system. It is therefore often convenient to treat the sensor as a part of the
‘open loop’ unity feedback system, with the only difference that the system output is now the sensor
signal, not the physical quantity being measured.
e(t)
u(t) + G x(t) e(t) x(t) x’(t)
-
u(t) +
- G H
H
Fig. 1.2: Equivalent non‐unity and unity feedback systems. Both systems have the same dynamic behaviour
but different definitions of the output signal.
These two systems are equivalent and behave exactly the same, because all transfer functions and
signal paths are the same. The only difference is that one uses the physical variable as the output,
while the other uses ′ .
Fig. 1.3: External disturbance as an additional input signal. Negative feedback can minimise the effect of disturbance on .
In general we want to minimise the response to disturbances using negative feedback. In the above
system, this means that we aim for → 0
Fig. 1.4: Analogue position‐control system
The above schematic diagram shows how a practical remote‐control positioning system may be built
using a DC servomotor to drive a load. This system uses one potentiometer to measure the motor shaft
4
position and another to record the demanded motor position. Both positions are represented by
corresponding voltages. The control loop uses op‐amp circuits to provide buffers (isolation of the
potentiometers from the load so they behave as ‘ideal’), difference amplifier and a variable‐gain
voltage amplifier. Since op‐amps cannot provide the large current needed to power the motor, the
system employs an additional power‐amplifier stage.
Although quite simple, this system has all the necessary elements needed in general to build a
functioning control system, shown in the diagram below. The system being controlled (DC motor) is
often called “the plant”. The forward path of the feedback loop also includes the controller and the
power/actuation stage.
Error
Input Controller Power Plant
+ Output
Voltage - (Gain) amp (DC motor)
Position
Signal
Sensor
Conditioning
(Potentiometer)
(Buffer)
Fig. 1.5: General layout of a practical control system
Computer control systems are functionally very similar, except that some parts of the control loop are
implemented using a control computer. As the diagram below shows, negative feedback and control
are implemented digitally, as a software program which generates the input signal (e.g. robot
trajectory), receives the output measurement via A/D converter, calculates the control signal and
supplies it via D/A converter. This process is repeated typically between 100 and 1000 times per
second.
Control computer
Error
Power
Input + Controller D/A Plant Output
- amp
Signal
A/D Sensor
Conditioning
Fig. 1.6: Digital control system
Ramp Input (constant speed) Used for steady state error analysis
Impulse Defines the system transfer function
5
Considering the step response, some standard response parameters are shown below.
Fig. 1.7: Typical step response shape with common control performance parameters
u(t) T x(t)
d nx d n 1 x dx
a n n a n 1 n 1 a1 a 0 x(t ) u (t )
dt dt dt
It is useful to note that the left hand side consist of the output and its derivatives, while the right‐
hand side contains the input which forces the system to move. ‘ ’ is the system order.
It is also feasible for a system to involve differentiation of input, so system dynamics can more generally
be represented by the differential equation of the form:
d nx d n 1 x d x d mu d m 1u du
an n
a n 1 n 1
a1 a 0 x (t ) bm m
bn 1 m 1
b1 b0 u (t )
dt dt dt dt dt dt
6
The solution of this equation is the system output , in response to a particular input signal or
to being released from some initial conditions, or both. The solution is always of the form
where PI is the “particular integral”, which depends on the particular input signal being applied. CF
is the “complementary function”, obtained by solving for 0. CF defines the systems “natural
modes of response” and it is usually more interesting than the PI part of the solution.
What are the natural modes of response?
Natural modes are signals that can be observed in the system output whenever it is supplied with
an input , or released from initial conditions, or subject to an external disturbance. In general, the
natural modes of response may be either exponential or oscillatory.
As a simple example, consider a simple mass‐spring‐dashpot system, driven by an applied force F t
while the output is the deflection x t from an equilibrium position.
F(t) T x(t)
Equation of motion:
In standard form: 2
1 cos sin
1
20
20
15
15
deflection (mm)
deflection (mm)
10 10
5 5
k = 1000 N/m; M = 25 kg; zeta = 0.1; k = 1000 N/m; M = 25 kg; zeta = 0.9;
step force, 10N at t = 0 step force, 10 N at t=0
0 0
0 1 2 3 4 5 0 1 2 3 4 5
time (sec) time (sec)
Fig. 2.1: Step response for different viscous damping constants . Observe how a change in damping changes the natural
mode shape (transient response)
7
2.2 Electric motor speed control: 1st Order System – Time Constant
Consider a DC servomotor, where the input signal is represented by the voltage applied at the
motor terminals and the output signal is the motor shaft speed .
R L
(t), (t)
i(t)
v(t) e(t)
F
Fig. 2.2: DC servo motor schematics
Assuming negligible armature inductance ( L 0 ),
The equations to use to derive the system model are:
KVL:
Current (assuming inductance → 0
Back e.m.f.: e(t ) K b(t )
Torque generated by the motor: T (t ) K t i(t )
d 2 d d
Mechanical equation of motion: T (t ) J 2 F J F (t )
dt dt dt
The operation of the motor may be represented by the following block diagram. Note that in addition
to adhering to the above equations, the block diagram also shows the correct signal flow. For example,
the motor current is caused by the voltage applied at the motor terminals, but it is effectively
reduced the back e.m.f. and the inductor voltage.
Fig. 2.3: DC motor block diagram showing all relevant physical variables
Usually may be neglected because it is of the order of , whereas is of the order of a few Ohms.
Combining the above equations to eliminate and we get:
d K K K
J F b t ( t ) t v( t )
dt R R
or
J d ( t ) Kt
v( t )
K b K t dt
F FR K b K t
R
8
This is a 1st order differential equation, which is represented in standard form as:
dx
x(t ) Ku (t )
dt
where u(t) is the input signal and x(t) is the output signal and is the time constant.
dx
Noting that Ku (t ) x(t ) , this differential equation can also be modelled using a corresponding
dt
block diagram built around an integrator. This is a useful concept for simulation.
dx dx
u(t) K.u ( t ) dt 1 dt x(t)
K
dt
We generally want to solve this equation for in response to a specific input signal. The solution
consists of two parts:
dx
a) Natural mode solution, found by solving x ( t ) 0 , giving
dt
.
0.37 C
t
b) Input dependent part. For example, unit step input:
t
x ( t ) 1 C.e
C
1
u(t) x(t)
0.37 C
t
The characteristic of the time constant system is that it reaches the steady state exponentially. When
the input drops to zero, the output also drops (exponentially) to zero.
9
For example, consider an ideal current source charging a capacitor
i(t)=const v(t)
v(t)
t
Integration characteristic can also result from a mathematical process. For example, position is the
integrals of speed:
d
( t )
dt
KbK t
R
Fig. 2.4: DC motor model with output being shaft position . Notice that this is a cascade of integration time constant and
pure integration
If we consider the motor model where 0, output shaft position (see Fig 2.3):
This is a 3rd order system, for which the natural modes solution (CF), depending on coefficient values, is:
either 3 exponentials:
10
or 1 exponential and 1 harmonic
However, solving differential equations of orders 3 and above is difficult. We need better mathematical
tools that will enable us to analyse efficiently systems of any order. Suitable tools include Laplace
transforms, leading to Root Locus method, and frequency response analysis, leading to the Bode
diagram method.
3 Laplace Transforms
Virtually all control textbooks use Laplace transforms to derive the system response. There are other
ways of doing the problem, but the Laplace approach is the easiest, once you have grasped the basics of
the subject (remembered from 2M Maths?!).
Laplace transform of a time‐function is . By definition:
where is a complex variable, the Laplace variable. Physically, the Laplace variable can be
interpreted as a complex frequency.
The reasons why Laplace transforms are useful for control systems analysis are:
Differential equation are transformed into polynomials, so they are easier to solve
Easy way of dealing with initial conditions
Various “nice” properties that let us analyse systems without having to solve DE explicitly
In control systems, it is sufficient to assume that nothing happens before 0 , so all relevant time‐
functions functions 0 for 0. Without losing generality we can therefore write:
e.g. A constant signal of magnitude may be represented by a step function, given by , 0
Table 3.1 gives Laplace transforms of some common signals.
Inverse Laplace transform is formally given by:
i
1 1, 0
L F ( s )
1
F ( s )e st ds f (t )u (t ) where
2i i 0, 0
Fortunately, we rarely need to find the inverse Laplace transform. If we do, then it is much easier in
practice to split a complicated expression into partial fractions, if needed, and to look up the individual
terms using published tables.
Some useful Laplace transform theorems are summarised in Table 3.2. Notice how the Laplace
transform of derivatives lead to an easy way to account for initial conditions 0 , , , … .
11
Also, the final value theorem is useful for evaluating steady state values in the Laplace domain (i.e. by
analysing instead of , which is usually much easier mathemathically)
Table 3.1: Laplace transforms of some common signals
Dirac delta
function 1
Unit step
1
1
t
Unit ramp
1
t
t
Exponential
1
t
Sine
1 1 1
t sin
2
Cosine
1 1 1
t cos
2
Damped
Sine
sin
t
Damped
Cosine
cos
t
Table 3.2: Laplace transform theorems
Name Theorem
Derivative 0
nth order derivative 0 0 ⋯ 0
Integral
Time shift, t0 .
Frequency shift
12
3.1 Complex frequency variable
The Laplace variable can be physically interpreted as a complex frequency. What does this mean?
Skipping over all mathematical proofs, it means that a time‐waveform of frequency is given by
. Since is complex it can be written as . The corresponding time‐waveform is
therefore:
. cos j. sin
Fig. 3.1: Complex frequency signal
Therefore is a harmonic signal of frequency / , with the amplitude changing exponentially
with time constant .
Signals of this form are represented as points in the complex s‐plane (axes and ). In fact the s‐plane
is complex conjugate and the points defining signals are complex conjugate pairs. Many signals that we
deal with in control are a combination of exponentials and harmonics. In
principle, any waveform can be represented by a corresponding set of points in the s‐plane.
Some points to note:
The s‐plane is symmetrical about the horizontal axis (complex conjugate).
The right half‐plane (positive ) corresponds to exponentially expanding signals.
The left half‐ plane (negative ) corresponds to signals that exponentially decay to zero.
j
t
t t
t
t
t
Fig. 3.2: Points in the complex s‐plane and the corresponding time‐signals
13
3.2 Solving equation of motion using Laplace transforms
Consider the mass‐spring‐dashpot system driven by the applied force , output position .
Equation of motion:
Taking Laplace transform: 0 0 0
Assume zero initial conditions 0 0 0:
Hence:
We can now analyse in response to various input signals
From Laplace transform tables use:
X 1
0.4 40
0.01
7.6 40 3.8 5.05
.
0.01 1 cos 5.05 0.75 sin 5.05
The steady state value of is:
lim 0.01
→
14
3.3 Transfer function
Following the above derivation for the mass‐spring‐dashpot system (input , output , the transfer
function is:
1
In general, when the systems is represented by a differential equation of the form:
… …
Taking Laplace transforms and assuming that all initial conditions are zero (this assumption is
sufficiently general for control system analysis):
⋯ ⋯
where X(s) and U(s) are the Laplace transforms of the input and output signals respectively. The system
transfer function can then be represented as a ratio of two polynomials in :
⋯
⋯
15
Fig. 3.3: Locations of transfer function poles in the s‐plane correspond to time signals which are the system’s natural modes
of response
Figures 3.2 and 3.3 show essentially the same information, but we can see that transfer function poles
can immediately show us the transient response characteristic.
Interesting points to note:
Poles in the right half‐plane give natural modes that expand infinitely – a system with such poles is
unstable.
Poles in the left half‐plane give natural modes that decay to zero – those modes are stable.
Poles on the imaginary axis mean that the system is self‐oscillatory – once disturbed it will oscillate
at frequency forever.
Poles on the real axis ( 0) mean that there is zero overshoot – critically damped or overdamped
response.
The further the poles are to the left (more negative ) the faster the system settles to a steady state.
The open loop transfer function is
so open loop poles are at 0, 1, 2 and there are no open loop zeros
We can plot the open loop poles in the s‐plane. What are the corresponding natural mode signals?
16
Fig. 3.4: Open loop poles in the s‐plane
Now consider the closed loop transfer function:
1
1 2
1 1 2
1
1 2
Closed loop poles can be seen to depend on the value of the and are defined by the characteristic
equation:
1 2 0
Let us evaluate closed loop poles for different gain values:
Characteristic polynomial Closed loop poles
0 1 2 0 0, 1, 2 same as open loop poles
0.3 3 2 0.1 0 0.9, 0.05, 2.04
0.5 3 2 0.3 0 0.21, 0.66, 2.13
1.0 3 2 0.5 0 0.40 0.25, 2.19
2 3 2 2 0 0.24 0.86, 2.52
5 3 2 5 0 0.05 1.31, 2.90
10 3 2 10 0 0.04 1.50, 3.09
We can plot these results in the complex s‐plane. The lines along which the closed loop poles move as a
function of system gain constitute the Root Locus. This is a powerful graphical tool for control system
analysis and design.
Fig. 3.4: Closed loop pole positions in the s‐plane for different values of the system gain . The points lie on the system root
locus diagram
17
4 The Root Locus Method
We have seen that in general a transfer function is represented as a ratio of two polynomials in ,
where is the complex Laplace variable, i.e. the complex frequency. By expressing the transfer function
in a factorised form, the numerator and denominator polynomial roots … and … ,
respectively, are immediately visible.
…
…
… are transfer function zeros. … are transfer function poles and the corresponding value of
corresponds to signals that are the system’s natural modes of response. The shape of the response
following application of an input signal, external load or being released from some initial conditions
(position, velocity, …) is immediately obtained from the knowledge of the natural modes of response.
A given transfer function G(s) is fully defined by its pole‐zero pattern in the complex s‐plane. Poles are
marked with ‘ ’ and zeros with ‘’. For example, consider the following transfer function.
j
s 1
G(s) 3
s 6s 2 10s
s 1
s.s 3 j s 3 j
Hence:
Poles @ 0, – 3 , – 3 –
Zero @ – 1
Note:
A given system can possess unstable natural modes of response. Such modes are represented by
poles in the positive half of the s‐plane, where the amplitude grows exponentially with time.
Poles in the negative half of the s‐plane correspond to stable modes, as the amplitude decays
exponentially to zero.
The modes with poles close to the Im‐axis decay more slowly.
A critically stable system has poles precisely on the Im‐axis.
Poles on the real axis correspond to non‐oscillatory modes of response.
A pair of complex conjugate poles corresponds to an oscillatory mode of response.
18
The closed loop transfer function is:
x (s) K.G (s)
u (s) 1 K.G (s).H(s)
where: adjustable gain constant, independent of ' '
forward path transfer function, complex
feedback path transfer function, complex
Note: With this formulation . . ) can be taken to represent the open loop transfer function.
This means that the control loop is opened by disconnecting the feedback signal , not the
output , so that all blocks are still present in the open loop systems.
Therefore the closed loop system poles are the roots of the denominator of the closed loop transfer
function, given by the solution of the closed loop characteristic equation:
1 . . 0
For control system design, we want to know how the closed loop poles vary with the adjustable gain ,
which is the design parameter. We are potentially interested in all positive gain values, i.e. the gain
range 0 ∞. Negative gain values are mathematically possible, of course, but they would
effectively result in positive output feedback, so they are not of practical interest for control design.
The closed loop poles for 0 ∞ lie along the lines of the root locus.
Definition: Root locus is the set of lines in the complex s‐plane along which the closed loop poles are
positioned as a function of the systems gain K.
Root loci start at open loop poles (for 0) and end at open loop zeros or at → ∞
along certain asymptotes (for → ∞).
19
8. There are asymptotes which originate on the real axis at the point
poles zeros
nm
9. The asymptotes are oriented relative to the positive ‐axis at angles:
180 l.360
l , l 0, 1, 2, ( n m 1)
nm
10. Root locus “breaks away” from the real axis (or “breaks in”) at the point of multiple rots (closed
loop poles).
11. Locations on the real axis containing multiple roots are defined by:
d 1
0
ds G ( s ).H ( s )
12. Angle of departure from complex poles are given by:
180° ∑ ∑
13. Angle of arrival to complex zeros are given by:
180° ∑ ∑
Note: Intuitively, it can be observed that the open root locus branches are ‘repelled’ by each other
and by the open loop poles, while they are ‘attracted’ by the open loop zeros.
The following set of graphs provides some illustrative root locus shapes and their corresponding open
loop transfer functions. Try to recognise the above rules in the examples shown.
20
Some representative root locus shapes
. . . .
j j
asymptotes
double
CL pole
. . . .
j j
. .
21
4.3 Using the Root Locus for Control Analysis and Design
Root locus is a powerful tool for analysis of the transient behaviour of a closed loop system under
different gain settings. The key is to remember that:
For a given value of the gain K, there is one corresponding point (closed loop pole) on each branch of
the root locus.
Each pole pair at locations , defines a natural mode . .
Therefore:
Any poles in the right half‐plane will result in instability.
Poles in the left half‐plane are stable and the value of the α‐coordinate defines the exponential
decay of the signal e . This defines the settling time.
The coordinate jω defines the frequency of oscillation
Closed loop poles on the real axis correspond to exponential modes (ω 0)
Settling time
For any pole at location , the settling time is defined by the exponential . Normally, settling
time is taken as the time in which the signal settles to within 2% of its final value. Thus:
0.02
Since the poles with a more negative real part decay faster, the settling time for controller design can
be specified as the largest acceptable value of .
j
Fig. 4.1: The shaded area indicates the region of acceptable pole locations according to a settling time criterion
Damping ratio, natural frequency
It can be proved that for a complex conjugate pair of poles, in the s‐plane:
Lines of constant damping ratio are straight lines at angle to the vertical axis
Lines of constant natural frequency are semicircles centred at the origin
This is illustrated in the figure below. As the damping ratio determines the amount of overshoot, the
minimum value of is usually specified as a control design criterion. Also, the natural frequency
determines the speed of response, minimum value of may also be specified as a control design
criterion. This is illustrated in the figures below.
22
j
j
Damping ratio
criterion
Fig. 4.2: Lines of constant damping ratio and natural frequency and the corresponding design criteria in the s‐plane
Control design process
The objective of control design is usually to select a value of the system gain K that meets the design
specifications, such as settling time and damping ratio. Following the above analysis, the control design
process using root locus may be summarised by the following steps:
1. Derive the open loop transfer function for the system being considered. Find the open loop poles
and zeros.
2. Plot the root locus. The root locus consists of lines along which the closed loop poles are located,
depending on the gain. There is one closed loop pole for each branch of the locus.
3. Specify the control design criteria in terms of damping ratio, settling time, natural frequency.
4. Find the desired closed loop pole locations that meet the criteria. For systems with more than 2
poles, the design is based on those that are furthest to the right (longest decay time, dominant
poles).
5. Evaluate the gain K corresponding to the chosen dominant poles.
The last step may be found by substituting for the chosen pole s value in the characteristic equation
1 . . 0 and solving it for gain K. However, if using Matlab, it provides a function
rlocfind(‘system’) to evaluate the gain for a chosen point on the plot. Furthermore there are also
manual techniques involving measurements from the root locus plot, but this is outside the scope of
this course.
We shall illustrate the design process in the following Matlab example.
23
Use Matlab to plot the root locus and find the maximum gain for which the system is stable and the
gains that will result in a damping ratios between 0.6 and 1.0
The open loop transfer function is
Open loop poles are: 0, 1, 5
The closed loop transfer function is:
5
6 5 5
5 6 5 5
1
6 5
Hence the characteristic equation is: 6 5 5 0
We seek the value of K that results in closed loop poles that satisfy our damping ratio criteria
To get an insight into the system behaviour, we can first simulate it in Matlab for different values of .
The following Matlab commands define the system for 0.1 and plot the step response, as well as
closed loop poles.
% Start Matlab text editor, define open loop transfer function:
num = [5];den = [1, 6, 5,0];plant = tf (num,den);%Open loop transfer function
contr =0.1; % Define controller gain K=0.1
system = feedback(contr*plant,1); % Define closed loop unity-feedback system
t = 0:0.01:60;step (system,t) % Plot step response for 0<t<60s
pzmap(system) %command to plot closed loop poles
The following are the results obtained for different gain values.
24
Gain Step response Closed loop poles
K=0.1
K=1
K=5
K=7
The root locus plots the closed loop poles for 0 ∞. Using Matlab, the commands given below
define an open loop transfer function ‘plant’ = and plot the root locus. Note that the
command sgrid also plots the grid of lines of constant damping ratio and natural frequency .
25
Root Locus
3
0.84 0.74 0.6 0.42 0.22
0.91
num = [5];
den = [1,6,5,0];
plant = tf 2
(num,den); 0.96
rlocus(plant)
sgrid
5 4 3 2 1
0
0.99
-1
0.96
-2
0.91
0.84 0.74 0.6 0.42 0.22
-3
-5 -4 -3 -2 -1 0 1
-1
Real Axis (seconds )
Typing the following command invokes a function to interactively select a point on the plot for which it
returns the gain and the closed‐loop pole locations.
[k,poles] = rlocfind(plant)
Using this command, we obtain the following:
Marginally stable system (closed loop poles on the imaginary axis) → 6
0.64 (closed loop poles on the corresponding line of constant ) → 0.48
0.85 (closed loop poles on the corresponding line of constant ) → 0.38
1 (closed loop poles at breakaway from real axis) → 0.23
Manual check:
We can manually evaluate the gain K corresponding to any point we choose on the locus.
e.g. From the above root locus plot, 0.64 corresponds to dominant poles at 0.41 0.525
Characteristic equation: 1 0:
5
1 0
6 5
6 5 5 0
For the pole at 0.41 0.525:
0.41 0.525 6 0.41 0.525 5 0.41 0.525 5 0
0.41 0.525 0.41 0.525 6 0.41 0.525 5 0.41 0.525 5 0
0.0351 0.207 0.0415 0.245 0.474 2.796 2.22 2.625 5 0
Equating parts:
0.0351 0.245 0.474 2.22 5 0
2.41 5 0
0.48
26
5 Steady State Errors
Consider a general closed loop system with non‐unity feedback:
u(s) e(s) x(s)
+ K.G(s)
-
H(s)
From the diagram:
.
Eliminating , the error signal, as a function of input, is thus given by:
1
1 . .
For a given input signal u(s), the steady state value of is by the final value theorem
lim lim .
→ →
The final value theorem is valid provided the limit exists. (Can you think of reasons why it would it not
exist?)
Open loop transfer function:
Error signal:
1 1 1 1 2
1 . 1 1 1 2
1 1 2
Final value theorem:
1 1 2
lim lim . lim .
→ → → 1 1 2
Consider now the response to unit step,
1 1 2 1 1 1 2 1
lim lim . . lim
→ → 1 1 2 → 1 1 2 1
The system can be seen to have a steady state error, which can only be eliminated if → ∞
27
1
1
1 K
Error signal:
1 1 1 1 2
1 . 1 1 1 2
1 1 2
Let , unit step again, and apply the final value theorem
1 1 2 1 1 1 2
lim lim . . lim 0
→ → 1 1 2 → 1 1 2
This time the steady state error is zero, owing to the integration in the forward path.
Now consider applying a unit ramp input . The steady state error can be found to be
1 1 2 1 1 1 2 1
lim lim . . lim
→ → 1 1 2 → 1 1 2
The external load acts as a second input signal. From the block diagram:
1
1 1 2
. . .
Hence: . . .
Therefore:
1
. .
1 . 1 .
28
1
1 1 1 2
. .
1 1
1 1 2 1 1 2
1 1 2 1
. .
1 1 2 1 1 2
Let 0, . Notice that we assume that the constant load is applied as a step at 0.
The resulting steady state error is:
1
lim lim . .
→ → 1 1 2
Unit accn 1 1
→ ∞ → ∞ 0
Note: A system with 2 or more free integrators will very likely be unstable. The final value theorem
tells us nothing about stability, so the steady state error calculation is valid only if the system is
by other means shown to be stable.
29
6 Frequency Response Analysis
Frequency response analysis has much in common with signal processing methods and treats the
dynamic system as a filter of the input signal. It is a different (but closely related) approach to that using
the root locus method. It leads to Bode diagrams, which are also widely used in signal‐processing (filter
design) and in vibrations analysis.
Frequency response implies providing the system with a harmonic input (e.g. sine or cosine) of a certain
frequency and unit amplitude and recording the corresponding output amplitude and phase shift.
Previously we used Laplace transforms to represent signals as functions of complex frequency
and used it in the expression for signals and transfer functions. Now however, the signal
amplitudes are constant, so 0 and the complex frequency variable is purely harmonic. We can
therefore simply replace by , as shown below:
cos j. sin
Fig. 6.1: Pure harmonic signal ( 0)
Fig. 6.2: Transfer function as a change in magnitude and phase
The magnitude and phase relationships between input and output can be also seen by using phasor
diagrams to represent harmonic signals. Remember, each phasor represents a complex number, while
the transfer function is itself also a complex quantity.
Im Im
Vi
KG(j) Vo
ωt
ωt
Re Re
Fig. 6.3: Phasor representation of magnitude and phase change
High‐order transfer functions can be viewed as a cascade of simpler (first order) transfer functions, very
much in the way that a low‐pass and a high‐pass filter can combine to give a band‐pass or a notch filter
(ME2 Mechatronics). Each of the transfer function blocks in a cascade results in a magnitude change
and a phase shift, contributing to the overall effect as shown below.
30
1
Fig. 6.4: Cascade of transfer functions, magnitude and phase are modified at each stage.
The overall magnitude is then the product:
| | | | | | | |
If expressed in decibels, the overall magnitude then becomes the sum:
20 log 20 log 20 log 20 log
The overall phase shift is the sum:
0.1 1 10 100
-3dB
Integration time constant
-20dB
Slope:
- 20dB/decade
-40dB
1 0.1 1 10 100
| |
1
1 5
∠ tan 45
90
31
Differentiation time constant
90
| | 1
1 45
∠ tan
5
0.1 1 10 100
Pure integration
1
| |
∠ 90° 45
90
Pure differentiation
| |
90
∠ 90°
45
Pure gain
0
32
Example 6.1: Aircraft roll‐angle control system – Bode diagram
In Sec. 3 we considered the automatic roll‐angle control system for an aircraft. The open loop transfer
function was given by:
5
1 5
We now want to plot the Bode diagram corresponding to the open loop transfer function.
To start, the transfer function factors should be expressed in the form 1 which is more
convenient for plotting Bode diagrams.
5 1
1 5 1 1 0.2
can be seen to be a cascade of 3 first order transfer functions – 2 integration time constants
and a pure integration.
1 1 1
1 jω 1 0.2 jω jω
Integrator
2 x time‐constant elements
st
20.log10 K* ωτ*
ωτ*
45
5
45
90
90
Plotting the Bode diagram by hand
The easiest way to plot the Bode magnitude diagram is as a corner plot; the corners can be rounded at
the end to give more accurate plot, if needed.
In principle, you can plot the Bode magnitude and phase diagrams for each of the of the constituent 1st
order transfer functions on one graph, then draw the plots for the overall system as a sum of these.
Notice, however, that each time constants element contributes 0db to the magnitude below its corner
frequency. We can use this to construct the magnitude plot in terms of slopes, while the 0dB line is
constructed at the end according to the gain. The phase plot is easiest to construct by evaluating a few
points of the graph. This is summarised by the following procedure:
Magnitude plot
1. Mark all corner frequencies for the transfer function on the frequency axis.
In this example they are 1 / and 5 / .
2. Draw the Bode magnitude line in the range below all corner frequencies. If the system contains no
pure integrators this line is horizontal; if it contains one pure integrator it is at a slope of
20 / .
33
In this example the low‐frequency portion of the plot is at the slope of 20 / , because
there is one pure integration.
3. Draw the subsequent line segments. At each corner frequency the slope changes by 20 /
if it corresponds to a differentiation time constant, 20 / if it is an integration time
constant.
In this example the slopes progressively change to 40 / and then to 20 / because
there are two integration time constants.
4. Construct the 0dB line.
a. If the low‐frequency segment is horizontal (no pure integrators) then the magnitude of transfer
as → 0 is 20 log .
b. If pure integration is present, the magnitude |KG jω | → ∞ as → 0. However, below all
corner frequencies the plot effectively corresponds to KG jω .
Therefore in this region |KG jω | .
0 line crosses the low frequency segment frequency K ω
In this example we assume K 1, so 0dB line crosses at ω 1 rad/s
1
1 jω 1
K
j 1 0.2 jω
20 dB
0 dB
34
0.1 1 5 10 100 1000
1
-45 1 0.2 jω
1
1 jω
-90
1
jω
-135
-180
-225
-270
Bode diagram using Matlab
Open loop transfer function:
5 5
K
jω jω 1 jω 5 6 5
To plot the Bode diagram or K=1:
Matlab comands:
num = [5];den = [1,6,5,0];plant = tf (num,den);
bode(plant)
Note:
Increasing gain by an amount K adds 20 log to all points on the magnitude plot (raises the plot)
Changing K does not affect the phase plot.
When plotting by hand, it is easier to redraw the 0 line as the gain is changed, instead of
redrawing the whole magnitude graph.
35
6.3 Stability Investigation
The above analysis is applied to the open loop transfer function, generally of the form:
dependent
x
K.G ( j)
e
Independent of e KG( j) x
For the purposes of control, we employ negative feedback. The simplest and sufficiently general for
analysis is the "unity feedback" closed loop system
u e KG ( j) x
Thus K.G ( j) is the open loop transfer function, while the closed loop transfer function is
1
1
e
u0 KG ( j) x
Fig. 6.5: Self‐sustained oscillations.
This represents the marginal stability case. In general
36
These conditions can be easily analysed using Bode diagrams, as shown in the following diagrams for an
arbitrary , open loop.
Marginally stable
| | 1 0
at for which
∠ 180°
Stable
| | 0
at for which
∠ 180°
Unstable
| | 0
at for which
∠ 180°
Fig. 6.6: Bode diagrams for an arbitrary system at various gain settings
37
6.3.2 Measures of Stability: Phase and Gain Margins
As explained above, a closed loop system is marginally stable if the gain has a value for which
there exists a frequency , such that the open loop transfer 1. Therefore
| | 0
∠ 180°
If a system is stable ( ), then the stability margins are defines as follows:
Gain Margin – additional system gain that can be introduced before the onset of instability
Phase Margin – additional phase lag that can be introduced before the onset of instability
These conditions can be readily investigated using the Bode diagrams.
0dB
0.1 1 10 100
Gain Margin
0
0.1 1 10 100
K.G ( j)
Phase Margin
180
Fig. 6.7: Definition of gain margin and phase margin
Gain and phase margins are measure of "how stable" the closed loop system is. The smaller the margins
the more oscillatory the transient behaviour. They are used as performance measures when designing
the transient response using frequency response analysis. An unstable system will have negative
stability margins.
6.3.3 2nd order system: GM, PM and Closed Loop Transient Response
It is important to remember that the Bode diagram analyses the frequency response of the open loop
system, while the design task is concerned with the performance of the unity feedback closed loop
system.
How is the open loop frequency response is related to the closed loop time response?
Transient response (stability, overshoot, rise time, settling time) is determined by the high‐
frequency part of the frequency response (gain margin, phase margin, bandwidth, 180° phase
cross‐over frequency)
Steady state errors are determined by the low‐frequency part of the frequency response (d.c. gain)
To show this we shall consider a unity feedback second order system whose open loop transfer function
in the standard form is
38
2n
G( j)
j j 2n
and the closed loop transfer function is then
G ( j) 2n
C( j)
1 G ( j) j2 2n j 2n
where ξ<1 is the damping ratio and ωn is the undamped natural frequency.
Fig. 6.8: Step response parameters
If we now consider the unit step response of the closed loop system with ξ≤1, we can define a number
of properties of interest for control design:
Rise time: time for the output to rise from 10% to 90% of the final value
no simple equation available
estimated from the time‐response plot, simulation
Time to reach first peak:
1
% Overshoot: /
% . . 100
Settling time: time for the output to settle to within 2% of final value
4
Remember also that the closed loop system will exhibit resonance if 0.707 with the following
√
properties:
Damped resonant
d n 1 2
frequency:
Resonance peak 1
magnitude: M
2
39
None of these response properties can be determined directly from the open loop frequency response.
However, they are determined by the damping ratio and the natural frequency of the system, and
these values can be related to the frequency response properties such as phase margin. The following
table and graph summarises how some of these vary with the phase margin (PM).
Response parameters for a 2nd order dynamic system.
100
ξ M % O/S PM (deg) 90
0 ∞ 100 0 80
0.1 5.0 73 12.5 70
0.2 2.5 53 25.9 60
0.3 1.7 37 38.6
PM
50
0.4 1.3 25 49.1
40
0.5 1.0 16 57.2
0.6 0.8 9 63.4 30 Slope ~100
20
0.7 0.7 5 68.0
0.8 ‐ 2 71.5 10
1.0 ‐ 0 76.3 0
Solution
Plot the Bode diagram as described above. If using Matlab, for K=1 we get the plot shown below. Note
that GM and PM are automatically calculated and displayed.
40
(a) From the Bode Diagram, phase is 180° at frequency 2.2 / and the corresponding
magnitude at that frequency is −15.6dB. Therefore gain margin is GM=15.6 dB (as displayed by
Matlab).
(b) Maximum gain for stability is the additional 15.6dB = 20log10(K). Therefore Kmax=6.03.
(c) From the table given above, damping ratio ξ=1 corresponds to Phase Margin ≈76°.
Figure below illustrates how a new 0dB may be constructed by hand, corresponding to gain being
reduced from K=1 (0dB) by 12 . Thus the required gain is:
20log K 12dB
0.25
Note
To confirm this gain value, we can look at the low‐frequency portion of the magnitude diagram. This
corresponds to a pure integration transfer function and is a line at a slope 20 / . It crosses
the newly constructed 0 line at frequency 0 1, i.e. 0.25 /
41
The graphs below the closed loop system output and error signals following a unit step input, for
different gain settings
K=1 K = 0.25
42
7 Compensation
Fig. 7.1: Controller augments the open loop transfer function, modifies the error signal.
Compensation involves incorporating a controller, which is a signal filter (low‐pass, high‐pass, etc...) in
the open loop transfer function, in order to modify (hopefully improve) the overall response
characteristic. Compensation is generally introduced to improve:
a) Transient response
- reduce overshoot (increased damping, stability margins)
- increase speed of response (increased natural frequency)
b) Steady state response
- reduce of steady state errors (step, ramp)
- reduce sensitivity to disturbance (external loads)
In analogue control systems compensation is almost always implemented as an electronic filter circuit.
In its simplest form it may be a passive filter (consisting of only resistors, capacitors). However, passive
filters can only provide attenuation of signals. An active filter can be constructed using op‐amps and it
can also amplify signals, but it is more complex, requires power supply etc. Finally, in digital control
systems, compensation is implemented in the form of a software algorithm running on the control
computer.
What precisely do we want the compensation to achieve? The answer to this question can be
formulated from different points of view, such as re‐shaping of the Bode diagram, re‐shaping of the
root locus, or by looking at the time‐signals. We shall briefly cover all of these viewpoints.
43
Fig. 7.2: The effect of a high‐pass filter with amplification. The compensated system has larger stability margins (GM and PM)
An alternative compensation strategy is shown in Fig. 7.3. In this case we focus on the Bode magnitude
plot and use a low‐pass filter with amplification to increase the low frequency magnitude. This has the
effect of reducing the steady state errors. However, low‐pass filter also introduces a negative phase
shift that can make the overall system highly oscillatory, so it has to be applied with caution.
Fig. 7.3: The effect of a low‐pass filter with amplification. Increased low frequency gain will result in smaller steady state
errors
From the frequency response point of view it is important to remember that:
a) Transient response is controlled by the high frequency characteristic
- higher stability margins (GM, PM) mean less oscillations, higher damping ratio
- higher crossover frequency means wider bandwidth, faster response
b) Steady state response is controlled by the low frequency characteristic
- higher DC gain means smaller steady state errors and better disturbance rejection
44
below indicates, this controller provides the control signal as a combination of three components:
error‐proportional, integral‐of‐error and derivative‐of‐error.
Control External
signal Load
KDs
Error
+ - System
+ KP Amp
- + + + G( s )
KI
s
Fig. 7.4: PID control
Because of the need to perform integration and differentiation, PID controller can only be implemented
as an active filter, using op‐amps.
Fig. 7.5: PID controller implementation using op‐amps
The controller transfer function can be expressed as:
Or 1
where: TI = integration time constant
TD = differentiation time constant
The graphs below illustrate the relative roles and effects of the tree constituent signals during a typical
step response:
Error‐proportional term (P) provides a signal with the sign that always drives the system
towards the target position.
Derivative‐of‐error term (D) gives an initially large push towards the target position, but as the
error reduces it becomes negative, effectively ‘applying the brakes’
- Increases speed of response
- reduces overshoot.
Integral‐of‐error term (I) raises the system class by introducing a free integrator in the forward
loop path, which can hold a steady output after the error has reduced to zero
- eliminate or reduces the steady state errors
- also increases the overshhot
45
Output Position
Positional Error
Derivative of error
Integral of error
t
Fig. 7.6: PID control system signals during step response
G PD
j
Kp
Kp
Kd
90 KP
s
KD
0
Compensation poles and zeros in the s‐plane
Bode diagram
46
It can be seen that PD controller acts as a high‐pass filter, providing a differentiation time constant with
corner frequency . As such it provides a positive phase shift for frequencies above ,
therefore increases the overall system Phase Margin and make it less oscillatory.
G PI
Kp
KI
Kp
0 KI
s
KP
90
Compensation poles and zeros in the s‐plane
Bode diagram
GPID
90
0
90 Compensation poles and zeros in the s‐plane
Bode diagram
PID controller aims to provide an optimal compromise between PD and PI control, i.e. well‐damped,
high‐bandwidth transient response and small steady state errors. However, there are 3 parameters to
47
set and finding the optimum settings is often an iterative process. At each iteration, the designer will
typically analyse the Root Locus, Bode diagrams and simulations such as step response. An interactive
tool such as Matlab is clearly useful in such task.
PI control K = 0.45 Kc
TI = 0.833 T
PID control K = 0.6 Kc
TI = 0.5 T
Td = 0.125 T
7.3.4.2 Ziegler‐Nichols Second Approach – non‐oscillatory systems
This approach is intended for the systems which do not exhibit oscillatory behaviour and possibly
possess significant response delay. This is typical for process plants with large inertias (e.g. temperature
control for a boiler or room heating). The specified procedure is as follows.
48
Output
R
t
L
(1) Generate a step response for the open loop plant. Typically, the shape of response will be as
that shown on the graph.
(2) Measure the slope of the response R and the time lag L. Note that the slope should pass
through the response’s point of inflection and is therefore the maximum possible slope.
(3) The recommended initial controller settings are given by:
P control K = 1 / (RL)
PI control K = 0.9 / (RL)
Ti = 3.3 L
PID control K = 1.2 / (RL)
Ti = 2 L
Td = 0.5 L
49
System Equations
The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is
related to the rotational velocity by the following equations:
In SI units (which we will use), Kt (armature constant) is equal to Ke (motor constant).
From the figure above we can write the following equations based on Newton's law combined with
Kirchhoff's law:
moment of inertia of the rotor (J) = 3.2284E‐6 kg.m2/s2
damping ratio of the mechanical system (b) = 3.5077E‐6 Nms
electromotive force constant (K=Ke=Kt) = 0.0274 Nm/Amp
electric resistance (R) = 4 ohm
electric inductance (L) = 2.75E‐6 H
input (V): Source Voltage
output (theta): position of shaft
The rotor and shaft are assumed to be rigid
Transfer Function
Using Laplace Transforms the above equations can be expressed in terms of s.
Θ
Θ
By eliminating I(s) we can get the following transfer function, where the rotating speed is the output
and the voltage is an input.
However during this example we will be looking at the position, as being the output. We can obtain the
position by integrating , therefore we just need to divide the transfer function by s.
Design requirements
We will want to be able to position the motor very precisely, thus the steady‐state error of the motor
position should be zero. We will also want the steady‐state error due to a disturbance, to be zero as
well. The other performance requirement is that the motor reaches its final position very quickly. In this
case, we want it to have a settling time of 40ms. We also want to have an overshoot smaller than 16%.
If we simulate the reference input (R) by a unit step input, then the motor speed output should have:
Settling time less than 40 milliseconds
Overshoot less than 16%
No steady‐state error
No steady‐state error due to a disturbance
50
Transfer Function
We can put the transfer function into MATLAB by defining the numerator and denominator as vectors:
Create a new m‐file and enter the following commands:
J=3.2284E‐6;
b=3.5077E‐6;
K=0.0274;
R=4;
L=2.75E‐6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
motor=tf(num,den);
Now let's see how the original open‐loop system performs. Add the following command onto the end of
the m‐file and run it in the MATLAB command window:
step(motor,0:0.001:0.2)
You should get the plot below, showing the motor reaching constant speed with constant voltage
applied:
Proportional control
Let's first try using a proportional controller with a gain of KP=1.7.
To determine the closed‐loop transfer function, we use the feedback command.
Add the following line to your m‐file:
Kp=1.7;
contr=Kp;
sys_cl=feedback(contr*motor,1);
Response to step input R, D=0
Add the following to the end of your m‐file, and run it in the command window:
t=0:0.001:0.2;
step(sys_cl,t)
You should get the following plot:
51
Response to step disturbance D
This requires us to rearrange the closed loop system as shown below, assuming R=0.
Add the following to the end of your m‐file, and run it in the command window:
dist_cl=feedback(motor,contr);
step(dist_cl,t)
You should get the following plot:
From the plots above we see that
the steady‐state error looks good
the settling time,
the overshoot is too large.
the steady‐state error due to a disturbance is large.
PID control
Recall that
adding an integral term will eliminate the steady‐state error and
a derivative term will reduce the overshoot.
Let's first try a PI controller to get rid of the disturbance steady state error. Try and Kp=1.7 (as before)
and introduce Ki =20.
1.7 20
Change your m‐file so it looks like:
J=3.2284E‐6;
b=3.5077E‐6;
K=0.0274;
R=4;
L=2.75E‐6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
motor=tf(num,den);
Kp=1.7;
Ki=20;
contr=tf([Kp Ki],[1 0]);
sys_cl=feedback(contr*motor,1);
t=0:0.001:0.4;
step(sys_cl,t)
52
Again to plot the step response to disturbance D add the following to your m‐file:
figure
dist_cl=feedback(motor,contr);
step(dist_cl,t)
Following the above, you should get the following step responses:
Evidently, PI control has reduced the steady state error to zero.
Note the zero introduced by PI is still at 11.8, but the loop gain has increased 10 , so:
.
the response is faster than before,
the overshoot has worsened (large).
Let's now try adding a derivative term to reduce the overshoot.
200
17 0.15
Go back to the m‐file and make the following changes to look at the step response.
Kp=17;
Ki=200;
Kd=0.15;
contr=tf([Kd Kp Ki],[1 0]);
sys_cl=feedback(contr*motor,1);
t=0:0.001:0.1;
step(sys_cl,t)
You should get the following plots:
53
We can see:
step response looks really good ‐ less than 16% overshoot, settling time is roughly 40ms,
no steady‐state error.
However the step disturbance response is now really slow (D‐term ‘applies the brakes’ as the
system approaches the target).
Remember that D‐term ‘applies the brakes’ as the system approaches the target. In that sense it
opposes the I‐term which aims to eliminate the steady state error.
Let us increase Ki to speed up the disturbance response. Change Ki to 600 in your m‐file and rerun the
file. You should get the following plots:
We can see that
step response has a settling time of roughly 40ms, it has less than 16% overshoot,
no steady state error.
step disturbance response also has no steady state error, settles to within 2% in 40 ms.
So all of our design requirements will be satisfied if we use a PID controller with Kp=17, Ki=600, Kd=0.15
54
7.4.3 PID Controller Design Using Root Locus
Here we shall repeat the PID controller design for the electric motor position control, this time using
the Root Locus as the analysis. This should demonstrate how Root Locus method provides a much
better insight into the problem than simulation alone.
As before, the transfer function is:
Create a new m‐file and type in the following commands (refer to main problem for the details of
getting those commands).
J=3.2284E‐6;
b=3.5077E‐6;
K=0.0274;
R=4;
L=2.75E‐6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
motor=tf(num,den);
Design requirements
Settling time less than 40 milliseconds
Overshoot less than 16%
No steady‐state error
No steady‐state error due to a disturbance
The settling time of 40 ms means that the closed loop natural modes decay according to 2%
Hence
0.04 log 0.02 3.91
100
The overshoot requirement <16% implies damping ratio 0.5. It can be shown that in the s‐plane the
lines of constant are straight lines through the origin at an angle sin relative to the ‐axis
The corresponding regions of the s‐plane are indicated below.
j j
Drawing the root locus
The main idea of root locus design is to find the closed‐loop response from the open‐loop root locus
plot. Then by adding zeros and/or poles to the original plant, the closed‐loop response will be modified.
Let's first view the root locus for the plant. Add the following commands at the end of your m‐file.
rlocus(motor)
sgrid(.5,0) %plots lines of constant damping ratio (radial through origin)
sigrid(100) %plots lines of constant in (vertical)
55
Matlab Note: The commands sgrid and sigrid are functions.
Sgrid is a function in the control systems tool box, but sigrid is not. You need to copy the sigrid.m
file to your directory. ( provided in the Carnegie‐Mellon tutorial on the cluster)
The variable in the sgrid command are the damping ratio ( 0.5 corresponds to an overshoot of
16%), and the term (no rise time criteria) respectively. The variable in the sigrid command is the
sigma term (4/0.04 seconds = 100). Run the above m‐file and you should get the root locus plot below:
If you look at the axis scales on this plot, one open‐loop pole is very far to the left (further than ‐
1x10^6). This pole does not affect the closed loop dynamics unless very large gains are used, where the
system becomes unstable. We will ignore this pole by doing a model reduction.
Model Reduction
One way of simplifying the model is to notice that L is very small and L/R that determins the
corresponding pole position is even smaller. Thus simply setting L=0 will reduce the model to 2nd order.
However, the correct general way to neglect these poles, keeping the DC gain of the transfer function
constant, is as follows:
≪
1
Let's see what the poles of the original transfer function are. Enter the following command at the
MATLAB prompt:
roots(den)
You should see the following output:
ans =
1.0e+06 *
0
‐1.4545
‐0.0001
We want to neglect the pole at ‐1.45e6. This can be translated into MATLAB code as:
J=3.2284E‐6;
b=3.5077E‐6;
K=0.0274;
R=4;
L=2.75E‐6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
poles=roots(den);
den2=deconv(den,[1/max(abs(poles)) 1]);%deconvolution, polynomial division
motor=tf(num,den2);
You can now check that the other poles have not been affected by entering
roots(den2)
at the MATLAB prompt.
56
Now we can draw the root locus of the reduced system. Add the following commands to the end of
your m‐file and re‐run it.
rlocus(motor)
sgrid(.5,0)
sigrid(100)
You should obtain the following plot in which you can see that the closed‐loop system will be stable for
small gains.
We can see from this plot that the closed‐loop poles are never fast enough to meet the settling time
requirement (that is, they never move to the left of the sigma=100 vertical line). Also, recall that we
need an integrator in the controller (not just in the system) to remove steady‐state error due to a
disturbance.
Integral Control
Now, let's try using integral control to remove steady‐state error to a disturbance. Note that this adds a
1/s term to the forward loop. Modify your m‐file so it looks like:
J=3.2284E‐6;
b=3.5077E‐6;
K=0.0274;
R=4;
L=2.75E‐6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
poles=roots(den);
den2=deconv(den,[1/max(abs(poles)) 1]);
motor=tf(num,den2);
contr=tf(1,[1 0]);
rlocus(contr*motor)
sgrid(.5,0)
sigrid(100)
Run this m‐file and you will obtain the following plot.
57
From this root locus we can see that the closed‐loop system under integral control is never stable, and
another controller must be used.
PI Control
Now, let's modify the integral controller to a PI controller. Using PI instead of I control adds a zero to
the open‐loop system. We'll place this zero at 20. The zero must lie between the open‐loop poles
of the system in this case so that the closed‐loop will be stable.
i.e.
20
Change the lines defining the controller (numcf and dencf) in your m‐file to the following.
contr=tf([1 20],[1 0]);
Re‐run your m‐file and obtain the following plot.
Note: You may not get a similar plot in your MATLAB window, depending on which version of the rlocus command you are
using. If the MATLAB output does not satisfy the rules of the root locus, or does not match your expectations, you
can always specify which gains you would like MATLAB to plot. For this particular root locus, the following commands
(replacing the rlocus command above) work well.
gain = 0:0.1:20;
rlocus(contr*motor,gain)
Now, we have managed to stabilize the system with zero steady‐state error to a disturbance, but the
system will still not be fast enough.
58
PID Control
In order to pull the root locus further to the left, to make it faster, we need to place a second open‐loop
zero, resulting in a PID controller.
After some experimentation, we can place the two PID zeros at 60 and 70
i.e.
60 70 130 4200
Change the lines defining the controller in your m‐file to the following.
numc=conv([1 60],[1 70]);
denc=[1 0];
contr=tf(numc,denc);
Re‐run your m‐file and obtain the following plot.
Now, we can see
two of the closed‐loop poles loop are well within both the settling time and percent overshoot
requirements.
The third closed loop pole moves from the open‐loop pole at 59.2 to the open loop zero
at 60. This closed‐loop pole nearly cancels with the zero because it is so close. Therefore,
we can ignore its effect.
However, the other open‐loop zero can be seen to pull the root locus branches back to the real
axis. Somewhat surprisingly, this has the effect that increasing gain will also increase the
damping and for high gains the system will be overdamped.
Finding the gain using the rlocfind command
If you recall, we need the settling time and the overshoot to be as small as possible, particularly
because of the effect of the extra zero. Large damping corresponds to points on the root locus near the
real axis. A fast response corresponds to points on the root locus far to the left of the imaginary axis.
To find the gain corresponding to a point on the root locus, we can use the rlocfind command. We can
find the gain and plot the step response using this gain all at once. To do this, enter the following
commands at the end of your m‐file and rerun it.
[k,poles] = rlocfind(contr*motor)
sys_cl=feedback(k*contr*motor,1);
t=0:0.001:.1;
step(sys_cl,t)
Go to the plot and select a point on the root locus on left side of the loop, close to the real axis as
shown below with the small + marks. This will ensure that the response will be as fast as possible with
59
as little overshoot as possible. These pole locations would indicate that the response would have
almost no overshoot, but you must remember that the zero will add some overshoot.
After doing this, you should see the following output in the MATLAB command window.
selected_point = ‐1.3943e+02+ 1.8502e+01i
k = 0.1309
poles =
1.0e+06 *
Note that the values returned in your MATLAB command window may not be exactly the same, but
should at least have the same order of magnitude. You should also get the following step response plot:
As you can see, the system has an overshoot of approximately 15%, a settling time of approximately
0.04 seconds, and no steady‐state error.
Let's now look at the disturbance response by computing the closed‐loop disturbance transfer function
and plotting its step response. Add the following lines to your m‐file:
dist_cl=feedback(motor,k*contr);
step(dist_cl,t)
Re‐run your m‐file, selecting the same point on the root locus, and you will get the following plot.
60
You can see that the response to a step disturbance reaches a steady‐state value of zero, and in fact,
stays within 0.02 (or 2%) after 0.04 seconds. Therefore, all the design requirements have been met.
The final form of the PID controller is therefore
60 70 0.13 16.9 546
0.13
The controller gains are Kp=16.9, Ki=546, Kd=0.13. These are very close to the ones derived through
simulation, but the root locus method involves much less trial‐and‐error iterations.
61