Two-Layer MRAC Overview

1 Introduction

This page provides an essential summary of the two-layer MRAC (model reference adaptive control) techniques coded in the simulator https://github.com/andrealaffly/UAV_Sim_PyChrono/wiki.

2. Two-Layer MRAC

A key chellenge in all MRAC systems is that the rate of convergence of the closed-loop trajectory tracking error, \(\alpha_{\max}(e(\cdot))\), is the same as the reference model, \(\alpha_{\max}(x_{\rm ref}(\cdot))\).

In practice, the closed-loop plant trajectory \(x(\cdot)\) reaches the reference model \(x_{\rm ref}(\cdot)\) as soon as the transient dynamics of the reference model have faded.

However, the MRAC philosophy is to guarantee that the closed-loop plant dynamics mimics the reference model at all times, especially during the transient period, which is the most critical for a dynamical model.

🔎 Practical observation

In a dynamical system whose state converges to a set, the transient is the preiod in which the effect of initial conditions fades, and initial conditions can be interpreted as the effor in setting the system’s trajectory in the target set.


Assume that the plant model (i.e., the system to be controlled) is in the form

\[ \dot{x}(t) = A x(t) + B \Lambda [u(t) + \Theta^{\rm T} \Phi(t,x(t))], \quad x(t_0) = x_0, \quad t \geq t_0, \]

where

As for classical MRAC, the primary goal of two-layer MRAC systems is to steer the plant state toward the trajectory of the refence model

\[ \dot{x}_{\rm ref}(t) = A_{\rm ref}x_{\rm ref}(t) + B_{\rm ref}r_{\rm cmd}(t),\quad x_{\rm ref}(t_0) = x_{\rm ref,0}, \quad{} t \geq t_0, \]

where

The second goal of two-layer MRAC systems is to enforce that the rate of convergence of the trajectory tracking error is larger than the rate of convergence of the reference trajectory, that is,

\[ \alpha_{\max}(e(\cdot)) > \alpha_{\max}(x_{\rm ref}(\cdot)). \]

⚠️ Disclaimer

To apply an MRAC system, the plant model must not be integrated. It suffices to assume that \(x(t)\) is known for all \(t \geq t_0\).


To this goal, two-layer MRAC systems set \[ u(t) = \phi(\tilde{K}(t),\tilde{\pi}(t)), \quad t \geq t_0, \]

where

\[ \phi(\tilde{K},\tilde{\pi}) \triangleq \tilde{K}^{\rm T} \tilde{\pi}, \quad (\tilde{K},\tilde{\pi}) \in \mathbb{R}^{(2n+m+N) \times m} \times \mathbb{R}^{(2n+m+N)}, \]

\[ \dot{\tilde{K}}(t) = - \Gamma \tilde{\pi}(t) \varepsilon^{\rm T}(t) P_{\rm tran} B, \quad \tilde{K}(t_0) = \tilde{K}_0, \quad t \geq t_0, \]

\[ \begin{aligned} \tilde{\pi}(t) &= \begin{bmatrix} x(t) \\ r(t) \\ - \Phi(t,x(t)) \\ e(t) \end{bmatrix}, \end{aligned} \]

\[ e_{\rm ref,tran}(t) = {\rm exp}\left(A_{\rm tran}(t-t_0)\right) e_{\rm ref,tran}(t_0), \quad{} t \geq t_0 \]

\[ {\rm Re}\left(\lambda_{\max}(A_{\rm tran})\right) < {\rm Re}\left(\lambda_{\max}(A_{\rm ref})\right) \]

(i.e., the eigenvalues of \(A_{\rm tran}\) are all to the left of the eigenvalues of \(A_{\rm ref}\) in the complex plane)

\[ A_{\rm tran}^{\rm T} P_{\rm tran} + P_{\rm tran} A_{\rm tran} = - Q \]

🔎 Practical observation


Key results

Assume that there exist \(K_x \in \mathbb{R}^{n \times m}\), \(K_r \in \mathbb{R}^{m \times m}\), and \(K_g \in \mathbb{R}^{n \times g}\) such that the matching conditions

\[ \begin{aligned} A_{\rm ref} &= A + B \Lambda K_x^{\rm T}, \\ B_{\rm ref} &= B \Lambda K_r^{\rm T}, \\ A_{\rm tran} &= A_{\rm ref} + B \Lambda K_g^{\rm T} \end{aligned} \]

are verified.

Two-layer MRAC guarantees

⚠️ Disclaimer

It is impossible to solve the matching conditions since \(A\) and \(\Lambda\) are unknown. However, the structure of \(A\) (i.e., the location of its zeros) is usually known and we know that \(\Lambda\) is diagonal and positive-definite. Thus, the existence of solutions to the matching conditions can usually be safely assumed.

