Tune Weights at Run Time
There are two ways to perform tuning experiments using Model Predictive Control Toolbox™ software:
Modify your controller object off line (by changing weights, etc.) and then test the modified object.
Change tuning weights as the controller operates, as described in this topic.
In Simulink®, the following blocks support online tuning:
Multiple MPC Controllers. In this case, the tuning signals apply to the active controller object, which might switch as the control system operates. If the objects in your set employ different weights, you should tune them off line.
The Explicit MPC Controller and Multiple Explicit MPC Controllers blocks do not support online tuning because a weight change requires a complete revision of the explicit MPC control law, which is computationally intensive.
To tune weights during command-line simulations, first create an mpcmoveopt
object, and specify the corresponding tuning weight properties. Then
pass this object to either mpcmove
, mpcmoveAdaptive
, or mpcmoveMultiple
.
This table lists the weights that you can tune at run time and their corresponding
Simulink block ports and mpcmoveopt
properties. For more information
on tuning weights, including tuning tips, see Tune Weights.
Tune weights for | Simulink Block Port | mpcmoveopt Property |
---|---|---|
Output variables | y.wt | OutputWeights |
Manipulated variables | u.wt | MVWeights |
Manipulated variable increment | du.wt | MVRateWeights |
Slack variable for constraint softening | ecr.wt | ECRWeight |
For the output variable, manipulated variable, and manipulated variable increment weights, you can specify time-varying weights at run time; that is, tuning weights that vary over the prediction horizon. To do so, specify the tuning weights as arrays.
Note
To vary weights at run time, you must specify time-varying weights when you create your MPC controller object. In other words, if you configure your controller to use constant weights over the prediction horizon, you cannot specify time-varying weights at run time.