To modify the signal types for an existing MPC controller, you must simultaneously modify any controller properties that depend on the signal type configuration.
Create a plant model with two outputs, one manipulated variable, one measured disturbance, and two unmeasured disturbances.
Create an MPC controller using this plant.
-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10.
-->The "ControlHorizon" property of the "mpc" object is empty. Assuming 2.
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
Configure the controller properties. For example, set the scaling factors for the disturbance signals.
Suppose you want to change the second unmeasured disturbance to be a measured disturbance. To do so, you must simultaneously update the DisturbanceVariables
property of the controller, since the order of its entries depend on the disturbance types (measured disturbances followed by unmeasured disturbances).
Create an updated disturbance variable structure array. To do so, move the third element to be the second element.
To set the internal plant model signal types, obtain the Model
property from the controller, and modify the signal types of its Plant
element.
Set the model and disturbance variable properties of the controller to their updated values.
In general, it is best practice to not modify the signal types after controller creation. Instead, create and configure a new controller object with the new signal configuration.