You are on page 1of 125

For Chapter 6:

Numerical Simulation of Dynamic Systems


• Videos Lectures by Dr. Abid Imran FME
https://drive.google.com/file/d/1nqRAhDBF-DUxb0BnQoLP
RtEbchr6wTVY/view?usp=sharing

• Download and watch the video and discuss in class if


there is any difficulty
Chapter 10: Introduction to Control Systems

• So far our major topics have been:


– Modeling physical dynamic systems (obtain ODEs)
– Determine the system response to a known input

• Now we introduce feedback control systems


– The system input depends on the system output (via feedback)
– The “controller” (algorithm) can shape the system input in order to improve the system
response (i.e., add damping, reduce settling time…)

• We will present an introduction to feedback control systems


10.2 Feedback Control Systems
• Consider the solenoid actuator and spool valve (below) which is an open-loop system (input does NOT
depend on output)

• Suppose we want valve position to be yss = 3 mm (0.003 m)

• The DC gain of the system is (12)/(1.5 x 7000) = 0.001143 m/V, hence a step voltage ein = 2.625 V will
produce the desired steady-state position IF we have a perfect model of the solenoid-valve

• What if the model is NOT exact? How can we adjust input voltage?
Closed-Loop Feedback Control System

• A basic block diagram for a general closed-loop, feedback control system is shown below:

Plant
disturbance
Reference Control System
command + error input output
Controller Plant
-

Feedback
Sensor
Feedback Control System (2)
Plant
disturbance
Reference Control System
command + error input output
Controller Plant
-

Feedback
Sensor

Plant: physical system to be controlled, usually represented by a model (TF or SSR)


Examples: robot, aircraft, liquid-level system, room temp, automobile, etc.

Sensor: the physical measuring device (allows feedback); modeled by TF or SSR


Examples: gyroscope, accelerometer, LVDT, thermocouple, tachometer, etc.

Controller: control logic or rules + actuating system; often modeled by TF or SSR


Examples: digital control logic, PID control, servo, throttle, valve, etc.
Examples of Feedback Control Systems

• Position control of an industrial robot

• Cruise control for an automobile

• Airplane autopilot (flight-path control)

• Motion of a remote vehicle

• Room temperature control (thermostat)

• Chemical processing plants


Performance Requirements of Control Systems

• Stability margins:

– The closed-loop system must demonstrate stable operation where the system output

remains bounded for all bounded reference commands

• Speed of response:

– For example, the control system must quickly respond to a new reference command

• Good damping characteristics:

– For example, a good controller design for a cruise-control system should result in very low

overshoot as the automobile’s actual speed approaches the desired reference speed
Performance Requirements of Control Systems (2)

• Little or no steady-state error (tracking):

– For example, a good cruise-control design would produce very small velocity error (good “tracking”)

at steady state

• Disturbance rejection:

– The closed-loop system should compensate for disturbance inputs and demonstrate

adequate performance (i.e., good response speed, tracking, etc.)


Control System Transfer Functions
• Consider the basic closed-loop feedback control system

Forward transfer function: G ( s )  GC ( s )GP ( s )


Feedback transfer function: H(s)
Open-loop transfer function: G( s) H ( s)
Control System Transfer Functions (2)
• The controller and plant transfer functions are combined into the forward TF G(s),
and the sensor TF is H(s).

Controller + Plant

• Closed-loop TF: relates input R(s) to output Y(s) (derived on board)

G ( s) Closed-loop transfer function


T (s) 
1  G ( s) H (s) (CLTF)
Closed-Loop Transfer Function

(a)

(b)

We can replace system (a) with the CLTF T(s) shown in system (b)

Therefore, the closed-loop response is determined by the poles of the CLTF


Closed-Loop TF (2)
• Once we have the closed-loop TF (CLTF), we can analyze the system response using methods
we have developed to date (identify pole locations, steady-state value, damping ratio, etc.)

• Stability is determined by the location of the closed-loop poles or roots of T(s)

R(s) Y(s)
T(s)
CLTF
• MATLAB computation of the CLTF:
>> sysG = tf(numG,denG) % build forward TF G(s)
>> sysH = tf(numH,denH) % build sensor TF H(s)
>> sysT = feedback(sysG,sysH) % compute CLTF
Closed-Loop TF (3)

• We can analyze the stability and closed-loop response using sysT and the MATLAB
commands damp.m, roots.m, step.m, impulse.m, lsim.m, etc.

• MATLAB closed-loop unit-step response (example)


>> sysG = tf(numG,denG) % build plant TF G(s)
>> sysH = tf(numH,denH) % build sensor TF H(s)
>> sysT = feedback(sysG,sysH) % CLTF T(s)
>> [y,t] = step(sysT) % closed-loop response

• We can also build closed-loop simulations in Simulink using the TF icons and connecting the
various blocks with signal path
DC Motor CLTF: Example 10.1

Faraday’s law of induction

Derive the CLTF that relates motor output (angular velocity) to input voltage
Km
Forward TF: G( s) 
( Ls  R)( Js  b)

Feedback “TF”: H(s) = Kb


Example 10.1 (2)
Km
G (s) 
( Ls  R)( Js  b)

H(s) = Kb

Closed-loop TF:
Km
G ( s) ( Ls  R )( Js  b) Km
T (s)   
1  G(s) H (s) K m Kb ( Ls  R )( Js  b)  K m K b
1
( Ls  R)( Js  b)
Example 10.1 (3)

Km
Closed-loop TF: T ( s) 
( Ls  R )( Js  b)  K m K b
10.3 Feedback Controllers

• Controller ~ turn feedback information into a control signal command