The matching conditions are needed to verify compatibility between the plant model and the reference model. Here is a simple exmple, if the plant model captures the dynamics of a car and the reference model captures the dynamics of an airplane, the matching conditions can not be verified because a car is unable to take off.


2. Robust Two-Layer MRAC

It is unlikely that all nonlinear uncertainties and external disturbaces are captured by the term \(\Theta^{\rm T} \Phi(t,x)\) for all \((t,x) \in [t_0,\infty) \times \mathbb{R}^n\).

In practice, plant models are more realistically captured by

\[ \dot{x}(t) = A x(t) + B \Lambda [u(t) + \Theta^{\rm T} \Phi(t,x(t))] + \xi(t), \quad x(t_0) = x_0, \quad t \geq t_0, \]

where

Applying two-layer MRAC as well as classical MRAC in the presence of an unmatched uncertainty may be catastrophic: the adaptive gains may diverge. For this reason, multiple robustifications of MRAC have been developed.

In this simulator, we employ a combination of the dead-zone modification of MRAC and continuous convex projection operator. In particular, we consider the control law

\[ \phi(\tilde{K},\tilde{\pi}) \triangleq \tilde{K}^{\rm T} \tilde{\pi}, \quad (\tilde{K},\tilde{\pi}) \in \mathbb{R}^{(2n+m+N) \times m} \times \mathbb{R}^{(2n+m+N)}, \]

which is the same as for classical two-layer MRAC, and the adaptive law

\[ \begin{aligned} \dot{\tilde{K}}(t) &= {\rm Proj}\left(\tilde{K}(t), - \mu_{\rm ramp}(\varepsilon(t),\epsilon_0) \Gamma \tilde{\pi}(t) \varepsilon^{\rm T}(t) P_{\rm tran} B \right), \\ &\quad \tilde{K}(t_0) = \tilde{K}_0, \quad t \geq t_0, \end{aligned} \]

where

\[ \mu_{\rm ramp}(e,\epsilon_0) \triangleq \begin{cases} 1, & \text{if } \lVert e \rVert \geq \epsilon_0, \\[6pt] \dfrac{\lVert e \rVert - \delta \epsilon_0}{(1 - \delta)\epsilon_0}, & \text{if } \lVert e \rVert \in [\delta \epsilon_0, \epsilon_0], \\[6pt] 0, & \text{if } \lVert e \rVert \leq \delta \epsilon_0, \end{cases} \quad e \in \mathbb{R}^n \]

The matrix continuous convex projection operator is defined as

\[ {\rm Proj}(K,K_{\rm d}) \triangleq \left[{\rm proj}(k_1,k_{\rm d,1}), \ldots, {\rm proj}(k_m,k_{{\rm d},m}) \right], \quad (K,K_{\rm d}) \in \mathbb{R}^{(n+m+N) \times m} \times \mathbb{R}^{(n+m+N) \times m} \]

where

\[ \begin{aligned} \mathrm{proj}(k,k_{\mathrm d}) &\triangleq \begin{cases} k_{\mathrm d} - h(k)\, \dfrac{ \left( \dfrac{\partial h(k)}{\partial k} \right)^{\mathrm T} \dfrac{\partial h(k)}{\partial k} }{ \dfrac{\partial h(k)}{\partial k} \left( \dfrac{\partial h(k)}{\partial k} \right)^{\mathrm T} } \, k_{\mathrm d}, & (k,k_{\mathrm d}) \in \mathcal{S}, \\ k_{\mathrm d}, & \text{otherwise}, \end{cases} \\[1ex] h(k) &\triangleq \frac{ (1+\varepsilon)(k-k_{\mathrm e})^{\mathrm T} \mathrm{diag}^{-1}(s s^{\mathrm T}) (k-k_{\mathrm e}) - 1 }{ \varepsilon } \end{aligned} \]

The function \(h(\cdot)\) defines the ellpsoid

\[ \overline{\Omega}_1 \triangleq \left\{k \in \mathbb{R}^{n+m+N} : h(k) \leq 1 \right\} \]

centered in \(k_{\rm e}\) and whose semi-major axes are given by the components of \(s\). This ellipsoid is a constraint set of each column of \(\hat{K}(\cdot)\).

Key results

Assume that there exist \(K_x \in \mathbb{R}^{n \times m}\), \(K_r \in \mathbb{R}^{m \times m}\), and \(K_{\rm g} \in \mathbb{R}^{n \times n}\) such that the matching conditions are verified.

Assume that \(K \triangleq \left[K_x^{\rm T}, K_r^{\rm T}, \Theta^{\rm T}, K_g^{\rm T} \right]^{\rm T}\), and assume that \(k_i \in \overline{\Omega}_1\) for all \(i \in \{1, \ldots, m \}\).

This robust adaptive MRAC system guarantees

3 Additional Reading Material

For additional information, see

4 Implementation