Documentation

setindist

Modify unmeasured input disturbance model

Syntax

  • setindist(MPCobj,'model',model)
    example
  • setindist(MPCobj,'integrators')
    example

Description

example

setindist(MPCobj,'model',model) sets the input disturbance model used by the model predictive controller, MPCobj, to a custom model.

example

setindist(MPCobj,'integrators') sets the input disturbance model to its default value. Use this syntax if you previously set a custom input disturbance model and you want to change back to the default model. For more information on the default input disturbance model, see MPC Modeling.

Examples

collapse all

Specify Input Disturbance Model Using Transfer Functions

Define a plant model with no direct feedthrough.

plant = rss(3,4,4);
plant.d = 0;

Set the first input signal as a manipulated variable and the remaining inputs as input disturbances.

plant = setmpcsignals(plant,'MV',1,'UD',[2 3 4]);

Create an MPC controller for the defined plant.

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.
   for output(s) y1 and zero weight for output(s) y2 y3 y4 

Define disturbance models such that:

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

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

  • Input disturbance 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 input disturbance model using the above transfer functions. Use a separate noise input for each input disturbance.

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

Set the input disturbance model in the MPC controller.

setindist(MPCobj,'model',indist)

View the conroller output disturbance model.

getindist(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
   UD1   0   0   0
   UD2   1   0   0
   UD3   0   0   1
 
  d = 
        Noise#1  Noise#2  Noise#3
   UD1        2        0        0
   UD2        0        0        0
   UD3        0        0        0
 
Sample time: 0.1 seconds
Discrete-time state-space model.

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

Remove Input Disturbance for Particular Channel

Define a plant model with no direct feedthrough.

plant = rss(3,4,4);
plant.d = 0;

Set the first input signal as a manipulated variable and the remaining inputs as input disturbances.

plant = setmpcsignals(plant,'MV',1,'UD',[2 3 4]);

Create an MPC controller for the defined plant.

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.
   for output(s) y1 and zero weight for output(s) y2 y3 y4 

Retrieve the default input disturbance model from the controller.

distMod = getindist(MPCobj);
-->Converting model to discrete time.
-->The "Model.Disturbance" property of "mpc" object is empty:
   Assuming unmeasured input disturbance #2 is integrated white noise.
   Assuming unmeasured input disturbance #3 is integrated white noise.
   Assuming unmeasured input disturbance #4 is integrated white noise.
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
   Assuming no disturbance added to measured output channel #2.
   Assuming no disturbance added to measured output channel #3.
   Assuming no disturbance added to measured output channel #4.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

Remove the integrator from the second input disturbance. Construct the new input 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)]);
setindist(MPCobj,'model',distMod)

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

View the input disturbance model.

tf(getindist(MPCobj))
ans =
 
  From input "UD1-wn" to output...
          0.1
   UD1:  -----
         z - 1
 
   UD2:  0
 
   UD3:  0
 
  From input "UD3-wn" to output...
   UD1:  0
 
   UD2:  0
 
          0.1
   UD3:  -----
         z - 1
 
Sample time: 0.1 seconds
Discrete-time transfer function.

The integrator has been removed from the second channel. The first and third channels of the input disturbance model remain at their default values as discrete-time integrators.

Set Input Disturbance Model to Default Value

Define a plant model with no direct feedthrough.

plant = rss(2,2,3);
plant.d = 0;

Set the second and third input signals as input disturbances.

plant = setmpcsignals(plant,'MV',1,'UD',[2 3]);

Create an MPC controller for the defined plant.

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.
   for output(s) y1 and zero weight for output(s) y2 

Set the input disturbance model to unity gain for both channels.

setindist(MPCobj,'model',tf(eye(2)))

Restore the default input disturbance model.

setindist(MPCobj,'integrators')

Input Arguments

collapse all

MPCobj — Model predictive controllerMPC controller object

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

model — Custom input disturbance model[] (default) | ss object | tf object | zpk object

Custom input 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 setindist(MPCobj,'integrators').

The input disturbance model has:

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

  • nd outputs, where nd is the number of unmeasured disturbance inputs defined in MPCobj.Model.Plant. Each disturbance model output is sent to the corresponding plant unmeasured disturbance input.

This model, in combination with the output disturbance model (if any), governs how well the controller compensates for unmeasured disturbances and prediction 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.

setindist does not check custom input 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 generate an error.

This syntax is equivalent to MPCobj.Model.Disturbance = model.

More About

Introduced before R2006a

Was this topic helpful?