Discrete Time Observers and LQG Control: Massachusetts Institute of Technology 2.151 Advanced System Dynamics and Control
Discrete Time Observers and LQG Control: Massachusetts Institute of Technology 2.151 Advanced System Dynamics and Control
The ZOH Plant Model: We consider a continuous LTI plant with state equations
x = Ax + Bu
y = Cx (1)
where the sampling interval T has been made implicit. The block diagram representation
is shown in Fig. 1. We note that, for a zero-order input with updates at intervals T , the
response of the discrete-time system in Eq. (3) will be identical to the continuous plant of
Eq. (1) at the sampling times.
u x x y
k + k + 1 k k
G z -1 C
+
Taking the z transform of Eqs. (3) Gives the pulse transfer-function matrix
1
Discrete-Time Controller Design: The properties of controllability and observability
transfer between the discrete and continuous representations. The discrete-time model may
therefore be used to design controllers for a controllable system described by Eqs. (1). For
example in a pole-placement regulator with control law u(n) = Kx(n) the closed-loop
state equations will be
x(n + 1) = ( K)x(n) (5)
and the eigenvalues may be placed arbitrarily in the z-plane using the same techniques as
for the continuous design. (Note that the effect of pole placement in the z-plane must be
interpreted differently from the s-plane).
Discrete-Time Full Observer: The discrete-time model of Eqs. (3) may be used to
generate an observer based controller for the continuous plant, with the assumption of zero-
order command. We assume that the system is observable, and that we desire estimates
x(k) of the state x(k) based on observation of the output y alone. As in the case of the
continuous observer, we use feedback of the estimator error y(k) Cx(k) as a correction
term
x(k + 1|k) = x(k|k 1) + u(k) + Ke [y(k) Cx(k|k 1)] (6)
where Ke is the observer gain matrix, and the notation x(k + 1|k) denotes that the estimate
(or prediction) of x(k + 1) is made using measurements available at time k.
Define the estimation error x as
x = x x, (7)
subtraction of Eq. (3) from Eq. (6) gives the error difference equation:
which allows arbitrary z-plane placement of the observer poles, as in the continuous case.
The observer described by Eq. (6) is known as a prediction observer, based on the fact
that it predicts the state values at the next time step from past measurements. This means
that control based on x(k) does not depend on the most current measurements, which might
lead to performance degradation. it is useful to construct an alternative observer formulation
that provides a current estimator x(k) based on the most recent measurements of y. Modify
Eq. (6) to estimate
x(k) = x(k 1) + u(k 1) (9)
and
x(k|k) = x(k) + Ke [y(k) Cx(k|k 1)] (10)
where x(k) is the estimate based on the prediction from the previous time step. Substitution
of Eq. (10) into Eq. (9) and advancing one time-step gives
The block diagram of the current observer is shown in Fig. 3. The question then becomes
which of the two estimators should be used in closed-loop feedback design? In general,
2
y k
u x x +
k + k + 1 k -
G z -1 C
+
F
x +
k
K e
+
because it is based on the most recent sample, one should use the current estimate because
it provides the fastest response to unknown disturbances or measurement errors.
The use of the current observer in a state-feedback controller with a continuous plant is
shown in Fig. 3.
u k = -K x k u (t)= u (k T ) .
P la n t y (t) y k = y (k T )
D A C x = A x + B u A D C
y = C x
C o n tin u o u s
x x +
+ k + 1 k -
G z -1 C
+
F
x k +
K K e
+
Figure 3: Discrete-time state feedback control of a continuous plant using a current discrete
observer
3
and have covariances defined by
n o n o
E w(k)wT (k) = Rw and E v(k)vT (k) = Rv
The optimization task is to determine a set of observer gains Ke to minimize the variance
of the estimation error, which is denoted P(k):
n o
P(k) = E (x(k) x(k))(x(k) x(k))T ,
in the presence of the process and measurement noise. The derivation is beyond the scope
of this handout, we simply state that the solution is a structure the same as the full-state
current observer with set of time-varying gains Ko
where
Ko (k) = P(k)CT R1
v (15)
and where P(k) is found from
The matrix M(k) is the covariance of the state estimates x(k) before the measurement. The
estimate x(k) is found from x(k 1) using Eq. (13) with w(k 1) = 0 because we know that
this is the expected value since the expected value of the plant noise is zero. Thus
This equation is known as the time update, whereas the change in the estimate from x(k)
to x(k) after measuring y(k) in Eq. (14) is known as the measurement update. The matrix
M (k) is updated as
M(k + 1) = P(k)T + 1 Rw T1 (18)
The solution starts with assumed initial values for M(0) and x(0). At each time step the
filter is updated in two steps:
4
w (t) v (t)
u (t)= u (k T ) y k = y (k T )
u = -K x P la n t y (t)
k k .
D A C x = A x + B u A D C
y = C x
C o n tin u o u s
x x +
+ k + 1 k -
G z -1 C
+
C o n tr o l g a in s F K a lm a n filte r g a in s
x k +
K K o (k )
+
A block diagram for the closed-loop control of a continuous plant using a Kalman-filter
estimator is shown in Fig. 4.
In an actual design problem, meaningful values can be assigned to Rv , which is based on
sensor noise which can often be found from the specifications. The same cannot be said of
the process noise, which is often an mathematical artifice that is used to expedite the opti-
mization. Physically, Rw is used to account for unknown disturbances and uncertainties in
the plant model. The disturbance noise model should be chosen to approximate any known
disturbances, but the designer is often forced to use acceptable values based on simulation
studies.
K = M CT (CM CT + Rv )1 (19)
and
M = X1
where " #
X
5
are the stable eigenvectors.
LQG Design Example Using Matlab: Consider the coupled-mass system in Fig. (5)
Under the influence of applied force u(t). The system has equations of motion:
+ K(y d) = u
M y + B(y d)
md + B(d y) + K(d y) = 0;
If we assume that the measurable outputs are the displacements d and y, the state and
output equations are:
0 1 0 0 0
K/m B/m K/m B/m 0
x = x + u
0 0 0 1 0
K/M B/M K/M B/M 1/M
" #
1 0 0 0
y = x
0 0 1 0
h iT
where x = d d y y . The following parameters are used: M = 1, m = 0.1, K = 0.091,
B = 0.0036. A sampling period of T = 0.4 s. is assumed. With these values the state
equations are:
0 1 0 0 0
0.91 0.036 0.91 0.036 0
x = x + u
0 0 0 1 0
0.091 0.0036 0.091 0.0036 1
The following Matlab script takes the plant model, discretizes it using a ZOH discrete
model, chooses LQR gains, forms a Kalman-filter observer for state estimation, combines
6
the plant, controller, and observer models and plots some initial condition responses of the
closed-loop system:
7
Rw = input(Enter estimator Rw: );
sensors = [1, 2]; % d and y are sensed
known = [1]; % force u
P = ss(Phi, [Gamma Gamma], C, [D D], T);
[Observer, Ko] = kalman(P, Rw, Rv, [], sensors, known);
%-----------------------------------------------------------
% Create the regulator and the closed-loop system
%
lqg_reg = lqgreg(Observer, K, current);
feedin = [1]; % force u
feedout = [1, 2]; % d and y
Gcl = feedback(ZOH, lqg_reg, feedin, feedout, +1);
%-----------------------------------------------------------
% Compute and plot the initial condition response
% Set x_1(0) = 1, all others to zero.
x0 = zeros(8,1);
x0(1) = 1;
figure(1), clf
initial(Gcl, x0)
% Plot all states and compare actual values with Kalman estimates
[y, t, x] = initial(Gcl, x0, 10);
figure(2), clf
subplot(2,2,1), stairs(t,x(:, [1 5])), grid, legend(x_1=d, x_1hat, 0)
title(Response of states and predictive estimates to x_1(0) = 1), ...
xlabel(Time (s))
subplot(2,2,2), stairs(t,x(:, [2 6])), grid, legend(x_2=ddot, x_2hat, 0)
xlabel(Time (s))
subplot(2,2,3), stairs(t,x(:, [3 7])), grid, legend(x_3=y, x_3hat, 0)
xlabel(Time (s))
subplot(2,2,4), stairs(t,x(:, [4 8])), grid, legend(x_4=ydot, x_4hat, 0)
xlabel(Time (s))
%---------------------------------------------------------------
References:
1. Franklin, G.F., Powell, J. D., Workman, M.L. Digital Control of Dynamic Systems
(3rd Ed.), Addison Wesley
2. Philips, C.L., Nagle, H.T. Digital Control System Analysis and Design (2nd Ed.),
Prentice Hall