Main Content

setindist

Modify unmeasured input disturbance model

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

Examples

collapse all

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);
-->"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.
   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 controller input 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.

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);
-->"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.
   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 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 #1 is integrated white noise.
   Assuming no disturbance added to measured output #2.
   Assuming no disturbance added to measured output #3.
   Assuming no disturbance added to measured output #4.
-->"Model.Noise" is empty. Assuming white noise on each measured output.

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.

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

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

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

Tips

  • To view the current input disturbance model, use the getindist command.

Version History

Introduced before R2006a