Choose Sample Time and Horizons
Recommended practice is to choose the control interval duration (controller property Ts) initially, and then hold it constant as you tune other controller parameters. If it becomes obvious that the original choice was poor, you can revise Ts. If you do so, you might then need to retune other settings.
Qualitatively, as Ts decreases, rejection of unknown disturbance usually improves and then plateaus. The Ts value at which performance plateaus depends on the plant dynamic characteristics.
However, as Ts becomes small, the computational effort increases dramatically. Thus, the optimal choice is a balance of performance and computational effort.
In Model Predictive Control, the prediction horizon, p is also an important consideration. If one chooses to hold the prediction horizon duration (the product p*Ts) constant, p must vary inversely with Ts. Many array sizes are proportional to p. Thus, as p increases, the controller memory requirements and QP solution time increase.
Consider the following when choosing Ts:
As a rough guideline, set Ts between 10% and 25% of your minimum desired closed-loop response time.
Run at least one simulation to see whether unmeasured disturbance rejection improves significantly when Ts is halved. If so, consider revising Ts.
For process control, Ts >> 1 s is common, especially when MPC supervises lower-level single-loop controllers. Other applications, such as automotive or aerospace, can require Ts < 1 s. If the time needed for solving the QP in real time exceeds the desired control interval, consider the Explicit MPC option.
For plants with delays, the number of state variables needed for modeling delays is inversely proportional to Ts.
For open-loop unstable plants, if p*Ts is too large, such that the plant step responses become infinite during this amount of time, key parameters needed for MPC calculations become undefined, generating an error message.
The controller inherits its time unit from the plant model. Specifically, the
controller uses the
TimeUnit property of the plant model LTI object.
This property defaults to seconds.
Suppose that the current control interval is k. The prediction horizon, p, is the number of future control intervals the MPC controller must evaluate by prediction when optimizing its MVs at control interval k.
Recommended practice is to choose p early in the controller design and then hold it constant while tuning other controller settings, such as the cost function weights. In other words, do not use p adjustments for controller tuning. Rather, the value of p should be such that the controller is internally stable and anticipates constraint violations early enough to allow corrective action.
If the desired closed-loop response time is T and the control interval is Ts, try p such that T ≈ pTs.
Plant delays impose a lower bound on the possible closed-loop response times. Choose p accordingly. To check for a violation of this condition, use the
Recommended practice is to increase p until further increases have a minor impact on performance. If the plant is open-loop unstable, the maximum p is the number of control intervals required for the open-loop step response of the plant to become infinite. p > 50 is rarely necessary unless Ts is too small.
Unfavorable plant characteristics combined with a small p can generate an internally unstable controller. To check for this condition, use the
reviewcommand, and increase p if possible. If p is already large, consider the following:
The control horizon, m, is the number of MV moves to be optimized at control interval k. The control horizon falls between 1 and the prediction horizon p. The default is m = 2. Regardless of your choice for m, when the controller operates, the optimized MV move at the beginning of the horizon is used and any others are discarded.
Reasons to keep m << p are as follows:
Small m means fewer variables to compute in the QP solved at each control interval, which promotes faster computations.
If the plant includes delays, m < p is essential. Otherwise, some MV moves might not affect any of the plant outputs before the end of the prediction horizon, leading to a singular QP Hessian matrix. To check for a violation of this condition, use the
Small m promotes (but does not guarantee) an internally stable controller.
Defining Sample Time and Horizons
You can define the sample time, prediction horizon, and control horizon when creating an
mpc controller at the command line. After creating a controller,
mpcobj, you can modify the sample time and horizons by setting the
following controller properties:
Sample time —
Prediction horizon —
Control horizon —
Also, when designing an MPC controller using MPC Designer, in the Tuning tab, in the Horizon section, you can modify the sample time and horizons.