• How do we design the “controller” transfer function shown in our general feedback system?
• Several “standard” controllers:
– On-off (or relay) controllers
– Proportional (P) controllers
– Proportional-plus-integral (PI) controllers

– Proportional-plus-derivative (PD) controllers


– Proportional-plus-integral-plus-derivative (PID) controllers
– Lead/lag controllers
On-Off (Relay) Controller
• Two-position controllers are simple devices that require an on-off switching action in order
to activate the control effort

M1 e(t )  0
u (t )   e(t) is the feedback error signal
M 2 e(t )  0

• Examples
– Solenoid-controlled valve for liquid-level system via float switch
– Furnace and thermocouple relay switch

• Note that on-off controllers are nonlinear devices, and that we cannot compute the
analytic CLTF or use any linear analysis tools with nonlinear components
– We must resort to numerical simulations (i.e., Simulink)
On-Off Controller: Example 10.4

“Buck converter”

Convert higher
input voltage to
lower output
voltage eC

 1 /( RC ) 1 / C   0 
SSR with x1 = eC and x2 = IL x    x  u
  1/ L 0  1 / L 

ein if eref  eC  0 where eref = 12 V


Control: u (t )  
0 if eref  eC  0
 We want eC = eref at S-S
On-Off Controller: Example 10.4 (2)

C?

ein if eref  eC  0
Control: u (t )   where eref = 12 V
0 if eref  eC  0
On-Off Controller: Example 10.4 (3)
Upper = 28
Lower = 0

Detailed Simulink Model

ein if eref  eC  0
Control: u (t )   where eref = 12 V
0 if eref  eC  0
On-Off Controller: Example 10.4 (4)

Capacitor voltage (output) vs time: meets 12-V reference


On-Off Controller: Example 10.4 (5)

LI L  u  ec

For Position 1
u  ec 28  12
u  28; I L    0.89; Slop
L 18
For Position 2

u  0; ec  12V ; IL  12 / 18  0.67; Slop


PID Controllers

• It has been estimated that 70-80% of industrial controllers use a Proportional-Integral-


Derivative (PID) scheme (e.g., motion control, hydraulic control systems, chemical
processing plants, and guidance and control of aerospace vehicles )

• We will show examples of P, PI, PD, and PID controllers and discuss the advantages that
each signal contributes to improving the closed-loop response

• A Proportional-Integral-Derivative (PID) controller includes three terms in the control signal


with 3 independent gains:

u (t )  K P e(t )  K I  e(t )dt  K D e (t )

where KP is the proportional gain , KI is the integral gain, and KD is the derivative gain
PID Controllers (2)
• Proportional control term, K P e(t )

– The control signal is proportional to the instantaneous error. Increasing the P-gain KP will tend
to speed up the system response. The proportional control term has diminished effect as the
feedback error goes to zero

• Integral control term, K I  e(t )dt


– The control signal is proportional to the summation (integral) of all past error signals and
therefore the integral control term will be non-zero even when the feedback error goes to zero.
For this reason, integral control is used to reduce the steady-state tracking error

• Derivative control term, K D e (t )


– The control signal is proportional to the instantaneous derivative of the error signal. Hence the
derivative control signal “anticipates” the system response. In general, increasing the D-gain
KD reduces overshoot and adds damping to the closed-loop system
PID Controllers (3)

u (t )  K P e(t )  K I  e(t )dt  K D e (t ) PID control logic


PID Controllers (4)
u (t )  K P e(t )  K I  e(t )dt  K D e (t ) PID control logic

E ( s)
U (s)  K P E (s)  K I  K D sE ( s ) Taking Laplace transforms…
s

KPs  KI  KDs2 PID transfer function


GC ( s ) 
s
Motor Speed Control: Example 10.5

• DC motor model: we have neglected the RL circuit dynamics since they are very fast (DC motor
TF only depends on inertia and friction)

• We have a “unity feedback” system where H(s) = 1

• Note that signals at the summing junction must have the same units (rad/s)

• Before microprocessors we would use a tachometer to convert angular velocity to a voltage


signal amplifier gain same speed-to-voltage conversion…these “gains” are neglected in the
closed-loop system shown above (hence unity-feedback systems can be assumed)
P-Controller: Example 10.5 (2)

For any controller, the closed-loop transfer function (CLTF) is


G(s) GC ( s )GP ( s )
T ( s)  
1  G ( s ) 1  GC ( s )GP ( s )

First, let’s consider a Proportional (P) Controller, GC(s) = KP


400
KP
s  20.4  400K P
CLTF: T ( s) 
400 s  20.4  400K P
1 KP
s  20.4
P-Controller: Example 10.5 (3)

If the reference speed input ref is a step input, then we can use the
DC gain of the CLTF to obtain the steady-state speed response:

400 K P
T ( s  0)  DC gain of CLTF
20.4  400 K P

400 K P
S-S motor velocity: ss  ref
20.4  400 K P

Therefore, if P-gain KP = 0.5 V-s/rad, then the DC gain is 200/220.4 = 0.9074

and the S-S velocity is 90.7% of the commanded reference speed.

 Increasing the P-gain improves the S-S error or “S-S tracking”


P-Controller: Example 10.5 (4)

Furthermore, increasing the P-gain reduces the CLTF time constant:

400 K P
T ( s)  CLTF
s  20.4  400 K P

1
 Time constant of the 1 -order system is  
st
20.4  400 K P

Using KP = 0.5 V-s/rad, the time constant is  = 0.0045 sec and


the settling time is 0.018 sec.
P-Controller: Example 10.5 (5)

Steady-state
errors

P-controller can
never drive error
to zero (for DC motor)

Reference speed = 50 rad/s (step) Large P-gain  Large initial input voltage
PI-Controller: Example 10.5 (6)
We need a control signal that remains even if the speed error goes to zero

