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:
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
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|
|Manipulated variable increment|
|Slack variable for constraint softening|
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.
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.