Main Content

Model Reference Adaptive Control

Compute control actions to make controlled system track reference model

Since R2021b

  • Model Reference Adaptive Control block

Libraries:
Simulink Control Design / Adaptive Control

Description

The Model Reference Adaptive Control block computes control actions to make an uncertain controlled system track the behavior of a given reference plant model. Using this block, you can implement the following model reference adaptive control (MRAC) algorithms.

  • Direct MRAC — Estimate the following controller gains and compute control actions using the estimated controller.

    • Feedback gains that relate the state of the controlled system to the control signal.

    • Feedforward gains that relate the reference signal to the control signal.

  • Indirect MRAC — Estimate the following matrices of the uncertain controlled system and derive control actions based on the estimated model.

    • State matrix A

    • Control effective matrix B

Both direct and indirect MRAC also estimate a model of the external disturbances and uncertainty in the system being controlled and use this model when computing control actions.

In both cases, based on the real-time tracking error, the controller can update the estimated parameters and disturbance model.

For more information, see Model Reference Adaptive Control.

Examples

Ports

Input

expand all

Provide the reference signal for the controlled system to follow.

Provide the current state vector from the controlled system.

Provide custom disturbance model features.

Dependencies

To enable this input port, set the Feature type parameter to Use External Source for Feature.

Output

expand all

Connect the control input signal to the input of the controlled system. The control input is a vector signal with length equal to the number of control inputs in the controlled system.

The disturbance and uncertainty estimate is the product of the disturbance model features and the disturbance model weight vector. You can use this signal to compare the estimated disturbance model with the actual disturbances in your system.

Dependencies

To enable this output port, select the Output disturbance/uncertainty estimate parameter.

Use this port to output the estimated state matrix for the estimator plant model.

Dependencies

This output port is used for indirect MRAC. To enable this port, first select the Indirect algorithm option. Then, select the Output estimated parameters parameter.

Use this port to output the estimated control effective matrix for the estimator plant model.

Dependencies

This output port is used for indirect MRAC. To enable this port, first select the Indirect algorithm option. Then, select the Output estimated parameters parameter.

Parameters

expand all

System

Select an MRAC algorithm and specify nominal, reference, and estimator model dynamics.

Specify the state matrix for the nominal model as an N-by-N matrix, where N is the number of states in the controlled system.

Dependencies

This parameter is used for direct MRAC. To enable this parameter, select the Direct algorithm option.

Programmatic Use

Block Parameter: 'A'
Type: character vector
Values: square matrix
Default: '0'

Specify the control effective matrix of the nominal model as a nonzero N-by-M matrix, where N is the number of states in the controlled system and M is the number of control inputs in the controlled system.

Dependencies

This parameter is used for direct MRAC. To enable this parameter, select the Direct algorithm option.

Programmatic Use

Block Parameter: 'B'
Type: character vector
Values: vector | matrix
Default: '1'

Specify the state matrix for the reference model as a matrix with the same dimensions as parameter A. For a stable reference model, Am must be a Hurwitz matrix for which every eigenvalue must have a strictly negative real part.

Programmatic Use

Block Parameter: 'Am'
Type: character vector
Values: square matrix
Default: '-1'

Specify the control effective matrix of the reference model as a nonzero matrix with the same dimensions as parameter B.

Programmatic Use

Block Parameter: 'Bm'
Type: character vector
Values: vector | matrix
Default: '[0;4]'

Specify the state matrix for the estimator plant model as an N-by-N matrix, where N is the number of states in the controlled system.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'Ahat'
Type: character vector
Values: square matrix
Default: '0'

When you select this parameter, the controller adapts the estimator plant model state matrix.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'ALrEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Use this parameter to control the rate at which the controller adapts the estimator plant model state matrix. A larger value increases the size of the updates.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, first select the Indirect algorithm option. Then, select the Adapt Ahat parameter.

Programmatic Use

Block Parameter: 'gamma_a'
Type: character vector
Values: finite positive scalar
Default: '1'

To add robustness at higher gains, select this option to add a momentum term to the estimator model state matrix updates. Configure the learning modification on the Learning Modification tab.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, first select the Indirect algorithm option. Then, select the Adapt Ahat parameter.

Programmatic Use

Block Parameter: 'ALrEnableMod'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Specify the control effective matrix of the estimator plant model as a nonzero N-by-M matrix, where N is the number of states in the controlled system and M is the number of control inputs in the controlled system.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'Bhat'
Type: character vector
Values: vector | matrix
Default: '1'

When you select this parameter, the controller adapts the estimator plant model control effective matrix.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'BLrEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Use this parameter to control the rate at which the controller adapts the estimator plant model control effective matrix. A larger value increases the size of the updates.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, first select the Indirect algorithm option. Then, select the Adapt Bhat parameter.

Programmatic Use

Block Parameter: 'gamma_a'
Type: character vector
Values: finite positive scalar
Default: '1'

