model reference adaptive control

25
Model Reference Adaptive Control (MRAC) The general idea behind Model Reference Adaptive Control (MRAC, also know as an MRAS or Model Reference Adaptive System) is to create a closed loop controller with parameters that can be updated to change the response of the system. The output of the system is compared to a desired response from a reference model. The control parameters are update based on this error. The goal is for the parameters to converge to ideal values that cause the plant response to match the response of the reference model. For example, you may be trying to control the position of a robot arm naturally vibrates. You actually want the robot arm to make quick motions with little or no vibration. Using MRAC, you could choose a reference model that could respond quickly to a step input with a short settling time. You could then build a controller that would adapt to make the robot arm move just like the model. INTRODUCTION

Upload: asusd1125

Post on 01-Dec-2014

275 views

Category:

Documents


22 download

TRANSCRIPT

Page 1: Model Reference Adaptive Control

Model Reference Adaptive Control (MRAC)

The general idea behind Model Reference Adaptive Control (MRAC, also know as an MRAS or Model Reference Adaptive System) is to create a closed loop controller with parameters that can be updated to change the response of the system. The output of the system is compared to a desired response from a reference model. The control parameters are update based on this error. The goal is for the parameters to converge to ideal values that cause the plant response to match the response of the reference model. For example, you may be trying to control the position of a robot arm naturally vibrates. You actually want the robot arm to make quick motions with little or no vibration. Using MRAC, you could choose a reference model that could respond quickly to a step input with a short settling time. You could then build a controller that would adapt to make the robot arm move just like the model.

INTRODUCTION

MRAC is a broad subject area with many different applications and methods. The purpose of this tutorial is to introduce the design of an MRAC using the MIT rule. The theory is explained and examples are used to illustrate the concepts. The MIT rule is then applied to control the motion of a pendulum. The remainder of the tutorial demonstrates the simulation and experimental implementation of MRAC on the pendulum system.

Follow the links below:

Page 2: Model Reference Adaptive Control

Theory

Simulation

Experiment

Final Words

References

Presentation

Simulink and Labview Code (Written using LabVIEW 7.1 and Matlab 7.0)

MRAC Theory

Again, the idea behind Model Reference Adaptive Control is to create a closed loop controller with parameters that can be updated to change the response of the system to match a desired model. There are many different methods for designing such a controller. This tutorial will cover design using the MIT rule in continuous time. When designing an MRAC using the MIT rule,

Page 3: Model Reference Adaptive Control

the designer chooses: the reference model, the controller structure and the tuning gains for the adjustment mechanism. 

MRAC begins by defining the tracking error, e. This is simply the difference between the plant output and the reference model output: 

From this error a cost function of theta (J(theta)) can be formed. J is given as a function of theta, with theta being the parameter that will be adapted inside the controller. The choice of this cost function will later determine how the parameters are updated. Below, a typical cost function is displayed. 

To find out how to update the parameter theta, an equation needs to be formed for the change in theta. If the goal is to minimize this cost related to the error, it is sensible to move in the direction of the negative gradient of J. This change in J is assumed to be proportional to the change intheta. Thus, the derrivative of theta is equal to the negative change in J. The result for the cost function chosen aobve is: 

Page 4: Model Reference Adaptive Control

This relationship between the change in theta and the cost function is knwon as the MIT rule. The MIT rule is central to adaptive nature of the controller. Note the term pointed out in the equation above labeled "sensitivity derivative". This term is the partial derrivative of the error with respect to theta. This determines how the parameter theta will be updated. A controller may contain several different parameters that require updating. Some may be acting n the input. Others may be acting on the output. The sensitivity derivative would need to be calculated for each of these parameters. The choice above results in all of the sensitivity derrivatives being multiplied by the error. Another example is shown below to contrast the effect of the choice of cost function: 

To see how the MIT rule can be used to form an adaptive controller, consider a system with an adaptive feedword gain. The block diagram is given below. 

EXAMPLE: ADAPTIVE FEEDFOWARD GAIN

Page 5: Model Reference Adaptive Control

 

