Lec19 - Linear Quadratic Regulator
Lec19 - Linear Quadratic Regulator
19.1
The simple form of loopshaping in scalar systems does not extend directly to multivariable (MIMO) plants, which are characterized by transfer matrices instead of transfer functions. The notion of optimality is closely tied to MIMO control system design. Optimal controllers, i.e., controllers that are the best possible, according to some gure of merit, turn out to generate only stabilizing controllers for MIMO plants. In this sense, optimal control solutions provide an automated design procedure we have only to decide what gure of merit to use. The linear quadratic regulator (LQR) is a well-known design technique that provides practical feedback gains.
93
19.2
Full-State Feedback
For the derivation of the linear quadratic regulator, we assume the plant to be written in state-space form x = Ax + Bu, and that all of the n states x are available for the controller. The feedback gain is a matrix K, implemented as u = K(xxdesired ). The system dynamics are then written as: x = (A BK)x + BKxdesired . (210)
xdesired represents the vector of desired states, and serves as the external input to the closedloop system. The A-matrix of the closed loop system is (A BK), and the B-matrix of the closed-loop system is BK. The closed-loop system has exactly as many outputs as inputs: n. The column dimension of B equals the number of channels available in u, and must match the row dimension of K. Pole-placement is the process of placing the poles of (A BK) in stable, suitably-damped locations in the complex plane.
19.3
First we develop a general procedure for solving optimal control problems, using the calculus of variations. We begin with the statement of the problem for a xed end time tf : choose u(t) to minimize J = (x(tf )) +
tf to
where (x(tf ), tf ) is the terminal cost; the total cost J is a sum of the terminal cost and an integral along the way. We assume that L(x(t), u(t), t) is nonnegative. The rst step is to augment the cost using the costate vector (t). J = (x(tf )) +
tf to
(L + T (f x))dt
(214)
Clearly, (t) can be anything we choose, since it multiplies f x = 0. Along the optimum should vanish. This follows from the fact that J is trajectory, variations in J and hence J chosen to be continuous in x, u, and t. We write the variation as J = x x(tf ) +
tf to
where subscripts denote partial derivatives. The last term above can be evaluated using integration by parts as and thus
tf to
Lx x + Lu u + T fx x + T fu u T x dt,
(215)
tf to
T xdt,
(216)
94
J = x (x(tf ))x(tf ) +
tf to
tf to
(Lu + T fu )udt +
(217)
Now the last term is zero, since we cannot vary the initial condition of the state by changing something later in time - it is a xed value. This way of writing J makes it clear that there are three components of the variation that must independently be zero (since we can vary any of x, u, or x(tf )): Lu + T fu = 0 Lx + T fx + T = 0 x (x(tf )) T (tf ) = 0. The second and third requirements are met by explicitly setting T = Lx T fx T (tf ) = x (x(tf )). (221) (222) (218) (219) (220)
The evolution of is given in reverse time, from a nal state to the initial. Hence we see the primary diculty of solving optimal control problems: the state propogates forward in time, while the costate propogates backward. The state and costate are coordinated through the above equations.
19.4
Numerical solutions to the general problem are iterative, and the simplest approach is the gradient method. It is outlined as follows: 1. For a given xo , pick a control history u(t). 2. Propogate x = f (x, u, t) forward in time to create a state trajectory. 3. Evaluate x (x(tf )), and the propogate the costate backward in time from tf to to , using Equation 221. 4. At each time step, choose u = K(Lu + T fu ), where K is a positive scalar or a positive denite matrix in the case of multiple input channels. 5. Let u = u + u. 6. Go back to step 2 and repeat loop until solution has converged.
95
The rst three steps are consistent in the sense that x is computed directly from x(to and u, and is computed directly from x and x(tf ). All of J in Equation 217 except the integral with u is therefore eliminated explicitly. The choice of u in step 4 then achieves J < 0,
unless u = 0, in which case the problem is solved.
The gradient method is quite popular in applications and for complex problems may be the
only way to eectively develop a solution. The major diculties are computational expense,
and the requirement of having a reasonable control trajectory to begin.
19.5
LQR Solution
In the case of the Linear Quadratic Regulator (with zero terminal cost), we set = 0, and 1 1 L = xT Qx + uT Ru, 2 2 (223)
where the requirement that L 0 implies that both Q and R are positive denite. In the case of linear plant dynamics also, we have
Lx Lu fx fu so that
= = = =
xT Q uT R A B,
x x(to ) = Qx AT (tf ) Ru + B T
= Ax + Bu = xo = 0 = 0.
Since the systems are clearly linear, we try a connection = P x. Inserting this into the equation, and then using the x equation, and a substitution for u, we obtain P Ax + AT P x + Qx P BR1 B T P x + P = 0. (233)
This has to hold for all x, so in fact it is a matrix equation, the matrix Riccati equation. The steady-state solution is given satises P A + AT P + Q P BR1 B T P = 0. (234)
96
19.6
This equation is the matrix algebraic Riccati equation (MARE), whose solution P is needed to compute the optimal feedback gain K. The MARE is easily solved by standard numerical tools in linear algebra. The equation Ru + B T = 0 gives the feedback law: u = R1 B T P x. (235)
19.7
Static Gain. The LQR generates a static gain matrix K, which is not a dynamical system. Hence, the order of the closed-loop system is the same as that of the plant. Robustness. The LQR achieves innite gain margin: kg = , implying that the loci of (P C) (scalar case) or (det(I +P C)1) (MIMO case) approach the origin along the imaginary axis. The LQR also guarantees phase margin 60 degrees. This is in good agreement with the practical guidelines for control system design. Output Variables. In many cases, it is not the states x which are to be minimized, but the output variables y. In this case, we set the weighting matrix Q = C T Q C, since y = Cx, and the auxiliary matrix Q weights the plant output. Behavior of Closed-Loop Poles: Expensive Control. When R >> C T Q C, the cost function is dominated by the control eort u, and so the controller minimizes the control action itself. In the case of a completely stable plant, the gain will indeed go to zero, so that the closed-loop poles approach the open-loop plant poles in a manner consistent with the scalar root locus. The optimal control must always stabilize the closed-loop system, however, so there should be some account made for unstable plant poles. The expensive control solution puts stable closed-loop poles at the mirror images of the unstable plant poles. Behavior of Closed-Loop Poles: Cheap Control. When R << C T Q C, the cost function is dominated by the output errors y, and there is no penalty for using large u. There are two groups of closed-loop poles. First, poles are placed at stable plant zeros, and at the mirror images of the unstable plant zeros. This part is akin to the high-gain limiting case of the root locus. The remaining poles assume a Butterworth pattern, whose radius increases to innity as R becomes smaller and smaller. The Butterworth pattern refers to an arc in the stable left-half plane, as shown in the gure. The angular separation of n closed-loop poles on the arc is constant, and equal to 180 /n. An angle 90 /n separates the most lightly-damped poles from the imaginary axis.
97
/2 n=4 = 45 degrees
X /2 X
19.8
The above stated properties of the LQR control are not dicult to prove. We need an intermediate tool (which is very useful in its own right) to prove it: the Liapunov function. Consider a scalar, continuous, positive denite function of the state V (x). If this function is always decreasing, except at the origin, then the origin is asymptotically stable. There is an intuitive feel to the Liapunov function; it is like the energy of a physical system. If it can be shown that energy is leaving such a system, then it will settle. It suces to nd one Liapunov function to show that a system is stable. Now, in the case of the LQR control, pick V (x) = 1 xT P x.
2 It can be shown that P is positive denite; suppose that instead of the design gain B, we
have actual gain B , giving (with constant P based on the design system)
V = 2xT P x T = 2x P (Ax B R1 B T Kx) = xT (Q + P BR1 B T P )x 2xT KB R1 B T P x. (236) (237) (238)
where we used the Riccati equation in a substitution. Since we require V < 0 for x = 0, we must have Q + P BG 2P (B B )G > 0, (239)
where G = R B P . Let B = BN , where N is a diagonal matrix of random, unknown gains on the control channels. The above equation becomes Q P B(I 2N )R1 B T P > 0. (240)
This is satised if, for all channels, Ni,i > 1/2. Thus, we see that the LQR provides for one-half gain reduction, and innite gain amplication, in all channels.
98
20 KALMAN FILTER
The phase margin is seen (roughly) by allowing N to be a diagonal matrix of transfer functions Ni,i = eji . In this case, we require that the real part of Ni,i is greater than onehalf. This is true for all |i | < 60 , and hence sixty degrees of phase margin is provided in all channels.