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 feedback and feedforward controller gains based on the real-time tracking error between the states of the reference plant model and the controlled system.

• Indirect MRAC — Estimate the parameters of the controlled system based on the tracking error between the states of the reference plant model and the estimated system. Then, derive the feedback and feedforward controller gains based on the parameters of the estimated system and the reference model.

Both direct and indirect MRAC also estimate a model of the external disturbances and uncertainty in the system being controlled. The controller then uses this model to compensate for the disturbances and uncertainty when computing control actions.

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

### Reference Model

For both direct and indirect MRAC, the following reference plant model is the ideal system that characterizes the desired behavior that you want to achieve in practice.

`${\stackrel{˙}{x}}_{m}\left(t\right)={A}_{m}{x}_{m}\left(t\right)+{B}_{m}r\left(t\right)$`

Here:

• r(t) is the external reference signal.

• xm(t) is the state of the reference plant model. Since r(t) is known, you can simulate the reference model to get xm(t).

• Am is a constant state matrix. For a stable reference model, Am must be a Hurwitz matrix for which every eigenvalue must have a strictly negative real part.

• Bm is a control effective matrix.

### Disturbance and Uncertainty Model

The Model Reference Adaptive Control block maintains an internal model uad of the disturbance and model uncertainty in the controlled system.

`${u}_{ad}={w}^{T}\varphi \left(x\right)$`

Here, ϕ(x) is a vector of model features. w is an adaptive control weight vector that the controller updates in real time based on the tracking error.

To define ϕ(x), you can use one of the following feature definitions.

• State vector of the controlled plant — This approach can under-represent the uncertainty in the system. Using the states as features can be a useful starting point when you do not know the complexity of the disturbance and model uncertainty.

• Gaussian radial basis functions — Use this option when the disturbance and model uncertainty are nonlinear and structure of the disturbance model is unknown.

• External source provided to the controller block — Use this option to define your own custom feature vector. You can use this option when you know the structure of the disturbance and uncertainty model. For example, you can use a custom feature vector to identify specific unknown plant parameters.

### Direct MRAC

A direct MRAC controller has the following control structure. The controller computes the control input u(t) as follows.

`$\begin{array}{l}u\left(t\right)={k}_{x}x\left(t\right)+{k}_{r}r\left(t\right)-{u}_{ad}\\ {u}_{ad}={w}^{T}\varphi \left(x\right)\end{array}$`

Here:

• x(t) is the state of the controlled system.

• r(t) is the external reference signal.

• kx and kr are the feedback and feedforward controller gains, respectively.

• uad is the adaptive control component derived from the disturbance model.

ϕ(x) contains the disturbance model features.

• w is an adaptive disturbance model weight vector.

The controller computes the error e(t) between the states of the controlled system and the states of the reference model. It then uses that error to adapt the values of kx, kr, and w in real time.

#### Nominal Model

The controlled system, which typically exhibits modeling uncertainty and external disturbances, has the following nominal state equation. The controller uses this expected nominal plant behavior when updating update the controller parameters.

`$\stackrel{˙}{x}\left(t\right)=Ax\left(t\right)+B\left(u\left(t\right)+f\left(x\right)\right)$`

Here:

• x(t) is the state of the system you want to control.

• u(t) is the control input.

• A is a constant state-transition matrix.

• B is a constant control effective matrix.

• f(x) is the matched uncertainty in the system.

A direct MRAC controller uses the following equations to update the controller gains and disturbance model weights  .

`$\begin{array}{l}{\stackrel{˙}{k}}_{x}={\Gamma }_{x}x\left(t\right){e}^{T}\left(t\right)PB\\ {\stackrel{˙}{k}}_{r}={\Gamma }_{r}r\left(t\right){e}^{T}\left(t\right)PB\\ {\stackrel{˙}{w}}_{x}={\Gamma }_{w}\varphi \left(x\right){e}^{T}\left(t\right)PB\end{array}$`

Here, P is the solution to the following Lyapunov function based on the reference model state matrix and B is the control effective matrix from the nominal plant model.

`${A}_{m}^{T}P+P{A}_{m}+Q=0$`

### Indirect MRAC

An indirect MRAC controller has the following control structure. The reference model is The controller computes the control input u(t) as follows.

`$\begin{array}{l}u\left(t\right)={k}_{x}x\left(t\right)+{k}_{r}r\left(t\right)-{u}_{ad}\\ {u}_{ad}={w}^{T}\varphi \left(x\right)\end{array}$`

Here:

• $\stackrel{^}{x}$(t) is the estimated state of the controlled system produced by an estimator model.