The constant k for this plant is unknown. However, a reference model can be formed with a desired value of k, and through adaptation of a feedforward gain, the response of the plant can be made to match this model. The reference model is therefore chosen as the plant multiplied by a desired constant ko: 

The same cost function as above is chosen and the derivative is shown: 

Page 6: Model Reference Adaptive Control

The error is then restated in terms of the transfer functions multiplied by their inputs. 

As can be seen, this expression for the error contains the parameter theta which is to be updated. To determine the update rule, the sensitivity derivative is calculated and restated in terms of the model ouput: 

Finally, the MIT rule is applied to give an expression for updating theta. The constants k and ko are combined into gamma. 

The block diagram for this system is the same as the diagram given at the beginning of this example. To tune this system, the values of ko andgamma can be varied. 

NOTES ON DESIGN WITH MIT

Page 7: Model Reference Adaptive Control

It is important to note that the MIT rule by itself does not guarantee convergence or stability. An MRAC designed using the MIT rule is very sensitive to the amplitudes of the signals. As a general rule, the value of gamma is kept small. Tuning of gamma is crucial to the adaptation rate and stability of the controller.

MRAC - Pendulum SimulationAs an exercise in the use of MRAC, the MIT rule (explained in the theory section) was applied to a driven pendulum system. The system contained a vertically oreinted bar whose pivot point was attached to an encoder, so that the angle and angular velocity could be measured. To the end of the bar, a DC motor and propellor were affixed. When voltage was applied to the motor, the propellor spin and pull the bar up. The goal was to command the bar to a specified angle. A diagram of the system is given below: 

Newton's laws and conservation of angular momentum were used to derrive the equations of motion. The equations and resulting transfer function for the linearized system are given below: 

Page 8: Model Reference Adaptive Control

The controller for this system will take the form: 

The MIT rule will be used to form update rules for the adaptive parameters in the controller. Following the same process as outlined in the theory, the

Page 9: Model Reference Adaptive Control

equation for the error and cost function are written. From these, an equation for updating theta can be written as a function of the sensitivity derivative. 

It is then assumed that the controller has both an adaptive feedforward (Theta1) and an adaptive feedback (Theta2) gain. To derive expressions for the sensitivity derivatives associated with these parameters, the error function must be restated to invlude Theta1 and Theta2. The equation for the error is first rewritten as the transfer function of the plant and model multiplied by their respective inputs. The input Uc is not a function of either of the adaptive parameters, and therefore can be ginored for now. However, the input U can be rewritten using the feedforward and feedback gains. This can be used to derrive an equation for Yplant. 

Page 10: Model Reference Adaptive Control

The error can now be written with the adaptive terms included. Taking the partial derivative of the error with respect to Theta1 and Theta2 gives the sensitivity derivatives. Remember that Uc does not include either parameter, and therefore is inconsequential when evaluating the derivative. 

Page 11: Model Reference Adaptive Control

The sensitivity derivatives obtained contain the parameters from the plant. The premise of design with MRAC assumes that the plant characteristics are not absolutely known. This seemingly places the design process at a dead end. However, the goal was to make the plant approach the model. If the model is close to the actual plant, the model characteristics can be substitued for the plant characteristics, giving the following sensitivity derivatives: 

Page 12: Model Reference Adaptive Control

Then, applying the MIT rule, the update rules for each Theta can be written. The block diagram for the system with the derrived controller is shown below. Note that the plant input and output measurements are filtered BEFORE being multiplied by the error and gamma. 

Page 13: Model Reference Adaptive Control

This system was modeled in simulink. The open loop step response plotted below illustrates the need for control. The settling time for the system is upwards of 100 seconds! The reason for the persistent oscillations is a lack of damping in the system. 

Page 14: Model Reference Adaptive Control

The controller designed above was implemented. The Simulink block diagram is shown below, along with the response to a step command of 35 degrees. The transfer function implemented does not exactly mach the transfer function stated earlier. There are alos several gains added around the plant. This is because the system stated earlier assumed an input of a commanded angle. Here, the plant must receive a voltage command. 

