Modify unmeasured output disturbance model

`setoutdist(`

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 Modeling.`MPCobj`

,'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,0.1);

-->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.

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);

-->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.

Retrieve the default output disturbance model from the controller.

distMod = getoutdist(MPCobj);

-->Converting model to discrete time. -->Assuming output disturbance added to measured output channel #1 is integrated white noise. -->Assuming output disturbance added to measured output channel #2 is integrated white noise. -->Assuming output disturbance added to measured output channel #3 is integrated white noise. -->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

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);

-->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.

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);

Remove the output disturbances for all channels.

```
setoutdist(MPCobj,'model',tf(zeros(2,1)))
```

Restore the default output disturbance model.

```
setoutdist(MPCobj,'integrators')
```

`MPCobj`

— Model predictive controllerMPC controller objectModel predictive controller, specified as an MPC controller
object. To create an MPC controller, use the `mpc`

command.

`model`

— Custom output disturbance model`[]`

(default) | `ss`

object | `tf`

object | `zpk`

objectCustom 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.

*n*outputs, where_{y}*n*is the number of plant outputs defined in_{y}`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 Modeling 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.

To view the current output disturbance model, use the

`getoutdist`

command.

`getEstimator`

| `getoutdist`

| `mpc`

| `setEstimator`

| `setindist`

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Was this topic helpful?