• r(t) is the external reference signal.

• kx and kr are the feedback and feedforward controller gains, respectively.

• uad is the adaptive control component derived from the disturbance model.

ϕ(x) contains the disturbance model features.

• w is an adaptive disturbance model weight vector.

The controller computes the error e(t) between the actual and estimated system states. It then uses that error to adapt the values of w in real time. The controller also uses e(t) to update the parameters of the estimator model in real time. The values of gains kx and kr are derived from the parameters of the estimator model and reference model.

#### Estimator Model and Controller Gains

The indirect MRAC controller contains the following estimator model of the controlled system.

`$\stackrel{˙}{\stackrel{^}{x}}\left(t\right)=\stackrel{^}{A}x\left(t\right)+\stackrel{^}{B}u\left(t\right)$`

Here:

• $\stackrel{^}{x}$(t) is the estimated system state.

• u(t) is the control input.

• $\stackrel{^}{A}$ is the state-transition matrix of the estimator.

• $\stackrel{^}{B}$ is the control effective matrix of the estimator.

During operation the controller updates $\stackrel{^}{A}$ and $\stackrel{^}{B}$ based on the estimation error e(t).

Rather than estimate the controller gains directly, an indirect MRAC controller derives the feedback gain kx and feedforward gain kr from the parameters of the reference and estimator models using a dynamic inversion-based approach as follows.

`$\begin{array}{l}{k}_{r}=\frac{{B}_{m}}{\stackrel{^}{B}}\\ {k}_{x}=\frac{1}{\stackrel{^}{B}}\left({A}_{m}-\stackrel{^}{A}\right)\end{array}$`

An indirect MRAC controller uses the following equations to update the estimator model parameters and disturbance model weights  .

`$\begin{array}{l}\stackrel{˙}{\stackrel{^}{A}}={\Gamma }_{a}x\left(t\right){e}^{T}\left(t\right)P\\ \stackrel{˙}{\stackrel{^}{B}}={\Gamma }_{b}u\left(t\right){e}^{T}\left(t\right)P\\ {\stackrel{˙}{w}}_{x}={\Gamma }_{w}\varphi \left(x\right){e}^{T}\left(t\right)PB\end{array}$`

Here, P is the solution to the following Lyapunov function.

`${k}_{\tau }^{T}P+P{k}_{\tau }+Q=0$`

kτ is the estimator feedback gain. By default, this value corresponds to the reference model state-transition matrix Am. However, you can specify a different estimator feedback gain value.

### Learning Modification

For both direct and indirect MRAC, to add robustness at higher learning rates, you can modify the parameter updates to include an optional momentum term. You can choose one of two possible learning modification methods: sigma modification and e-modification.

For sigma modification, the momentum term for each parameter update is the product of the momentum weight parameter σ and the current parameter value. For example, the following update equations for a direct MRAC controller include a sigma modification term.

`$\begin{array}{l}{\stackrel{˙}{k}}_{x}={\Gamma }_{x}x\left(t\right){e}^{T}\left(t\right)PB+\sigma {k}_{x}\\ {\stackrel{˙}{k}}_{r}={\Gamma }_{r}r\left(t\right){e}^{T}\left(t\right)PB+\sigma {k}_{x}\\ {\stackrel{˙}{w}}_{x}={\Gamma }_{w}\varphi \left(t\right){e}^{T}\left(t\right)PB+\sigma w\end{array}$`

For e-modification, the controller scales the sigma-modification momentum term by the norm of the error vector. For example, the following update equations for an indirect MRAC controller include an e-modification term.

`$\begin{array}{l}\stackrel{˙}{\stackrel{^}{A}}={\Gamma }_{a}x\left(t\right){e}^{T}\left(t\right)P+\sigma |e\left(t\right)|\stackrel{^}{A}\\ \stackrel{˙}{\stackrel{^}{B}}={\Gamma }_{b}u\left(t\right){e}^{T}\left(t\right)P+\sigma |e\left(t\right)|\stackrel{^}{B}\\ {\stackrel{˙}{w}}_{x}={\Gamma }_{w}\varphi \left(t\right){e}^{T}\left(t\right)PB+\sigma |e\left(t\right)|w\end{array}$`

To adjust the amount of the learning modification for either method, change the value of the momentum weight parameter σ.

 Ioannou, Petros A., and Jing Sun. "Robust adaptive control." American control conference, No. 21(June 1984): 333-335.

 Naren, Kumpati S, and Anuradha M Annaswamy. Stable Adaptive Systems. Courier Corporation, 2012.