Beruflich Dokumente
Kultur Dokumente
MBE4039
Computer Controlled Systems
Semester B 2016/17
City University of Hong Kong
Contents
5 Robot Control 45
5.1 Linearization 45
5.2 Proportional, Integral, and Derivative 46
5.3 Low-Pass Filtering 46
5.4 Case Study: Mobile Robot 47
H Solutions 69
x = Fx + Gu
y = Hx + Ju, (1.1)
where x is an n 1 column vector called the state, u is an m 1 input
vector, y is a p 1 output vector, F is an n n system matrix, G is an n m
input matrix, H is 1 n and J is a scalar.
where b1, b2, ..., bm+1 are coefficients of the numerator, and a1 , a2, ..., an+1 are
coefficients of the denominator. Alternatively, a transfer fuction can be
written as the ratio of factored polynomials (called zero-pole-gain or zpk
form)
(s z1 ) (s z2 ) ... (s zm )
G (s) = k , (1.4)
(s p1 ) (s p2 ) ... (s pn )
where k is a scalar gain, zs and ps are zeros and poles of the system.
Given the standard expression of a linear system as in equation (1.1), the
transfer function of the system can be calculated as
G (s) = H (sI F)1 G + J . (1.5)
Example: Use the result from equation (1.2) to evaluate the transfer function
of the driven mass-spring-damper system according to equation (1.5).
This allows us to solve for the final steady-state value without solving for
the entire response.
H(s)
1.6 Stability
1 + H (s) G (s) = 0.
1
ess = .
1 + Kp
Uo
U (s) = .
s2 + 2
The systems response is then
Uo
Y (s) = G (s) .
s2 + 2
Providing that the system is stable, the transient response will die out and
only terms left in the steady state are those due to the sinusoidal excitation.
The steady-state tiem response is
y (t) = U0 A sin (t + ) ,
where
Im [ G ( j )]
A = | G ( j )| = | G (s)| and = tan1 = G ( j ) .
s= jo = Re [ G ( j )]
So, a stable linear system G (s) excited by a sinusoid will eventually exhibit
a sinusoidal output y with the same frequency as the input u. The magni-
tude of y with respect to the input is | G ( j )| and the phase is G ( j ).
The plot of the frequency response of a system is called a Bode plot.
Both magnitude and phase are plotted against a horizontal axis propor-
tional to the logarithm of frequency. An example of a Bode plot of a second
order linear system is shown in figure 1.4.
0
Magnitude (dB)
10
20
30
40
0
Phase (deg)
45
90
135
180
0 1 2
10 10 10
Frequency (rad/s)
1. The system is unstable for positive as the response will grow indefi-
nitely, or
2. The system is stable for < 0 and the respose will exponentially decay
towards zero.
The settling time ts is the time
Similarly, for a system with two poles, the general form of the factorised it takes the system transient to
4.6
decay, ts .
transfer function is
The overshoot is the maximum
1 amount the system overshoots
H (s) = , its final value devided by its
(s j) (s + j)
final value.
The rise time tr is the time
meaning the poles are located at s = j. This representation of poles is
the system takes to reach the
rather useful as gives an indication whether the system is asymptotically vicinity of its new setpoint,
stable or how rapidly the response exponentially grows or decays (which tr 1.8/r.
determines the settling time for the stable case), while informs whether
there will be oscillation in the response. They, however, does not immedi-
ately indicate the amount of overshoot, which is related to the damping
ratio of the system. The conventional damping
ratio (which 0 < 1) is
related to as cos = .
City University of Hong Kong 11
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
Using this notion, we find the, r is the resonant frequency of the system,
and the amount of overshoot M is given as M e/ = e cot . For a
stable system /2 < < 3/2, the amount of overshooting is maximum
near = /2, 3/2 and minimum near = .
2.1 Digitization
Figure 2.1 shows (a) a typical continuous system and (b) a digital controlled
systems. The fundamental differences between the two implementations are
that the digital system operates on samples of the sensed plant output.
Control
2.2.2 Integers
First bit taken as a sign bit. Hence n bits 2n1 .
There are still 28 = 256 numbers possible, but they are no longer equidis-
tantly spaced.
In the case that the function f is linear and depends only on a finite number
of past es and us, we write
a2 2 uk + ( a1 2a2 ) uk + ( a1 + a2 + 1) uk = b0 ek .
solution:
(uk ) = 2 uk = uk uk1
= (uk uk1 ) (uk1 uk2 ) = uk 2uk1 + uk2
= u k 2 ( u k u k ) + u k 2 = u k + 2 u k + u k 2 or
2
u k 2 = u k + u k 2 u k
uk = a2 2 uk + ( a1 + 2a2 ) uk + ( a1 a2 ) uk + b0 ek
b0 ek = a2 2 uk + ( a1 2a2 ) uk + ( a1 + a2 + 1) uk
U (s) s+a
D (s) = = K0 .
E(s) s+b
solution:
u + bu = K0 e + aK0 e
u ( k + 1) u ( k ) e ( k + 1) e ( k )
+ bu (k) = K0 + aK0 e (k)
T T
u (k + 1) u (k) + bTu (k) = K0 e (k + 1) K0 e (k) + aTK0 e (k)
u (k + 1) + (bT 1) u (k) = K0 e (k + 1) + ( aT 1) K0 e (k )
where we have group the output terms (ui ) together on the left hand side
and the input terms (ei ) together on the right hand side. We would like to
find a solution uk that satisfies the difference equation given the input ei
and a set of initial conditions u0 , u1 ,..., un . The general solution to equa-
tion (2.2) may be derived as the sum of two solution components
u (k ) = uc (k ) + u p (k ) ,
y (k + 3) 6y (k + 2) + 11y (k + 1) 6y (k) = 0.
Find the system response y (k) for k > 2 given the initial conditions y (0) =
2, y (1) = 1 and y (2) = 2.
solution:
the characteristic equation is 3 62 + 11 6 = 0, = 1, 2, 3. The
system response is
y (k) = A1 .1k + A2 .2k + A3 .3k ,
2.5 Z-Transform
If a signal has a destrete values y0 , y1 , ..., yk, ... we define the ztransform of
the signal as the function
Y (z) Z {y (k)}
yk zk ,
k =
z1
lim f (t) = lim F (z) if the left limit exists.
t z 1 z
The z-transform has the same role in discrete systems that the Laplace
transform has in analysis of continuous system. The transfer function is
defined as the ratio of the transform of the ouput to the transform of the in-
put. For a system described by the difference equation as given by equation
(2.1), the general form of the transfer function is
b0 + b1 z1 + ... + bm zm
H (z) = . (2.3)
1 + a1 z1 + a2 z2 + ... + an zn
Oftentimes this is defined by the numerator b (z) and the denominator a (z)
as
b (z)
H (z) = ,
a (z)
h i h i
where b (z) = b0 b1 ... bm and a (z) = 1 a1 ... an . Another
representation of the discrete transfer function parallels the zero-pole-gain
representaion of the continous systems (c.f. equation 1.4):
(z z1 ) (z z2 ) ... (z zm )
H (z) = k .
(z p1 ) (z p2 ) ... (z pn )
0.2z1
H (z) = ,
1 0.9z1
which can be re-written as the difference equation
u = EA sin (kT + ) ,
where the amplitude gain A ( ) and the phase can be found from the fre-
quency response H e jT defined as
H e jT = H (z)
z=e jT
from
A ( ) = H e jT , and
jT
1 Im H e
( ) = tan = H e jT
.
Re H e jT
b
H (z) = .
za
solution:
b
A ( ) = H e jT = q
(cos T a)2 + sin2 T
sin T
( ) = H e jT
= tan 1
cos T a
x ( k + 1) = Ad x (k ) + Bd u (k )
y (k) = Cd x (k ) + Dd u (k ) , (3.1)
In section (2.4), we introduced the difference equation that relates the out-
put y to the input u as
The transfer function of this differene equation (as previously given in equa-
tion (2.3)) is
b0 + b1 z1 + ... + bm zm
H (z) = . (3.3)
1 + a1 z1 + a2 z2 + ... + an zn
If b0 6= 0, we must pull out the term
and set D = b0 in the state space model. The controller canonical form is
then written as
a 1 a 2 a n 1 a n 1
1 0 0 0 0
A = 0 1 0 0 0
B=
.. .. .. .. ..
. . . . .
0 0 1 0 0
h i
C = 1 2 m D = b0 .
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
Remarks:
From equation (3.4), if we write y (k) = H (z) u (k) ,we have
1 z1 + ... + m zm
y (k) b0 u (k) = u (k) .
1 + a1 z1 + a2 z2 + ... + an zn
Here, if we define
1
= u (k) , (3.5)
1 + a1 z 1 + a2 z2 + ... + an zn
then
y (k) b0 u (k) = 1 z1 + ... + m zm
z 1
h i
z 2
= 1 2 m 0 0
..
for m n.
| {z } .
Cd zn
| {z }
x(k)
1 + 2z1 + 3z2
H (z) = ,
1 + 21 z1 + 31 z2
Consider the n-th order discrete-time linear system in equation (3.1), which
can be re-written in the z-domain with a delay variable z1
x = Fx + Gu
y = Hx + Ju, (3.7)
if the system has a zero order hold on its input u with the sample time T,
then it can be shown that the analogous discrete state space model can be
written as in equation (3.1), where
Ad = eFT ,
Z T
Bd = eF dG,
0
Cd = H
Dd = J. (3.8)
While the relations above can be proved exactly, here we offer a less rigor-
ous proof via numerixal approximaions. Starting from
Ad = eFT
F2 T 2 F3 T 3
= I + FT + + + ...
2! 3!
I + FT as T 0. (3.9)
Similarly,
Z T
Bd = eF dG
0
Z T
F2 T 2 F3 T 3
= I + FT + + + ...dG
0 2! 3!
FT 2 FT 3
= IT + + + ... G
2 3
GT as T 0. (3.10)
x ( k ) x ( k 1)
= Fx (k) + Gu (k) . (3.12)
T
Re-arranging the equation yields
x (k ) = ( I FT )1 x (k 1) + ( I FT )1 GTu (k) .
x ( k ) x ( k 1) x ( k ) + x ( k 1) u ( k ) + u ( k 1)
=F +G .
T 2 2
From here, it can be shown that
1
FT FT FT 1 GT
x (k) = I I+ x ( k 1) + I (u (k) + u (k 1)) .
2 2 2 2
x ( k ) x ( k 1)
= Fx (k 1) + Gu (k 1) .
T
The left hand side of the above equation is now identical to that of equation
(3.12). Therefore, we can combine the two equations using the average of
the right hand sides:
x ( k ) x ( k 1) Fx (k 1) + Gu (k 1) Fx (k) + Gu (k)
= +
T 2 2
x ( k ) + x ( k 1) u ( k ) + u ( k 1)
=F +G .
2 2
h i
where x = x1 x2 is the state vector. Discretize this system using the
Tustins method for sample time T = 0.5.
Solution:
" # " #
8 1
1 27
x (k) = x (k 1) + 27 (u (k) + u (k 1))
49 27
5 4
27
h i
y (k) = 1 0 x ( k ) + [0] u ( k )
3.5 Stability
When the input to the discrete time system is zero, the state response of a
system reduces to
x ( k + 1) = A d x ( k ) , (3.13)
that is
x (k) = Akd x (0) .
The condition for the equation (3.14) to hold is that the magnitudes of all
eigenvalues of Ad are less than unity. If || > 1, the state vector will grow
exponentially with time the system is unstable.
A linear discrete-time system described by the state equation x (k + 1) =
Ad x (k ) is asymptotically stable if and only if all eigenvalues have magnitude
smaller than one.
To evaluate eigenvalues of Ad , one solves the equation |I Ad | = 0.
This is identical to the characteristic equation of the system in the transfer
function form (3.6). Hence, the roots of the characteristic equation obtained
from the transfer function are eigenvalues of Ad . The system is deemed
stable if and only if all roots have magnitude smaller than one.
(z 0.5) (z 0.4) = 0
z = 0.5, 0.4
(z 1 ) (z 2 ) ... (z n ) = 0.
Thus far, we have shown that the pole placement method could stabilise
the system output limk y (k) = 0 by ensuring x (k) 0 as k . In
more general settings, we may desire to have the output y (k) following a
constant non-zero reference signal r (k). To achieve such result, let us first
define xr (k ) as the desired value of the state and a matrix Nr that satisfy
Nr r ( k ) = xr
y = Cd xr = r.
The two equations reduce to Cd Nr = I, which allows us to find Nr . Further- We are assuming Dd = 0,
more, assuming the system is at desired steady state (with no errors) when hence, Y = Cd x.
xr ( k + 1) = A d xr ( k ) + B d ur ( k ) (3.16)
xr ( k ) = A d xr ( k ) + B d ur ( k )
( I A d ) xr ( k ) = B d ur ( k )
( I A d ) Nr r ( k ) = B d ur ( k )
e ( k + 1) = Ad e (k) Bd Ke (k)
= (Ad Bd K) e (k ) ,
2. Design a digital controller for returning the mass to the origin using the
pole placment method to place tho poles at z = 3, 5. In fact, this is a poor example
as poles at z = 3, 5 would
3. Instead of stabilizing the mass at the origin, we intend to stabilize the destabilize the system.
mass at a reference position yr = 1, calculate Nr and Nu and find the new
control law based on the controller evaluated in (2).
Solution:
1.
" # " #
0 0.2 1
x (k) = x ( k 1) + f ( k 1)
1 0 0
h i
y (k) = 0 0.04 x (k)
The control law designed using the pole placement method or other meth-
ods typically assume that all state elements are available for feedback. In
reality, not all elements are measured. The missing portion of the state has
to be estimated for use in the control law.
We call the current estimate x (k). This state estimate is calculated based
on measurements y (k ) up to and including the kth instant. For a discrete
state space system in the form of equation (3.1), its estimated are obatined
from
x (k) = x (k) + L [y (k) Cd x (k)] , (3.17)
where L is an n 1 estimator gain matrix, x (k ) is the predicted estimate
based on a model prediction from the previous time estimate according to
x (k) = Ad x (k 1) + Bd u (k 1) . (3.18)
x (k) = Ad x (k 1) + Bd u (k 1) + L [y (k ) Cd ( Ad x (k 1) + Bd u (k 1))]
= Ad x (k 1) + Bd u (k 1) + L [Cd ( Ad x (k 1) + Bd u (k 1)) Cd ( Ad x (k 1) + Bd u (k 1))]
= Ad x (k 1) + Bd u (k 1) + LCd ( Ad x (k 1) x (k 1)) (3.19)
Using the stability analysis we discussed in section (3.5), it follows that the
estimation error is asymptotically stable (that is the error reduces to zero
over time) if the all eigenvalues of Ad LCd Ad are in the unit circle. This
could be achived by choosing a suitable estimator gain matrix L by placing
the pole of Ad LCd Ad at desired locations.
Construct an estimator such that the poles are located at z = 0.4 0.4j for
T = 0.1s.
Solution:
We are looking for L that makes
" # " # " # " #
1 0 1 T L1 h i 1 T
z + 1 0 =0
0 1 0 1 L2 0 1
identical to
(z 0.4 + 0.4j) (z 0.4 0.4j) = 0.
An example system
U (s) a
= G (s) =
E (s) s+a
is equivalent to
u + au = ae,
or
Z t
u (t) = au ( ) + ae ( ) d
0
Z kT
u (kT ) = u (kT T ) + au ( ) + ae ( ) d. (4.1)
kT T
1 1 e aT
H (z) = aT
.1. (z + 1) . .
ze 2
z = |{z} e jT .
eT |{z}
rz e jz
The first part eT describes the magnitude of z in the complex plane and
the second part e jT determines the phase of z. Writing z = rz e jz , a stable
system has < 0, rendering rz < 1, which, as anticipated, a stable condition
for a discrete system.
When analysising a discrete-time system, it is sometimes useful to vi-
sualise the system response using notions from continuous-time systems,
particularly the damping ratio and resonant frequency. On the z-plane,
we can plot the contour of different from 0.1 to 0.9 as illustrated in figure
4.1 (red dashed lines). As decreases (or cos 0 as discussed in section
1.10), the system leans towards unstability, and the contours in figure 4.1
approaches the z = 1 line (unit circle).
To inspect the resonant frequeny, we use the representation s = re j ,
which leads to
z = er(cos + j sin )T
= e|rT{z
cos jrT sin
} e| {z } .
magnitude phase
Suppose we would like to obtain the system with one particular resonant
frequency r, then the location of pole on the z-plane follows one of the blue
dashed lines as we varies.
0.2
0.9/T 0.1/T
0.4
0.8/T 0.2/T
0.6
0.7/T 0.3/T
0.8
0.6/T 0.4/T
0.5/T
1
1 0.5 0 0.5 1
1
0.5/T
0.6/T 0.4/T
0.8 0.1
0.7/T 0.3/T
0.2
0.6 0.3
0.8/T 0.4 0.2/T
0.5
0.4 0.6
0.7
0.9/T 0.8 0.1/T
0.2 0.9
1/T
0
1/T
0.2
0.9/T 0.1/T
0.4
0.8/T 0.2/T
0.6
0.7/T 0.3/T
0.8
0.6/T 0.4/T
0.5/T
1
1 0.5 0 0.5 1
For a discrete transfer function H (z), plots of magnitude and phase are
accmplished by letting z takes on values allow the unit circle z = e jT , that
is,
magnitude = | H (z)|e jT
phase = H (z) .
jT e
100 2 1 0 1
10 10 10 10
Frequency (Hz)
90
Phase (deg)
180
270
360 2 1 0 1
10 10 10 10
Frequency (Hz)
1
G (s) = . (4.2)
s (s + a)
Observe that the magnitude is often plotted showing the decibel (dB) value,
defined as 20 log (magnitude). The frequency could be in Hz or in radian
per second. It can be seen that there are small discrepancies between the
original continuous-time transfer function and discrete-transfer functions
described by three methods from section 4.1.
Continuous-time 171.0 .
Forward 188.8
Backward 153.2
Bilinear 171.0 .
180 2 1 0 1
10 10 10 10
Frequency (Hz)
180
Phase lag (deg)
180
0 1 2 3
T ( r ad)
To inspect the result from the above example further, figure In fact, con-
version from continous-time transfer function to discrete-time transfer func-
tions may result in phase lag/lead, depending on the method used and the
transfer function itself. General rules are
D (z) G (z)
Y (z) = R (z) ,
1 + D (z) G (z)
1
E (z) = R (z)
1 + D (z) G (z)
S (z) R (z) ,
5.1 Linearization
Most, if not all, physical systems are nonlinear, and many systems have
important nonlinearities such as friction that cannot be ignored even for
a small range of operation. However, the variety of nonlinear systems is
so vast that it would not be possible to consider all issues and concepts.
Robotic systems are typically highly nonlinear as they often involve rota-
tions and revolute joints.
Linearization is the procedure in which a set of nonlinear differential
equations is approximated by a linear set. There are at least two primary
reasons why the process is useful in control. First, there are many good
design and analysis tools for linear systems (for example, we can evaluate
its stability, or design a controller using the pole placement method). Sec-
ond, it can be proven that if the linearized model is stable, there will exist a
small region (though this could be infinitesimally small), within which the
nonlinear system will be stable. Thus, al most always, the first technique for
analysing and controlling a nonlinear system is to obtain a linear approxi-
mation and design a controller for it.
To begin, let x (t) be a state vector, u (t) be the input, and y (t) be the
output of the system. We may write
Suppose we are looking to operate this system near a nominal condition, In the case of a linear system,
provided by x 0 = f (x0 (t) , u0 (t)), but the current state of the system given f (x (t) , u (t)) = Fx + Gu.
Keeping only upto the first order terms, we can substitute the result from
equation (5.4) to equation (5.3) to yield
f (x, u) f (x, u)
x = x + u
x x0 ,u0 u x0 ,u0
= Ax
+ Bu, (5.5)
f (x,u) f (x,u)
where we have used A = x and B = u . Equation (5.5) is
x0 ,u0 x0 ,u0
in the continuous state space form (c.f equation (1.1)). This can be converted
into the discrete-time state space representation using the methods we have
learned for computer controlled purposes.
mgl sin = ml 2 .
1. = 0, = 0.
2. = 0 6= 0, = 0.
usually pass the derivative part of the signal through a low-pass fitler with
a suitable cutoff frequency. This inevitably results some delay which may
affect the stability of the controller. There are various kind of low-pass
fitlers that can also be designed in the continuous-time domain and later
converted to the discrete-time representation. Examples include Butter-
worth, Chebyshev type I & II, etc.
x = v cos y = v sin .
Simultaneously, the robot takes two control inputs u1 and u2 in a way that
the first input regulates (increases or decreases) the speed and the second
input changes the orientation of the robot as mathematically written as
v = u1
= u2 .
x = f (x, u1 , u2 )
x v cos
d y
v sin
= . (5.6)
dt v u1
u2
Take the script files provided from the Canvas, upload them in the same
folder.
What should be the nominal value of x0 (t), y0 (t), v0 (t), and hence
u1,0 (t)?
What should be the nominal value of 0 (t), 0 (t), and hence u2,0 (t)?
Enable the disturbance, see run again and see the result (leave it enabled
after this point).
Then, discretise the linearised dynamics using Forward Euler method as-
suming the sample time is T.
Hence, we can verify whether the proposed control policy stabilises the
system or not by looking at eigenvalues of A (k) TK. However, since A (k)
where we need to include the current state of the system (v and ) in the
gain matrix. Try = 5 = 5 and = 10 = 5. What is the difference? In
fact, one of the parameters acts like a proportional gain and the other acts
like a derivative gain, can you identify which is which?
Im [G (j)]
G (j) = tan1 .
Re [G (j)]
C. Initial and Final Value Theorems
where the pole p and zero z are both typically negative (or on the left half
plane). In a lead compensator, |z| < | p| , while in a lag compensator |z| > | p|.
Determine the final value to a unit step input for the open-loop systems:
4
G (s) = s2 +4s+4
4
G (s) = s2 4s+4
Assume both z and p are negative, what are the conditions for the closed-
loop system to be stable?
Re-write the difference equation such that it has only zero or negative time
shifts without altering the meaning of the equation (only k x is allowed,
not k + x).
is stable for a > 0 as the pole lies in the left half plane. We can discretize
G (s) with time step T using Eulers method. The resultant discrete-time
transfer function is
T/a
H (z) = .
z (1 T/a)
What is a required condition for T (positive) such that the discretized sys-
tem is asymtotically stable?
One can notice that although the sampled sinusoid is a pure harmonic
at frequency , the time waveform appears to consist of beats as ap-
proaches . Some insight into this appearance may be gained as follows.
Specifically, show that a discrete-time signal y (k) = sin k may be writ-
ten as y (k ) = sin ( ) cos k.
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
1
sin k = [sin k + sin ( 2 ) k] .
2
The following trigonometric identity may be helpful:
a+b ab
sin a + sin b = 2 sin cos .
2 2
What is the value given by the Final Value Theorem applied to this U (z)?
Find the final value of u (k) by taking the inverse transform of U (z),
using partial-fraction expansion and the tables.
C.2 Stability
uk = 0.5uk1 0.3uk2
uk = 1.6uk1 uk2
uk = 0.8uk1 + 0.4uk2 .
Find the transfer functions from the two block diagrams in figure C.1. Ver-
ify that they are identical.
In facts, the matrices Ad1 , Ad2 , Bd1 , Bd2 , Cd1 , Cd2 , Dd1 and Dd2 are just
scalars. And the two subsystems can be recombined to create a new
system using
" # " #
Ad1 0 Bd1
Ad12 = Bd12 ,
0 Ad2 Bd2
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
Ad = T1 Ad12 T
Bd = T1 Bd12
Cd = C12 T
Dd = D12 .
y (k) 3y (k 1) + 2y (k 2) = 2u (k 1) 2u (k 2)
U k 0
0
u (k) =
0 k<0
" # " #
1 T T 2 /2
x ( k + 1) = x+ u.
0 1 T
Find the control law for placing the closed-loop poles at z = 0.8 0.25j.
If we would like to ensure that the rise time of the system is less than 0.1
second, what should be the magnitude of the pole, r, in the s domain?
Given the sample time T = 0.1 s. Which area in the z-plane that the pole
of the discrete-time system should be in?
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
1
0.5/T
0.6/T 0.4/T
0.8 0.1
0.7/T 0.3/T
0.2
0.6 0.3
0.8/T 0.4 0.2/T
0.5
0.4 0.6
0.7
0.9/T 0.8 0.1/T
0.2 0.9
1/T
0
1/T
0.2
0.9/T 0.1/T
0.4
0.8/T 0.2/T
0.6
0.7/T 0.3/T
0.8
0.6/T 0.4/T
0.5/T
1
1 0.5 0 0.5 1
Find the intersection between the areas to yield the area that satisfies all
the requirements.
For the system in the first question, find the control law using the pole
placement to place the poles at i) or ii) as you just found above.
The second order linear system of interest has a continuous transfer func-
tion
s+1
H (s) = 2 .
s + 5s + 6
Find the discrete-time transfer function of the system using Forward,
Backward, and Zero-pole matching methods for sample time T = 0.1 s.
The means that at this frequency, the phase of the transfer function is
-1.258 rad, or 72 . In the lecture, we learned that when we convert the
Forward rule
Backward rule
Trapezoid rule
Pole-zero mapping
Take the open-loop discrete-time transfer function with sample time T = 0.2
from the following:
z+1
G (z) = 0.05 .
z2 1.9z + 0.9
Find the poles, is the system stable in open-loop?
MBE4039 Computer Controlled System
Semester B 2016/17 P Chirarattananon
For the closed-loop gain K = 1, calculate the phase and magnitude of the
KG when z = e j2.26T .
Make sure you are confident with the examples, tutorial questions, and
mid-term exam questions. The final exam will be closed-book, but you will
be provided with the formula sheet. Study the meaning of material on the
formula sheet and how to use them. Content not provided by the formula
sheet could be in the exam.
Question 1
The plant of a continuous-time feedback system is
10
G (s) =
s2 + 3s + 9
1. Convert the system to discrete state-space form with T = 0.1 s.
Question 2
Take the open-loop discrete-time transfer function with sample time T = 0.2
from the following:
z+1
G (z) = 0.05 .
z2 1.9z + 0.9
1. This system is unstable, to stabilize the system, we closed the loop using
a proportional controller with the elementary feedback configuration (shown
in figure 1.1) with the controller H (z) = K zz0.9 with the gain K = 1. Is
the closed-loop system stable?
2. For the closed-loop gain K = 1, calculate the phase and magnitude of the
HG when = 5 rad/s.
4. If you would like to find the stability margin of this closed-loop system,
what is the equation you have to evaluate to find it?
hint: the stability margin can be found from
M (z = z ) when
d
M (z) = 0,
dz z=z
what is M (z) ?
Question 3
Consider a system with no input
y (k + 3) 3y (k + 2) 18y (k + 1) + 40y (k ) = 0.
If you are informed that y (0) = 2, y (1) = 3, and y (2) = 4, find the general
solution of y (k). (hint: one root of the equation x3 3x2 18x + 40 = 0 is 2)
control strategy that only relies on easily obtainable state body reaches its maximum height during flight with y = 0.
measurements. Another inquiry on how to achieve effective Another important event, not illustrated in the figure, is bottom,
control of the SLIP model, now extended to a spatial setting, corresponding to the point of maximal leg compression during
Question 4 is provided in [8], focusing on lateral motions of the model. In stance. Table I details the notation used throughout the paper.
conjunction with these studies primarily focused on running
[y , x ] [ya , x a ]k+1
behaviors, similar analytically motivated contributions were
Convert the following discrete-time transfer function to continous-time a a k [rlo, lo, rlo, lo]
also made to the structurally different walking behaviors [15, [td , rtd , td ]
transfer functions 22,
when T = 0.5
40], providing using
evidence that forward, backward,
the same dynamic model can and trapezoid
provide a unified description for both walking and running
rules. Is the discrete-time system stable? What about the continous-time
touchdown
[17].
systems? Our contributions in the present paper have a number of
lifto
apex
apex
A2.
From
4
G (s) =
s2 + 4s + 4
4
=
(s + 2)(s + 2)
Poles of the system are at s = 2, therefore, the system is stable.
Final Value is found from
4 s 4
lim = = 1.
s0 ( s + 2)( s + 2) s 4
From
4
G (s) =
s2
4s + 4
4
= ,
(s 2)(s 2)
and
4 s 4
lim = = 1.
s0 ( s 2)( s 2) s 4
But the poles of the system are at s = 2. Hence, the system is unstable.
There is no final value.
A.3
From figure 1.1 and
Y (s) G (s)
=
U (s) 1 + G (s) H (s)
1
sn
= z )
1 + ( s1 n )( ss p
sp
=
(s n)(s p) + (s z)
The characteristic equation is
(s n)(s p) + (s z) = 0
2
s + (1 n p)s + (np z) = 0
If n=5, then
p > 4
5p > z.
For example, we may choose
p = 5
z = 30.
B.1
u(k) + au(k 1) = b1 e(k 1) + b0 e(k 2) + b1 e(k 3)
B.2
A discrete transfer function is stable if the magnitude off all poles are
smaller than unity, i.e., |1 Ta | < 1. In this case, it becomes
T
1 <1
a
and
T
1 > 1,
a
which can be re-written as T > 0 and 2a > T.
C.1
Applying the Final Value Theorem :
z1 z1 z
lim U (z) = lim
z 1 z z1 z ( z 1)( z 2)
1
= lim ]
z 1 z 2
= 1
Let
a b ( z 2) a + ( z 1) b
U (z) = + = ,
z1 z2 ( z 1) ( z 2)
it follows that
( z 2) a + ( z 1) b = z
( a + b)z + (2a b) = z.
u ( k ) = u ( k 1 ) + 2 2k 1 u ( k 1 )
= u ( k 1 ) + 2k u ( k 1 )
It can be seen that the final value is
lim u(k)
k
The difference is because the system is unstable. The poles of the system
is outside the unit circle, hence u(k) does not have a constant final value.
C.2
From
uk = 0.5uk1 0.5uk2
0 = uk 0.5uk1 + 0.3uk2 .
1 0.5z1 + 0.3z2 = 0
z2 0.5z1 + 0.3 = 0.
We find
p
0.5 (0.5)2 4(0.3)
z=
2
= 0.25 0.487i
|z| = 0.548 < 1.
Therefore, the system is stable.
From
uk = 1.6uk1 uk2
0 = uk 1.6uk1 + uk2
1 1.6z1 + z2 = 0
z2 1.6z + 1 = 0.
We have
p
1.6 (1.6)2 4
z=
2
= 0.8 0.6i
|z| = 1
Therefore, the system is marginally stable.
For
uk = 0.8uk1 + 0.4uk2
0 = uk 0.8uk1 0.4uk2
1 0.8z1 0.4z2 = 0
z2 0.8z1 0.4 = 0,
we get
p
0.8 (0.8)2 + 4(0.4)
z=
2
= 0.4 0.748
z = 1.148 and z = 0.348 < 0
Therefore, the system is not stable.
C.3
Consider the first system.
u = b0 e + x1 ,
where
x1 = (b1 e a1 u + x2 )z1
x2 = (b2 e a2 u + x3 )z1
x3 = (b3 e a3 u)z1 .
Together, we have
u = b0 x1 z + b1 x1 + b2x2 + b3 x3 ,
with
x 1 = ( e a 1 x 1 a 2 x 2 a 3 x 3 ) z 1
x 2 = x 1 z 1
x 3 = x 2 z 1 .
This becomes
u = b0 x1 z + b1 x1 + b2x2 + b3 x3
= b0 x1 z + b1 x1 + b2 x1 z1 + b3 x1 z2
= (b0 z + b1 + b2 z1 + b3 z2 ) x1
x 1 = ( e a 1 x 1 a 2 x 2 a 3 x 3 ) z 1 , (1)
whereas
x1 = ez1 a1 x1 z1 a2 x1 z2 a3 x1 z3
ez1 = x1 + a1 x1 z1 + a2 x1 z2 + a3 x1 z3
e = ( z + a 1 + a 2 z 1 + a 3 z 2 ) x 1 . (2)
u (b z + b1 + b2 z1 + b3 z2 ) x1
H (z) = = 0
e ( z + a 1 + a 2 z 1 + a 3 z 2 ) x 1
b0 z3 + b1 z2 + b2 z1 + b3
= .
z3 + a1 z2 + a2 z1 + a3
As both systems have the same transfer function, they are identical.
C.4
z ( z 1)
F (z) =
z2 1.25z + 0.25
z ( z 1)
=
(z 1)(z 0.25)
z
=
(z 0.25)
1
=
(1 0.25z1 )
Z 1 { F (z)} = 0.25k u(k)
Let
a b
F (z) = + ,
z2 z3
where
a(z 3) + b(z 2) = 8z 19
( a + b)z + (3a 2b) = 8z 19.
By comparing coefficients, the following equations are obtained
(
a+b = 8
3a 2b = 19
Solving the equations yields a = 3 and b = 5. That is
3 5
F (z) = +
z2 z3
3z1 5z1
= +
1 2z1 1 3z1
Z { F (z)} = 3(2 u(k 1)) + 5(3k1 u(k 1)).
1 k 1
D.1
Starting from
16yk+3 20yk+2 + 8yk+1 yk = 5uk+2 7uk+1 + 2uk
16yk z3 20yk z2 + 8yk z yk = 5uk z2 7uk z + 2uk
(16z3 20z2 + 8z 1)yk = (5z2 7z + 2)uk
yk 5z2 7z + 2
H (z) = =
uk 16z3 20z2 + 8z 1
5 1 7 2 2 3
16 z 16 z + 16 z
= 20 1 8 2 1 3
.
1 16 z + 16 z 16 z
Use the canonical form,
20 8 1
16 16 16
A=1 0 0
0 1 0
1
B = 0
0
h i
C = 165 7 2
16 16
D=0
That is
20 8 1
x1 ( k + 1) 16 x1 ( k ) 1
16 16
x2 ( k + 1) = 1 0 0 x2 ( k ) + 0 u ( k )
x3 ( k + 1) 0 1 0 x3 ( k ) 0
h i x1 ( k )
Y (k) = 5 7 2
16 16 16 x2 ( k ) .
x3 ( k )
D.2
From
" #
0.5 1.5
Ad =
1 2
" #
2
Bd =
0
h i
Cd = 1 1
Dd = 2
We have
Y (z)
H (z) = = Cd (zI Ad )1 Bd + Dd
U (z)
" # " #!1 " #
h i z 0 0.5 1.5 2
= 1 1 +2
0 z 1 2 0
" #!1 " #
h i z + 0.5 1.5 2
= 1 1 +2
1 z2 0
" #" #
1 h i z 2 1.5 2
= 2 1 1 +2
z 1.5z + 0.5 1 z + 0.5 0
" #
1 h i 2
= z1 z2 +2
z2 1.5z + 0.5 0
2z 2
= +2
z2
1.5z + 0.5
2z2 z 1
= 2 .
z 1.5z + 0.5
D.4
1
U (z) = U0
1 z 1
Hence,
2 1
Y (z) = U
( z 2 ) 0 1 z 1
2z
= U0
(z 1)(z 2)
By partial fraction,
2 4
Y (z) = U0 +
z1 z2
2z1 4z1
= U0 +
1 z 1 1 2z1
y (k) = U0 (2 u(k 1) + 4 2k1 u(k 1))
= 2U0 u(k 1) + 2k+1 U0 u(k 1)
= 2 2k 1 U0 u(k 1).
E.1
h i
Use the control in the form u (k) = k1 k2 x (k) . The closed-loop
dynamics become
" 2 2
#
1 T2 k1 T T2 k2
x ( k + 1) = x.
Tk1 1 Tk2
h iT
For the observer design, we write L = L1 L2 and find the eigen-
values of A LCA, which becomes
z2 + ( L1 2) z + TL2 + 1 L1 = 0.
E.2
The rise time requirement:
tr = 1.8/r
r > 1.8/0.1 = 18 = 0.57/T.
The poles should be on the left hand side of the red line.
1
0.5/T
0.6/T 0.4/T
0.8 0.7/T 0.10.3/T
0.2
0.6 0.3
0.8/T 0.4 0.2/T
0.5
0.4 0.6
0.7
0.9/T 0.8 0.1/T
0.2 0.9
1/T
0
1/T
0.2
0.9/T 0.1/T
0.4
0.8/T 0.2/T
0.6
0.7/T 0.3/T
0.8
0.6/T 0.4/T
0.5/T
1
1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1
That is
TK2 K1 T 2 /2 2 = 1.2
2
K1 T /2 TK2 + 1 = 0.52.
F.2
You would fne the the phase of the continous transfer function is 55 ,
forward method 74 , backward method 40 , and the bilinear 55 .
Notice that the results might not be the same as what you expected. In
fact, you are not seeing the phase lag/lead effect from the denumerator
of the transfer function. This is because you can re-write the original
transfer function as
s+1
10 .
s + 10
The effect of the denominator would only kick in at the frequency s > 10
(approximately). That is > 10, which is larger than 3 rad/s we tested.
That is why we do not see it.
In this case, the sampling time is 0.25 s (or 4 Hz), hence the maximum
frequency for the discretized system is 2 Hz, or = 2 2 = 12. This is
not really bigger than 10, so we are unlikely to see it.
F.3
Poles are at z = 1.0, 0.9. The system is not stable.
The gain magin is 1/0.5 = 2, consistent with the fact that the system
becomes marginally unstable when K = 2.
G.1
First we convert the system into the state-space form:
" # " #
0 1 0
x (t) = x (t) + u (t)
9 3 1
h i
y (t) = 10 0 x (t) ,
h i
Suppose we use the controller u (k) = K1 K2 x (k). The close-loop
dynamics become
" #
1 0.1
x ( k + 1) = x (k) ,
0.9 0.1K1 0.7 0.1K2
x (k + 1) = ( A LCA) x (k)
" # " # !
1 0.1 L1 h i
= 10 10 x (k )
0.9 0.7 L2
" #
1 10L1 0.1 10L1
= x (k)
0.9 10L2 0.7 10L2
u (k ) = Nu yr K (x (k) Nr yr ) .
G.2
The closed-loop stability is determined from the zeros of 1 + G (z) H (z),
which is
z z2 1.9z + 0.9 + 1 0.05 (z 0.9) (z + 1) = 0
z (z 0.9) (z 1) + 0.05 (z + 1) (z 0.9)
h i
(z 0.9) z2 0.95z + 0.05 = 0
( z + 1)
GH = 0.05
z ( z 1)
z2 + 2z + 1
= 0.05 = 0.05.
z ( z2 1)
That is the magnitude is 0.05 and the phase is 180 . It follows that the
gain margin is 1/0.05 = 20.
1
z = arg max
z |1 + G (z) H (z)|
d
|1 + G (z) H (z)|1 = 0
dz
G.3
A general solution of a linear difference equation is y = Ak . The substi-
tution yields,
3 32 18 + 40 = 0
( 2) ( 5) ( + 4) = 0.
y (0) = A1 + A2 + A3 = 2
y (1) = 2A1 + 5A2 4A3 = 3
y (2) = 4A1 + 25A2 + 16A3 = 4.
13 k 2 k 1
y (k) = 2 5 + (4)k .
6 9 18
G.4
The discrete-time system
z ( z 1) z ( z 1) z
= =
z2 1.25z + 0.25 (z 1) (z 0.25) z 0.25
is stable as the pole is smaller than unity.
G.5
h iT
The state vector x is x = r r . The provided equations of
motion can be re-written as:
k c
r = r 2 g cos (r ri ) r
m m
r g
2 + = sin + .
r r mr2
The dynamics of the system is then
r
r 2 g cos k (r r ) c
x = f (x, ) = m i m r
.
g r
r sin + 2 r + mr2