This section describes the matrices associated with the model predictive control optimization problem described in Optimization Problem.
Then, the prediction model is:
x(k+1) = Ax(k) +Buu(k) +Bvv(k)+Bdnd(k)
y(k) = Cx(k) +Dvv(k) +Ddnd(k)
Next, consider the problem of predicting the future trajectories of the model performed at time k=0. Set nd(i)=0 for all prediction instants i, and obtain
This equation gives the solution
Let m be the number of free control moves, and let z= [z0; ...; zm–1]. Then,
where JM depends on the choice of blocking moves. Together with the slack variable ɛ, vectors z0, ..., zm–1 constitute the free optimization variables of the optimization problem. In the case of systems with a single manipulated variables, z0, ..., zm–1 are scalars.
Blocking Moves: Inputs and Input Iincrements for moves=[2 3 2]
Consider the blocking moves depicted in Blocking Moves: Inputs and Input Iincrements for moves=[2 3 2]. This graph corresponds to the choice moves=[2 3 2], or, equivalently, u(0)=u(1), u(2)=u(3)=u(4), u(5)=u(6), Δ u(0)=z0, Δ u(2)=z1, Δ u(5)=z2, Δ u(1)=Δ u(3)=Δ u(4)=Δ u(6)=0.
Then, the corresponding matrix JM is
The function to be optimized is
Finally, after substituting u(k), Δu(k), y(k), J(z) can be rewritten as
Note You may want the QP problem to remain strictly convex. If the condition number of the Hessian matrix KΔU is larger than 1012, add the quantity 10*sqrt(eps) on each diagonal term. You can use this solution only when all input rates are unpenalized (WΔu=0) (see Weights in the Model Predictive Control Toolbox™ reference documentation).
In this case, the block-diagonal matrices repeat p times, for example, once for each step in the prediction horizon.
You also have the option to use a combination of the standard and alternative forms. See Weights in the Model Predictive Control Toolbox reference documentation for more details.
Next, consider the limits on inputs, input increments, and outputs along with the constraint ɛ≥ 0.
Note To reduce computational effort, the controller automatically eliminates extraneous constraints, such as infinite bounds. Thus, the constraint set used in real time may be much smaller than that suggested in this section.
Similar to what you did for the cost function, you can substitute u(k), Δu(k), y(k), and obtain
In this case, matrices Mz,Mɛ,Mlim,Mv,Mu,Mx are obtained from the upper and lower bounds and ECR values.