Main Content

setoutdist

Modify unmeasured output disturbance model

Description

setoutdist(mpcobj,'model',model) sets the output disturbance model used by the model predictive controller, mpcobj, to a custom model.

example

setoutdist(mpcobj,'integrators') sets the output disturbance model to its default value. Use this syntax if you previously set a custom output disturbance model and you want to change back to the default model. For more information on the default output disturbance model, see MPC Prediction Models.

example

Examples

collapse all

Define a plant model with no direct feedthrough, and create an MPC controller for that plant.

plant = rss(3,3,3);
plant.D = 0;
mpcobj = mpc(plant,0.1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.

Define disturbance models for each output such that the output disturbance for:

  • Channel 1 is random white noise with a magnitude of 2.

  • Channel 2 is random step-like noise with a magnitude of 0.5.

  • Channel 3 is random ramp-like noise with a magnitude of 1.

mod1 = tf(2,1);
mod2 = tf(0.5,[1 0]);
mod3 = tf(1,[1 0 0]);

Construct the output disturbance model using these transfer functions. Use a separate noise input for each output disturbance.

outdist = [mod1 0 0; 0 mod2 0; 0 0 mod3];

Set the output disturbance model in the MPC controller.

setoutdist(mpcobj,model=outdist)

View the controller output disturbance model.

getoutdist(mpcobj)
ans =
 
  A = 
        x1   x2   x3
   x1    1    0    0
   x2    0    1    0
   x3    0  0.1    1
 
  B = 
       Noise#1  Noise#2  Noise#3
   x1        0     0.05        0
   x2        0        0      0.1
   x3        0        0    0.005
 
  C = 
        x1  x2  x3
   MO1   0   0   0
   MO2   1   0   0
   MO3   0   0   1
 
  D = 
        Noise#1  Noise#2  Noise#3
   MO1        2        0        0
   MO2        0        0        0
   MO3        0        0        0
 
Sample time: 0.1 seconds
Discrete-time state-space model.

The controller converts the continuous-time transfer function model, outdist, into a discrete-time state-space model.

Define a plant model with no direct feedthrough, and create an MPC controller for that plant.

plant = rss(3,3,3);
plant.D = 0;
mpcobj = mpc(plant,0.1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.

Retrieve the default output disturbance model from the controller.

distMod = getoutdist(mpcobj);
-->Converting model to discrete time.
-->Assuming output disturbance added to measured output #1 is integrated white noise.
-->Assuming output disturbance added to measured output #2 is integrated white noise.
-->Assuming output disturbance added to measured output #3 is integrated white noise.
-->"Model.Noise" is empty. Assuming white noise on each measured output.

Remove the integrator from the second output channel. Construct the new output disturbance model by removing the second input channel and setting the effect on the second output by the other two inputs to zero.

distMod = sminreal([distMod(1,1) distMod(1,3); 0 0; distMod(3,1) distMod(3,3)]);
setoutdist(mpcobj,'model',distMod)

When removing an integrator from the output disturbance model in this way, use sminreal to make the custom model structurally minimal.

View the output disturbance model.

tf(getoutdist(mpcobj))
ans =
 
  From input "Noise#1" to output...
          0.1
   MO1:  -----
         z - 1
 
   MO2:  0
 
   MO3:  0
 
  From input "Noise#2" to output...
   MO1:  0
 
   MO2:  0
 
          0.1
   MO3:  -----
         z - 1
 
Sample time: 0.1 seconds
Discrete-time transfer function.

The integrator has been removed from the second channel. The disturbance models for channels 1 and 3 remain at their default values as discrete-time integrators.

Define a plant model with no direct feedthrough and create an MPC controller for that plant.

plant = rss(3,3,3);
plant.D = 0;
mpcobj = mpc(plant,1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.

Set the output disturbance model to zero for all three output channels.

setoutdist(mpcobj,model=tf(zeros(3,1)))

View the output disturbance model.

getoutdist(mpcobj)
ans =
 
  D = 
        Noise#1
   MO1        0
   MO2        0
   MO3        0
 
Static gain.

A static gain of 0 for all output channels indicates that the output disturbances were removed.

Define a plant model with no direct feedthrough and create an MPC controller for that plant.

plant = rss(2,2,2);
plant.D = 0;
mpcobj = mpc(plant,0.1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.

Remove the output disturbances for all channels.

setoutdist(mpcobj,model=tf(zeros(2,1)))

Restore the default output disturbance model.

setoutdist(mpcobj,'integrators')

Input Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, use mpc.

Custom output disturbance model, specified as a state-space (ss), transfer function (tf), or zero-pole-gain (zpk) model. The MPC controller converts the model to a discrete-time, delay-free, state-space model. Omitting model or specifying model as [] is equivalent to using setoutdist(mpcobj,'integrators').

The output disturbance model has:

  • Unit-variance white noise input signals. For custom output disturbance models, the number of inputs is your choice.

  • ny outputs, where ny is the number of plant outputs defined in mpcobj.Model.Plant. Each disturbance model output is added to the corresponding plant output.

This model, along with the input disturbance model (if any), governs how well the controller compensates for unmeasured disturbances and modeling errors. For more information on the disturbance modeling in MPC and about the model used during state estimation, see MPC Prediction Models and Controller State Estimation.

setoutdist does not check custom output disturbance models for violations of state observability. This check is performed later in the MPC design process when the internal state estimator is constructed using commands such as sim or mpcmove. If the controller states are not fully observable, these commands will generate an error.

Tips

  • To view the current output disturbance model, use the getoutdist command.

Version History

Introduced in R2006a