To add robustness at higher gains, select this option to add a momentum term to the estimator model control effective matrix updates. Configure the learning modification on the Learning Modification tab.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, first select the Indirect algorithm option. Then, select the Adapt Bhat parameter.

Programmatic Use

Block Parameter: 'BLrEnableMod'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

To specify the estimator feedback gain, first select this parameter. Then, specify the Estimator feedback gain parameter.

If you do not select this parameter, the estimator uses a default feedback gain equal to the Am parameter.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'externalKTauEnable'
Type: character vector
Values: 'off' | 'on'
Default: 'off'

To use the Am matrix as the default estimator feedback gain, specify this parameter as -1. Otherwise, specify the feedback gain as a Hurwitz matrix with the same dimensions as Am.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, first select the Indirect algorithm option. Then, select the Specify estimator feedback gain parameter.

Programmatic Use

Block Parameter: 'k_tau'
Type: character vector
Values: -1 | matrix
Default: '-1'

Select this parameter to add the Ahat and Bhat output ports for the estimator state and control effective matrix values, respectively.

Dependencies

This parameter is used for indirect MRAC. To enable this parameter, select the Indirect algorithm option.

Programmatic Use

Block Parameter: 'estParamOutput'
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Control Gains

Define initial feedback and feedforward gains for model matching when using direct MRAC. You can configure the block to update these control gains and adjust the corresponding learning rates. To enable the parameters on this tab, select the Direct algorithm option.

Initial feedback gain values. If you do not select the Adapt feedback gains parameter, then the controller holds the specified feedback gains at these initial values.

Programmatic Use

Block Parameter: 'kx'
Type: character vector
Values: finite scalar | matrix of finite values
Default: '0'

When you select this parameter, the controller adapts the feedback gains based on the difference between the states of the controlled system and the reference model.

Programmatic Use

Block Parameter: 'FBLrEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Use this parameter to control the rate at which the controller adapts the feedback gains. A larger value increases the size of the gain updates.

Programmatic Use

Block Parameter: 'gamma_kx'
Type: character vector
Values: finite positive scalar
Default: '1'

To add robustness at higher gains, select this option to add a momentum term to the feedback gain updates. Configure the learning modification on the Learning Modification tab.

Programmatic Use

Block Parameter: 'FBLrEnableMod'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Initial feedforward gain values. If you do not select the Adapt feedforward gains parameter, then the controller holds the specified feedforward gains at these initial values.

Programmatic Use

Block Parameter: 'kr'
Type: character vector
Values: finite scalar | matrix of finite values
Default: '0'

When you select this parameter, the controller adapts the feedforward gains based on the difference between the states of the controlled system and the reference model.

Programmatic Use

Block Parameter: 'FFLrEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Use this parameter to control the rate at which the controller adapts the feedforward gains. A larger value increases the size of the gain updates.

Programmatic Use

Block Parameter: 'gamma_kr'
Type: character vector
Values: finite positive scalar
Default: '1'

To add robustness at higher gains, select this option to add a momentum term to the feedforward gain updates. Configure the learning modification on the Learning Modification tab.

Programmatic Use

Block Parameter: 'FFLrEnableMod'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Disturbance Model

Configure the disturbance and uncertainty model used by the block. During operation, the block adapts the disturbance model parameters.

When you select this parameter, the controller uses a disturbance model to estimate the uncertainty and external disturbances in the controlled system. The controller adapts the parameters of the disturbance model based on the error between the states of the controlled system and reference model.

The disturbance model has the form wTϕ(x).

  • ϕ(x) is the disturbance model feature vector. To configure the feature vector, use the Feature type parameter.

  • wT is a weighting matrix that contains disturbance model parameters. The controller adjusts its disturbance and uncertainty model by adapting these parameters.

Programmatic Use

Block Parameter: 'AdaptEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Use this parameter to control the rate at which the controller adapts the disturbance model parameters. A larger value increases the size of the parameter updates.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter.

Programmatic Use

Block Parameter: 'gamma'
Type: character vector
Values: finite positive scalar
Default: '100'

To add robustness at higher gains, select this option to add a momentum term to the disturbance parameter updates. Configure the learning modification on the Learning Modification tab.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter.

Programmatic Use

Block Parameter: 'WLrEnableMod'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

The channel learning rate Q is a weighting matrix for state tracking errors in the Lyapunov function for the error dynamics. The larger the value of Q, the faster the tracking error goes to zero. However, a larger value of Q also creates larger transients and a less robust system.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter.

Programmatic Use

Block Parameter: 'Q'
Type: character vector
Values: finite positive scalar | vector of positive values | symmetric positive definite matrix
Default: '1'

Select one of the following types for the disturbance model feature vector.

  • State — Use the states from the controlled plant as the disturbance model. This option can underrepresent the uncertainty and therefore perform poorly.

  • Radial Basis Function — Use Gaussian radial basis functions to create the feature vector.

  • Single Hidden Layer Network — Use a neural network with a single-hidden layer.

  • Use External Source for Feature — Add the phi input port to the block. Use this port to provide your own custom feature vector.

