Main Content

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®支持在线t,下面的块万博1manbetxuning:

TheExplicit MPC ControllerandMultiple Explicit MPC Controllersblocks 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 anmpcmoveoptobject, and specify the corresponding tuning weight properties. Then pass this object to eithermpcmove,mpcmoveAdaptive, ormpcmoveMultiple.

This table lists the weights that you can tune at run time and their corresponding Simulink block ports andmpcmoveoptproperties. For more information on tuning weights, including tuning tips, seeTune Weights.

Tune weights for Simulink Block Port mpcmoveoptProperty
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.

Related Topics