Main Content

Indirect MRAC Control of Mass-Spring-Damper System

This example shows how to use an indirect model reference adaptive control (MRAC) system in Simulink for model parameter estimation of a second-order mass-spring-damper system. The properties of the mass-spring-damper system are unknown. The indirect MRAC controller estimates the plant parameters and implements an inversion-based controller to track a reference model.

Mass-Spring-Damper Model

The mass-spring-damper system consists of two carts of mass m1 and m2, connected to each other and ground through springs with stiffness coefficients c0 and c1 and dampers with damping coefficient d.

mass-spring-damper.png

The unknown dynamical system defining the spring-mass-damper system can be written as follows.

  x(t)˙=Ax(t)+Bu(t)

A=[0100-(c0+c1)m1-2dm1c1m1dm10001c1m2dm2-c1m2-2dm2],B=[001m100001m2]

Here:

  • x=[p1,p1˙,p2,p2˙] is the system state vector.

  • p1 and p2 are the positions of the masses.

  • A and B are the parameters of the unknown system.

Given this unknown nonlinear system, the goal is to design a controller that enables the tracking of the following reference.

xm˙(t)=Amxm(t)+Bmr(t)

Am=[0100-25-1000000100-25-10],Bm=[0025000025]

Here:

  • xm contains the reference model states.

  • Am and Bm are the parameters of the reference system.

  • r(t) is the reference signal provided by the user.

Reference-Tracking Controller

The indirect MRAC controller uses an estimator model to compute Aˆ and Bˆ, which are estimates of the unknown system parameters A and B, respectively.

xˆ˙=Aˆx(t)+Bˆu(t)

To compute the control action u(t), the controller uses the feedforward gain kr and feedback gain kx.

u(t)=-kxx(t)+krr(t)

The controller gains are derived from the reference model parameters (Am and Bm) and estimated observer parameters (Aˆ and Bˆ).

kr=BmBˆkx=1Bˆ(Am-Aˆ)

Configure Controller

Specify the true stiffness coefficients, damping coefficient, and masses for the mass-spring-damper system.

% Stiffness
c0 = 1;
c1 = 1;
% Damping
d = 1;
% Mass
m1 = 5;
m2 = 1;

Define the actual system dynamics using these system parameters.

A = [0 1 0 0;-(c0+c1)/m1 -2*d/m1 c1/m1 d/m1;
    0 0 0 1;c1/m2 d/m2 -c1/m2 -2*d/m2]
A = 4×4

         0    1.0000         0         0
   -0.4000   -0.4000    0.2000    0.2000
         0         0         0    1.0000
    1.0000    1.0000   -1.0000   -2.0000

B = [0 0;1/m1 0;0 0;0 1/m2]
B = 4×2

         0         0
    0.2000         0
         0         0
         0    1.0000

This true model is unknown to the indirect MRAC controller. Instead, the controller uses an estimator model to estimate the unknown plant dynamics. During operation, the controller can adapt the parameters of this model to improve its estimate of the unknown system parameters.

Ahat = [0 1 0 0;0 0 0 0;0 0 0 1;0 0 0 0];
Bhat = [0 0.1;0.1 0;0 0;0.1 0.1];

The goal of the controller is to track the performance of the reference model. Specify the parameters of the reference model.

Am = [0 1 0 0;-25 -10 0 0;0 0 0 1;0 0 -25 -10];
Bm = [0 0;25 0;0 0;0 25];

Specify the initial condition of the plant.

x_0 = 0;

Specify the learning rates for updating the estimator model parameters.

gamma_a = 0.1;  % Ahat learning rate
gamma_b = 0.1;  % Bhat learning rate

Simulate Controller

Open the Simulink model.

mdl = 'mracMassSpringDamper';
open_system(mdl)

In this model:

  • The Actual Plant Model block implements the nominal model of the mass-spring-damper system.

  • The Reference block generates reference signals for both masses.

  • The Model Reference Adaptive Control block outputs the control action u, which it derives from the using the estimator model.

While an MRAC controller can also estimate unknown disturbances in the controlled system, for this example there are no such disturbances. Instead, the goal of the controller is simply to estimate the parameters of the unknown plant model. For an example that estimates unknown disturbances using a direct MRAC controller, see Model Reference Adaptive Control of Aircraft Undergoing Wing Rock.

Simulate the model.

Tf = 100;
sim(mdl);

View the actual plant states, which are the positions of the masses, along with the corresponding reference signals. The controller is able to make the actual plant states track the reference signals.

open_system(mdl + "/p1")

open_system(mdl + "/p2")

The Model Reference Adaptive Controller block is configured to output the parameters Aˆ and Bˆ of the estimator model using the Ahat and Bhat output ports, respectively. Plot the parameters.

open_system(mdl + "/Ahat")

open_system(mdl + "/Bhat")

Over time the controller adapts the values of the estimator parameters. However, the estimated parameters do not converge to the true parameters due to a lack of persistency of excitation in the reference signals. Despite the fact that the model parameters do not converge, the controller still converges to the reference behavior.

See Also

Blocks

Related Topics