Documentation Center |
On this page… |
---|
Assume that estimates of x(k), x_{d}(k) are available at time k (for state estimation, see State Estimation). The model predictive control action at time k is obtained by solving the optimization problem:
(2-3) |
In this equation, the subscript "( )_{j}"denotes the j component of a vector, "(k+i|k)" denotes the value predicted for time k+i. This predictive value is based on the information available at time k. r(k) is the current sample of the output reference, subject to
where
i = 0, ..., p–1
h = m, ..., p–1
with respect to the sequence of input increments {Δu(k|k),...,Δu(m-1+k|k)} and to the slack variable ɛ. The control action sent to the plant is u(k)=u(k–1)+Δu(k|k)*. In this case, Δu(k|k)* is the first element of the optimal sequence.
Note Only the measured output vector y_{m}(k) is fed back to the model predictive controller. However, r(k) is a reference for all the outputs (measured and unmeasured). |
When the reference r is not known in advance, the current reference r(k) is used over the whole prediction horizon, so r(k+i+1)=r(k) in Equation 2-3.
In model predictive control, the exploitation of future references is referred to as anticipative action (or look-ahead or preview). You can perform a similar anticipative action for measured disturbances v(k). In this prediction, you obtain d(k+i) by setting n_{d}(k+i)=0 as shown in Model Used for Optimization.
, , are nonnegative weights for the corresponding variable. The smaller the value of w, the less important the behavior of the corresponding variable is to the overall performance.
u_{j,}_{min} u_{j,}_{max}, Δu_{j,}_{min}, Δu_{j}_{,max}, y_{j}_{,min}, y_{j}_{,max} are lower/upper bounds on the corresponding variables. In Equation 2-3, the constraints on u, Δu, and y are relaxed or softened by introducing the slack variable ɛ≥ 0. In Equation 2-4, the weight ρ_{ɛ} on the slack variable ɛ penalizes the violation of the constraints. As ρ_{ɛ} increases relative to the input and output weights, the controller gives minimization of constraint violations higher priority.
The Equal Concern for the Relaxation (ECR) vectors , , , , , have nonnegative entries that quantify the concern for relaxing the corresponding constraint; the larger V, the softer the constraint. V=0 means the constraint is hard and cannot be violated. By default, all input constraints are hard ( ) and all output constraints are soft ( ). Also, by default:
(2-4) |
The model predictive controller penalizes the worst case soft constraint violation—the one for which the inclusion of the non-zero slack variable (and the associated ECR value) allows the constraint to be satisfied at equality. As the model predictive controller attempts to minimize the cost function, it might increase violations of other soft constraints. You can use the ECR values to adjust the priority. Doing so allows you to determine which constraint is selected as the worst-case violation.
Vector u_{target}(k+i) is a setpoint for the input vector. You typically uses u_{target} when the number of inputs is greater than the number of outputs. Doing so specifies a preferred value for the inputs when all other objectives have been achieved.
As mentioned earlier, only Δu(k|k) is actually used to compute u(k). The remaining samples Δ u(k+i|k) are discarded, and a new optimization problem based on y_{m}(k+1) is solved at the next sampling step k+1.
The algorithm implemented in the Model Predictive Control Toolbox™ software uses different procedures depending on the presence of constraints. If there are no constraints, the controller uses a fast analytical solution to obtain its optimal moves at each sampling instant. Otherwise, a Quadratic Programming (QP) solver is used. The matrices associated with the quadratic optimization problem are described in QP Matrices.
If, for numerical reasons, the QP problem becomes infeasible, the second sample from the previous optimal sequence is applied, i.e. u(k)=u(k–1)+Δ^{*}u(k|k–1).
You have the option to use the following quadratic objective instead of the standard one (Equation 2-3):
(2-5) |
In this equation,Q is an n_{y} by n_{y} matrix, and R_{Δ}_{u} and R_{u} are n_{u} by n_{u} matrices, all positive semidefinite. Equation 2-5 allows nonzero, off-diagonal weights but uses the same weights at each step in the prediction horizon.
Equation 2-3 and Equation 2-5 are equivalent when:
Weights , , and are constant for all i = 1, ..., p.
Matrices Q, R_{Δ}_{u} and R_{u} are diagonal with the squares of the weights , , and respectively as their diagonal elements.
Terminal weights are the quadratic weights Wy on y(t+p) and Wu on u(t + p – 1). The variable p is the prediction horizon. You apply the quadratic weights at time k +p only, such as the prediction horizon's final step. Using terminal weights, you can achieve infinite horizon control that guarantees closed-loop stability. However, before using terminal weights, you must distinguish between problems with and without constraints.
Terminal constraints are the constraints on y(t + p) and u(t + p – 1), where p is the prediction horizon. You can use terminal constraints as an alternative way to achieve closed-loop stability by defining a terminal region.
Note: You can use terminal weights and constraints only at the command-line. See setterminal. |
For the relatively simple unconstrained case, a terminal weight can make the finite-horizon Model Predictive Controller behave as if its prediction horizon were infinite. For example, the MPC controller behavior is identical to a linear-quadratic regulator (LQR). The standard LQR derives from the cost function:
(2-6) |
where x is the vector of plant states in the standard state-space form:
x(k + 1) = Ax + Bu(k) | (2-7) |
The LQR provides nominal stability provided matrices Q and R meet certain conditions. You can convert the LQR to a finite-horizon form as follows:
(2-8) |
where Q_{p} , the terminal penalty matrix, is the solution of the Riccati equation:
(2-9) |
You can obtain this solution using the lqr command in Control System Toolbox™ software.
In general, Q_{p} is a full (symmetric) matrix. You cannot use the standard Model Predictive Control Toolbox cost function to implement the LQR cost function. The only exception is for the first p – 1 steps if Q and R are diagonal matrices. Also, you cannot use the alternative cost function because it employs identical weights at each step in the horizon. Thus, by definition, the terminal weight differs from those in steps 1 to p – 1. Instead, use the following steps:
Augment the model (Equation 2-7) to include the weighted terminal states as auxiliary outputs:
y_{aug}(k) = Q_{c}x(k)
where Q_{c} is the Cholesky factorization of Q_{p} such that Q_{p} = Q_{c}^{T}Q_{c}.
Define the auxiliary outputs y_{aug} as unmeasured, and specify zero weight to them.
Specify unity weight on y_{aug} at the last step in the prediction horizon using setterminal.
To make the Model Predictive Controller entirely equivalent to the LQR, use a control horizon equal to the prediction horizon. In an unconstrained application, you can use a short horizon and still achieve nominal stability. Thus, the horizon is no longer a parameter to be tuned.
When the application includes constraints, the horizon selection becomes important. The constraints, which are usually softened, represent factors not considered in the LQR cost function. If a constraint becomes active, the control action deviates from the LQR (state feedback) behavior. If this behavior is not handled correctly in the controller design, the controller may destabilize the plant.
For an in-depth discussion of design issues for constrained systems see [2]. Depending on the situation, you might need to include terminal constraints to force the plant states into a defined region at the end of the horizon, after which the LQR can drive the plant signals to their targets. Use setterminal to add such constraints to the controller definition.
The standard (finite-horizon) Model Predictive Controller provides comparable performance, if the prediction horizon is long. You must tune the other controller parameters (weights, constraint softening, and control horizon) to achieve this performance.
As discussed previously, Model Predictive Control Toolbox software allows you to add upper and lower bounds on manipulated variables and plant outputs. You can also use the toolbox to constrain linear combinations of these signals. For example, you might want a particular manipulated variable to be greater than the weighted sum of two other manipulated variables. You provide such constraints in the form:
Eu(k + j|k) + Fy(k + j|k) + Sv(k + j|k) ≤ g + εh
In this equation, j = 0,...,p, E, F, S, g, and h are constants. The variable p is the prediction horizon, ε is the slack variable used for constraint softening (as in Equation 2-3). Thus, each row of E, F, S, g, and h represents a linear constraint to be imposed at each prediction horizon step.
Note: Custom constraints can be specified only at the command line. See setconstraint. |