Page 15: Model Reference Adaptive Control
Page 16: Model Reference Adaptive Control

The plant response obviously doesnt match the reference model. In fact, the plant almost goes unstable. This response is largely due to the near instability of the open loop system. Tuning of gamma and changing the refernce model did not allieviate this problem. In an unconventional attempt to kill the oscillations, proportional and derivative control was applied across the plant. The resulting simulink model and output are shown below. 

Page 17: Model Reference Adaptive Control
Page 18: Model Reference Adaptive Control

The reference model was chosen to have a settling time of 3 seconds and a damping ratio of .707, which is an industry accepted standard. The plot shows the response for several different values of gamma. As can be seen, when the value of gamma is increased, the system responds much faster, but threatens to become unstable. A smaller value of gamma leads to longer adaptation times, but a less volatile response. 

As a note, the practice of adding PD control across the plant is not generally accepted in MRAC design. There is an inherit problem with MRAC models in that the parameters continue to update even when the proper values are reached, resulting in oscillation about the set point. However, the conventional was of handling this problem are to make the input signal "rich" or to add a dead zone which kills updating when the error is within a given limit.

MRAC - Experimental ResultsAfter simulating the system in simulink (outlined in the simulation section), the designed controller was implemented on the real world system. Data was acquired and processed using LabVIEW 7.1. It should be noted that the continuous time design was implemented. It was assumed that data was acquired and processed fast enough in LabVIEW such that the implemented system approzimated the continuous time model. With sampling times under

Page 19: Model Reference Adaptive Control

10 ms, this appeared to hold true. The front panel of the LabVIEW VI is shown below. 

From here the operator can set the angle to command the pendulum to and set the constants such as gamma and the PD constants used. The control signal, model response, and system response are plotted together in the top right corner. The error is plotted below this graph. The two smaller graphs show the values of the adaptive parameters Theta1 and Theta2. The back panel is shown below. 

Page 20: Model Reference Adaptive Control

While the LabVIEW back panel appears a jumbled mess, being able to follow this example isnt as important as understanding principles in simulating differential equations in discrete time. The green block is the reference model. The blue and purple blocks are the filters applied to the plant input and output before they are multiplied by gamma and the error. In simulating differential equations such as these, the first question that arises is,"How are the states computed?" The solution is simple. 

Page 21: Model Reference Adaptive Control

If given a system, often the highest order dynamics are derrived from some physcial equation. For example, systems obeying newtonian motion often start with an equation for acceleration (or force). When evaluating this in discrete time, the value of this state should be computed first. Once the current value of the highest order state are known, the next values of the lower order states can be calculated. The equation is: 

f(t+T) = f(t) + f'(t)T        T = sampling time 

Simply put, the next value of "f" is equal to the current value plus the change in "f" times the change in time. Should you need the derrivative of a signal, it is: 

df/dt = (f(t) - f(t - T)) / T 

The derivative is the change in f divided by the change in time. And finally, the integral: 

int(f(t)) = f(t) + f(t - T) 

The integral is the summation of all the values over time. With these fundamentals you should be able to construct any system. Be wary with any of these calculations, however, as they are not as precise as directly measuring states. The derivative in particular becomes unusably noisey as the noise of the measured state increases. 

The experimental results are shown below. Click the pictures to view the videos (WARNING!! Each video is approximately a 5 mB mpg). 

Page 22: Model Reference Adaptive Control

FINAL WORDS

For this particular system, it was necessary to add PD feedback across the plant to kill oscillations and a deadzone around the set value to prevent updating of the adaptive parameters when the actual angle approached the commanded angle. In general, the MIT method is not the best implementation of MRAC, particularly with nearly unstable systems.

MRAC design comes in many flavors. Some of the more robust methods include Lyapunov direct and indirect MRAC. These methods are founded of of Lyapunov stability theory. More recent uses of MRAC incorporate other control methodologies such as Fuzzy-MRAC and Variable-Structure MRAC (VS-MRAC).

I hope you enjoyed the introduction to MRAC. If you have any questions or comments feel free to email me at:[email protected]