For more information on when to use each type of feature vector, see Disturbance and Uncertainty Model.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter.

Programmatic Use

Block Parameter: 'FeatureTypeOptions'
Type: character vector
Values: 'Radial Basis Function' | 'State' | 'Single Hidden Layer Network' | 'Use External Source for Feature'
Default: 'Radial Basis Function'

Number of radial basis function (RBF) centers to use in the disturbance model. The RBF centers are evenly spaced across the span defined by the Centers min and Centers max parameters.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Radial Basis Function.

Programmatic Use

Block Parameter: 'nCen'
Type: character vector
Values: positive integer
Default: '20'

Specify the lower limits for the radial basis function centers. If you specify a scalar value, the same minimum is used for all basis functions. Otherwise, you must specify a vector with length equal to the Number of RBF centers parameter.

The Centers min parameter must be less than the Centers max parameter.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Radial Basis Function.

Programmatic Use

Block Parameter: 'cSpanMin'
Type: character vector
Values: finite scalar | vector
Default: '-1'

Specify the upper limits for the radial basis function centers. If you specify a scalar value, the same maximum is used for all basis functions. Otherwise, you must specify a vector with length equal to the Number of RBF centers parameter.

The Centers max parameter must be greater than the Centers min parameter.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Radial Basis Function.

Programmatic Use

Block Parameter: 'cSpanMax'
Type: character vector
Values: finite scalar | vector
Default: '1'

Specify the standard deviation for the Gaussian basis function kernel. If you specify a scalar value, the same standard deviation is used for all basis functions. Otherwise, you must specify a vector with length equal to the Number of RBF centers parameter.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Radial Basis Function.

Programmatic Use

Block Parameter: 'cSig'
Type: character vector
Values: positive scalar | vector
Default: '5'

Specify the number of neurons in the hidden layer of the neural network. In general, a network with more neurons can approximate more complex nonlinear disturbances. Though, too many neurons can produce a noisy disturbance estimate.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Single Hidden Layer Network.

Programmatic Use

Block Parameter: 'shlHiddenLayerSize'
Type: character vector
Values: positive scalar | vector
Default: '10'

Use this parameter to control the rate at which the controller adapts the weights of the neural network. A larger value increases the size of the weight updates.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter and set the Feature type parameter to Single Hidden Layer Network.

Programmatic Use

Block Parameter: 'gamma_V'
Type: character vector
Values: positive scalar | vector
Default: '0.1'

Select this parameter to add the u_ad output port.

Dependencies

To enable this parameter, select the Enable disturbance adaptation parameter.

Programmatic Use

Block Parameter: 'adaptiveCntrlOutport'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Learning Modification

To add robustness at higher gains, you can modify the parameter updates to include a momentum term. The equations in the Parameter Update Equations section show the update formulas for the current block configuration.

Select one of the following options for computing the momentum term that is added to the parameter updates.

  • Sigma Modification — The momentum term is the product of the momentum weight parameter σ and the current parameter values.

  • e-Modification — Scale the sigma-modification momentum term by the magnitude of the error value

  • None — Do not use learning modification.

To specify σ, use the Sigma parameter.

Programmatic Use

Block Parameter: 'modChoice'
Type: character vector
Values: 'Sigma Modification' | 'e-Modification' | 'None'
Default: 'Sigma Modification'

Specify the value for the momentum weight term. A larger value increases the size of the parameter updates gain and parameter updates.

Dependencies

To enable this parameter, set the Modification Methods parameter to either Sigma Modification or e-Modification.

Programmatic Use

Block Parameter: 'sigma_val'
Type: character vector
Values: finite positive scalar
Default: '0.1'

Since R2024b

Select to use discrete-time integration for parameter updates. Doing so allows you to generate code for embedded systems that require a user-specified sample time.

Programmatic Use

Block Parameter: 'DiscreteEnable'
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Since R2024b

Sample time for discrete-time integration, specified as a finite positive scalar.

Dependencies

To enable this parameter, select the Use discrete-time integration in adaptation parameter.

Programmatic Use

Block Parameter: 'Ts'
Type: character vector
Values: finite positive scalar
Default: '0.05'

Since R2024b

Specify the discrete integration formula for calculating the integral in parameter update equations as one of the following:

  • Forward EulerTsz1

  • Backward EulerTszz1

  • TrapezoidalTs2z+1z1

Dependencies

To enable this parameter, select the Use discrete-time integration in adaptation parameter.

Programmatic Use

Block Parameter: 'IntegrationMethods'
Type: character vector
Values: 'Forward Euler' | 'Backward Euler' | 'Trapezoidal'
Default: 'Forward Euler'

Extended Capabilities

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

Version History

Introduced in R2021b

expand all