Introduction to Constrained Control Graham C. Goodwin September 2004 Centre for Complex Dynamic Systems and Control 1.1 Background Most of the literature on Control Theory deals with Linear Unconstrained Systems. However to get the most out of a system, we usually need to deal with nonlinearities. The most common nonlinearity met in practice are Actuator Limits. Centre for Complex Dynamic Systems and Control To get the most out of a system you need to push up against limits. Centre for Complex Dynamic Systems and Control Other examples? Playing sport at international level Excelling in business or academia Aerospace, chemical process control, . . . Control is a key enabling technology in many (all?) areas Getting the most out of control means pushing against boundaries Centre for Complex Dynamic Systems and Control 1.2 Approaches to Constrained Control Cautious (back off performance demands so constraints are not met) Serendipitous (allow occasional constraint violation) Evolutionary (begin with a linear design and add embellishments, for example, antiwindup) Tactical (include constraints from the beginning, for example, MPC) Centre for Complex Dynamic Systems and Control 1.3 Example: Rudder Roll Stabilisation of Ships (See lecture 3.5) It has been observed that unless appropriate actions are taken to deal with constraints, then the performance of rudder roll stabilisation systems can be worse than if nothing is done due to the effect of actuator amplitude and slew rate constraints. Centre for Complex Dynamic Systems and Control 1.4 Model Predictive Control Model Predictive Control (MPC) is a prime example of tactical method. Long history in petrochemical industry. Many thousands of applications. Several commercial products. Industrial “credibility”. Centre for Complex Dynamic Systems and Control Background A survey by Mayne et al. (2000) divides the literature on MPC in three categories: Theoretical foundations: the optimal control literature. Dynamic Programming (Bellman 1957), the Maximum Principle (for example, Lee & Markus 1967). “Process control” literature, responsible for MPC’s adoption by industry. Evolving generations of MPC technology. An example of practice leading theory. “Modern” literature, dealing with theoretical advances such as stability and robustness. Centre for Complex Dynamic Systems and Control General Description MPC is a control strategy which, for a model of the system, optimises performance (measured through a cost function) subject to constraints on the inputs, outputs and/or internal states. Due to the presence of constraints it is difficult, in general, to obtain closed formulae that solve the above control problem. Hence, MPC has traditionally solved the optimisation problem on line over a finite horizon using the receding horizon technique. This has also restricted the applicability of MPC to processes with slow time constants that allow the optimisation to be solved on line. Recent results allow faster systems to be handled. Centre for Complex Dynamic Systems and Control An Illustrative Example We will base our design on linear quadratic regulator [LQR] theory. Thus, consider an objective function of the form: VN ({xk }, {uk }) , N −1 1 1 X xN PxN + xk Qxk + uk Ruk , 2 2 (1) k =0 where {uk } denotes the control sequence {u0 , u1 , . . . , uN −1 }, and {xk } denotes the corresponding state sequence {x0 , x1 , . . . , xN }. In (1), {uk } and {xk } are related by the linear state equation: xk +1 = Axk + Buk , k = 0, 1, . . . , N − 1, where x0 , the initial state, is assumed to be known. Centre for Complex Dynamic Systems and Control The following parameters allow one to influence performance: the optimisation horizon N the state weighting matrix Q the control weighting matrix R the terminal state weighting matrix P For example, reducing R gives less weight on control effort, hence faster response. R → 0 is called “cheap control”. Centre for Complex Dynamic Systems and Control Details of Example Consider the specific linear system: xk +1 = Axk + Buk , (2) yk = Cxk , with " 1 A= 0 # 1 , 1 " # 0.5 B= , 1 h C= 1 i 0 , which is the zero-order hold discretisation with sampling period 1 of the double integrator d 2 y (t ) = u(t ). dt 2 Centre for Complex Dynamic Systems and Control Example eplacements controller uk sat xk linear system Figure: Feedback control loop for Example 1 if u > 1, sat(u) , u if |u| ≤ 1, −1 if u < −1. (3) Centre for Complex Dynamic Systems and Control (i) Cautious Design " 1 (N = ∞, P = 0) and weighting matrices Q = C C = 0 R = 20 gives the linear state feedback law: h uk = −Kxk = − 0.1603 # 0 and 0 i 0.5662 xk . Centre for Complex Dynamic Systems and Control Cautious Design 1 0.8 uk 0.6 0.4 0.2 0 −0.2 −0.4 0 5 10 k 15 20 25 0 5 10 k 15 20 25 1 0 −1 −2 yk ag replacements −3 −4 −5 −6 Figure: uk and yk for the cautious design uk = −Kxk with weights Q = C C and R = 20. Centre for Complex Dynamic Systems and Control (ii) Serendipitous Design Using the same Q = C C in the infinite horizon objective function we try to obtain a faster response by reducing the control weight to R = 2. We expect that this will lead to a control law having “higher gain.” Centre for Complex Dynamic Systems and Control Serendipitous Design 3 uk 2 1 0 −1 0 5 10 k 15 20 25 0 5 10 k 15 20 25 1 0 −1 −2 yk ag replacements −3 −4 −5 −6 Figure: uk and yk for the unconstrained LQR design uk = −Kxk (dashed line), and for the serendipitous strategy uk = −sat(Kxk ) (circle-solid line), with weights Q = C C and R = 2. Centre for Complex Dynamic Systems and Control Encouraged by the above result, we might be tempted to “push our luck” even further and aim for an even faster response by further reducing the weighting on the input signal. Accordingly, we decrease the control weighting in the LQR design even further, for example, to R = 0.1. Centre for Complex Dynamic Systems and Control 6 4 uk 2 0 −2 −4 −6 0 5 10 k 15 20 25 0 5 10 k 15 20 25 4 2 yk ag replacements 0 −2 −4 −6 Figure: uk and yk for the unconstrained LQR design uk = −Kxk (dashed line), and for the serendipitous strategy uk = −sat(Kxk ) (circle-solid line), with weights Q = C C and R = 0.1. Centre for Complex Dynamic Systems and Control The control law u = −sat(Kx ) partitions the state space into three regions in accordance with the definition of the saturation function (3). Hence, the serendipitous strategy can be characterised as a switched control strategy in the following way: −Kx u = K(x ) = 1 −1 if x ∈ R0 , (4) if x ∈ R1 , if x ∈ R2 . Notice that this is simply an alternative way of describing the serendipitous strategy since for x ∈ R0 the input actually lies between the saturation limits. The partition is shown in following figure. Centre for Complex Dynamic Systems and Control Figure 5 4 3 2 xk2 1 0 ag replacements −1 R2 −2 R0 −3 −4 −6 R1 −4 −2 xk1 0 2 4 6 Figure: State space trajectory and space partition for the serendipitous strategy uk = −sat(Kxk ), with weights Q = C C and R = 0.1. Centre for Complex Dynamic Systems and Control Examination of figure 8 suggests a heuristic argument as to why the serendipitous control law may not be performing well in this case. We can think, in this example, of x 2 as “velocity” and x 1 as “position.” Now, in our attempt to change the position rapidly (from −6 to 0), the velocity has been allowed to grow to a relatively high level (+3). This would be fine if the braking action were unconstrained. However, our input (including braking) is limited to the range [−1, 1]. Hence, the available braking is inadequate to “pull the system up”, and overshoot occurs. Centre for Complex Dynamic Systems and Control (iii) Tactical Design Perhaps the above heuristic argument gives us some insight into how we could remedy the problem. A sensible idea would seem to be to try to “look ahead” and take account of future input constraints (that is, the limited braking authority available). To test this idea, we take the objective function (1) as a starting point. Centre for Complex Dynamic Systems and Control Tactical Design We use a prediction horizon N = 2 and minimise, at each sampling instant i and for the current state xi , the two-step objective function: i +1 1 X 1 V2 ({xk }, {uk }) = xi+2 Pxi +2 + xk Qxk + uk Ruk , 2 2 (5) k =i subject to the equality and inequality constraints: xk +1 = Axk + Buk , |uk | ≤ 1, (6) for k = i and k = i + 1. Centre for Complex Dynamic Systems and Control Tactical Design In the objective function (5), we set, as before, Q = C C , R = 0.1. The terminal state weighting matrix P is taken to be the solution of the Riccati equation P = A PA + Q − K (R + B PB )K , where K = (R + B PB )−1 B PA is the corresponding gain. Centre for Complex Dynamic Systems and Control Tactical Design As a result of minimising (5) subject to (6), we obtain an optimal fixed-horizon control sequence {ui , ui +1 }. We then apply the resulting value of ui to the system. The state evolves to xi +1 . We now shift the time instant from i to i + 1 and repeat this procedure. This is called receding horizon control [RHC] or model predictive control. Centre for Complex Dynamic Systems and Control Receding Horizon Technique (1) At time i and for the current state xi solve an open-loop (OL) optimal control problem over a prediction horizon using a model of the system to predict future states and taking into account the present and future constraints; (2) Apply the first step of the resulting optimal OL control sequence; 0 1 2 3 k 0 1 2 3 k (3) “Move the horizon”, that is, repeat the procedure at time i + 1 for the current state xi + 1. 0 1 2 3 4 k Centre for Complex Dynamic Systems and Control 6 4 uk 2 0 −2 −4 −6 0 5 10 k 15 20 25 0 5 10 k 15 20 25 4 2 yk ag replacements 0 −2 −4 −6 Figure: uk and yk for the unconstrained LQR design uk = −Kxk (dashed line), and for the receding horizon design (circle-solid line), with weights Q = C C and R = 0.1. Centre for Complex Dynamic Systems and Control We will see later that the receding horizon strategy described above also leads to a partition of the state space into different regions in which affine control laws hold. The result is shown (for interest) in figure 9. The region R2 corresponds to the region R2 in figure 8 and represents the area of state space where u = −1 is applied. Comparing figure 8 and figure 9 we see that the region R2 has been “bent over” in the figure 8 so that u = −1 occurs at lower values of x 2 (velocity) than was the case in figure 8. This is in accordance with our heuristic argument about “needing to brake earlier.” Centre for Complex Dynamic Systems and Control Figure 7 4 3 R3 R2 2 R0 1 xk2 g replacements 0 −1 R1 −2 R4 −3 −4 −6 −4 −2 xk1 0 2 4 6 Figure: State space plot for the receding horizon tactical design. Centre for Complex Dynamic Systems and Control Figure 5 and Figure 7 4 4 PSfrag replacements 3 2 1 1 R3 R2 R0 xk2 2 xk2 ents 3 0 0 −1 −1 R2 R1 −2 −2 R4 R0 −3 −4 −6 −3 R1 −4 −2 0 xk1 2 4 6 Figure: State space trajectory and space partition for the serendipitous strategy uk = −sat(Kxk ), with weights Q = C C and R = 0.1. −4 −6 −4 −2 0 xk1 2 4 6 Figure: State space plot for the receding horizon tactical design. Centre for Complex Dynamic Systems and Control Summary Can often avoid constraints by lowering performance demands However, this is at a cost If we increase demands - constraints are met Small violations not too significant Soon get poor performance Rethink the problem - add constraints into the design Leads to idea of Receding Horizon Control Centre for Complex Dynamic Systems and Control