Solution: use Proportional + Integral (PI) control:

KI KPs  KI
GC ( s )  K P   PI controller TF
s s
With PI control, the closed-loop transfer function (CLTF) becomes

 K P s  K I  400 
  
 s  s  20.4  400( K P s  K I )
T (s)   2
 K s  K I  400  s  (20.4  400 K P ) s  400 K I
1  P  
 s  s  20.4 
PI-Controller: Example 10.5 (7)
CLTF using PI controller (repeated):

400( K P s  K I )
T ( s)  2
s  (20.4  400 K P ) s  400 K I

Note that the DC gain of the CLTF is unity for any gain KI

If we select P-gain KP = 1 V-s/rad, the denominator of the CLTF is

s 2  420.4s  400 K I  0 (determines closed-loop roots)

If I-gain KI is “too large” closed-loop roots are complex and lightly damped

If I-gain KI is “too small” closed-loop roots are real and small (“slow”)
PI-Controller: Example 10.5 (8)

All values of I-gains KI lead to zero S-S error

Increasing the P-gain  reduces closed-loop settling time

However, we cannot over-gain the system: too much control! (saturation)

Adding integral control has slightly slowed down the response


Position Control: Example 10.6

Mechanical system position control of a machine tool in a manufacturing process

Investigate and compare the use of proportional (P) and


proportional-derivative (PD) controllers for a reference step
position command xref(t) = 0.1 m

For any controller, the CLTF is


G ( s) K AGC ( s )GP ( s )
T (s)  ; G ( s )  Gc ( s) K AG p ( s) T (s) 
1  G(s) 1  K AGC ( s )GP ( s)
P-Controller: Example 10.6 (2)

Sub KA = 2 N/V, use a P-controller GC(s) = KP , and sub plant


transfer function GP(s)
2K P
s 2
 0. 3s 2K P CLTF with P-controller
T (s)   2
2K P s  0.3s  2 K P
1 2
s  0.3s
Note: DC gain = 1 for ANY gain KP
 Perfect tracking at steady state
P-Controller: Example 10.6 (3)

2K P
T (s)  2 CLTF with P-controller
s  0.3s  2 K P
2n  n2

However, increasing the P-controller gain KP increases the natural


frequency n and decreases the damping ratio  (more overshoot)

If we use “small” gains for KP then the closed-loop poles are real
and we have a very slow transient response

Closed-loop responses with various P-gains is shown on the


next slide…
P-Controller: Example 10.6 (4)

Same settling
time regardless
of gain KP
(if underdamped)

Increasing P-gain KP increases the frequency and the overshoot


PD-Controller: Example 10.6 (5)

• A proportional-derivative (PD) controller is needed to add damping to the closed-loop


system and improve the transient response

GC ( s )  K P  K D s PD controller (2 gains)

• Closed-loop TF for any PD controller

2( K P  K D s )
s 2
 0.3 s 2( K P  K D s )
T (s)  
2( K P  K D s ) s 2  (0.3  2 K D ) s  2 K P
1
s 2  0.3s
PD-Controller: Example 10.6 (6)

• Now we can independently adjust the 1st- and zeroth-order terms in the CLTF
using the two free gains KP and KD

2( K P  K D s)
T (s) 
s 2  (0.3  2 K D ) s  2 K P

2n n2

• Let’s choose gains KP = 16 V/m and KD = 4 V-s/m

• The closed-loop response with PD control is on the next slide…


PD-Controller: Example 10.6 (7)

Low overshoot
(good damping)
Fast response
Zero S-S error

PD controller gains
KP = 16 V/m
KD = 4 V-s/m
Ziegler-Nichols PID Tuning Rules

• Ziegler and Nichols (1940s) developed two “rules” for “tuning” or selecting the 3
PID gains KP , KI , and KD

• Method 1: “reaction-curve” or “S-curve” method


– Many physical systems show an “S-shaped” response to an open-loop step input
– The S-shaped response can be obtained via experiment (next slide)

• Method 2: “ultimate gain” method


– Continue to increase forward-path gain until oscillations are present in the closed-loop system
step response (“marginal stability”)
S-Curve Method

Run open-loop experiment and record slope R and delay time Td


S-Curve Method (2)

P, PI, and PID gains are simply computed from slope R and delay time Td

These gains are good starting points for further “tweaking”


Ultimate-Gain Method
Run closed-loop experiments (or simulations) and continually increase the proportional gain
KP until sustained oscillations are observed (below)

2K P
T (s)  2
s  0.3s  2 K P

2( K P  K D s )
T (s)  2
s  (0.3  2 K D ) s  2 K P
Ultimate-Gain Method (2)

Record “ultimate gain” KU and oscillation period PU

Again, these rules establish “ball-park” values for PID gains….


 General Considerations
• Ziegler–Nichols tuning rules allow the control engineer to obtain a good starting point for selecting the PID
gains
• The final PID design may be obtained by further experimental or simulation trials with adjustments in a
particular gain in order to improve a facet of the transient response (e.g., the derivative gain could be
increased to further reduce overshoot if necessary).

 A word of Caution!
• Some systems (plants) will not exhibit an S-shaped reaction curve to a step input or sustained oscillations
with a high-gain P-controller. Consequently, the Ziegler–Nichols tuning rules may not necessarily apply to
a particular plant.
10.4 Steady-State Accuracy
• We will present a systematic method for computing steady-state errors between the input
and output signals (“tracking error”)

• To begin, consider a simple closed-loop control system with unity feedback:

R(s) + E(s)
Y(s)
G(s)
- Controller + Plant

Y (s) G(s)
The closed-loop transfer function (CLTF) is T ( s)  
R( s) 1  G ( s)
Steady-State Tracking Error
• The tracking error is E(s) = R(s) – Y(s)

