Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Optimization Problem

Standard Form

Assume that estimates of x(k), xd(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 ym(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 nd(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.

uj,min uj,max, Δuj,min, Δuj,max, yj,min, yj,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 utarget(k+i) is a setpoint for the input vector. You typically uses utarget 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 ym(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).

Alternative Cost Function

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 ny by ny matrix, and RΔu and Ru are nu by nu 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 Ru are diagonal with the squares of the weights , , and respectively as their diagonal elements.

    Note   When using the alternative cost function, you must define the controller using MATLAB® commands. The Model Predictive Control Toolbox design tool does not provide this option.

Terminal Weights and Constraints

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 Qp , 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, Qp 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:

  1. Augment the model (Equation 2-7) to include the weighted terminal states as auxiliary outputs:

    yaug(k) = Qcx(k)

    where Qc is the Cholesky factorization of Qp such that Qp = QcTQc.

  2. Define the auxiliary outputs yaug as unmeasured, and specify zero weight to them.

  3. Specify unity weight on yaug 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.

    Tip   Robustness to inaccurate model predictions is usually a more important factor than nominal performance in applications.

 Related Examples

Custom Constraints on Inputs and Outputs

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.

 Related Examples

Was this topic helpful?