functionlqg

LQG design algorithm

Information

Syntax

(Kc, Kf, sslqg) = StateSpace.lqg(ss, Q, R, V, W)

Description

This function calculates matrices Kc and Kf for linear quadratic gaussian problem (LQG), i.e. the minimization of the expected value of a cost function in consideration of stochastically disturbed states and outputs of the system

der(x) = Ax + Bu + w
     y = Cx + Du + v

The noise w(t) and v(t) are supposed to be both white, Gaussian zero-mean, stationary stochastic processes with positive semidefinte covariance matrix W

E[w(t)*w'(tau)] = W*delta(t-tau)

and positive covariance matrix V

E[v(t)*v'(tau)] = V*delta(t-tau).

E[s] denotes the expected value of a signal s.

The LQG approach combines the deterministic LQR approach and Kalman filter principle to estimate stochastically disturbed systems, such that input u(t) is given by

u(t) = -Kcx̂(t)

where Kc is a lqr feedback matrix and x̂(t) the reconstructed state vector estimated by a Kalman filter.

Since, the considered problem is stochastic, the objective function to minimize is an expected value

           1      T
J = lim   ---- E[Integral (x'*Q*x + u'*R*u)dt],
  (T->inf) 2T    -T

where the weighting matrices Q and R are, respectively, symmetric positive semidefinite and positive definite.

The feedback matrix Kc is calculated by

Kc = R-1*B'*Xc,

where Xc satisfying the continuous-time algebraic Riccati equation (care)

Q + A'*Xc + Xc*A - Xc*B*R-1*B'*Xc = 0.

The matrix Kf of the filter problem to generate the estimated state vector x̂(t) is given by

Kf = Xf*CT*V-1,

where Xf is satisfying the continuous-time algebraic Riccati equation

W + A*Xf + Xf*A' - Xf*C'*V-1*C*Xf = 0.

The vector x̂(t) satisfies the differential equation

x̂̇(t) = (A - KfC)x̂(t) + (B - KfD)u(t) + Kfy(t)

Combining the equation state feedback and state estimation, the state vector x(t) and the estimated state vector x̂(t) are given by

| ẋ | | A   −BKc |   | x | | I   0 |   | w |
| x |   =   | | | |   +   | | | |
| x̂̇ | | KfC A − BKc − KfC | | x̂ | | 0 Kf | | v | .

Finally, the output sslqg represents the estimated system with y(t), the output of the real system, as the input

x̂̇ = [A - KfC - BKc + KfDKc]*x̂ + Kf*y
ŷ = [C - DKc] x̂

Example

  StateSpace ss=StateSpace(
    A=[-0.02, 0.005, 2.4,  -32; -0.14,  0.44,  -1.3,  -30; 0,  0.018,  -1.6,  1.2; 0, 0, 1, 0],
    B=[0.14,  -0.12; 0.36, -8.6; 0.35, 0.009; 0, 0],
    C=[0, 1, 0, 0; 0, 0, 0, 57.3],
    D=[0,0; 0,0]);

   Real Q[:,:] = transpose(ss.C)*ss.C " state weighting matrix";
   Real R[:,:] = identity(2) " input weighting matrix";
   Real V[:,:] = identity(2) " covariance output noise matrix";
   Real W[:,:] = ss.B*transpose(ss.B) " covariance state noise matrix";
   Real Kc[size(ss.B, 2),size(ss.A, 1)] "Controller feedback gain matrix";
   Real Kf[size(ss.A, 1),size(ss.C, 1)] "Kalman feedback gain matrix";

algorithm
  (Kc, Kf) := StateSpace.Design.lqg(ss, Q, R, V, W);

// Kc = [-0.0033,     0.04719,      14.6421,        60.8894;
          0.0171,    -1.05154,       0.29273,        3.2468]

// Kf = [0.015,     -0.2405;
         9.066,     -0.1761;
         0.009,      0.2289;
        -0.003,      0.08934]

Inputs

TypeNameDefaultDescription
StateSpacessOpen loop system in state space form
Real[size(ss.A, 1),size(ss.A, 2)]Qidentity(size(ss.A, 1))State weighting matrix
Real[size(ss.B, 2),size(ss.B, 2)]Ridentity(size(ss.B, 2))Input weighting matrix
Real[size(ss.C, 1),size(ss.C, 1)]Videntity(size(ss.C, 1))Covariance output noise matrix
Real[size(ss.A, 1),size(ss.A, 1)]Widentity(size(ss.A, 1))Covariance state noise matrix
BooleaniscontinuousSystemtrueTrue, if state space system is continuous

Outputs

TypeNameDefaultDescription
Real[size(ss.B, 2),size(ss.A, 1)]KcController feedback gain matrix
Real[size(ss.A, 1),size(ss.C, 1)]KfKalman feedback gain matrix
StateSpacesslqgClosed loop system

Revisions

Date Author Comment
2010-05-31 Marcus Baur, DLR-RM Realization