• We can find the TF relating tracking error to the input by dividing tracking error
by R(s)

E (s) Y ( s) 1  G (s) G ( s) 1
 1  1  T (s)   
R( s) R( s) 1  G (s) 1  G( s) 1  G ( s)

R(s) + E(s) Y(s)


G(s)
- Controller + Plant
Steady-State Tracking Error (2)
1
• Therefore, the tracking error is E ( s)  R( s)
1  G ( s)

• We can compute the steady-state tracking error by using the final-value theorem
(FVT) from Laplace transform theory

sR( s )
ess  lim e(t )  lim sE ( s )  lim
t  s 0 s 0 1  G ( s )

• Hence S-S error depends on depends on (1) the nature of the input, R(s), and (2) the
forward transfer function G(s)
System Type
• System type is a designation for the forward TF and is useful in characterizing the steady-
state tracking error.

• As a purely notational convenience, let the forward TF be written as

F ( s)
G( s) 
s N Q( s)

where F(s) or Q(s) does not contain a zero at s = 0

Therefore, N is the number of “pure integrators” (1/s terms) that


can be “split off” from the forward TF G(s)

System Type is the number of characteristics roots/poles of the forward TF at the origin
System Type (Example #1)
• Let the forward TF be

6s  2  F ( s)
G( s)  
s 2  18s  80 s N Q ( s )

 N = 0 (no pure integrators)

• Therefore, this system is said to be “type 0”


System Type (Example #2)
• Let the forward TF be

4s  12 4( s  12) F ( s)


G(s)  2   N
s  2s s ( s  2) s Q ( s )

 N = 1 (one integrator)

• Therefore, this system is said to be “type 1”


Steady-State Accuracy: Step Input
• Now, let’s compute the steady-state (S-S) error for various standard input functions.

• Unit-step input: r(t) = 1  R(s) = 1/s (Laplace transform of step function)

• Therefore, the S-S tracking error for a unit step is

sR ( s ) s (1 / s ) 1
ess  lim ess  lim  
s 0 1  G ( s ) s 0 1  G ( s ) 1  K sp

where Ksp = “static position error constant”


= DC gain of forward TF, G(s = 0)
S-S Accuracy: Step Input (2)
• Now, observe the system type for G(s)

s (1 / s ) 1
ess  lim 
s 0 1  G ( s ) 1  K sp

• If N = 0 (type 0 system, no pole at s = 0), the DC gain of G(s) is finite, and therefore Ksp is finite, and a

finite S-S error exists. We can reduce the S-S tracking error by increasing Ksp , that is, increasing the
DC gain of the forward loop

• If N > 1 (type 1 system or higher), computing the DC gain G(s = 0) results in dividing by zero and Ksp =
∞,, steady-state error for a unit-step input is e(∞) = 1 ∕ ∞ = 0(perfect tracking at steady state)
• A single “free integrator” may reside naturally in the plant transfer function GP(s), OR it can be
inserted into the forward path by using a PI or PID controller.
S-S Accuracy: Ramp Input
• Unit-ramp input (more demanding): r(t) = t  R(s) = 1/s2 (Laplace transform of unit-ramp function)

• Therefore, the S-S tracking error is

sR ( s ) s (1 / s 2 ) 1/ s 1 1
ess  lim ess  lim  lim  lim 
s 0 1  G ( s ) s 0 1  G ( s ) s 0 1  G ( s ) s 0 s  sG ( s ) K sv

where Ksv = “static velocity error constant”  lim sG ( s )


s0
S-S Accuracy: Ramp Input (2)
• Steady-state error for unit ramp input (repeated)
1
ess  K sv  lim sG ( s )
K sv s0

• If N = 0 (type 0 system), there is no integrator in G(s) and therefore Ksv = 0, and the S-S error
goes to infinity! The system cannot track a ramp input

• If N = 1 (type 1 system), the single integrator in G(s) cancels the “s” and therefore Ksv is finite,
and the S-S error is finite (constant offset at S-S)

• If N > 2 (type 2 system or higher), Ksv is infinity, and the S-S error is zero (perfect tracking at
steady state)
S-S Accuracy: Parabolic Input
• Unit-parabola input: r(t) = t2/2  R(s) = 1/s3

• Therefore, the S-S tracking error is

sR ( s ) s (1 / s 3 ) 1/ s2 1 1
ess  lim ess  lim  lim  lim 2 2 
s 0 1  G ( s ) s 0 1  G ( s ) s 0 1  G ( s ) s 0 s  s G ( s ) K sa
2
where Ksa = “static acceleration error constant”  lim s G( s)
s0
S-S Accuracy: Parabolic Input (2)
• The S-S tracking error for a parabolic input (repeated)

1
ess  K sa  lim s 2G ( s)
K sa s0

• If N = 0 or 1 (type 0 or 1 system), Ksa = 0, and the S-S error goes to infinity! The system cannot
track a parabola input

• If N = 2 (type 2 system), the two integrators in G(s) cancel the s2 and therefore Ksa is finite, and
the S-S error is finite (constant offset at S-S)

• If N > 3 (type 3 system or higher), Ksa is infinity, and the S-S error is zero (perfect tracking at
steady state)
Steady-State Errors, ess Summary for Unit Inputs

System Unit Step Unit Ramp Unit Parabolic


Type input input input
0 1
 
1  K sp

1 0 
1
K sv
2 0 0 1
K sa
S-S Accuracy: Summary (2)
• The previous table assumes a unity input function; hence the numerator coefficient is
always 1
– For a non-unity input, the numerator is the input magnitude
– For example, for ramp input r (t )  0.2t the Type-1 steady-state error is e()  0.2 / K sv

• Adding integrators in the forward loop improves steady-state tracking

• If the system must track constant inputs (steps), then one integrator in the controller will
suffice (i.e., PID controller)

• However, adding integrators introduces lag into the system (slows down response) and
can cause instability problems
Steady-State Accuracy: Example 10.8
• Compute the steady-state position errors for proportional (P) and proportional-integral (PI)
controllers. Let Kp = 0.04 V/m, Kl = 0.002 V/m-s

Actuator gain is KA = 2 N / V

The reference position is xref(t) = 0.01t m (ramp input)


Steady-State Accuracy: Example 10.8 (2)

1
ess 
K sv
K sv  lim sG ( s )
Suppose the P-gain is KP = 0.04 V/m (controller) s0

K AKP 0.08
The forward TF is G (s)    Type 1
s 2  0.3s s ( s  0.3)

For a ramp input, the S-S tracking error is


0.01 0.08 0.08
xe ()  K sv  lim s G ( s )  lim   0.2667
K sv s 0 s 0 s  0.3 0.3
Steady-State Accuracy: Example 10.8 (3)
0.01
For a ramp input, the S-S tracking error is xe ()   0.0375 m
K sv
Steady-State Accuracy: Example 10.8 (4)

KPs  KI
For a PI controller we have GC ( s ) 
s

Using gains KP = 0.04 V/m and KI = 0.002 V/m-s we have the forward TF

K A ( K P s  K I ) 0.08s  0.004
G (s)  2
 2  Type 2 K sv  lim sG ( s )
s ( s  0.3) s ( s  0.3) s0

0.01
xe () 
K sv
We know that the S-S error of a Type 2 system is zero for a ramp input
Steady-State Accuracy:
Example 10.8 (5)
Closed-loop response using a PI controller

ZERO S-S error


10.5 Closed-Loop Stability
• BIBO stability: a system is said to be “bounded-input/bounded-output” (BIBO) stable if for every
bounded input, the output remains bounded for all time

• For LTI systems, BIBO stability requires that all poles of the CLTF lie in the left-half of the
complex plane (LHP)

• If all closed-loop poles are strictly in the LHP, then the real parts of all poles are negative, and the
closed-loop system is asymptotically stable

• Checking stability is easy with MATLAB: given the CLTF, simply use the roots.m M-file to
compute the roots of the denominator of the CLTF (characteristic equation)
10.6 Root-Locus Method

• It is obvious that the basic characteristics of the transient response of a closed-loop system (such

as %O.S., damped frequency, , tS , etc) are related to the locations of the closed-loop poles.

• W.R. Evans developed a graphical method (late 1940s) for determining the closed-loop pole

locations in the complex (s) plane  the “Root-Locus Method”

• The root-locus method allows a control engineer to predict the closed-loop response as a gain is

varied; or as poles/zeros are added to the open-loop transfer function

2K P 2( K P  K D s )
T (s)  2 T (s)  2
s  0.3s  2 K P s  (0.3  2 K D ) s  2 K P
Root Locus: Quick Example
• To show the root-locus method, consider the simple unity-feedback control system:

Ref angle,
ref + error 1 
KP s ( s  3)
_
P-gain Plant

• The CLTF is

K PG(s) KP
T (s)   2
1  K P G ( s ) s  3s  K P
Root Locus: Characteristic Eq.
• Therefore, the characteristic equation (denominator of CLTF)

s2 + 3s + KP = 0 (determines closed-loop pole locations)

Clearly, closed-loop pole locations


KP depend on gain K
T ( s)  2 CLTF
s  3s  K P

Ref angle,
ref + error 1 
KP s ( s  3)
_
P-gain Plant
Root Locus: Pole Locations
Table of closed-loop pole locations for various gains KP
Gain, KP Closed-loop poles
Near open-
0.001  2.9997 ,  0.0003 loop poles
1  2.6180 ,  0.3820
2.25  1.5 ,  1.5
4  1.5  j1.3229
10  1.5  j 2.7839
100  1.5  j 9.8869

ref + error 1 
KP s ( s  3)
_
P-gain Plant
Root Locus Sketch
• Now, let’s sketch the closed-loop pole
locations in the complex (or “s”) plane:
Root Locus: Notes

1. The above plot shows the closed-loop pole locations (“roots”) in the
complex plane.
2. The roots start at the open-loop poles with KP = 0
3. The two roots both go to +/- infinity as gain KP  infinity
Root Locus: Notes (2)

 n
cos  
n

4. The closed-loop system is stable for all gains KP > 0 since both
closed-loop poles remain in the left-half plane (LHP)
5. As gain KP increases, damping ratio  decreases and undamped
natural frequency n increases
Root Locus: Definition

• Definition: Root Locus is a plot of the paths (or “loci”) followed by the n closed-loop poles

(or “roots”) of a system as a single parameter (usually a gain K) is varied

• The root-locus method is a graphical procedure for constructing a root locus based only on

knowledge of the open-loop poles and zeros


Root Locus:
Magnitude and Angle Conditions
• We will (briefly) derive the conditions that dictate the root locus plot

• To start, consider a very general closed-loop system with a single adjustable gain K in the
forward path
– Note that the controller TF (such as PID) can be factored into the forward TF G(s) along with the plant
TF
Magnitude and Angle Conditions (2)


Y ( s) KG ( s )
The CLTF is T (s)  
R ( s ) 1  KG ( s ) H ( s )
• The roots of the characteristic equation (CLTF denominator) define the locations of the
closed-loop poles:
1
1  KG ( s ) H ( s )  0 or G(s) H (s) 
K
Magnitude and Angle Conditions (3)
1
G(s) H (s)  (essentially the CLTF characteristic eq)
K
• In general, G(s)H(s) is a complex function of s (it has real and imaginary parts)

• Therefore, we can re-write the single condition (shown above) into two conditions: the angle
condition, and the magnitude condition:

• Angle condition: Since G(s)H(s) = –1/K is a negative real number, the corresponding angle (in the
s plane) is 180 deg

arg[G ( s ) H ( s)]  180  r 360 deg, r = 0,+/-1, +/-2, …


Or Odd multiple of 180 deg; (2q+1)180, q = 1, 2, …
Magnitude and Angle Conditions (4)
1
G(s) H (s)  (essentially the CLTF characteristic eq)
K
• Magnitude condition: Since G(s)H(s) = –1/K, the magnitude is
1
G ( s) H ( s) 
K
• Values of complex variable s that satisfy both the angle and magnitude conditions lie on the root
locus plot (i.e., they are closed-loop poles)

• General rules for sketching a root locus plot can be derived from the angle and magnitude
conditions
– We will not derive these rules, but only summarize them and use them in constructing root locus plots
Root Locus Rules
1. The number of paths (loci) is n, the number of open-loop poles of G(s)H(s)

2. The root locus is symmetric about the Real axis

3. The n loci (or closed-loop branches) begin at the open-loop poles with gain K = 0

4. The n loci terminate with K  infinity at the m finite open-loop zeros of G(s)H(s), or the m
– n “zeros at infinity”
Root Locus Rules (2)
5. The n – m loci that approach infinity do so along radial, straight-line asymptotes centered at

n m

 p zi i
with angle  
k180
deg k = 1, 3, 5, …
a  i 1 i 1
nm
nm

6. A point on the Real axis is on the root locus if there is an odd number of open-loop poles
and zeros to the right of that point (from the angle condition).

7. Points at which the root locus leavers/enters the Real axis satisfy the equation

d
G ( s ) H ( s )  0
ds
Recommended Steps for Sketching a Root Locus
• Starting with the open-loop TF G(s)H(s), determine the n open-loop poles (pi) and the m open-
loop zeros (zj).

• Sketch the open-loop poles and zeros on the s-plane. Use “X” for an open-loop pole, and “O”
for an open-loop zero. Open-loop poles act as “sources” and zeros are “sinks” (see Rules 3
and 4)

• Sketch the Real-axis root locus using Rule 6.

• Compute the asymptotes using Rule 5.

• Complete the approximate root-locus sketch (experience helps here). With enough
experience, one does not need to exactly compute the breakaway/break-in points using Rule
7.
[ Next Slide ]
Recommended Steps for Sketching a Root Locus
Example 10.10

 MATLAB

ζ = 0.3413

ζ = 0.1995

ζ = ? marginally stable at gain KP = 150


Root Locus Using MATLAB
• Creating a root-locus plot with MATLAB is fairly simple. We must be dealing with a closed-
loop system in which the characteristic equation has the form:

numGH
1 K 0
denGH

• Typically, numGH/denGH is the open-loop TF G(s)H(s) in the most general case, and the
adjustable gain K appears in the forward loop (usually in the controller TF)

• In the above case, the MATLAB root-locus plot is created using

>> sysGH = tf(numGH,denGH) % open-loop TF G(s)H(s)


>> rlocus(sysGH) % draws root locus
Root Locus Using MATLAB (2)
• We can evaluate the closed-loop roots at a specific gain (no plot)

>> K = 2;
>> CL_roots = rlocus(sysGH,K) % computes CLTF roots

• Another useful command is rlocfind.m which allows the user to set a “cross-hair target” on the
root locus, click, and return the gain K and the closed-loop roots:

>> rlocus(sysGH) % draw root locus to screen


>> [K,CL_roots] = rlocfind(numGH,denGH)

• Another helpful tool is the command sgrid which draws contours of constant damping ratio ()
and undamped natural frequency (n)
Root-Locus Method: Example 10.11

• Use the root-locus construction rules to develop the basic structure of the root locus and use
MATLAB to create the root locus

• Finally, use the root locus plot to characterize the closed-loop transient response and closed-
loop stability
Root-Locus Method: Example 10.11 (2)

• We start with the open-loop transfer function


s6 s6
G ( s) H ( s)  2 
2 s  4 s 2 s ( s  2)
• Clearly the open-loop poles and zeros are p1  0 , p2  2 and z1  6
– Hence, we can start the root locus with X and O markers on the real axis
Root-Locus Method: Example 10.11 (3)

• We have n – m = 2 – 1 asymptote with the angle


180
   180 deg (i.e., negative real axis)
nm

• The following MATLAB commands create the root-locus plot:

>> sysGH = tf([1 6],[2 4 0] % creates G(s)H(s)


>> rlocus(sysGH) % creates and draws the root locus
Root-Locus Method: Example 10.11 (4)

Complex roots
Gain KP = 39.6

Gain KP = 0.404

p2  2
p1  0
z1  6

One CL root goes to –Inf while the other


CL root terminates at s = –6 as KP  Inf
Root-Locus Method: Example 10.11 (5)

Using sgrid command:

Radial lines  constant 

Semi-circles  constant n

Good transient response: Select


gain KP so that CL roots are in this Simple P controller will be enough
region fast response ωn > 10 for good performance
rad/sec, > 0.94

 is always greater than 0.5 for all roots


Controller Design Using Root Locus: Example 10.12
• Consider a closed-loop system with a 2nd-order plant

• Actuator gain is KA = 2 N/V

• If we use a simple proportional (P) controller, the OLTF is


2 Two open-loop poles at 0, –0.3 and no open-loop
G( s) H ( s)  2
s  0.3s zeros
Example 10.12 (2)
2
G ( s) H ( s) 
s 2  0.3s Root Locus for
P-control (gain KP )
Two open-loop
poles at 0, –0.3 and
no open-loop zeros
Slow response:
real part is –0.15

Poor damping as
gain increases

• Therefore, we have limited ability to get both a fast response and a well-damped response by
simply adjusting the gain KP (P-controller).
Controller Design Using Root Locus: Example 10.12 (3)

• We need to shift the root locus to the left to improve the transient response
GC ( s )  K P  K D s : PD Controller
• Therefore, use a PD controller:
Kp
s ;Zero of system
KD
GC ( s )  K ( s  3)  K P  K D s
GC ( s )  K ( s  z D )
K  K D ; zD  K p / K D
• Here, we have added an open-loop zero at s = –3
– Zeros act as “sinks” and attract the closed-loop root loci branches (i.e., “pull” root locus to the
left)
Example 10.12 (4)
Adding PD controller shifts Root Locus for
root locus to the left
PD controller
2( s  3)
GC ( s ) 
s 2  0.3s

Good transient
response
Example 10.12 (5)

Closed-loop step response using PD controller


with gain K = 5.514

Fast response and


good damping
Effect of Differentiation
PD and PID Issues
• Recall the PID control signal

u (t )  K P e(t )  K I  e(t )dt  K D e (t )

• Note that if the reference input r(t) is a step function then the derivative e (t ) will
theoretically be infinity at time t = 0 when input r(t) instantaneously steps up from zero to
a constant value

• This (theoretically) infinite derivative signal will be gained by KD to produce an infinite


control signal u(t)  Damage to Actuator

• One possible solution is to measure and feed back the derivative of the output ( y )
instead of differentiating the error signal (i.e., “rate feedback”)
PD and PID Issues (2)
• Another method for circumventing the infinite error derivative is to insert a low-pass
filter into the control loop

• Below is a feedback control system with a unity-gain low-pass filter inserted before
the PID controller GC(s)

Corner/Break Frequency = 15 rad/sec (2.4 Hz), Removes high-frequency component


in error signal e(t)
Design/Desired value
Lead Controller
• Suppose we choose to implement a PD controller with an open-loop zero at s  4
that is preceded by a low-pass filter with corner frequency c = 15 rad/s

• The product of the low-pass filter and PD controller is

15 K 1 ( s  4)
GLP ( s )GC ( s )  K ( s  4) 
s  15 s  15
Lead Controller (2)
• The low-pass filter + PD controller is called a “lead controller” or “lead filter”

• The lead controller transfer function is

K1 ( s  4) 1 zero, 1 pole
GLF ( s )  1 adjustable gain
s  15
Lead Controller (3)
• Consider the Bode diagrams of a PD controller and lead controller

PD controller:
0.25( s  4)

Lead controller:
Unity DC gain 3.75( s  4)
s  15

Both controllers
add phase lead near
= 4 rad/s

PD controller amplifies
high-frequency noise
PD vs. Lead Controllers
• Implementing a PD controller will result in an impulsive control signal (for step function)
due to the infinite derivative in the error signal at t = 0

• PD controllers must be used carefully because they greatly amplify the high-frequency
component of a feedback signal

• Adding a low-pass filter before a PD controller creates a lead controller

• A lead controller is an approximation of the PD controller; both controllers improve


damping and reduce the settling time
10.7 Stability Margins
• A general performance criteria of a good control system is a measure of its closed-loop stability

• Relative stability: how close is the current closed-loop system design from becoming
unstable?

• That is, how much can we increase the current gain K before driving the closed-loop system
unstable?

R(s) + E(s) U(s) Y(s)


K G(s)
-

H(s)
Relative Stability Using Bode Diagrams
• It turns out that Bode diagrams can be used to quantify the so-called relative stability margins

• Another classical stability approach is the Nyquist stability margin (not very intuitive); we will
only demonstrate the use of Bode diagrams for relative stability (more intuitive)

R(s) + E(s) U(s) Y(s)


K G(s)
-

H(s)
Bode Diagram: Critical Points
• There exists some “critical points” on the Bode diagram for the open-loop transfer function
(OLTF), G(s)H(s)

• Some definitions are useful:

• Unity-gain crossover frequency: frequency where magnitude (gain) curve on the Bode
diagram crosses 0 dB (the magnitude critical point)

• Phase-crossing frequency: frequency where phase (angle) curve on the Bode diagram
crosses -180 deg (the phase critical point)
Bode Diagram: Critical Points

Unity-gain crossover frequency

Phase-crossing frequency
Definitions for Relative Stability
• Gain Margin (GM) is the maximum factor by which the current gain setting can be multiplied
by until the closed-loop system is driven unstable (crosses Imaginary axis over into the right-
half plane in a root-locus plot).

• We can easily compute the gain margin from the Bode diagram by observing how much
additional gain pushes the magnitude curve “up” to 0 dB at the phase-crossing frequency

• Phase Margin (pm) is the maximum amount of additional phase lag allowed until the closed-
loop system is driven unstable.

• We can easily compute the phase margin from the Bode diagram by observing how much
additional phase lag pushes the phase curve “down” to -180 deg at the unity-gain crossover
frequency
Relative Stability via Bode
• Example: Suppose we have a P-controller (gain KP ) and the following plant transfer function

1
G (s) 
s ( s  2)( s  3)

Therefore, the OLTF is KG(s). The Bode diagram for a gain setting
of KP = 2 is on the next slide…
Relative Stability via Bode (2)
Bode Diagram of OLTF with Gain KP = 2

-23.5 dB; neg for


(2) stable system
Gain margin 10GM db /20

(1)
Gain Margin via Bode Diagram
• Note that the phase-crossing frequency is gm = 2.45 rad/s (see green box)

• Since the magnitude (gain) is about -23.5 dB at the phase-crossing frequency, the gain
margin (GM) is roughly 23.5 dB

• A gain margin of 23.5 dB is equivalent to a magnitude of 15, since 20 log10(15) = 23.5 dB

• Because the Bode diagram is for a controller gain of KP = 2, the closed-loop system will go
unstable when the controller gain is increased to KP = (2)(15) = 30
Relative Stability via Bode (2)
Bode Diagram of OLTF with Gain KP = 2

-23.5 dB; neg for stable


(1) system

Gain margin 10GM db /20

-105 deg (2)


Phase Margin via Bode Diagram

• Note that the 0 dB gain crossover frequency is pm = 0.33 rad/s (see red box)

• Since the phase angle is about -105 deg at the unity-gain crossover frequency, the phase
margin (pm) is roughly 75 deg

• If 75 deg of additional phase lag is introduced to the system, it will go unstable


Marginal Stability: Critical Points
Bode Diagram of OLTF with Gain KP = 30

GM = 0 (marginally stable)

Magnitude plot has


shifted up 23.5 dB

Phase plot does not


change with gain
Gain and Phase Margin: MATLAB
• Consider again the P-controller (gain KP) and plant G(s) in a unity-feedback closed-loop system:

1 1
Plant: G(s)   3
s ( s  2)( s  3) s  5s 2  6 s

• The MATLAB command computes gain and phase margins:

Result: Gain margin in dB:


Gain and Phase Margin: MATLAB (2)
>> margin(Kp*sysG) % gain is KP = 2

GM = 23.5 dB

PM = 74.5 deg
Gain and Phase Margin: MATLAB
>> margin(Kp*sysG) % gain is Kp = 30 (marginally stable)
Bode Diagram
Gm = -1.93e-015 dB (at 2.45 rad/sec) , Pm = 4.64e-007 deg (at 2.45 rad/sec)
100

50
zero GM and PM
Magnitude (dB)
0

-50

-100
-90

-135
Phase (deg)

-180

-225

-270
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
10.8 Implementing Control Systems

• Before microprocessors (the “old days”) control systems were constructed by using analog
electrical circuits

• For example, filters, PID, and lead controllers were built using RC circuits with op amps
– Sensors converted mechanical motion into electrical signals

• Of course, control systems today are digital algorithms


– The equations that represent a PID controller or filter transfer function are software (“code”) that is executed
by a microprocessor
– Control engineers often design systems using the continuous (or “s” domain) and then convert the controller
TF GC(s) into a digital algorithm
Digital Control Systems

The digital controller is software (“code”) in a programmable computer

The input/output signals from the digital computer must be digital signals

The physical system (actuator + plant) has continuous (“analog”) signals

Therefore, we must use “digital-to-analog” (D/A) and A/D converters


A/D and D/A Converters
• Analog-to-digital (A/D) converters involve sampling the continuous-time signal and quantizing
the discrete measurements to produce a digital signal (finite precision)

• A common digital-to-analog (D/A) converter is the zero-order hold:

Sampling time Ts is an important parameter in digital control system design


Digital Controller Algorithms
• Consider the PI controller in the continuous (“s”) domain:

u (t )  K P e(t )  K I  e(t )dt

• The digital representation of the PI controller would be

u (k )  K P e(k )  K I w(k ); e  k   e  kTs 

where k = sample index (1, 2, 3, …) and e(k) is the sampled error signal

w(k) is the numerical integral of the error:

w(k )  w(k  1)  Ts e(k )


Rectangular-rule integration
Digital PI Controller (2)

The PI controller algorithm is 2 lines of code:


w(k )  w(k  1)  Ts e(k ) Numerical integral

u (k )  K P e(k )  K I w(k ) Digital control command (to ZOH via D/A for actuation)
Digital PID Algorithm
• Consider the PID controller in the continuous (“s”) domain:

u (t )  K P e(t )  K I  e(t )dt  K D e (t )

• The digital representation of the PID controller would be


First-order recursive method
u (k )  K P e(k )  K I w(k )  K D v(k ) Memory for e(k - 1) and w(k - 1)

v(k) is the numerical derivative of the error (using backward finite differences)

e(k )  e(k  1) ( poor accuracy if error signal


v(k )  is corrupted by noise )
Ts

Therefore, the digital PID controller has 3 lines of code


Digital Lead Controller Algorithm
• We could replace a pure PD controller with a low-pass filter + PD controller combination (“lead
controller”)

U ( s)
GPD ( s )  12  4 s  4( s  3)  “Pure” PD controller
E (s)
• A lead controller with the same low-frequency gain (=12) is

80( s  3) U ( s )
GLF ( s)   Lead controller (DC gain = 12)
s  20 E (s)

• The digital lead filter equation can be determined for a sample time of Ts = 0.01 s (100 Hz) (use
MATLAB’s c2d.m)
First-order filter
u (k )  0.8187u (k  1)  80e(k )  77.82e(k  1) (stores past samples)

If we change Ts or the TF GLF(s) we must re-compute the filter equation


Chapter 10: Summary
• We investigated the three-term PID control scheme for a closed-loop, feedback control
system:
– The proportional (P) control signal reduces the response time
– The integral (I) signal reduces the steady-state tracking error
– The derivative (D) signal adds damping to the system

• The root locus method is a graphical technique for visualizing the effect that varying one
parameter (usually a gain) has on the locations of the closed-loop poles

• We also presented the gain and phase margins which are quantitative measures of
relative stability
– Gain and phase margins can be read from the Bode diagram

• We briefly discussed how controllers are implemented as discrete-time algorithms in a


digital computer

You might also like