Main Content

Disturbance Compensator

Modify control actions to compensate for unknown dynamics and disturbances

Since R2024a

  • Disturbance Compensator block icon

Libraries:
Simulink Control Design / Disturbance Observer

Description

Use the Disturbance Compensator block to modify control actions of a nominal controller to reject and compensate for disturbances in your model. To compensate for disturbances, the Disturbance Compensator block uses an extended state observer to estimate total disturbances in the model and returns the modified controller actions you can use as plant input.

The block extends the implementation of ESO described in the previous section as follows.

x˙/x+=Ax+Buu+Bddym=Cmxu=u0+Kdd^

Here:

  • x is the plant states.

  • x˙ is the state derivative in continuous time and x+ is the state update x[k+1] in discrete time.

  • A, Bu, and Cm are the plant dynamics.

  • ym is the measurable plant output.

  • Bd is the disturbance input matrix.

  • d is the total disturbances in the model, including unknown dynamics and internal and external disturbances.

  • u is the modified controller action.

  • u0 is the nominal controller action.

  • Kd is the compensation gain matrix.

The block does not require you to provide an actual model of the plant. You can specify the dynamics obtained from a physical representation or an approximation of the plant. Therefore, the accuracy of disturbance rejection will depend on the accuracy of the plant approximation you provide.

For more information, see Control Design and Disturbance Compensation Using Extended State Observers

Examples

Ports

Input

expand all

Specify the known inputs of the model as an Nu-by-1 signal, where Nu is the number of inputs in the model.

Specify the measured outputs of the model Ny-by-1 signal, where Ny is the number of outputs in the model.

Specify the state matrix as an Nx-by-Nx signal, where Nx is the number of states in the model.

Dependencies

To enable this port, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

Specify the input matrix as an Nx-by-Nu signal, where Nx is the number of states and Nu is the number of inputs in the model.

Dependencies

To enable this port, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

Specify the output matrix as an Ny-by-Nx signal, where Nx is the number of states and Ny is the number of outputs in the model.

Dependencies

To enable this port, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

Specify the disturbance matrix as an Nx-by-Nd signal, where Nx is the number of states and Nd is the number of disturbances in the model.

Dependencies

To enable this port, select the Use external source for matrix Bd and Use external source for L parameters.

Specify the initial conditions for the extended states as a scalar or vector with length Nx + Nd, where Nx is the number of states and Nd is the number of disturbances int the model.

Dependencies

To enable this port, select Use external source for initial conditions S0 (x0,d0).

Specify the observer matrix as an (Nx+Nd)-by-Ny signal.

Dependencies

To enable this port, select Use external source for matrix L.

Specify the compensation gain matrix Kd as anNu-by-Nd signal.

Dependencies

To enable this port, select Use external source for matrix Kd.

Output

expand all

Estimated disturbances in the model, returned as an Nd-by-1 signal, where Nd is the number of disturbances in the model.

Estimated states of the model, returned as an Nx-by-1 signal, where Nx is the number of states in the model.

Dependencies

To enable this port, select Output estimated model states xhat.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Parameters Tab

Specify the controller time domain.

When you select discrete-time, specify the sample time using the Sample time parameter.

Specify the known plant dynamics as a state-space model object. You can obtain this model from a physical representation or an approximation of the plant.

Select this option to specify the model matrices A, Bu, and Cm using the block input ports A, Bu, and Cm, respectively.

Dependencies

To enable this parameter, you must also select the Use external source for L parameter.

When you specify model matrices as block inputs, use this parameter to specify the number of states in the model.

Dependencies

To enable this parameter, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

When you specify model matrices as block inputs, use this parameter to specify the number of inputs in the model.

Dependencies

To enable this parameter, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

When you specify model matrices as block inputs, use this parameter to specify the number of outputs in the model.

Dependencies

To enable this parameter, select the Use external source for model matrices (A,Bu,Cm) and Use external source for L parameters.

Specify the gain value k for computing disturbance matrix Bd such that Bd = k×Bu.

Select this option to specify the disturbance matrix Bd using the block input port Bd.

Dependencies

To enable this parameter, you must also select the Use external source for L parameter.

When you specify disturbance matrices as a block input, use this parameter to specify the number of inputs in the model.

Dependencies

To enable this parameter, select the Use external source for matrix Bd and Use external source for L parameters.

Specify the initial conditions for the extended states as a scalar or vector with length Nx + Nd, where Nx is the number of states and Nd is the number of disturbances int the model.

Select this option to specify the initial conditions using the block input port S0.

Tuning Tab

Specify the observer bandwidth ωo as a positive scalar.

Specify the spacing for the closed-loop poles. For given observer bandwidth ωo and pole spacing δ, the block places the closed-loop poles at [ωoωo+δωo+δ×2ωo+δ×n], where n is the number of closed-loop poles.

Select this option to specify the observer matrix using the block input port L.

Select this option to specify the observer matrix using the block input port Kd.

Block Tab

Option to limit block output to specified saturation limits. Specify the output saturation limits using the Upper limit and Lower limit parameters.

Specify the upper limit for the block output. The block output is held at this value whenever it would otherwise exceed this value.

Dependencies

To enable this parameter, select the Limit output (u) parameter.

Specify the lower limit for the block output. The block output is held at this value whenever it would otherwise go below this value.

Dependencies

To enable this parameter, select the Limit output (u) parameter.

Specify the floating-point precision based on simulation environment or hardware requirements.

For continuous-time models, the block only supports double data type.

Specify time delays in the model as a scalar or vector of length Nu, where Nu is the number of inputs in the model.

For discrete-time models, specify the delay as an integer multiple k of the sample time. The delay in discrete time is given by Td = k×Ts.

Dependencies

To enable this parameter, select the Specify input delays parameter.

Select this option to output estimated model states at the block output xhat.

Select this option to output estimated model states at the block output dhat.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2024a