# Adaptive Control using Multiple Models

#### Table of Contents:

This post has been adapted from a university project to understand and simulate the findings of [1]

## Preamble

The evolution of a dynamical system is
mathematically modeled as differential equations. Properties of the system like position and
velocity at any given moment are the
State of the system. Differential
equations capture how these *states* change and influence each other over time.

The mathematical models imply that a given system (or
Plant) would follow a deterministic
trajectory for a given *initial state*. For example, an airplane would remain at rest if it is
parked on level ground. It would glide down if it is released at 1000 feet above in the air with a
particular initial velocity and orientation.

But we often want to do more with systems than to let them follow their natural trajectories. And we cannot always precisely set or measure initial conditions. We want more Control.

Thus we influence some properties of the dynamical system by applying a *control input*. For example
applying torque to the wheels of your car, or by propelling the motors of an airplane to create
thrust that pushes it forward. This control input directly or indirectly alters the state of our
system.

A control designer’s job is to ensure that the system follows a trajectory of our choice, which is
often represented as a *Reference Model*; and to ensure stability of the overall system, i.e. it
does not behave erratically on small deviations.

## PID Controller

For simple single-order plants, an often effective strategy is to change the control
input in proportion to the difference (or *error*) between the plant state and reference state.

The error term is often integrated over time to capture the past, and differentiated to capture the instantaneous future of the error. The three terms (Proportional, Integral, Derivative) are used together in different proportions to design a control input, resulting in a PID Controller.

The performance of simple PID controllers isn’t always good enough, and the control law is not designed to the specification of plant dynamics and parameters, but only to its output.

Especially for complex multi-order plants, a lot of information is lost if we use only the plant output to control it and not the known information about its internal dynamics.

## Adaptive Control

Many times the parameters of the dynamical system are not completely known, or they are changing as the system evolves. In such scenarios, we need to adaptively change the control law itself with time.

Adaptive control primarily focuses on system identification (i.e. estimating the parameters of the system) to design the control input; and using Lyapunov analysis to ensure stability of the system.

### Plant Model

Let’s start with the simple case of a multi-order linear plant. Its dynamics can be described in state-space form as:

Where is the n-dimensional state space vector, are the parameters as a companion matrix. is the control input, and

**Side Note**: More details on how to represent an nth order d.e. in state-space form with
companion matrices is given
here

The last row of the companion matrix is the parameter vector , which can also be represented as:

### Reference Model

A reference model that this plant should track can be described via a similar set of equations:

Where and are described similarly, and is a known reference signal.

### Identification Model

Before we proceed to designing our control law, we need to estimate the plant parameters , as they are unknown to us.

To achieve that we set up an identification model as follows:

Where is a matrix in companion form with its last row as the plant parameter estimate . The identification error is defined as:

### Adaptive Law

Let be the positive definite matrix solution to the lyapunov equation for the reference model:

Where our Lyapunov function candidate is defined as:

#### Theorem 1

If we define our parameter adaptive law as:

we end up with a stable system under Lyapunov criteria:

### Control Law

Using the Lyapunov stability analysis, we can define our control input as:

Where . From Barbalat’s lemma it follows that the tracking error approaches 0 , or in other words that tracks .

#### Simulation 1

For a second order plant, with parameters tracking a reference model with . We initialize our identification model with . The tracking signal is .

(d/l multidim_singlemodel.slx)

The tracking error dies down slowly. This is because the parameter estimates converge to the plant values very slowly (as seen in the following figure).

## Multiple Identification Models

### Level 1

Let us use identification models, defined similarly as before, with same initial state as , but different initial values for the parameter estimate :

Despite having models, we can still only have a single control input. We achieve that by taking a convex combination of the parameter estimates as:

Where . We can restate this in matrix-vector notation, with as columns of , and :

#### Theorem 2

If adaptive identification models are initialized as such that
, and plant parameter vector lies in the *convex hull* of
, then continues to lie in the *convex hull* of
.

#### Simulation 2

For a second order plant, with parameters tracking same reference model as before . We initialize our identification model with and

(d/l multidim_multimodel.slx)

Tracking error still dies down slowly in the later phase. Despite having multiple models, we’re still estimating only one value in the convex hull of the multiple models. And the individual parameter errors of the models are still converging slowly to the actual value.

### Level 2

Level 1 leads to an equivalent performing system as before, albeit using multiple models. The key insight is to adaptively estimate itself, along with each model’s parameters.

The conclusion of theorem 2 can be restated as:

Subtracting from both sides:

The previous equation can be simplified down using:

Substituting leads to:

#### Estimate

We can now use a standard estimation process for like we did for parameters before. Let be its estimation, then the adaptive law is given by:

#### Theorem 3

Using analysis similar to Theorem 1, we can show that the second level of adaptation also leads to an overall stable system. And when convergence is slow in first level (i.e. large parametric errors), convergence of to is rapid. (and vice versa)

#### Simulation 3

For the same second order plant as in Simulation 2. That is , . This time we initialize our identification model with estimating it on the fly along with plant parameters with

(d/l multidim_multimodel_lvl2.slx)

The tracking error is converging to 0 rapidly.

The individual parameter estimates are still converging to the plant values very slowly. But due to fast second level estimation of (as seen in next fig.), the system as a whole is converging down rapidly.

## Result

Through qualitative analysis and simulations we have demonstrated the effectiveness of using multiple models for adaptive control, as introduced by the original paper [1].

## References

[1] Z. Han and K. S. Narendra, “New Concepts in Adaptive Control Using Multiple Models,” in IEEE Transactions on Automatic Control, vol. 57, no. 1, pp. 78-89, Jan. 2012. doi: 10.1109/TAC.2011.2152470