adaptive control for a first-order system

147
ADAPTIVE AND OPTIMAL TRACKING CONTROL OF ELECTROMECHANICAL SERVOSYSTEMS by ADITYA GARG A thesis submirted ro the Depi~rtmenr of Mechanical Engineering in conjonnity with the requiremenrsfor the degrw of Master of Science (Engineering) Queen's University Kingston, Ontario Canada KX 3N6 October 200 1 copyright O Aditya Garg, 200 1

Upload: bogdan-andrei

Post on 24-Oct-2014

64 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Adaptive Control for a First-Order System

ADAPTIVE AND OPTIMAL TRACKING CONTROL OF

ELECTROMECHANICAL SERVOSYSTEMS

by

ADITYA GARG

A thesis submirted ro the Depi~rtmenr of Mechanical Engineering in conjonnity with the requiremenrsfor the degrw of

Master of Science (Engineering)

Queen's University Kingston, Ontario Canada K X 3N6

October 200 1

copyright O Aditya Garg, 200 1

Page 2: Adaptive Control for a First-Order System

National übraiy I*I ofCa"& Bibliothèque nationale du Canada

Acquisitions and Acquisitions et Bibliographie Services senrices bibliographiques

395 Weuuigton Sireet 395. tue Wellington Ottawa ON KlA ONiI Otiaw~ON K l A W canada Canada

The author has grantecl a non- exclusive licence allowing the National Library of Canada to reproduce, loan, distribute or seii copies of this thesis in microform, paper or elecîronic formats.

The author retains ownership of the copyright in this thesis. Neither the thesis nor substantial extracts fiom it may be printed or othenivise reproduced without the author's permission.

L'auteur a accordé une licence non exclusive peunettant a la Bibliothèque nationale du Canada de reproduire, prêter, distribuer ou vendre des copies de cette thèse sous la fome de microfiche/fïlm, de reproduction sur papier ou sur format électronique.

L'auteur conserve la propriété du droit d'auteur qui protège cette thèse. Ni la thèse ni des extraits substantiels de celle-ci ne doivent être imprimés ou autrement reproduits sans son autorisation.

Page 3: Adaptive Control for a First-Order System

Adiya Garg: Ahplive ami Optimal Tracking Cvritrol of Electromechanical Servosystems. M. Sc. Thesis, Queeti 's Utiiversiiy a Kirigstot i. October, 2 O0 1

Adaptive control is an appealing control approach when a system requires variable

controller gains to compensate for unknown operating parameters. Similarly, optimal

control has drawn a fair degree of attention for trajectory tracking tasks. Optimal control

is an example of a model-based linear controller that provides a tigorous anaiyticai

approach to obtaining a set of fixed gains for a state feedback controller. The objective

of this thesis is to compare the performance of these approaches for trajectory tracking.

This thesis evaluates Model Reference Adaptive Control (MRAC) as compared with 1)

conventional Proportional-Velocity (PV) control and 2) Linear Quadratic Regulator

Tracking (LQRT) control. Simulation studies were conducted on two electromechanical

servosystems, a DC servomotor and a two-link robotic manipulator. Experimentai

studies were conducted with a single DC servomotor apparatus. Tests evaluated the

ability of each system to track step, ramp, sinusoidal and circular trajectories. The effect

of parameter changes on systern tracking performance was also exarnined.

MRAC and LQRT were first validated on an ideal second order system. Simulation

results for the robotic manipuiator showed that MRAC gave robust performance while

PV control failed to keep tracking errors within desired limits when the system was

subjected to inertia changes. Experimentd P-only and PV control results for the DC

servomotor were obtained to validate the control and data acquisition system. The LQRT

aigorithm achieved good tracking performance for al1 trajettories under conditions of

constant parameters. Simulation results for the DC servomotor showed that MRAC

could satisb design requirements with only partid knowledge of the system and under

conditions of changing systeni parameters. Implementation difficulties prcvented

experimental evaluztion of the MRAC aigorithm. It was apparent from inertia change

tests that LQRT is not suitable for systems which undergo significant parameter

variations. On the other hand, LQRT is simpler to implement than MRAC, which makes

it a good choice for those applications with comant and nearly constant parameters.

Page 4: Adaptive Control for a First-Order System

ACKNOWLEDGEMENTS

1 would like to extend my gratitude to rny supervisor Dr. Bnan Surgenor for his

continuous guidance and support throughout my program at the University.

The financial support provided by the School of Graduate Studies and the Department of

Mechanical Engineering is greatly acknowledged.

1 appreciate my lab mate Yang Xia, who through his sense of humour helped me get

through occasional hard tirnes.

1 would also like to thank my fiiend Abhinandan Jain at University of British Columbia

for his kind words and encouragement every now and then.

1 must express my gratitude for rny parents, my sisters and my girlfriend Elizabeth (soon

to be my fiance), without whose suppon I would not have been able to reach this

important moment in my life. Finally, 1 thank Queen's on the whole for making my two-

year stay here a most enjoyable and fruithl t h e of my life - not just acadernically, but

also in the cordial, carefiee environment and opponunities it provided for doing things,

which 1 had never done before.

Page 5: Adaptive Control for a First-Order System

TABLE OF CONTENTS

AB STRACT ACKNOWLEDGEMENTS TABLE OF CONTENTS LIST OF FIGUES LIST OF NOMENCLATURE

I iNTRODUCTION 1. I Problem Overview I .2 Thesis Objectives 1.3 Thesis Outline

2 LITERATIRE REVIEW 2.1 Adaptive Controt

2.1.1 Mode[ Reference Adaptive Control (MRAC) 2.1.2 Self Tuning Control (STC) 2.1.3 Design of MIWC Systems

2.2 Adaptive Control of Robotic Servosystems 2.3 Optimal Tracking Control

2.3.1 Integrator Exampie 2.4 Summary

3 SERVOSYSTLM S W A T I O N STUDES 3 . 1 Adaptive Control of a Second-Order System

3.1. i Modified MIT RuIe 3.1.2 MRAC for Generd Linear Systems

3.2 MRAC and PV for a 2-Iink Robotic Manipulator 3 2.1 Cosine Trajectory 2-22 Response to Parameter Changes 3 .Z.3 Straight Line Trajectory with MRAC

3.3 P and PV ControI for DC Servomotor 3 -3.1 Step and Trapezoidal Trajectories 3 -3.2 Response to Parameter Changes 3.3.3 Cucle Trajectory with PV

3.4 Sumrnary

Page 6: Adaptive Control for a First-Order System

4 SERVOSYSTEM EXPERIMENTAL STUDES 4.1 Background

4.1.1 Apparatus 4.1.3 Control Software 4.1.3 Open Loop Validation 4.1.4 Closed Loop Validation

4.3 LQRT for DC Servomotor 4.2.1 Optimal Replator Design 4.2.3 Ramp and Sine Tracking Design 4.2.3 Ramp and Sine Trajectories with LQRT 4.2.4 Circle Trajectory with LQRT

4.3 MRAC for DC Servomotor 4.3.1 Discrete Model for MRAC 4.3.2 Controller and Observer Design 4.3.3 Recursive Least Squares (RLS) Estimation 4.3.4 Square Wave Trajectories with MRAC 4.3.5 Circle Trajectory with MRAC

4.4 Cornparison of LQRT and MRAC 4.5 Summary

5 CONCLUStONS AND RECOMMENDATIONS 5.1 Conclusions 5.2 Recommendations

REFERENCES 1 O5

APPENDIX A: SIMULATION SOURCE CODE

APPENDIX B: EXPERlEvlENïATiON SOüRCE CODE 117

APPENDIX C: ADAPTIVE CONTROL FOR A FIRST-ORDER 127 SYSTEM

APPENDIX D: FIRST-ORDER SYSTEM SOLUTION FOR O P T W 130 TRACKMG PROBLEM

VITA 134

Page 7: Adaptive Control for a First-Order System

LlST OF FIGURES

Figure 2.1 :

Figure 2.2:

Essential components of an adaptive control system

Model Reference Adaptive Control system (parameter adaptation)

Figure 2.3: Model Reference Adaptive Control system (signal synthesis)

Figure 2.4:

Figure 2.5:

Figure 2.6:

Self Tuning Control system

Block diagram of a simple feedback loop

Integrator tracking example, cornparison of approximate Solution and exact solution for a ramp reference signal

Simulation of adaptive contrai for a 2nd -order system with MIT nile, showing trajectory and process output for 3 different adaptation gains and comparison of response to square wave command with three different amplitudes

Figure 3.1 :

Simulation of adaptive controi for a 2" -order system with modified M T nile, showing trajectory and process output and comparison of response to square wave cornmand with three different amplitudes

Figure 3.2:

Figure 3.3: W C for a second-order system using Lyapunov stability theory showing 2"d-order reference trajectory and process output

Figure 3.4:

Figure 3.5:

Schematic of a two-Iink manipulator carrying an unknown load

Cornparison of simulation of PV control and MRAC of a 2-link robotic manipulator for a desired cosine trajectory

Figure 3.6:

Figure 3.7:

Figure 3.8:

Figure 3.9:

Parameter estimates for MRAC of a 2-link robotic manipulator for a desired cosine trajectory

Cornparison of simulation of PV control and MRAC of a 2-link manipulator for a desired cosine trajectory with inertia change

Parameter estimates for MRAC of a 2-link robotic manipulator for a desired cosine trajectoty with inertia change

Cornparison of simulation results for MRAC of a t-link robotic manipuIator for a desired straight-line trajectory for two sets of gains

Figure 3. IO:

Figure 3.1 1:

Figure 3.12:

Position and velocity open loop remit for DC motor

Trapezoidai velocity profile

Cornparison of simulation resu1ts for P-only control of step test for DC motor for two different percent overshoots

Page 8: Adaptive Control for a First-Order System

Figure 3.13:

Figure 3.14:

Figure 3.15:

Figure 3.16:

Figure 3.1 7:

Figure 3.18:

Figure 3.19:

Figure 4.1 :

Figure 4.2:

Figure 4.3:

Figure 4.4:

Figure 4.5:

Figure 4.6:

Figure 4.7:

Figure 4.8:

Figure 4.9:

Figure 4.10:

Figure 4.1 1 :

Figure 4.12:

Comparison of simulation results for P-only control of ramp ifiput test for DC motor for two different percent overshoots

Comparison of simulation results for PV control of step test for DC motor for two dEerent percent overshoots and a fixed settling time

Comparison of simulation results for PV control of ramp input test for DC motor for two different percent overshoots and a fixed settling time

Cornpanson of performance degradation for P-only control of step test for DC motor for two different percent overshoots

Comparison of performance degradation for PV control of step test for DC motor for two different percent overshoots

Camparison of performance degradation for PV trajectory control of DC motor for two different velocity gains

Simulation oPPV control for two DC motors in response to sinusoidal reference signal to track a circuiar erajectory

Experimental Apparatus

PMDI MotionTools Main GUI

Simulation vs. experimental open loop test showing comparison of responses tvith 5 volt and 8 volt step inputs

Simulation vs. experimental open loop test showing comparison of responses with change in inertia (5 wfr step input)

Simulation vs. experimental P-only closed loop test for a step reference signal

Simulation vs. experimental PV closed Ioop step test for short response time

Simulation vs. experimental PV closed Ioop step test for long response time

Comparison of simulation results for closed loop step test with 3 sets of gains

Comparison of experimental results for DC motoi in response to a step input of 1 rot for j sec for three sets of gains

Simulation response for approximate vs. exact tracking solution for 5 rot'sec ramp reference

Simulation response for approximate vs. exact tracking solution for 0.5 Hz sùiusoidai reference

Simdation response for approximate vs. exact tracking solution for 0.5 Hz sinusoidai reference with inertia change

Page 9: Adaptive Control for a First-Order System

Figure 1.13 : Optimal tracking test showi.ng comparison of simulation and experimental result of approximate solution for a 5 rotj'sec ramp reference signal

Figure 4.14: Optimal tracking test, comparison of simulation and experimental result of exact solution for a 5 rok'sec ramp reference signal

Figure 4.15: Optimal tracking test showing comparison of simulation and experimental result of approximate solution for a 0.5 Hz sinusoidai reference signal

Figure 4.16: Optimal tracking test showing comparison of simulation and experimentai result of exact solution for a 0.5 Hz sinusoidal reference signal

Figure 4.17:

Figure 4.18:

Simulation of LQRT control for two DC motors in response to sinusoidal reference signal to track a circular trajectory

Simulation result for MRAC controller showing the actual response adapting after a few transients of square wave reference signal with initiai low estimate of initial parameters

Figure 4.19: Simulation result for MRAC controller showing the actual response adapting after a few transients of square wave reference signal with initiai high estimate of initial parameters

Figure 4.20:

Figure 4.2 1 :

Figure 4.22:

Figure B. 1 :

Simulation result for MRAC controller vs. PV controller for a square wave reference signal with inertia change

Simulation of MRAC for two DC motors in response to sinusoidal reference signal to track a circular trajectory

Comparison of simulation of LQRT and MRAC for two motors for tracking a circular trajectory with inertia change

Optimal tracking experimental test for exact solution for a 5 roosec ramp reference signal, comparison of results for different sampling times

Figure B.2: Optimal tracking experimental test with expanded scaies for exact solution for a 5 rorsec ramp reference signal, comparison of results for different sampling times

Figure C. 1 :

Figure D. 1 :

Comparison of adaptive control for l'order system with trajectory and process output for 2 different adaptation gains

First-order system optimal tracking example with cornparison of simulation of approximate and exact solution in response to a rarnp reference signal

Figure D.2: First-order system optimal tracking example with cornparison of simulation of approximate and exact solution in response to a sinusoidal reference signal 133

vii

Page 10: Adaptive Control for a First-Order System

LIST OF NOMENCLATURE

unknown parameter vector of 2-link manipulator

mode1 coefficients

siope of ramp or amplitude of sine reference input

acceleration of trapezoida1 move profile

state space matrices of the DC motor

observer polynomial

unknown parameters of discrete-time motor model

polynomial gains of mode1

extemal optimal control vector

instantaneous gain

steady-state approxirnate solution for LQR

coefficient for 1' order and 2* order system

cosines of joint angles

coriolis matrix

constants in optimal control Iaw

coefficient for 1" order and 2"d order system

components of parameter vector for RLS algorithm

total move t h e of trapezoidal move profile

error between model and process outputs

filtered error

output matrix of filtered error equation of manipulator

uansfer hnction for a general system

state-space matnx for a general system

gravitational constant

state-space matrix for a general system

transfer fhction for a ~eneral system

Page 11: Adaptive Control for a First-Order System

I l , , Ir2

N

N r * Nu

0 8

P

mode! transfer hnction

gravity m a t e

sampling time

state-space matrix for a general system

a combination matrix of system matrices and controller gains

identity matrix

unknown parameter - moment of inenia

minimum-error criterion

controller gain vector

optimal controller gain vector

system gain

manipuiator control gain

motor gain

proportional gain

velocity gain

lengths of manipulator links

unknown distance of 2"d link mass center fiom 2& joint

ratio of sampling time, Tm and motor cime constant, r,

manipuiator mass math

percent overshoot for dc rnotor

point masses of 2 links of manipulator

unknown parameter - mas

components of parameter vector for RLS algorithm

combined manipulator gravity and coriolis matrix

variables used in controller design of MRAC for motor

observer gain

differential operator

Page 12: Adaptive Control for a First-Order System

polynomid or matrix for filtered error

factors of polynomial P

vector of n-joint manipulator system parameters

solution of Riccati equation

joint angles

desired joint angle trajectory

reference velocity

polynomiai or matrix for filtered enor

nonnegative definite weighting matrix

step reference signal

controller polynomiai gain

positive detinite weighting matrix

controller parameter

sine of joint angles

reference velocity error

controller polynomiai gain

time

controller parameters

acceleration time of trapezoidal move prof le

deceIeration time of trapezoidal move profile

total move time of trapezoidai move profle

constant velocity time of trapezoidai move profile

controller polynomiai gain

extemal disturbance vector

settling tirne

control input signal

optirnai control

Page 13: Adaptive Control for a First-Order System

Greek letters

command signai

additionai control signal term in LQR tracking algorithm

open loop step reference input voltage

average velocity of trapezoidal move profile

maximum velocity of trapezoidal move profile

speed of the rnotor

open Ioop steady state velocity of rnotor

matrix of tùnctions ofjoint variables

controllability rnatrix

state vector

reference or desired trajectory vector

process output or position

trajectory output

known rnatrix, fùnction of q, q, q,, q,

a vector used in RLS algorithm

parameter introduced to avoid division by zero

saturation tùnction parameter

unknown parameter - angle relative to original 2"d link

adaptation gain

error augmentation

controI torques

6rst order system constant

motor t h e constant

discrete state space matrices

Page 14: Adaptive Control for a First-Order System

Acronyms

DC

DOF

DSP

GUI

P

LQ

LQR

LQRT

MRAC

P-only

P D

PV

RLS

STC

non-negative rnatrix

symrnetric positive definite matrix

parameter vector

vector of negative value of gradient of loss hnction

vector of joint positions

natural Frequency

damping factor

polynomial used in controller design of MRAC

parameter vector for estimation in RLS algorithm

vector of rnotor output and control signal

forgetting factor

symrnetric positive detinite rnatrix

Direct Current

Degree of Freedorn

Digital Signal Processing

Graphical User Interface

Index of Performance

Linear Quadratic

Linear Quadratic Reguiator

Linear Quadratic Regulator Tracking

Model Reference Adaptive ControI

Proportional only feedback controt

Proponionai-lntegrai-Derivative

Proponional-Velocity

Recursive Least Squares

Self Tuning Control

Page 15: Adaptive Control for a First-Order System

CHAPTER 1

INTRODUCTION

Automatic control systems exist in a virtually idnite variety, both in type of application

and level of sophistication. Control engineering can be surnrned up as the design and

irnplementation of control systems to achieve specified objectives under given

constraints. For a complex system, the overall objectives and constraints need to be

translated into performance specifications for the various individual subsystems that

make up the complete system. Control engineering practice includes the use of better and

fister control design strategies for increasing quality levels in manufacturing processes,

improving the energy efficiency of power production facilities, advancing the state of

flight control for aerospace applications, among others. System models are becoming

more and more important for the design of modem control system. The challenge to

control engineers can be stated as the need to model and control increasingly complex

and highly interrelated systems.

The importance of controllers in al1 technological areas is well known and documented.

For exarnple, without good process control, as in the case of a manufacturing plant. issues

such as product quality, production rates, material management, reliability and even

personnel safety would be in jeopardy. Controllers are there to maintain the process or

plant parameters within their prescribed limits, to track pre-designed trajectones to

perform certain tasks. And they rnust do so despite system disturbances, plant

uncenainties, model errors and so forth. Therefore, they have to be robust and able to '

ensure stability and maintain good system performance under adverse operating

conditions. In the context of this thesis, a robust controller is one that can maintain

performance in the face of changing operating conditions and system parameters, and yet

require a minimum of controller gain tuning.

Page 16: Adaptive Control for a First-Order System

P D is the acronym for the classicaI and most heavily used controI algorithm.

Proportional-Integral-Derivative (PD) controllers are sufficient for many control

problems, pmicularIy where there are benign process dynamics and modest performance

requirements. However, there are numerous control situations in which PID control with

constant gains fails to meet the requirements. For example, systems with large parameter

variations are candidates for more sophisticated contra[ structures.

When knowledge of the system is limited, the issue of adaptive control becomes

important. Adaptive control can rapidly modiQ an initially "imprecise" set of controller

gains as the controller seeks to adjust :O an unknown system state. Adaptive control with

its variabIe gain structure is also of value for those systems where operating parameters

Vary with time. Adaptive techniques are increasingiy being used in industrial controi

systems. Adaptive control is not a new subject. In the early 1950s extensive research

was done on adaptive control for the design of autopilots for high performance aircraft.

In sumrnary, adaptive controI can cope with increasingiy cornplex systems in the

presence ofextreme changes in systern pararneters and input sigals.

There are two main approaches for constructing adaptive controllers. One is the Mode1

Reference Adaptive Control (MRAC) rnethod and the other is the so-ca1Ied Self Tuning

Control (STC) method. This thesis will only apply the MRAC method. In a MRAC

system, the desired performance is expressed in ternis of a reference model, which gives

the desired response to a command signai. The regulator's pararneters are changed based

on the error as given by the difference between the outputs of the systern and the

reference model. In the context of widely u s a i comrol algorithms. an alternative to

adaptive control is optimai control.

Optimal control has drawn a fair degree of attention in particular for trajectory tracking

tasks. Optimal controt is a particdar branch of modem control, as opposed to classical

control, that aims at providing especiaily appeding adyticai designs. The system that

Page 17: Adaptive Control for a First-Order System

results from applying optimal control design methodology is not merely stable or satisfies

classicd requirements, but is also supposed to be the best possible or "optimal" system.

Linear optimal control is a special type of optimal control. Linear optimal control is an

example of a model-based linear controller that provides a ngorous analyticai approach to

obtaining a set of fixed gains for a state feedback cantroller. There are several

justifications for applying linear optimal control to a large number of systems as opposed

simply to optimal control. For example, a linear controller is simple to implement and

will often be sufficient for plants which are linear prior to addition of a controller. Most

linear optimal control problems are computationally inexpensive. Linear optima1 control

results may also be applied to nonlinear systems on a small signal basis. Through linear

optimal control, the class of systems for which control designs may be achieved can be

vastly extended.

Optimal control using linear quadratic methods aims at providing a system input that will

either 1) take the plant from a nonzero state to the zero state, or 2) cause the system

output to track some prescnbed function. This thesis will concentrate on the second

objective, namely tracking of a desired trajectory, by studying a Linear Quadratic

Regulator Tracking (LQRT) algorithm. A common situation where this objective is to be

achieved is trajectory-controllable systems such as electromechanical servosystems that

have to track a continuous path to do certain tasks like welding, cutting or painting in an

industrial environment.

1.2 Thesis Objectives

The objective of this thesis is to compare the performance of MRAC and LQRT

approaches for trajectory tracking as applied to representative elecuomechanical

servosystems. Servosystems in generaI are required to maintain a prescribed motion

dong a desired time-based trajectory with the controller applying corrective

Page 18: Adaptive Control for a First-Order System

compensating torques to adjust for any deviations fiom the trajectory and achieve fastest

response tirnes with minimal errors.

Specifically, the following issues wilI be addressed in this thesis:

What is the relative performance of Model Reference Adaptive Control (MRAC)

and Linear Quadratic ReguIator Tracking (LQRT) as applied to representative

electromechanical servosystems ?

Under what conditions can MRAC and LQRT be applied and when is their

application not advisable ?

1s MRAC harder or easier to implement than LQRT? What are the difficulties

encountered in their irnplementation ?

Are there ways that MRAC and LQRT cm be improved in the context of the

algorithms as irnplernented for this thesis ?

1.3 Thesis Outline

The organization of this thesis is as follows:

Chapter 2 is a literature review. It gives background theory on adaptive controi,

specifically on m C , and linear quadratic (LQ) control theory. A review of

difftrent adaptive control aiprirhmr For robotic rervosystems and optimal

tracking algonthms is aIso presented.

Chapter 3 presents simulation results for representative electromechanicai

servosysterns. Application of MRAC is made to three systerns: an ided second

Page 19: Adaptive Control for a First-Order System

order system, a 2-link robotic manipulator and a DC servomotor. For

comparative purposes, application of P and PV control is aiso made.

Chapter 4 contains experimental results of open and closed loop tests conducted

on a DC servomotor. MRAC is applied to the servomotor and verification of

LQRT is made for various trajectories. The performance of LQRT is compared

directly with that of MRAC, includins the case of an inertia change.

Chapter 5 summaizes findings and conclusions on the adaptive and optimal

tracking control of electromechanical servosysterns. Recommendations for hmre

work are aiso given.

Page 20: Adaptive Control for a First-Order System

CHAPTER 2

LITERATURE REVIEW

Chapter 2 gives a review of the literature and theory on the subject of adaptive and

optimal control in the context of tracking control of electromechanical servosystems.

Particular attention is paid to MRAC as an adaptive algorithm, application to robotic

manipulator servosystems and LQ as an optimal control algonthm.

2.1 Adaptive Control

M y dynamic systems to be controlled have constant or slowly varying wlcertatn

paramefers. For instance, robot manipulators may carry large objects with unknown

inertial parameters. Power systems may be subjected to large variations in loading

conditions. Adaptive control is a popular approach to the control of such systems.

There does not seem to be a universally accepted definition of what is an adaptive

controller. However, according to Landau (1979), an adaptive system measures a certain

index OF performance (IP) using the inputs, the States and the outputs of the adjustable

system. From the companson of the measured IP values and a set of given iP values, the

adaptation mechanism modifies the parameters of the adjustable system or generates an

auxiliay input in order to maintain the measured iP values close to the set of given ones.

This definition is illustrated in Figure 2.1.

The basic idea in adaptive control is to estimate the uncertain plant parameters (or

equivalently, the corresponding controller parameters) on-line as based on the measured

system sipais, and use the estimated parameters in the control input computation. An

adaptive system c m thus be regarded as a control system with on-line parameter

estimation (Slotine and Li, 1991). Pragmatically speaking, it is a specid type of

Page 21: Adaptive Control for a First-Order System

nonlinear feedback control in which the states of the process cm be separated into two

categories, which change at différent rates. The sIowly changing states are viewed as

parameters. An adaptive controller has two loops: one for ordinary feedback and the

second For updating regulator parameters. Adaptive control systems, whether developed

for Iinear or for nonlinear plants, are inherently nodinear, and their analysis and design is

intimately connected with the theory of nonlinear control. and in particular with

Lyapunov theory.

Unknown Known perturbations , perturbations

Figure 2. I: Essential cornponents of an adaptive controt system (Chalam, 1987)

---r--- *

An adaptive controller differs fiom an ordinary controller in that the controller

parameters are variable, and there is a mechanisrn for adjusting these parameters on-line

based on signais in the system. Adaptive controt systems may be classified by rnany

cnteria. For example, they can be parameter-adaptive or signai synthesis adaptive

systems, direct or indirect adaptive systems, or determïnistic, stochastic or leamhg

systems. Landau (1993) diicusses the evolution of adaptive control algorithms driven by

the results obtained in the application of fim generation of adaptive controllers.

t

ADJUSTABLE SY STEM

Page 22: Adaptive Control for a First-Order System

There are two main approaches For consuucting adaptive controllers. One is Model

Reference Adaptive Control (MRAC) method, and the other is Self-Tuning Control

(STC). This thesis shall deal ody with b M C .

2.1.1 Model Reference Adaptive Control (MRAC)

The problem of self-adjusting the parameters of a controller in order to stabilize the

dynamic characteristics of a feedback controi system when drift variations in the plant

parameter occur, was the origin of MRAC systems (Whitaker, Yamon and Kezer, 1958).

The two basic schemes of MRAC are given in Figure 2.2 and Figure 2.3. A MRAC

system is composed of four parts: a plant containing unknown parameters, a refirence

model for compactly specifjmg the desired output of the control system, a feedback

cot~trol l m containing adjunable parameters, and an adapm[otr mechanism for updating

the adjustable parameters (Slotine and Li, 1991). The reference modei gives the desired

response of the adjustable system and the task of the adaptation is to minimize a hnction

of the difference between the outputs, or the states, of the adjustable system and those of

the reference model. This is done &y the adaptation mechanism that modifies the

parameters of the adjustable systems or generates an auxiliary input signai. The

disturbances represented in Figure 2.2 are parameter disturbances modifying either the

reference model or the adjustable system. One of the most important advantages of this

type of adaptive system is its high speed of adaptation. This is because a measure of the

difference between the given iP specified by the reference model and the iP of the

adjustable system, is obtained directly tiy the cornparison of the outputs, or the states, of

the model with those of the adjustable system.

The plant is assurned to have a known structure, although the parameters are unknown.

This means that either the number of poies and zeros or the structure of noniinear

dynamic equations is known.

Page 23: Adaptive Control for a First-Order System

A refirence mode1 is used to specifj the ide* response of the adaptive control system.

The choice of reference model is part of adaptive system design. This choice should

reflect the performance specification in control tasks, and also this ideai behavior should

be achievable for the adaptive control system, Le., there are some inherent constraints on

the structure of the reference model given the assumed structure of the plant model.

The cottrrofler is usually parameeerized by a number of adjustable parameters. The

controller should have perfect tracking capacity in order to allow the possibility of

tracking convergence. if the control law is linear in terms of the adjustable parameters, it

is said to be li~iearly parumeferized. Existing adaptive control designs nonally require

linear parameterization of the controller in order to obtain adaptation mechanisms with

guaranteed stabiiity and tracking convergence.

The objective of adapmtioti law is to make the tracking error converge to zero. The main

issue in adaptation desi~n is io synthesize an adaptation mechanism that wiil guarantee

that the control system rernains stable and the cracking error converges to zero as the

parameters are varied. Many formalisms can be used to this end. such as Lyapunov

theory, hyperstability theory, and passivity theory.

CONTROLLER

Figure 2.2: Mode1 Reference Adaptive Controi system (parameter adaptation)

9

Page 24: Adaptive Control for a First-Order System

uc e + ADAPTARON - MECHAMSM

* P L M b

Figure 2.3: Mode1 Reference Adaptive Control system (signal synthesis)

2.1.2 Self Tuning Control (STC)

The self-tuning controller was originally introduced by Astrom and Wittenrnark in 1973.

In STC, a design procedure for known plant parameters is chosen first. This is applied to

the unknown plant parameten using recursively estimated values of the parameters. A

STC system is shown in Figure 2.4.

- REGLJLATOR DESIGN RECURSIVE

P L u b u E E R ESTMATOR

I Adjustable @-stem I

Figure 2.4: Self Tuning Conuol systern

Page 25: Adaptive Control for a First-Order System

There are strong relations between W C and STC design methodologies. Both kinds of

systems have an inner loop for control and an outer loop for parameter estimation. es rom a theoretical point of view, MRAC and STC can be put under a unified h e w o r k .

However, two methods can be quite different in tems of analysis and implementation.

2.1.3 Design of MRAC Systems

There are essentially three basic approaches to the analysis and design of a MRAC:

1. The gradient approach

2. Lyapunov functions

3. Passivity theory

The gradient method was used by Whitaker et al in 1958 in the original work on the

MRAC. This approach is based on the assumption that the parameters change more

slowly than the other variables in the system. Lyapunov's stability theory (Parks 1966,

Popov 1973, Vidyasagar 1986) and passivity theory (Vidyasagar, 1978) have been aIso

used to modify the adaptation mechanism to yield stable adaptive systems

The gradient approach is a fundamental idea in MRAC approach. The parameter

adjusment scheme is usually called the MIT nile. Assume that an attempt is made to

change the parameters of the regulator so that the error e between the output of the

process and the reference model is driven to zero. The following criterion is introduced:

where J = minimum error criterion or index

9 = parameter vector

e = error between mode1 and process outputs

Page 26: Adaptive Control for a First-Order System

To make J smail, it is rettsonable ro change the parameters in the direction of the negative

gradient ofJ, that is,

where Y = adaptation gain

1 - - time

The derivative &/28 is the sensitivity derivative of the system. The adjustrnent mie of

Equation 2.2 is cornmonly referred to as the MIT rule. It also applies to the case of many

adjustable parameters. The variable B should then be interpreted as a vector and &/a@ as the gradient of the error with respect to the parameters. The parameter adjustrnent

mechanism described in Equation 2.7 can be regarded as composed of an element for

computinç the sensitivity denvatives from process inputs and outputs, a multiplier, and

an integrator. The parameters are then introduced in the control law using a multiplier.

This is a generic part of many adaptive schemes.

Stability is a basic requirement in a control system. Much effort has been devoted to

analysis of stability of adaptive systems. Stability theory has been the major source of

inspiration for the development of MRAC systems. Assuming that ail the state variables

of a system are measured, the Lyapunov stabiiity theory can be used to design adaptive

control laws that guarantee the stability ofclosed-loop system. This approach is based on

Ftnding suitable candidates for Lyapunov ttnctions.

If we divide the system into two blocks, as s h o w below in Figure 2.5, where H and G

are general noniinear tirne-varyin3 systerns, we can establish properties for each bIock

and then use thern to conclude the stabiiity of the closed-loop system. By using the enor

rnodel below, it is possible to use passivity theorem if system H is passive (Astrom and

Wittenmark, 1989). The strictty positive reai condition of G is an important condition in

the design.

Page 27: Adaptive Control for a First-Order System

Augmented error cm be introduced to avoid hrther problems. The augmented error

method gives conversence.

Figure 2.5: Block dia- of a sim.$e téedback loop

The method for a direct MRAC can be described in the following steps:

1. Find a regulator structure that admits perfect model-following for the plant.

2. Derive an enar mode1 of the form

where G = transfer function

P = differential operator

P = vector of negative value of gradient of loss ftnction

3. Use the parameter adjustrnent law (a is a parameter to avoiding division by zero)

Page 28: Adaptive Control for a First-Order System

The error model of Equation 2.3 is linear in the parameters. The mathematical

manipulations used to derive the e m r model include filtering and error augmentation.

The details of complete derivation wiil not be discussed here. The equations needed to

implement the general MRAC are:

where

B m - I I , Y m -- A m

Filtered error: O O e,. = = e = = ( y - y,) P P

Errer augmentation: q = - -ii + Ii 1 b,Q Augmented error: e = t., + - rl

A d ,

Adjustment rate: $ = y@

Control input: tr = -0' (4 p)

Y = process output

Y , = trajectory (ideai output fory)

A,, B, = polynomiai gains of model

II = controi input signal

'1, = command signai

e,. - - tiItered error

P, 0 = poiynornids

rl = error augmentation

P, = factor of polynomid P

4 = observer polynomiai

4 = instantaneous gain

Page 29: Adaptive Control for a First-Order System

A. and A, are related by Diophantine's equation. Q is a polynomial wbose degree is not

greater than deg Ad,,,. The controller is given by

ir = R-' ( T i r , - Sy) (2.12)

where R.S and Tare polynomials. P=PIPI where P? is a stable monic polynomial of the

sarne degree as R. P,p and p are generated by filter from signals u , I I . and y. For

complete derivation of this set of equations, see Astrom and Wittenmark (1989).

2.2 Adaptive Control of Robotic Servosystems

Robotic servosystems are familiar examples of trajectory-controllable mechanical

systems. With increased demands on manipulator performance comes the need for

improved servo control techniques. However, their nonlinear dynamics present a

challenging control problem, since traditional Iinear control approaches do not apply. The

dynamic equations of a manipulator are of great importance in the design of its control

scheme. One of the major problems in applying sophisticated control atgorithms is that

of imprecise dynamic models. Extensive research has b e n done on control of

mechanical manipulators in cases where the physicai modeis that describe the

maniputators are not well known. Incorrectness or uncertainty in a dynamic mode! can

be spiit into two portions (Craig, 1988, Chapter 1). S~ructured uncerrainry is the case of

correct structurai mode1 with al1 uncertainty due to incorrect parameter vdues, Le. there

exists a correct (but unknown) set of vaiues for the parameters such that the mode1 will

match the actual system. Utrstr~ict~rred rrticertainty means unrnodeled effects, some of

which may be state-dependent and others are external disturbances. This thesis addresses

the case where modeling error is largely due to structured uncertainty.

Page 30: Adaptive Control for a First-Order System

The dynamic equation of a generaI serial manipulator rnodeted as a set of ri moving

jointed rigid bodies can be wiitten in the form:

where = 11 x 1 vector of joint torques

= ti x I , manipulator mass matrix

= vector of torques from coriolis & centrifbgal forces

= vector of torques due to gravity

= vector of unmodeled dynamics and extemal disturbances

= vector of joint positions

Using Lyapunov theory, following adaptation law can be denved for the manipulator

(Craig, 1988):

where Pr = vector of systern parameters

@, = estimate of P,

A = a non-negative matnx

CV - - matrix of functions of O, 0, O

EI = output matrix of filtered error equation

The stability, parameter error convergence and robustness to bounded disturbances for

the adaptive algorithm can be proved by using appropriate mathematicid tools. Any

adaptive aigorithm must possess these properties before it can quaiijl for

implementation.

Page 31: Adaptive Control for a First-Order System

Considerable research has been done on adaptive control of robotic manipulators in

recent years. Researchers have studied a variety of robots, a major proportion of them

being simple two- or three-link manipuiators. under different adaptive algoriths. There

has also been some research done on parallel manipulators though for most part, it has

dealt with kinematics and dynaniics.

One of the most notable initiai works on the application of MRAC to robotic

manipulators was done by Dubowsky and DesForges (1979). They justified MRAC by

pointing out that this procedure requires only a relatively simple, linear uncoupled model

of the system instead of cornplex nonlinear system dynamic equations of the actud robot,

leading to less burden on control compter. FolIowing the work of Donalson and

Leondes (1963). they developed the compensation network and parameter adjustment

algorithm for a six degree-of-&dom serial manipulator.

The technique used in the research of Dubowsky and DesForges was not systematized

and needed a difficult stability analysis. Horovitz and Tomizuka (1986) overcame this

shortcoming and presented an adaptive control scheme using the Popov hyperstability

theory. Baiestrino, Maria and Sciavicco (1983) designed an adaptive mode] following

control technique by doing away with assurnption of a constant linear model.

Slotine and Li (1987) did some signifiant research on adaptive control of industrial

robots using Lyapunov Theory for stability anaiysis. Craig (1988) in his book gave a

detailed account of the relative disadvantages of conventional dynamic control of the

manipulators and designed a MRAC aigorithm that maintains the structure of computed

torque servo but in addition has an adaptive elernent. Johansson (1990) presented

algonthms for continuous-time discrete adaptive control of robot manipulators using

detaiied Lyapunov Theory.

Gourdeau and Schwartz (1991) presented a motion control adaptive scheme with

trajectory tracking results of experimentation on a robot having same configuration as the

Page 32: Adaptive Control for a First-Order System

MIT Direct Drive robot. The MiT robot has been used as a benchmark by a number of

researchers (Asada and Youcef-Toumi, 1987).

In the previous decade to this century, severd researchers have attempted to design more

general and efficient MRAC algorithms for robotic manipulators using a variety of

simulation tools and also experimenting on the actual hardware. They have exploited the

special structure of rnanipulator dynarnics (Irnura, Sugie and Yoshikawa, 1994) and

eliminated the need for any a priori information on the robot uncertainty to design

sirnpler controllers. Self Tuninç Control and Variable Structure Systems methodology

has also been explored in designing more sophisticated controllers for manipulators.

Young (1978) did pioneering research on controller design for a manipulator using theory

of variable structure systems. Yu (1998) proposed a new combined adaptive and variable

structure adaptive control approach for manipulators. Yu. Zhihong, Chonç and Fei (1999)

developed a robust adaptive stiding mode controller (which is a special case of variable

structure systems) for trajectory trackins.

Nguyen, Antrazi, Zhou, and Campbell (1993) presented the irnplementation of a joint-

space MRAC scheme to control the noncompliant motion of a Stewan platform-based

manipulator (SPBM). Numerous adaptive control schemes were developed for open-

kinematic chah maniputators but oniy a few for SPBMs.

Most industrial robots use electric actuators, for exarnple DC servornotors, for actuation

of their joints. The next section Iooks at the tracking control of electromechanical

servosystems from another perspective; that is from the perspective of Optimal Control.

Page 33: Adaptive Control for a First-Order System

2.3 Optimal Tracking Control

The Optimal control problern can be stated as the need to determine the control u which

minimizes a given petformance tiinctional J. Given the system

and a quadratic performance index

where - X - state vector

F, G, H = state space matrices for a general system

minimùation pmblem is to find an optimal control ri'(t) for al1 t E [tu, T ] that Mnirnizes

J. The solution of this problem is given by following control law:

where r r 0 ( t ) = optimal control

RI = positive definite weighting matriv

QI = positive definite weighting matrix

P, = solution of Riccati equation

is given by the solution of the following Riccati equation, with initial condition P(T) =O

Page 34: Adaptive Control for a First-Order System

For details of the derivation of the above solution, one can refer to Anderson and Moore

(1990, Chapter 2).

For a conventional regulator, the objective is to arrive at the zero state and the path that

the system takes to reach that state is typicaliy ignored. The path is known as the

trajectory. This optimal regulator problem is in fact a special case of a wider class of

problems where it is required that the system States follow or track a desired trajectory in

some optimal sense. This type of problem is Frequently encountered in case of trajectory-

controllable systems such as robotic manipulators that have to track a continuous path to

do certain tasks. Another example is for altitude control of a terrain following aircrafl,

where there is knowledge of fiiture terrain. The approach to optimal tracking taken in

this thesis follows that of Anderson and Moore (1990, Chapter 4).

For the system given by Equations 2.15 and 2.16, a performance index can be given of

the form:

- where Y = reference signal or desired trajectory vector

the optimal control II* is given by:

where K' is the optimal gain and 60) is the exact solution to the infinite time tracking

problern as given by following:

Page 35: Adaptive Control for a First-Order System

In order to make the notation consistent with wider practice, K*is replaced with K for the

remainder of this thesis, where K = - KT . The notation for .? is also changed because -

for this particular case, H = 1, and therefore F = y = x, .

The following equations summarize the Optimal Tracking control algorithm:

where 1, = reference trajectory vector

Various approximately optimal trackers can be designed from above algorithm. Setting

Equation 2.27 to zero, and solving for b to get the steady state solution for the

compensator provides:

where H l = (GK - F)'

b, = steady state approximate solution for LQR

A review of the (steady-state) Riccati equation reveaIs that

and Equation 2.26 with b, substituted for 6 reduces tu the standard form of the LQR

control law:

Page 36: Adaptive Control for a First-Order System

2.3.1 Integrator Example

To illustrate above tracking theory, consider a simple scalar example where the plant to

be controlled is a pure integrator and reference input is a ramp signal (Anderson and

Moore, Chapter 4, 1990).

We have

F = O , G = l and x, = a,[

where a, = siope of the ramp reference input

Substituting the above values in Equations 2.25 to 7.27 gives:

The exact solution for b can be derived using standard differential equation theory, for

exarnple by finding the complementary but not the particular solution to Equation 2.33

Wce and Strange, 1994). In the case of a ramp reference signal, this becomes:

For a sep reference signal withx, = a, th.e exact solution for b becomes:

Page 37: Adaptive Control for a First-Order System

a a, For a sinusoidal reference signal with x, = 'sin (a f - -) + -, the exact solution for

2 2 2

b becornes:

where O = frequency of sinusoidai reference signai

The "approximate solution" is the terminology used by Anderson and Moore. This

terminology can be considered somewhat misleading. The tracking result for a process

modeled as a pure integrator is given as Figure 2.6, with a companson of the approximate

and exact solutions, in response to a ramp reference signai. According to Anderson and

Moore, the "approximate solution" is obtained by setting b = O in Equation 2.33. In the

case of the integrator example, this will reduce the control law of Equation 2.32 to

21 = - K . It can be shown, for example by using the Final Value Theorem, that for pure

proponional state feedback, there will be a constant and non-zero steady state error for a

ramp input. This is confirmed in Figure 2.6 for the approximate solution result, with a

steady state error on the order of O. 1.

Figure 2.6 also shows that the feedforward nature of the exact solution significantly

reduces the steady state tracking error, with control action starting before the initiation of

the ramp reference sipal at 0.1 sec. This result matches that given in Anderson and

Moore (1990, Ch. 4, Fig. 4.3-1). AIthough Anderson and Moore outline the theory of

optima1 control for tracking applications, they do not provide the exact solutions for

processes beyond that of an integrator. Extension to first order and second order

processes will be given in Appendix A and Chapter 4, respectively.

Page 38: Adaptive Control for a First-Order System

0.5 1 Tirne (sec)

Figure 2.6: Integrator tracking e~ample. cornparison of approximate solution (dot-dashed line) and exact solution (sotid Iine) for a ramp reference signal (dotted line).

2.3 Summary

The key observations frorn the theory and Iiterature survey docurnented in this chapter

can be surnmarized as follows:

Adaptive control is a very eEective control technique in the case of dynarnic

systerns that have slowly varying uncertain parameters or that are subjected to

unknown but bounded extemal disturbances.

Page 39: Adaptive Control for a First-Order System

Model Reference Adaptive Control (MRAC) finds a usehl application in robotic

servosystems. as robots are fiequently required to perform a variety of tasks dong

a set of desired trajectories and in an uncertain environment.

Although there is an abundance of literature on optimal control, there is Iittle on

optimal contour tracking control for servosystems.

Optimal Control can be an appealing approach for tracking control systems with

known and constant parameters, in which case a complex algorithm like MRAC

may not be desirable.

Page 40: Adaptive Control for a First-Order System

CHAPTER 3

SERVOSYSTEIII SIMULATION STUDIES

Modeling inaccuracies cm have strong adverse eRects on nonlinear control systems.

Therefore, a good design must take them into account explicitly. As mentioned in

Chapter 2, adaptive control is a robust control methodology; one that is able to maintain

good performance characteristics despite mode1 enors and parameter uncertainties. In

this chapter, we present simulation of various systems under adaptive control and also

servo system tracking simulation. The simulation code for al1 the applications in this

chapter is given in Appendix A.

3.1 Adaptive Control of a Second-order System

The design of an adaptive controller for an ideal second order system is given in this

section. For reference purposes, the design of a controller for a first-order system is

given in Appendix C.

Consider a second-order system with transfer hnction given by (Astrom and Wittenmark.

1989):

The objective of the MRAC control system is to adjust a feedforward gain 8 to the value

8' for system coefficients c and d. Applying the MIT rule for parameter adjustment

(Equation 2.2), the adaptive system cm be represented by the following set of equations:

Page 41: Adaptive Control for a First-Order System

d'y dy - + c - + d y = B u , dt ' dt

The fact that the parameter adjustment rate depends on the magnitude of the command

signal u, can also lead to instability.

Figure 3.1 shows the comparison of simulation results for adaptive control of a second

order system with trajectory, y, and process output, y for two different adaptation gains

y and three different square wave command signal u, amplitudes. For the three grids

piotted, the amplitudes of the command signal were: 0.1 (top), 1 (middle) and 3.5

(bottom). The remaining control parameters used in the simulation were c=d =Bo =1.

It is apparent fiom Figure 3.1 that the response can be unstable if the adaptation gain y is

set too large. Specifically, the response is unstable if y is 1.5. It is dso seen that

instability can result if the command signal u, is too large The figure also shows that the

convergence rate depends on the magnitude of the command signal. SpecificaIly, the

response is unstable when the amplitude of u, is 3.5; and the convergence is too slow

when the amplitude of u, is 0.1. The next section will illustrate how to avoid the problem

of instability and to rernove the dependency of the parameter adjusment rate on the

magnitude of the control signai.

Page 42: Adaptive Control for a First-Order System

fime (sec)

Figure 3.1 : Simulation of adaptive control for a 2" order qstem with MIT rule, trajectory,~, (dotted line) and process output, y for 2 different adaptation gains, y = [O. 1 (dash-dotted line) 1.5 (solid line)]. Response to square wave command, u, with amplitudes OF: O. 1 (top), 1 (rniddle) and 3.5 (bottom).

3.1.1 Modified MIT Rule

As explained in the last section, it would be desirable to modi@ the MIT mle so that the

adjustment rate does not depend on the magnitude of the cornmand signal. One way is to

rnake normalization (Astrom and Wittenmark 1989), invoduce a saturation to Quarantee

Page 43: Adaptive Control for a First-Order System

that the pararneter adjustment rate is always below a given lirnit, and replace the MIT mle

in Equation 2.2 with

where

x c - p snt (x . p) = [.ip + g

The algorithm of Equation 3.5 is sometimes referred to as the Modified Parameter

Adjustment Rule (Astrom and Wittenrnark, 1989). For the purposes of this thesis, it wilt

be tenned the Modifled MIT mie. The parameter a > O eliminates the possibility of

division by zero. In Figure 3.2 the second-order system was again sirnulated but with the

modified rule of Equation 3.5 in place of the original rute of Equation 2.2. In this

particular case Equation 3.5 simplifies to:

It should be noted that in some situations it rnight be desirable to have adjustnxnt rates

depend on the magnitude of the command signa1 for smail levels, as measurement noise

may be present. Comparing Figure 3.2 with Figure 3.1, it is clear that the Modified MIT

rule performs better, 1) elimination of the instability and 2) improved pararneter

convergence rate for the given range of command signa1 amplitudes. It is in fact possible

to make the Modified MIT rule work very well over a large range of command signai

amplitudes. However, it should be noted that instabïii is ail1 possible with the modified

rute if the adaptation gain is too large.

Page 44: Adaptive Control for a First-Order System

-2 , I

O 20 40 6 O 80 1 O0 1 20 140

Time (sec)

Figure 3.2: Simulation of adaptive controi for 2&-order system with Modified MIT nile, trajectory, y, (dotted line) and process output, y (solid line). Comparison of

response to square wave cornmand, JI, with amplitudes of O. 1 (top), 1 (middle) and 3.5 (bottom).

3.1.2 MRAC for General Linear Systems

Lyapunov stability theory can be used ta design adaptive control laws that sarantee the

stability of a closed-loop system. Such an approach is based on finding suitable

candidates for the Lyapunov fiinction Equations 2.6 to 2.12 gave the design for one such

approach to the probiem.

Page 45: Adaptive Control for a First-Order System

The performance of this system is illustrated by simulation of a second-order systern in

Figure 3.3. The systern is given by

and the standard second-order model is given by

where< is the damping factor, G, the model transfer hnction and K, is system gain.

It is apparent fiorn Figure 3.3 chat by using a control design based on Lyapunov Theory,

systerns with stable performance can be obtained. The adopted filter design is seen to

give rapid convergence of y to y,, and the error between the actual and the ideai model

reduces to near zero as the simulation progresses. Spikes in the plot of the control signal,

ri, are seen whenever there is a step change in the input signal. These spikes are due

largely to the proportionai component of the control law of Equation 2.12 in response to

the step change in the error signal. The bottom two grids of Figure 3.3 show the

parameter estirnates, which are seen to converge to near steady values.

3.2 MRAC and PV for a 2-link Robotic Manipulator

As mentioned in Chapter 2. adaptive control has been considered as an effective

mechanism for robot controller design due to the presence of nonlinearities and

uncertainties in robot dynamic models. MRAC was one of the first adaptive aigorithms

in practice and consequently has been more extensiveIy considered for robot rnanipulator

Page 46: Adaptive Control for a First-Order System

60 80 Time (sec)

Figure 3.3: MRAC for a second-order system using Lyapunov stability theory, with model reference that o f standard second-order model, second-order trajectory, ym , (dotted line) and process output, y (solid Sie).

Page 47: Adaptive Control for a First-Order System

The robot control probiem can be senerally stated as that of designing the joint torques so

that the joint motion variables track a desired trajectory.

The efficacy of MRAC as applied to robot manipulators will be illustrated by means of a

simulation of a two degrees-of-freedom (DOF) maniputator (Slotine and Li 1991). The

manipulator is modeled as two rigid, revolute links of lengths 11 and k with second link

carrying a large unknown mass. The two joint variables are joint angles (1, (angle of link

1 From horizontal) and q: (angle of link 2 with respect to link 1) as in Figure 3.4. The

control problem lies in determining the joint inputs required to cause the joints execute

the desired trajectory. The secoqd link, with the payload attached, can be regarded as an

augmented link with four unknown parameters, namely, mass nt,, moment of inertia I,,

the distance I,, of its mass center to the second joint, and the angle S relative to the

original second link.

Figure 3.4: Schematic of a two-[ink manipulator c-ng a large unknown load (Slotine and Li, 199 1)

Page 48: Adaptive Control for a First-Order System

The dynamic equations ofmotion of a 2-link revolute-joint rnanipulator are given by

(vidYasagar; 1989):

where control torques

Iengths of rnanipulator links

point masses of 2 links of manipulator

joint angles

cosines of joint angles

cosine of sum of joint angles

sine ofjoint angles

gravitational constant

friction tems

These equations can be rearranged to arrive at Following standard matrix fom,

where r = controI torque vector

hl = manipufator mass matrix

IV = vector of torques uïsing fiom centrifùgal, corioiis and gravity forces

Page 49: Adaptive Control for a First-Order System

The dynamics of the manipulator with payload c m then be wntten as

where

Hl, = a, + 20, cosqz + 2a, sin qz

H,z = HII = a, + aj cosq, + a, smq2

H E =al

h, = n3 sin y, - a, cos q.

C I , = I , i m , i c ; +nt/, ' + m , l , "

4- = f, + me ice'

4 , = m,Z, le= cos6,

a3 = m, il f, sin Je

We consider the case when the manipulator is required to follow a desired trajectory. The

adaptive controller design problem is to derive a control Iaw for the actuator torques, and

an estimation law for the unknown parameters. Applying Lyapunov theory gives

following result (for complete derivation, see Slotine (1991, pg. 404 and 405):

Control law: r = Y i - K,s, (3.22)

Parameter adaptation Iaw: G = - RYr s,. (3.23)

where R is a syrnrnernc positive definite mat* K, is gain and Y is a known matrix

such that

Page 50: Adaptive Control for a First-Order System

The rnatrix Y has been derived by using an additionai physical property of the system,

namely that, given a proper definition of the unknown parameter vector a describing the

rnanipulator's mass properties, the terms H ( q ) , C(q,q) and G(q), al1 depend linearly on

4. S, can be interpreted as a "velocity error" term

where

The "reference velocity" vector q, is fonned by shifting the desired velocities q,

according to the position error r j . 4) is a symrnetric positive definite matrix.

3.2.1 Cosine Trajectory

With reference to the 2-link manipulator in Figure 3.4, the following is obtained:

The components of rnatrix Y as given in Equarion 3.24 can be written as

Page 51: Adaptive Control for a First-Order System

Figure 3.5 shows a cornparison of simulation of the manipulator with conventional

Proportional-Velocity (PV) type control and Mode1 Reference Adaptive Control with

regard to tracking errors and control [orques. The PV control Iaw in this case is given by:

where ?, is the position error, q, is the velocity, K, and K,. are the controller gains.

It is evident from Figure 3.5 that PV control is not suitable for trajectory control as it has

larger initial position errors and more imponantly, position errors continue to oscillate

between large maximum and minimum values. On the other hand, W C gives much

better performance with srnaller initial position errors and f ier 1 sec the maximum error

settles to within 2 0.5 deg.

In the case of W C , we start without any a priori information ($0) = 0) for the

desired cosine trajectory. Figure 3.5 confirms the results given in Slotine and Li (1991,

Figures 9.4 and 9.5, pg 408 and 410).

Page 52: Adaptive Control for a First-Order System

MRACManipulatorl : Kp=2000,Kv=100 Cosine destred trajectory

Time (sec) Time (sec)

Figure 5 3 : Cornparison of simulation of PV control (dotted line) and MRAC (soiid line) of a 2-link robotic manipulator for a desired cosine trajectory.

Page 53: Adaptive Control for a First-Order System

Figure 3.6 shows the parameter estirnates for the W C resuit of Figure 3 5, except with

the time scale increased from 3 to 5 sec. The parameters shown in the top two grids

exhibit a stigfx drift but they are not unstable and show a trend towards convergence CO a

steady value. The parameters shown in the bottom two grids show an oscillation, but

again they are not unstabte as the amplitudes of their osciIlations are not growing.

MRACManipulatorZ: Kp=2001).Ki~c100 Cosine desired trajectory 0.25 0.8

Time (sec) Time (sec)

Figure 3.6: Parameter estimates for MRAC of a 2-link robotic manipulator for a desired cosine trajectory. Note the convergence pattern of ail the parameters which start without any a prion information

Page 54: Adaptive Control for a First-Order System

3.2.2 Response to Parameter Changes

In order to show the robustness of the MRAC scherne as applied to the robotic

rnanipuIator problem, Figure 3.7 gives a cornparison of the simulation result for PV

control and bIEWC for a desired cosine trajectory with a step doubling of the inertia of

the second link at f = 2 sec. MIWC gives superior performance in the face of this sudden

load change with the system recoverinç dmost immediately afier an initia1 increase of

errors and control toques at r = 2 sec. The two top grids in the figure show that position

errors for PV control are significantly Iarger as compared to those for MRAC. The PV

control performance degrades significantly after the inertia change and never recovers.

Page 55: Adaptive Control for a First-Order System

MRACManipulator4: Kp=20.00,K\~100 Cosine desired trajectory

-600 . -200 1 O 1 2 3 4 O 1 2 3 4

Time (sec) i Ïme (sec)

Figure 3.7: Cornparison of simulation of PV control (dotted line) and MRAC (solid h é ) of a 2-Iink robotic manipulator for a desired cosine trajectory with doubling of inertia at t=-l sec.

Page 56: Adaptive Control for a First-Order System

Figure 3.8 shows the adaptation of the unknown parameters. The parameters show a

sudden increase in values at the time of the inenia change at t = 2 sec but they still

converge to their final values. It should be noted that because none of the four mode1

parameters relate directly to the physical inertia, this approach does not necessarily

estimate the unknown parameters exactly, but simply generates values that allow the

desired task to be achieved.

MRACManipulatorS: Kp=2000,Kv=100 Cosine desired trajectory

0) -.

E - 3 . e UY a l .

Time (sec) O 1 2 3 4

Time (sec)

Figure 3.8: Parameter estimates for MRAC of a 2-link robotic manipulator for a desired cosine trajectory with change in load inertia at t=2 sec.

Page 57: Adaptive Control for a First-Order System

3.2.3 Straight-Line Trajectory with MRAC

After applying the MRAC scheme to a cosine desired trajectory, the contro! method was

applied to a straight-line trajectory. The end effector of the 2-link robotic manipulator

was required to track a straight-line trajectory in the X-Y plane of the manipulator. Since

the desired trajectory was defined in end effector plane, inverse kinematics was used to

determine the required joint trajectories, which would accomplish the tracking task.

Figure 3.9 gives a simulation result for the manipulator given the task of tracking a

straight line, with the X-coordinate remaining constant and Y-coordinate varying with

time. Initially. the rnanipulator is located to the right of the desired stan point for the

straight line. Note thar the large top grid gives the end effector position in Canesian

coordinates as generated by the angular positions of the joints of the manipulator.

It is apparent from Figure 3.9 that even though MRAC starts from an initially arbitrary

position, it is still able to reach the desired trajectory and maintain a small tracking error

thereafter. This shows that MRAC is capable of giving a satisfactory performance for a

range of trajectories with incornplete knowledge of the systern.

A different set of gains was used to study the effect of a change in gains used for the

control law. The resultant response was plotted as a dash-dotted line in Figure 3.9. It is

apparent that gains needed to be tuned before a good tracking performance can be

achieved. It is also noted that near the full-extension position of the manipulator, small

enors in the joint anges result in a very visible error in the end effector position. The

hard limit to the manipulator extension is r l . 8 on the y-axis (as marked in Figure 3.9).

The trajectory task of Figure 3.9 was repeated for the condition of a step doubling of the

inertia. Due to the reIatively slow tracking speed, there was no detectible effect on the

tracking error as MRAC was able to rapidly correct for the change.

The trajectory task was aIso dane for PV control for the sake of cornparison. However,

there was no significant difference between the PV and MRAC response for this test.

Page 58: Adaptive Control for a First-Order System

MRACManipulatoiB: MRAC Ibr manipulator. stnight line tnjectory

1 'i j Hard Full extension of the manipulator (small errors in joint 1

i 1.4 i angles result in a visible enor in end eiiector position) 4 bit

End eiiector position, x-axis

Joint 1 Joint 2 - 2 A

v v e l t - p O L - . - g ' j J Z . ' z ', 1 a,/ PI I - -C _ 1 0 - g 0 - 1; U ' U - 2 J

Time (sec) Time (sec)

Figure 3.9: Cornparison of simulation results for MRAC of a 2-link robotic manipulator for a desired straight-line trajectory with two sets of gains: [K, K,] =

il500 601 (dotted line) and [2000 3001 (solid line).

Page 59: Adaptive Control for a First-Order System

3.3 P and PV Control for DC Servomotors

There are two open-1oop parameters for the SIS0 system (position control of a servo

motor). the motor gain, Km. and the motor time constant, r, . The value of the motor

gain is f ied for a servomotor. The value of the time constant is a fiinction of the load on

the motor. The fügher the rotational inertia of the load, the larger the time constant of the

motor.

The measured speed of the DC motor, v, , can be given as a first order response with the

applied control signal. u, as the input (Kuo, 1991):

The position of the load, y,, can be obtained by integration of the speed signal, v, . Both

v, and ir are measured in volrs. The above mode! c m be convened to a second order

continuous state space form:

where

air - = AX + Bri

A. B = state space matrices of the motor

-r~ = motor position

r . = motor speed

The corresponding state space matrices A and B are given as:

Page 60: Adaptive Control for a First-Order System

The following values of the two parameters, r, and K m , were obtained by performing

an open loop test (the plot for which will be shown in Chapter 4). The actual response of

the motor to a step change on the control signal will also be given in Chapter 4.

Figure 3. IO shows open loop simulation for the above DC motor for a step reference

input. The figure compares the open loop response for different arbitrary values of motor

time constants and true motor time constant.

Page 61: Adaptive Control for a First-Order System

Bmotor: Open Loop test: Um=lO, Km=5.6, Ustep=5.00

-10 i f

O 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (sec)

Figure 3.10: Position and velocity open Ioop remit, with Km = 5.6 and rm = L0.0625 (dotted), 0.125 (dashed), and 0.28 (solid)]

3.3.1 Step and Trapezoidal Trajectories

Figure 3. Il shows a trapezoidal move profile with given distance and rnove tirne

parameters. Equations 3.42 to 3.44 give the starting points for determining a trapezoidal

profile.

Page 62: Adaptive Control for a First-Order System

Figure 3 .1 1 : Trapezoidal velocity profile (Industrial Devices Corporation, 1996)

Assume

where acceleration time

constant velocity tirne

deceleration time

total move time

maximum velocity

average velocity

total move time

acceleration

Page 63: Adaptive Control for a First-Order System

The average velocity given in Equation 3.43 is defined as:

- Dis tan ce to travel - D - - - Time reqllired t ,

Proportional control of a DC servomotor for a step reference input can be designed for a

given percent overshoot, M, . The tollowing equations can be derived from the classical

analytical design for P-only control of an ideal second order system (Kuo, 199 1):

where

,- - log (lll , , 100) 5 - -

( + ( l o g ( 1 100))')

4' = damping factor

K, = proportional gain (by design)

The P-only control law is given by

where P = error between desired and actual response

Page 64: Adaptive Control for a First-Order System

Figure 3.12 shows the cornparison of simulation of "Proportional-oniy control" by design

for a step reference input with two different user-defined percent overshoot, M, (5% and

25%). It is apparent from the figure that for Ad, = 25%, the response is faster that that €or

Ad, = 5%. The position signal for smaller overshoot reaches steady state earlier. A h , the

design value of gain does satisf) the desired requirernent of percent overshoot.

Bmotorl: P-only control: Km=5.6,Trn=0.28. Kp=0.978. step input signal

s r : 1 - 1 1C - - - - - - -y - - - - - - - -y-- - -- ',, O;' - --- 1 a -5 1

O 0.5 1 1.5 2 2.5 3 3.5 4 4 0 ,

\

u 1 2 20 i -- ,. . - Y - ----_ I

I y- > O - ---\ --- /

- - - .- 0 -20 - " - - II-

bl -40 &

i - > O 0.5 1 1.5 2 2.5 3 3.5 4

' 0 Y,. z 1 -- I

O 0.5 1 1.5 2 2.5 3 3.5 4 200 .

tn 1 ime (sec) O I

g OL ,,-----. ' ,' -

al r /

U I

-200 a 1

a O 0.5 1 1.5 2 2.5 3 3.5

j 4

Tirne (sec)

Figure 3.12: Cornparison of simulation results for P-only control of DC motor with Km = 5.6, r, = 0.28 sec and percent overshoot hl, = [5 (dotted) 25

(solid)]. Dashed line is the step reference signd.

Page 65: Adaptive Control for a First-Order System

Figure 3.13 shows the cornparison of simulation of "Proportional-ody control" by design

for a ramp reference input with two different user-defined percent overshoots, M, (5%

and 25%). Proportional-only control wiil result in a non-zero steady-state error both for

step and ramp reference trajectories. Introducing integral control action can eliminate this

steady-state error.

Bmotor2: P-only control: Km=5.6.Tm=0.28, Kp=0.978. ramp input signal

- _./-- \- E O - e - - - -- -----. - * E O 1

! \-

O - 1 0 ~ O 0.5 1 1 .S 2 2.5 3 3.5 4

10or ln y--

1 ime (sec) O .*-.,

--k . '-< - y O? , - - -

- / ,-'

Pi x. b*'- /

C) u -100'

0 0.5 1 1.5 2 2.5 3 3.5 4 Time (sec)

Figure 3.13: Cornparison of simulation results for P-only control of DC motor with Km = 5.6, r, = 0 . 2 8 ~ ~ and percent overshoot M, = 15 (dotted) 25

(solid)]. Dashed line is the rarnp reference signal.

Page 66: Adaptive Control for a First-Order System

PV control dlows one to design a controllcr fur a specified percent overshoot, M, and

settling time, T,. The following equations cm be derived 6om the classical analytical

design for PV controi of an ideal second order system (Kuo, 1991):

where w = natural frequency

K,. = velocity gain

T, = settling time

The PV control Iaw is given by

Page 67: Adaptive Control for a First-Order System

Figure 3-14 shows the cornparison of sirnuiation results for PV control applied to the

above DC rnotor for a step reference signal for two different user-defined percent

overshoots and a fixed settiing tirne- it is apparent fiom the figure that the design values

of proportional and velocity gains achieve the required performance in t e m of percent

overshoot and setting tirne. The system settles faster for PV than for P-only control.

Bmotor3: PV control: Km=5.6.Tm=0.28,Ts=0.5,Kp=19.63,K~O.62, step input

-

-20: 1

I

O 0.5 1 1.5 2 2.5 3 3.5 4 ,- 400 Time (sec) - 1 UI

200 1 . --- -- g o c - i/ - - I

1 -'Y. - 1 l /-A

-200 r L K k d 1 O 2 -400

l

O 0.5 1 1.5 2 2.5 3 3.5 4

Time (sec)

Figure 3.14: Cornparison of simulation results for PV control of DC motor with Km = 5.6, rm = 0.38sec, percent overshoot M, = [5 (dotted) 25 (soiid)]

and settling timt T = 0-5 sec. Dashed line is the step reference signal.

Page 68: Adaptive Control for a First-Order System

Figure 3.15 shows the comparison of simulation of Proportionai-Velocity control for a

ramp reference input with two different user-defined percent overshoots, M , (5% and

25%) and tked settling time. Note that PV control gives much better performance that P-

only control. This is because with PV control. we are allowed to specifj two degrees-of-

freedom - percent overshoot and settling time. This gives us more control over the shape

of the response. This is why the lag between the reference input and the actual output is

significantly Iess in the case of PV control.

Bmotor4: PV control: Km=5.6.Tm=0.28.Ts=0.5,Kp=19.63,K\F0.62, ramp input

O 0.5 1 1.5 2 2.5 3 3.5 4 ;ù 400 , rime (sec) ln 3 200 i- , ,.

' -. A

----- - -.. ? . I

g 0-1 .v : '.- - . ,/ I

5 -200 1 i O 1 2 -400 1

I

O 0.5 1 1.5 2 2.5 3 3.5 4

Time (sec)

Figure 2.15: Cornparison of simulation results for PV control of DC motor with Km = 5 . 5 , r , = 0.28 sec, percent overshoot M, = [ 5 (dotted) 25 (solid)]

and settling time T, = 0.5 sec. Dashed line is the ramp reference signal.

Page 69: Adaptive Control for a First-Order System

3.3.2 Response to Parameter Changes

The response of the motor can signiticantly degrade if subjected to changes in parameters

Iike motor gain and motor time constant. These changes can be caused by sudden change

in load on the system, for example, applying brakes to reduce the speed of the motor can

actually act as a viscous fiction causing change in both motor gain and time constant.

Figure 3.16 compares the degree of degradation in simulation of Proportional-only for a

step reference input when the system is subjected to tive times change in inertia and

controller is designed for two different percent overshoots.

BmotorS: P-anly control: Krn=5.6.Tm=0.28. Kp=0.978. step input

Time (sec)

Figure 3.16: Comparison of performance degradation for P-only control of DC motor with Km = 5 . 5 , r , = 0.28sec, percent overshoot M , = [5 (doned) 25

(solid)] Dashed fine is the step reference signal.

Page 70: Adaptive Control for a First-Order System

It is evident from acceleration grid of Figure 3.16 chat the response becomes much more

sluggish after inertia change at i=2 sec. Mso, the overshoot becorne significantly larger

which is clearly a sign of performance degradation. This is tme for both the d u e s of

percent overshoot. Figure 3. L 7 shows that PV control shows a similar trend of degraded

performance.

-20 1

O 1 2 3 4 5 6

200 .; Time (sec] +

l . -200: ,, i

: O 1 2 3 4 5 6 Time (sec)

Figure 3.17: Comparison of performance degradation for PV control of DC motor with Km = 5.5, r, = 0.28sec. percent overshoot M , = [5 (dotted) 25 (solid)]

and settling time T, = 0.5 sec. Dashed Line is the step reference signai.

Page 71: Adaptive Control for a First-Order System

Figure 3. i8 below illustrates trapezoidal velocity trajectory control using PV controller

when the systern is subjected to 500% change in inertia at f=2 sec. The maximum

velocity is 10 m/s and system has a fixed proponional gain. Figure compares results for

three different values of velocity gain. It is clear that when velocity gain is zero (Le

Proportional-only control), the performance degradation is more severe than when

velocity gain is non-zero (Le. PV control). PV control obviousiy gives more control over

performance in the face of parameter changes as explained before.

TrapTrajl: PV control: Krn=5.6.Tm=0.28, Kp= 2. KF[O 1 21, Trapezoid wlo. traj.

O 0.5 1 1.5 2 2.5 3 3.5 4

Time (sec)

Figure 3.18: Cornparison of performance degradation for PV trajectory control of DC motor with K, = 5.5, r, = 0,28sec, K, = 2, Ky = [O (dotted) 1 (dot-

dashed) 3 (solid)] Dashed line is the reference trajectory.

Page 72: Adaptive Control for a First-Order System

3.3.3 Circle Trajectory with PV

A planar circular trajectory cm be tracked by using two actuators for each of two

independent axes. We sirnulated cracking of a circular trajectory by using two identical

DC servomotors, one each for two axes in X-Y plane. A PV controller was applied to

control the systeni. The resuit of the simdation is showed in Figure 3.19. The top plot

shows the tracking of circle in 2-D plane. Plots under the top plot show two axes

separately. It's evident chat there is a significant tracking error in case of a simple PV

controller. We can eliminate this error by using the optimal tracking control algorithm

which will be explained in Chapter 4.

Page 73: Adaptive Control for a First-Order System

CircTrajl: PV Tracking of a circular tnjectory

-1 -0.5 O 0.5 1

Position. Motor 1

l ime (sec) Time (sec)

Figure 3.19: Simulation of PV control for two DC motors in response to sinusoida1 reference signal to track a circular trajectory

Page 74: Adaptive Control for a First-Order System

In Section 3 , I . a MR4C conuoiler as designed through the gradient appmach and

Lyapunov Theory was tested in simulation on an ideaI second-order system. These

simutations provided an introduction to the nature of adaptive control when dealing with

uncertain systems. In Section 3.2, the MRAC controller was applied to a more

demanding application, namely a two-link serial robotic manipulator. A performance

comparison was made between PV control and MRAC for the tasks of tracking

sinusoidal and straight-Iine trajectories under changing load conditions (doubling of

system inertia). These tests confirmed the superiority of M W C over PV in the case of

changing operating parameters as applied to a variety of trajectories.

In Section 3.3, P-only and PV control oPa DC servornotor was tested in simulation. A

performance comparison was made for the tasks of step, trapezoidal and circular

trajectories. Again, the etTect on pertbrmance of changing load conditions was

examined. These simulations enabled one to contirm a classical analyticd design

procedure For the P-only and PV controllers. This design procedure is used for the

purpose of systern validation for P-only and PV tests in Chapter 4.

The simulations in Section 2 . 3 involved only a single servornotor. On the other band, the

seriai rnanipulator simulated in Section 3.2 involved two servomotors whose cornbined

action moved the robot's end effector whose position was govemed by a set of nonlinear

dynamic equations. Therefore, one cannoe directly compare the results in Section 3.2

with those in Section 3 .3 .

The steady state tracking error seen for the circle trajectory in Section 3.3 highlighted the

need for an explicit tracking aigorithm such as LQRT. This, together with the application

of MRAC to a single DC servomotor for direct cornparison of LQRT and MRAC, is the

subject of the next chapter.

Page 75: Adaptive Control for a First-Order System

CHAPTER 4

SERVOSYSTEM EXPERIMENTAL STUDIES

Chapter 3 presented simulation results on representative electromechanical servosystems.

Application of bIIWC was made to three systems: an ideai second order system, a 2-link

robotic manipulator and a DC servomotor. This chapter will give experimental results of

tests conducted on a DC servomotor apparatus. Both MRAC and LQRT aigonthms are

tested with a variety of trajectories.

4.1 Background

This section will give a description of the apparatus used for experimentation, together

with open and closed loop results. The results are presented to validate the system mode1

as well as confirm the operation of the control and data acquisition system.

4.1.1 Apparatus

A schematic of the apparatus used for experimental testing is shown in Figure 4.1.

Basically, the experimentai setup consists of a DC servomotor, motion control DSP card

by Precision Micro Dynarnics Inc. (PMDI), a linear power amplifier, power supply and a

Pentium III host PC. The motion controller is used for data acquisition and servo control.

Ail of the interface facilities of the board are available to the host PC. The PMDI card

has digital VO, DIA and A/D converters, programmable timers, and intempt generation

devices. Al1 the hardware on the controller can be programmed using software routines

[to be descnbed in next section). The motion control card resides on the host PC. It is

co~ec ted to the DC servomotor via analog and encoder connectors. The DC servomotor

has a digitai encoder which feedbacks position data to the motion card through the

Page 76: Adaptive Control for a First-Order System

encoder connector. This encoder data is numericaliy differentiated to obtain an estimate

of motor speed. The host PC bas PMDI MotionTools software, resister access functions

and motion control library. The user can mn MotionTools to control and test the DC

servomotor. Altematively, the user can wnte customized C/C+ programs using register

access functions to implement different control structures and algorithms. The PC's

processor accesses the controller's resources through the PCI bus. From the PCI bus, the

registers are mapped into 32-bit memory. The amplifier amplifies the control signals

Rom a DSP board and supplies them to the motor. The amplifier has multiple current

and voltage mode gain settings. The motor responds to these commands and the position

data is then fed back to the motion card registers. These registers can then be read by

MotionTools or the user's program to complete the control loop.

4.1.2 Control Software

The software used for this research consists of PMDI MotionSuite, which is a

combination of MotionTooIs, motion controller's register access tùnctions and Motion

Control Interface (MCI) Library. A typical user interface is illustrated in Figure 4.2.

MotionTools has a GUI for tuning and testing with a PMDI motion control card. It mns

on a local host computer. It also has the capability of running across a local area network

or even the Intemet to control a remote motion control card and apparatus. MotionTools

was used for several purposes: 1) capture and view motion data, 2) interact with hardware

locally, 3) tune in reai-time by editing controI structure parameters, 4) viewing the

response in a display window and 5) read from and write to memory locations on the

PMDI card. It uses an initialization fiIe format to set various motion control parameters.

The user can also write C/C* prograrns using register access fùnctions and motion

control library. The board communication ftnction group handles basic controller board

communication. These functions deaI with the register map directly and are contained in

the dynamically linked Iibrary (DLL) mcregddll. The experimentation code, as wrïtten

in Visual C*, for al1 tests is siven in Appendix B.

Page 77: Adaptive Control for a First-Order System

1 PMDI Motion Control/DSP Card 1 m MC8-DSP-ISA

I2 ENCODER

m

f - \ \ Host PC

Linear Power ,- (MotionTools, Register Access fis)

Power ii Digital

Encnd~r

Fisure 4.1 : Experimental Apparatus

Page 78: Adaptive Control for a First-Order System

Figure 4.2: PMDI MotionTools Main GUI

Page 79: Adaptive Control for a First-Order System

4.1.3 Open Loop Validation

First logical step in the expenmentation phase is to conduct open loop tests on the system

@C motor in our case) to determine system parameters. Two system parameters as in

Equation 4.1 are sufficient to completely define the characteristics of a DC motor - rnotor

velocity gain, K m , and motor time constant, rm .

These parameters are defined as following:

Motor Velocity Gain, Km : Ratio of open loop steady state velocity to the input

step voltage, K m =v,/II,, , where v, is the open loop steady state velocity of

motor and u , , is the open loop step reference input voltage

Motor Time Constant, rm : Time taken by motor to reach 63% of the steady state

velocity

Inspection of Equation 4.1 shows that the steady state veiocity of the motor is in direct

proportion to the control signal magnitude. Ideally, motor gain should remain constant

with c h g e in the control signal magnitude, since it is calculated as the ratio of v, and

u,, . But in practice, this may not be the case.

Open loop tests were conducted with 2 different control signal magnitudes (5 V and 8 V).

The result is illustrated in Figure 4.3. It was found that the gain slightly changed with the

contrai signal magnitude and the change was nonlinear. The best fit for K, and r , to

the experimental results of Figure 4.3 were: Km = 5.6 and r, = 0.28 sec.

Page 80: Adaptive Control for a First-Order System

O 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Tïme (sec)

Figure 4.3: Simulation (dotted line) vs. experirnental (solid line) open loop test, cornparison of responses with 5 volt and 8 volt step inputs.

Two approaches were examined to produce a change in ioad for the apparatus in order to

provide a test for controller robustness: different discs (43 % change in r,) and different

magnetic brakes (18 % change in r,). It was found that only the different disc approach

produced a measurable change in controller performance.

Figure 4.4 shows the effect of a change in the inertia for the open loop response. The

inertia was reduced by replacing the origind Iarger and heavier steel disc on the motor

sh& with a srnalier and lighter aluminum d i x . Note that r, was 0.28 sec and 0.4 sec for

the fùll inertia and reduced inertia cases, respectiveIy.

Page 81: Adaptive Control for a First-Order System

h

O Reduced inertia 2 4 0 L 0 '4 - 2. c U t 0 20- O > Full inenta

Figure 4.4: Simulation (dotted line) vs. experirnental (solid line) open loop test, cornparison of responses with change in inenia (5 volt step inpuij.

4.1.4 Closed Loop Validation

Next step in experirnentation was to apply Proportional control to the motor with a

positive and negative step input cycle. MoeionTools could not be used for this purpose as

it does not allow precise trajectory control. Therefore, a C program was written (see

Appendix B) using DSP r e s t e r access Lunetions to implement the trajectory. This test

also served to validate the motor mode1 we used in simulation and for confirmation of

open loop results.

Figure 4.5 shows a cornparison of simulation and experïmefitai for Proportional control

of the motor. The gain K,= 0.34 was obtained fiom Equations 3.45 and 3.46, with

M, = 5 % and C = 0.69. The experiment (solid line) is seen to be a good match with the

Page 82: Adaptive Control for a First-Order System

simulation (dotted line). Note that the same gains were used in both experiment and

simulation. This match in the dosed loop tùrther didates the mode1 for the motor as

well as the control and data acquisition system for the apparatus.

Tirne (sec)

Figure 4.5: Simulation (dotted line) vs. experimental (solid line) P-only closed loop test for a step reference signal (with M, = 5%).

Page 83: Adaptive Control for a First-Order System

As mentioned in Section 3.3.1, PV control ailows the user to speciQ the settling t h e and

the percent overshoit in response to a step command. Figures 4.6 and 4.7 are

cornparisons of simulation and experiment for PV control of the motor with an overshoot

of 5 % and settling times of 0.5 sec and 1.3 sec. The gains K, = 6.72 and K., =0.62 were

obtained from Equations 3.48 to 3.5 1. Figures 4.6 and 4.7 tùrther validate the mode1

parameters obtained fiom open loop test. These results also confirm that PV control bas

been correctly irnplemented with the MotionTools software. In particular, care had to be

taken that the scale factors between experiment and simulation were correct.

Tirne (sec)

Figure 4.6: Simulation (dotted iine) vs. experimentai (sotid line) PV closed loop step test for short response time (with M, = 5 % and T, = 0.5 sec).

Page 84: Adaptive Control for a First-Order System

O 1 2 3 4 5 6 7 8 9 10 Time (sec)

Figure 4.7: Simulation (dotted line) vs. experimental (solid line) PV closed loop step test for long response time (with M, = 5 % and T, = 1.3 sec).

The foliowing section will deai with the problem of optimal trajectory tracking and the

controller gains will be obtained through an LQ design aigorithm. The LQ approach

tends to generate higher gains than with the analyticai approach used in this section.

In order to provide a comparison with the LQ results, Figures 4.8 and 4.9 illusuate the

step tests with the gains of Section 4.6 (K, = 10, K, = 0.84) for simulation and

experiment, respectively. Three different combinations of gains were used: 1) P-only, 2)

PV with half the velocity gains and 3) PV with hl1 (LQ) gains. The result confirms the

expected behaviour narnely; P only is underdamped, PV (half) is marginally

Page 85: Adaptive Control for a First-Order System

underdamped and PV (fiil!) is near criticdy damped, with settling times progressively

reduced. It is important to note that this trend is confirmed in both simulation and

experirnent. Recall that the experiment was generated with the controller generated in C-

code and there was some question as to whether the coding was correct.

O 0.5 1 1 .S 2 2.5 3 Erne (sec)

Figure 4.8: Companson of simulation results for closed loop step test with 3 gains: P-only with K=[10 O] (dot-dash line), PV with K=[lO 0.421 (dashed line), and PV with K=[10 0.841 (solid line).

Page 86: Adaptive Control for a First-Order System

-1 0 O 0.5 t 1.5 2 2.5 3

Time (sec)

Figure 4.9: Comparison of experimental results for DC motor in response to a step input of 1 rot for 3 sec, P-oniy with K=[IO O] (dot-dash line), PV with K=[10 0.421 (dashed line), and PV with K=[10 0.841 (solid line).

Page 87: Adaptive Control for a First-Order System

4.2 LQRT for DC Servomotor

Linear optimal control is a speciar type of optimal controi. The pIant that i s controlled is

assurned linear, and the controller is constraincd to be linear. Linear control!ers are

achieved by workinç with quadratic performance indices. These indices are quadratic in

the controi and regulatiodtracking error variables. Such methods that achieve linear

optimal control are calIed Linear-Quadratic (LQ) methods.

The design of a LQRT controller for the servomotor as a second order system is ~iven in

this section. For reference purposes, the design of a LQRT controlIer for a first-order

system is given in Appendix D.

4.2. i Op t imd Regula tor Design

Suppose we are given the system (Anderson and Moore, 1990):

i = Fx + Cri

y = H T x

where F, G, H = state-space matrices

Let the quadratic performance index to be minimized is given by:

where 0, = nonnegative definite matrix

R, = positive definite weighting matrix

Page 88: Adaptive Control for a First-Order System

Then the optimal regulator problem is to find an optimal control rr' that minirnizes the

performance index J. Solving Riccati equation, the solution is given by

where

1,' = - R, .' GP,(t)x(f)

P, = solution of Riccati equation, and is given by

- ~ ( t ) = P(t) F + F F(r) - P(r) G R, -'G'P(I) + Q,

4.2.2 Ramp and Sine Trajectory Design

The regulator theory discussed in previous section deais with the problem of returning a

system to its zero state in some optimal way. This problem is, in fact, a special case of a

wider class of problems where it is required that the outputs of a system follow or crack a

desired trajectory in some optimai sense.

Trajectory followinç problems can be further classified into three categones:

I . Servo problem (plant outputs are to follow a class of desired trajectones)

2. Tracking problem (the desired trajectory is aparricular prescribed

fiinction of time)

3. Model-following problem (plant outputs are to follow the response of

another plant or model)

In this chapter, we will discuss only the tracking problem where the desired trajectory xr

is hown a priori. h example of this type of problem is altitude control of a terrain-

folIowing aircrafl where there is knowledge of tiiture terrain. With a system given by

Equations 4.2 and 4.3, the optimal tracking problem is to find the optimal control u * ,

Page 89: Adaptive Control for a First-Order System

such that output y cracks the signal x,. The solution of this problem is given by following

three equations (Anderson and Moore, 1990):

where K. = optimal controller gain

Merl = additional control signai term

b = extemai optimal control variable

Changing notation for the control gain (with K = -KI ), the following equations were

adopted for implernentation in MATLAB:

I = Fx + Gu (4. IO)

I I = - K X - R ; ' G ' ~ (4. I l )

With regard to generai tracking task above, various approximately optimal trackers cm

be constructed. Setting Equation 4.12 to zero, and solving for b to get the steady state

solution, b, for the compensator:

Page 90: Adaptive Control for a First-Order System

A review of the (steady-state) Riccati equation will reveal that

and Equation 4.1 1 with b , substituted for b reduces to the standard form of the LQR

control law:

A state space model of the motor was provided in Chapter 3 (Equations j.38 to 3.40).

Given the sarne motor parameters ( Km = 5.6 and r, = 0.28 sec), then for the case of

RI = 1 and Q, = O], the result foi Equntion 4.14 is calculated with the PC-

MATLAB function LQR as K = [IO 0.841. The initial value for Q, is traditionally

taken as the identi9 rnatrix. The adopted vdue for QI came after a trial and error tuning

exercise where the result was a good balance between speed of response and the

avoidance of over saturation of the control signal.

Given a rarnp reference trôjectory defined as:

The control law uses onIy b2, hence we neglect the solution of b,

Page 91: Adaptive Control for a First-Order System

Solving Equation 4.12, we get following general solution for b(0:

H22 and C1 =- Hl2

For a sinusoidal reference signai, the exact solution for b(I) becomes:

4.2.3 Ramp and Sine Trajectories with LQRT

Using the optimal control design given in the previous section, simulation tests were

conducted for ramp input signal with a siope of 5 rousec and sine input signal with a

Frequency of 0.5 Hz.

Figures 4.10 and 4.1 1 show the comparison of simulation results for approximate solution

and exact solution for the DC servomotor in response to a ramp and a sinusoidai input

respectively. The top grid shows the tracking enor between the reference signai and the

actual response. It is apparent from the figures that the exact solution succeeds in

reducing the steady state tracking error significantly for both ramp and sinusoidai

reference signal, while the approximate solution fails to do so.

Page 92: Adaptive Control for a First-Order System

OptimaIMotionSimulal: Q I 1=100. R=1, K=[l O 0.841. ramp input signa1 . 1 : I

Figure 4.10: Simulation response for approximate (dotted line) vs. exact (solid line) tracking sotution for 5 robsec ramp reference (K = [ I O 0.841).

Page 93: Adaptive Control for a First-Order System

OptimalMotionSimula3: QI 1=100, R = l . K=[10 0.841, sine input signal

Figure 4.11: Simulation response for approxirnate (dotted line) vs. exact (solid line) tracking solution for 0.5 Hz sinusoidd reference (K = [IO 0.841).

Page 94: Adaptive Control for a First-Order System

Figure 1.12 shows the simulation of deterioration in performance of tracking algorithm in

the event of change of inertia of motor. The inertia of the rnotor was made 5 times of the

initial inertia at K. 1 sec. As cm be seen, this introduces significant tracking errors.

OptimaIMotionSimula3: QI 1=100, R=l, K=[lO 0.841, sine input signal

Figure 4.12: Simulation response for approximate (dash-dotted line) vs. exact (solid line) tracking solution for 0.5 Hz sinusoidal reference and 500% inertia change at t=2.I sec, @=[IO 0.841)

Page 95: Adaptive Control for a First-Order System

Figure 3.13 shows the comparison of simulation and experimental results for approximate

solution in response to a ramp input. Note that the tracking error for the simulation

reaches a steady state value of 0.5 rot. The cracking error for the experiment is of the

same order of magnitude but doesn't reach a steady state. However, the overall match

between the simulation and the experirnental results is reasonably good. thus vdidating in

part the tracking algorithm. There is considerabte noise in the velocity plot. This is

mainly due to the fact that veiocity data was obtained by numerical direrentiatiun of the

position data from the encoder. The noise in the velocity signal is fiinher arnplified by

virtue of the velocity feedback in the control algorithm.

OptirnaIMotorl: QI t=100, R = l , K=[ lO 0.841. ramp input signal

Time (sec)

Figure 4.13: Optimal tracking test, comparison of simulation (dot-dashed line) and experimental result (solid line) of approximate sotution for a 5 rdsec ramp referme signal (dotted he ) .

Page 96: Adaptive Control for a First-Order System

Figure 4.14 shows the comparison of simulation and experimental results for exact

solution for the same ramp reference signal. Note that the steady state error is reduced

significantiy and also that simulation resul ts are hrther confirmed by experimental

results, thus vaiidating the algorithm for tracking. There are oscillations in conuol signal,

which as explained berore, are due to noise in velocity signal. Another reason for this

phenomenon is that the motor positian is somewhat osciilatory about the reference ramp

signal, which reflects both in velocity and control input computation. However, despite

the apparently iarge oscillations in the control signal, the algorithm is still abte to achieve

good tracking.

OptirnalMotoR: Q l l=100, R=l , K=[1 O 0.841, ramp input signai

Time (sec)

Figure 4.14 Optimal tracking test, comparison of simulation (dot-dashed line) and experimental remit (soiid Iine) of exact solution for a 5 rocsec ramp reference signai (dotted line).

Page 97: Adaptive Control for a First-Order System

Figure 4.15 shows the cornparison of simulation and expenmentd results for approximate

solution of DC motor rnodel in response to a sinuddal input. Again there is a steady

state error between desired signal and actud response. Simulation result is a good match

with the experimental result. This is evident fiom the top g i d which shows that the

simulation and experimental tracking error are of comparable magnitudes ( = O 3 ror)

except for the oscillations in experimental plot.

OptimalMotor3: QI 1=100. R=l , K=[lO 0.841, sine input signal

O 0.5 1 1.5 2 2.5 3 3.5 4 2 10 - _- -

7 L - - 0, Y - '- ,de >- +. . - O-/,"- , . '-L - '- 2- 1. - > * L

- I O - -. / .-,--- =

- ----*- 5 - 1 0 :

> O 0.5 1 1.5 2 2.5 3 3.5 4 5 :

2 ; 3 - _ 1-- - -.v*-/-

d'. .: .,-,..)' \ L - .,4 t-- :y, .Y I

; O + . .*,' * -.-, - E ; ; C '- vL'\ 6'.

C ' 1 -:--,.r. ..+ -2..r"u\-J C i

- 5 ; O 0.5 1 1.5 2 2.5 3 3.5 4

Tirne (sec)

Figure 4.15: Optimal tracking test, cornparison of simulation (dot-dashed line) and experimental result (solid line) of approximate solution for a 0.5 Hz sinusoida1 reference signal (dotted line).

Page 98: Adaptive Control for a First-Order System

Figure 4.16 shows the comparison of simulation and expenmentai results for exact

solution of DC motor mode1 in response to a sinusoidal input. Again, implementing the

tracking aigorithm reduces significantly the steady state enor between desired signal and

actuai response. Again, simulation result is a sufficiently good match to the expenmentai

result.

OptirnalMotor4: Q I 1=100. R = l , K=[lO 0.841, sine input signal

f 1 - . . - . - , - . . . .. m.Y ,ci d O - - - . *. . ,--- e -.. . . ,- - i 'J

\/ j 5 1 1 " -5 ' A

O 0.5 1 1.5 2 2.5 3 3.5 4

Time (sec)

Figure 4.16: Optimal tracking test, cornparison of simulation (dot-dashed line) and expenmentai resuh (solid line) of exact solution for a 0.5 Hz sinusoidal reference signai (dotted line).

Page 99: Adaptive Control for a First-Order System

42.4 Circle Trajectory with LQRT

In Chapter 3, we explained how a circular trajectory could be tracked by using 2 DC

motors in parallel, one each for rwo axes in X-Y plane. However, Figure 3.16 showed that

there existed a significant steady staie error for the PV controller. The tracking aigorithm

presented in Section 4.2.2 is applied here to both the motors to eliminate this steady state

error.

Figure 4.17 shows the improved cracking obtained by implementing the above algorithm.

Comparing this figure with Figure 3.16 in Chapter 3, it is apparent that the steady state

error with PV control is significantly reduced when LQRT aigorithm is applied to the

circular trajectory.

Page 100: Adaptive Control for a First-Order System

CircTraj2: LQRT of a circulai trajectory

3 .

N L- 0.2 ?j O

= g -0.2 2. a ;!,

-0 .4 ' ! r \ i , .) ! I

-0.61 '... , . Y ,

-. ! -0.8 i

l

-1 -1 4 . 5 O 0.5 1

Position. Motor 1

F m e (sec) Time (sec)

Figure 4.17: Simulation of LQRT control for two DC motors in response to sinusoidal reference signai to track a circular trajectory

Page 101: Adaptive Control for a First-Order System

4.3 MRAC Tor DC Servomotor

This section gives the application of Mode1 Reference Control (MRAC) to the DC servo

motor (Chen and Naughton, 2001). The technique used for estimation of unknown

parameters is Recursive Least Squares (RLS). The objective is to design an adaptive state

ieedback controller to track a square reference input wave. The controller should meet the

following specifications of the dosed-bop step response:

Percentage overshoot, M, 5 10%

Settlinj tirne, 1: 5 0.8s

4.3.1 Discrete Mode1 for MRAC

We now discretise the system rnodel. Let h be the sarnpling period; the discrete-time,

state-space model is then given by

where 4, i- and H are discrete-time state space system matrices and

i r , = u(kh)

Page 102: Adaptive Control for a First-Order System

The systern matrices are given by

where A,, AI, i l , and A, are unknown parameters of systern mode1 are given by

following relations:

4.3.2 Con troller and Observer Design

It is assumed that the closed-loop poles are to be located at z = :, and : = zz, for the

purposes of the design of the controller and its associated observer. The following state

Page 103: Adaptive Control for a First-Order System

feedback control law can be used to track a step reference signai r, (Franklin ec al, 1998):

where K is the gain matrix obtained kom the Ackermann formula (Franklin, Powelt and

Workman, 1998):

where WC = [r # r] is the controllability marrix of the discrete-time model. ' P d ( ) is a

polynomial constmcted from the desired closed Ioop system poles, and N,and Nu are

solutions of the following matnx equation. where 1 is the identity matrix:

Following reduced-order observer can be used to estimate the angular velucity, xzs :

where

- = yi: - - Aj lir-i

and 0, is the observer gain, which can be obtained h m the Ackermann formula:

t

where z = r,, is the desired observer pole.

Page 104: Adaptive Control for a First-Order System

4.3.3 Recursive Least Squares (RLS) Estimation

The parameters of the system mode1 are given by A, , AS, A, and A, . They can be directly

estimated by using the RLS algorithm. The first step is to obtain the following discrete

transfer fùnction:

where

11, = K , ( h - r , + r,e-L)

11. = K m ( r m - rn, f! -L - h e ' L )

Ci, = - ( 1 + e -L )

ci, = r - L

From Equation 4.4 1 , following input-output relationship is obtained:

-vk = -d,yk-, - +n,uk-, + ntllk-2

Let E = [di d: t 11.1 be the parameter vector for estimation and

L k = [-Y,., -h-: U r - , "k - iP

Page 105: Adaptive Control for a First-Order System

Then, we can use RLS algorithm to estimate the parameter vector 6 (Astrom and

Wittenmark, 1989):

where O 5 p I 1 is a forgetting factor.

When the estimate of the vector 5 is obtainrd, it is used to determine K m and r , fiom

Equations 4.42 CO 1.45 as:

Subsequently, the values of Km and r, from Equations 4.52 and 4.53 are substituted into

Equations 4.30 to 4.34 to obtain the parameters of the state space model.

Page 106: Adaptive Control for a First-Order System

4.3.4 Square Wave Trajectories with bIRAC

The MEWC aigorithm as defined by Equations 4.23 to 4.53 was applied to the DC

servomotor model as defined by Equations 3.39 to 3.41 . A design specification for a

percentage overshoot, M, of 10% and settling time, T, of 0.8 sec was applied. The closed

loop poles were determined From these specifications, which were then used to obtain the

initial feedback gain matrix K.

The correct model parameters for the motor as taken fiom Section 4.1.3 are K m = 5.6

and r , = 0.28 sec. Two simulations were done with two different initial (incorrect)

estimates of K m and r,, :

Low estimate Case: Km = 3, r , = 0.1

High estimate Case: Km =IO, r , = 0.5

The simulation for the low and high estimate cases are shown in Figures 4.18 and 4.19,

respectively. It is apparent from both figures that the actual response (shown by solid

line) approaches the ideal response after two transients and satisfies the design

requirements of percent overshoot and settling time. This verifies the W C algorithm

and establishes the fact that MRAC aigorithm is capable of giving desired performance

when there is only a partial knowledge of the system parameters.

Attempts were made to impiement this iMRAC design on the experimental setup for the

DC servomotor. In esperiment under MRAC control, the motor never reached steady

state and consequently there appeared to be a convergence problem with the code as

implemented in Visuai C++. The code for the experimentation of , W C is induded in

Appendix B for reference purposes.

Page 107: Adaptive Control for a First-Order System

M o t o r M R A C I . M R A C using R L S : initial K m = 3 . Tm =0 .1 , M p = 5 % . T s = 0 . 8 ~ 80 1

1

O

Figure 4.18:

2 4 6 8 10 1 2 1 4

Time ( s e c )

Simulation result for M M C controller, the actual response (solid line) adapts afier a few transients of square wave reference signal (dotted Iine), initial low estimate Km = 3, r , = 0.1 sec, trueK, = 5.6, r , = 0.28 sec.

Page 108: Adaptive Control for a First-Order System

Motorhi R A C 2 : M R A C using R L S : initial K m =IO. Tm =O.S. M p = S % . Ts=0.8s 6 0 i I

-6 0 O 2 4 6 8 1 O 1 2 1 4

T i m e ( s e c )

Figure4.19: Simulation result for IMRAC controller, the actual response (solid line) adapts after a few transients of square wave reference signal (dotted line), initial high estirnate K, = 10, rm = 0.5 sec, true K m = 5.6, r , = 0.28 sec.

Figure 4.20 shows the cornparison between performance of W C controiler and PV

controiler for the same square wave signal as used in Figures 4-17 and 4.18, with a 500%

inertia change at F I O sec. It is clear fiom the trend in tracking error that MRAC

controller gives better performance than PV controiler in the event of change in motor's

properties.

Page 109: Adaptive Control for a First-Order System

MotorMRACVsPV: initial Km=3. Tm =0.1. Mp=5%. Ts=0.8s 1 O0 1

Inertia change

-100 -- O 2 4 6 8 10 12 14 16 18

Time (sec)

Figure 4.20: Simulation result for W C controller (solid line) vs. PV controller (dash- dotted line) for a square wave reference signal, 500% inenia change at F I O sec.

4.3.4 Circle Trajectory with iMRAC

Figure 4.21 shows the simulation of MRAC applied to two motors for tracking a circular

trajectory. Note that with each cycle the tracking error decreases and is significantly

reduced at the end of two cycles.

Page 110: Adaptive Control for a First-Order System

MotorMRAC3: MRAC tncking for a circular trajectory

-1 4 . 5 O O 5 1

Portlion. Motor 1

Time (sec) nrne (sec)

Figure4.21: Simulation of MRAC for two DC motors in response to sinusoidal reference signal (dotted line) to track a circdar trajectory

Page 111: Adaptive Control for a First-Order System

4.4 Corn parison of LQRT and hlRAC

Figure 4.17 shows simulation of LQRT for two servomotors running in parailel to track a

circular trajectory. [t is apparent from the tigure that LQRT gives good tracking

performance reducing steady state error significantly. Similady, Figure 4.21 shows

simulation for MRAC controller for the same circular trajectory and setup of two rnotors

tracking the desired path. It was noted that after a few transients, MRAC gives a good

match between actual and desired response.

However, it is not clear from Figures 4.17 and 4.21 how do LQRT and MRAC perform in

case where the servomotor inertia changes manifold for the same trajectory. Figure 4.22

shows comparison of simulation for MiUC and LQRT for the circuiar trajectory with

500% inertia change in servomotor at F l sec.

It is apparent from the figure that although both LQRT and M M C reduced steady state

error up until f= L sec, afler inenia change, LQRT gives a poor performance compared to

MRAC. Mer inertia change in servomotor, LQRT produces a much larger steady state

error at the end of the cycle; on the other hand, W C shows a jump in error onIy

initiaily. after which it recovers and brings back the system with much less tracking etror.

Therefore, it can be concluded from this test that MRAC is better than LQRT in cases

where inertia or load on the system changes unpredictably. When the system is not

expected to face unpredictable or sudden variations in loading conditions, LQRT is a

good alternative and it provides satisfactory performance.

A major issue with implementation of iMRAC on reai life systems is the computationai

overheads. Since the design of k W C system is more involved and the aigorithm is

much more complex, greater computationai resources and capabilhies will be required for

satisfactory real-time performance. Although cheap cornp~tation is available now due to

faster microprocessors, the systems too are growing compiex with a large array of

variabIes and parameters to account for. Therefore, MEUC is advisable only when the

knowledge of the system is incomplete, uncertain or varying.

Page 112: Adaptive Control for a First-Order System

MRACbsLQRf: MRAC VI LQRT b r a circulai tralectory 1 5

Position. Moror 1

-2 ' -5 ' 1

O O S t 1.5 2 O 0.5 1 1.5 2 firne (sec) rime (sec)

Figure 4.22: Cornparison of simulation oFLQRT (dashdotted line) and MRAC (solid Iine) for two motors for tracking a circuIar trajectory with 500% inema change at t= I sec.

Page 113: Adaptive Control for a First-Order System

Section 4. L gave the description of the apparatus and software that were used for

experimentation on the DC servornotor. A cornparison was given of simulation and

experimental results for open loop tests and closed loop tests with P-only and PV control.

The open loop and closed-Ioop tests confirmed the rnotor constants and validated the

control and data acquisition system for the apparatus.

Section 4.2 highlighted the need for an optimal tracking control algorithm. The

background theory for optimal regdator was provided. An LQRT algarithm for ramp

and sine trajectories was designed, sirnulated and implemented on the DC servornotor. It

was confirmed that the tracking error was reduced significantly by the application of

LQRT. A good match was obtained between the simuLation and experimental results of

the algorithm. LQRT was aIso applied in simulation to circular trajectory tracking with

two servornotors. Again. perfbrmance was cornpared with that obtained with PV control.

There was some concern about the difference in magnitude of the experimental noise in

the velocity signal, when a comparison was made of the ramp and sine trajectory tracking

tests. This difference was seen when one compares Figures 4-12 and 4.14 (for the ramp)

with Figures 4.15 and 4.16 (for the sine), respectively. ft was observed that sine tracking

was srnoother than rarnp tracking. No reason could be advanced for this difference. On

the other hand, it did not appear to affect the tracking performance of LQRT.

In Section 4.3, ;WWC was applied to the DC servomotor, usin3 the RLS technique for

parameter estimation. MIWC was tested on its ability to track a square wave comrnand

signal assuming pmial knowIedoe of the motor gain and time constant. The simulation

resdts showed that was able to obtain the desired performance in spite of these

unknown parameters. A comparison was also made between the performance of MRAC

and PV in the case of an inertid load change part-way through a test. It was found that

MIWC recovered rapidly after the load change. On the other hand, PV control was

unable to maintain the performance afier the sarne load change.

Page 114: Adaptive Control for a First-Order System

Finalty, a cornparison of LQRT and MRAC as applied to a circular trajectory with Ioad

change was made in Section 4.4. The tracking by the LQRT algoBihm degraded d e r the

load variation. By contrast, W C proved to be a robust technique as &er an initial

increase in tracking error, it was able to restore system performance to its original value.

in conclusion. it was apparent frorn the inertial load change tests that unlike MRAC,

LQRT is not suitabIe for systems which undergo significant parameter variations. On the

other hand, LQRT is simpIer to impIement than MRAC. which makes it a good choice

for those applications with constant and nearly constant parameters.

Page 115: Adaptive Control for a First-Order System

CHAPTER 5

CONCLUSIONS AND RECOMMENDATIONS

5.1 Conclusions

This thesis examined Model Referencc Adaptive Controi (MRAC) and Linear Quadratic

Regulator Tracking (LQRT) control with application to the tracking control of

electromechanical servosystems. A literature review was given on the theory associateci

with the design of MIWC and LQRT control algorithms.

Simulation of MRAC for an ideal second-order systern was done to validate the

algorithm and illustrate the behavior of ;MRAC when dealing with uncertain systems. A

convincing demonstration was çiven of the ability of MRAC to start with partial

knowledge of the system to be controlled and yet still achieve satisfactory performance.

Next, MIWC was applied to a two-link robotic manipulator and was required to track a

cosine and a straight line with changing inertial load conditions. These results, as

compared with the performance of conventional PV control, funher showed that MRAC

could achieve significantly better positioning performance under conditions of changing

load. The performance of PV control for a trapezoidal trajectory was studied to provide a

benchmark measure of performance. Next, PV control was applied to the task of using

two DC servornotors to track a circular trajectory. The simulation results showed that

there was a steady state error berween the desired and actual trajectories that was inherent

to the system and consequently could not be eliminated.

Moving on to experimentation, open and closed dosed loop P-only and PV control tests

were conducted to validate a systern model and confirm the operation of the control and

data acquisition systern for an experimenta! DC servomotor apparatus. A commercial

software package known as MotionTooIs was used in conjunction with user-writien C-

language routines. The DC servomotor was modeIed as a second order system and an

Page 116: Adaptive Control for a First-Order System

appropriate LQRT algorithrn was desigfied. The LQRT algorithm was applied to the DC

. servomotor for ramp and sinusoidal trajectories. M e r successful simulations, the

algorithm was validated experimentally.

Simulation of LQRT for two servomotors tracking a circular trajectory was also

perforrned. The circular tracking iesults were compared with those for PV control. It

was found that LQRT significantly reduced the tracking error of the servosystem.

MlWC was also applied to the servomotor for a square wave command signal trajectory

with different sets of initial motor parameters. It was apparent €rom the results that

MRAC could indeed adapt to a lack of aprtort system knowledge and with the aid of its

adaptation mechanism. gave good performance. Finally, both LQRT and MRAC were

sirnulated and compared for a circular trajectory under the condition of a inertial load

change in the system part-way through the test.

In the introduction to this thesis (Section 1.2), a set of 4 issues or questions was raised.

The direct answers to these questions are as follows:

On the issue of relative tracking performance of MlWC and LQRT for

electromechanical servosystem, both MRAC and LQRT gave comparable

pefiorniance under constant gain conditions.

On the issue of the appropriate conditions for their application, MRAC gives a

robust performance when the system to be controlled has unknown or uncenain

parameters or changing environment. On the other hand, although LQRT gives

good tracking performance in the case of invariant systerns, it does not maintain

the desired performance in the face of parameter changes. This is expected as

LQRT is a non-adaptive algorithm and is designed for fixed set of system

parameters. Thus, it cm be observed that the choice between MRAC and LQRT

would be dictated by the context of the application.

Page 117: Adaptive Control for a First-Order System

On the issue of ease of implementation, it was apparent t?om the expenmental

results that bIRAC is harder to implement than LQRT. The W C aigorithm is

more cornplex because in order to adapt the system, the controller gains need to

be estimated and adjusted at every sampling interval. The MRAC algorithm is

computationally intensive, making real-time performance harder to achieve. On

the other hand, LQRT is computationally straightforward.

The algorithms for MRAC and LQRT perfonned as expected and consequently

no recommendations can be given with respect to improving their performance as

implemented for this thesis.

[n conclusion, the choice between VRAC and LQRT is a tradeoff between ease of

implementation (simplicity) and pertbrmance when there is a risk of changing load

conditions ancilor unknown system parameters. But MRAC would achieve better

performance than LQRT in the case of varying systern parameters. The complexity of

implementing the MRAC algorithm was yaphically illustrated in this thesis by the failure

to get MR4C to work for the experimentai servomotor apparatus.

When using PV and LQRT control in experimentation, it was clear that the quaiity of the

velocity signal was important. The velocity was calculated by numerical differentiation

of the measured position signal from the digital encoder. This resulted in numerical noise

in the velocity signal. It is therefore recommended that a tachometer be incorporated

dong with the existing digital encoder for direct velocity feedback. Since the control

signal depends on the velocity signal, a better quaiity velocity signai wilI improve the

quality of the control signal.

Since PMDI MotionTools software can be used only for fixed-gain control structures iike

P, PV or P D and cannot be expanded to implement MRAC, other control algorithms

Page 118: Adaptive Control for a First-Order System

have to be written and irnplemented in C/C++ language. However, one of the advantages

of using MotionTools is its user-fiendly GUI. This provides easy access to various

parameters and programrning fiinctions. Using Visual Basic or Visual C*, a sirnilar

GUI for other control algorithms could be developed. It is recommended that such an

interface be developed using a standard Windows Programming language.

Consideration should also be given to procuring at least one more servornotor so that two

servomotors can be run in paraliel. This would allow expenmentation on two-

dimensional trajectories such as a circle (which was simulated in Chapter 3 and 4).

It is also recommended that the MTWC algorithni, as explained in Chapter 4 and

documented in Appendix B. be debugged and implemented successfiiliy on the

servomotor apparatus.

Another area to explore could be the cornbination of different tracking and adaptive

algorithrns to design a novel control technique, which couId ive more robust tracking

performance in the tàce of system parameter variations for a range of trajec~ories.

Page 119: Adaptive Control for a First-Order System

Anderson, B.D.O. and Moore, I.B. (1990): "Optimal Control: Linear Quadratic Methods", Prentice Hall, New Jersey

Asada, H. and Youcef-Toumi, K. (1987): "Direct-Drive Robots", MIT Press, Cambridge, Massachusetts

Astrom, K.J. and Wittenmark. B. (1973): "On Self-Tuning Regulators", Automatica, Vol. 9, pp. 185-199

Astrom, K. J. and Wittenrnark, B. ( 1 989): "Adaptive Control", Addison-Wesley Publishing Company, New York

Balestrino, A., Deblaria G. and Sciavicco, L. (1983): "An adaptive model following control for robotic manipulators", Journal of Dynamic Systems, Measurement and Control, Vol. 105. pp. 143-1 5 1

Chdam, V.V. (1987): ".4daptive Control Systems: Techniques and Applications", Marcel Dekker, New York

Chen, Y.-C. and Naushton, I.M. (2000): "An Undergraduate Laboratory Platform for Control System Design, Simulation and Implementation", IEEE Control Systems Magazine, pp. 12-20

Craig, J.J. (1988): "Adaptive Conuol of Mechanicd Manipulators", Addison-Wesley Publishing Company, New York

Donalson, D.D. and Leondes, C.T. (1963): "A Model Referenced Parameter Tracking Technique for Adaptive Controt Systems", IEEE Transactions on Applications and Industry, Vol. 82, No. 68, pp. 241-262

Dubowsky, S. and DesForges, D.T. (1 979): "The Application of Model Reference Adaptive Controi", Journal of Dynamic Syaems, Measurement and Control. Vol. 101, pp. 193-200

Franklin, G.F., PowelI, I.D. and Workrnan, .4 (1998): "Digital Control of ûynamic Systems", Addison-Wesley Publishing Company, Reading

Garg, A (2000): "Control and SimuIation of Trajectory and Setpoint Tracking for a 2-link Robotic Manipulator3', Project Report for MECH 850, Queen's University, Kingston

Page 120: Adaptive Control for a First-Order System

Gourdeau, R and Schwartz. H.M. (1991): "Adaptive control of robotic manipulators: Experimental results", Proceedings of 1991 E E E International Conference on Robotics and Automation. Sacramento. Apnl. pp. 8-15

Horowitz, R. and Tomimka, M. (1986): "An Adaptive Control Scheme for Mechanical manipulators - Compensation of Nonlinearity and Decoupling Control", Journal of Dynarnic Systems. Measurement. and Control, Vol. 1 OS, pp. 127-135

Imura, J.-ichi, Sugie, T. and Yoshikawa, T. (1984): "Adaptive robust control of robot manipulators - Theory and experiment", IEEE Transactions on Rototics and Automation, Vol. 10, No. 5, pp. 705-710

Industrial Devices Corporation (1996): "Electric Linear Actuators and Controls", pp. E- 10

Johansson, R. (1990): "Adaptive control of robot manipulator motion", EEE Transactions on Robotics and Automation. Vol. 6, No. 4, pp. 483-490

Kuo, B.C. (1991): "Automatic Control Systems", Englewood Cliffs, New Jersey

Landau, Y.D. (1979): ".4daptive Control: The Model Reference Approach", Marcel Dekker, New York

Landau, I.D. (1993): "Evolution of Adaptive Control", Journal of Dynamic Systems, Measurement, and Control, Vol. 1 15, pp. 38 1-39 I

Nguyen, C.C., Antrazi, S.S., Zhou, 2.-L. and Campbell, Jr. C.E. (1993): "Adaptive Control of a Stewart-based manipulator", Journal of Robotic Systems, Vol. 10, No. 5, pp. 657-687

Parks, P.C. (1966): "Lyapunov Redesign of Model Reference Adaptive Control Systems", EEE Transactions on Automatic Control, AG1 1, pp. 362-365

Popov, V.M. (1973): "Hyperstability of Control Systems", Spnnger-Verlag, Berlin

Rice, B.J. and Strange, J.D. (1994): "Ordinary Dierential Equations", BrookdCole Publishing Company, California

Slotine, J.-J. E. and Li, W. (1987): "On the adaptive control of manipulators", International Journal of Robotics Research, Vol. 6, No. 3, pp. 49-59

Slotine, J.-J. and Li, W. (199 1): "Applied Noiilinear Controt", Prentice Hall, New Jersey

Page 121: Adaptive Control for a First-Order System

Vidyasagar, M. (1978): bbNonlinear Systems Analysis", Englewood CWs, New Jersey

Vidyasagar, M. (1986): "New Directions in Research in Nonlinear System Theory", Proceedings of EEE, No.74, pp. 1060- 109 1

Vidyasagar, M. and Spong, Mark M. (1989): "Robot Dynamics and Controln, John Wiley Publishers, New York

Whitaker, H.P., Yarmon, J. and Kezer, A. (1958): "Design of Model Reference Adaptive ControI Systems for Aircraf?", Report R-164, Instrumentation Laboratory, MIT, Cambridge.

Young. K.-K. D. (1978): "Controller Design for a Manipulator using Theory of Variable Structure Systems", EEE Transactions on Systems, man, and Cybernetics, Vol. SMC-8, N0.2, pp. 101-109

Yu, H. (1998): "Robus: combined adaptive and variable structure adaptive control of robot manipulators", Robotica, Vol. 16, Pt 6, pp. 623-650

Yu, X., Zhihong, M.. Chong, S.S. and Fei, M. (1999): "Robust Adaptive Sliding Mode Control of Robotic Manipulators", International Journal of Robotics and Automation, Vol. 14, No. 2, pp. 54-60

Page 122: Adaptive Control for a First-Order System

APPENDIX A

Simulation Source Code

The following source code is a listing of the routines used in PC MATLAB for

simulation purposes. For al1 simulations, a numerical time step of 0.001 sec with a 1'

Order Euler Method was used. Previous work with the serial manipulator model had

shown that this time step was appropriate from the standpoint of both accuracy and

stability (Garg, 2000). Given that the tirne constant of the servomotor model was on the

order of 0.1 sec, it was evident that a tirne step of 0.001 sec was suficient for this

application as well.

Adaptive Control for a l"-order Syvtcm

Y- Input square signal genention [U,V = gensig('square',70.time. samplel: Z = ones(size(U); UC = (Z-U); for j = L:length(UC); if UCQ) == O; UCQ) = -L; end end

Yi- Model response IO square input sys = tf(am,[l bml); [YM.îMl= Isim(sys.UC.T):

YI- Process for i = 1 :lengtIi(YbO

dy = <*y + d * u v = y + sample*dy Yi- actwl process output é = y - ~h.i( i) ; %- error between actual and mode1 output du = -am*st + UC(i): xt = .ut + wmple*d~t: du = -am*.u + y: .YS = .ss + sample*d~~. dtO = -(gamma*e)*.\;t: 10 = tr) + mple*dtO: %- conuoIIer parameter dsO = (g;imma*e)*.us. sO = sO + samplecds0: O/&- mntmIler parameter u = tO*UC(i) - sO*y Y- corn1 signal Y(i) = y: Ul(i)z u;

End

Page 123: Adaptive Control for a First-Order System

Adaptive Control for r Zn*-order System

This code represents the impleinentation of Equations 3.1 to 3.1.

Y i - Input square signal genention [U.Tl=gensig('square1. period, time. sample): Z=ones(size(U)); UC=(Z-U): UCI=O. L*UC: UCZ=3.5*UC:

Y- h c s s for i= l:Iength(Yhl)

dy2 = tlieta*UCl(i) - al*dyl - aï*?; dyl = dy 1 7 sample*dy2: y = y + sample'dy 1; %- actual pmess outpu1 e = y - YW); dtlieta = -(gamma*e)*YM(i): Y- panmeter adaptation theta = rhcta + sample*dtheta: Y(i) = 5

end

Aduptivc control fur 2"-order System with Modified MIT Rule

This code represents 11ic ti~ipleineiitation of Equations 3.5 IO j .7.

Y- Process for i= l:lengtli(YM)

dy2 = thetaeUC l ( i ) - a l*dy 1 - aZ*y dy l = dy 1 + saiiiple*dy2: y = y + sainple*dy l; e = y - YM(i): Y M L=Yivl(i j: dtheta = -gamma8SAT(e.YM1.thet30.alpha.bet'd); Y- Saturation function theta = theia + sample*dtlieta; Y(i) = y:

end

function zI = SAT(e.YMl.thetaO.alpIu.bet2l): theta0 l=ilietac)*2; P = (e*Wl*ibetaO)l(alph*thetaOI + YMIY); if P c -beta Y&- Saturation parainetet

zl = -ben: eiseif abs(P) <= beta

21 =P: else

z l = betx end

Page 124: Adaptive Control for a First-Order System

MRAC of a 2-link manipulrtor

This code represents the implementation of Equations 3.12 to 3.36

'7" Mode1 parameten and c o ~ r s ml = 1; II = 1; Icl = 0.5: lm1 = 0.5: KP = 2000; KI = LOO: KV = 100; %- ControlIer gains lambda = diag([0.03 0.05 O. 1 0.31); g = 9.8; zeta = 2O*eye(2);

Y&-- Simulation IOOP for i = l:(tiine/dc+l)

est-Hl1 = alplu + 2*eps*cZ + 2*ctafs2: Y- Esuinated henia matrix at-H 12 = beta + eps*c2 + cta*s2: est-HZ1 = beta + epsW - eta*s2: est-HZ2 = beta: est-H = [est-Hl 1 est-HF: est-H2I est-MZI;

HI 1 = 3.3 + 2.08*cL + l.Z*sZ: Y i Tme [nenia matrix Hl2 = 0.97 L.O.l*cZ + 0.6*s2: H21 = 0.97 + l.O-i*c2 + 0.6*s2: H22 = 0.97: H = (HI1 H12: H21 H221: H-diff = est-H - H:

C 1 1 = -h*qv(2); C 12 = -ll+(qv( 1 )+qv(2)): C2I = hfqv(l): C22 = O; C = [Cl 1 CI2: C X C22l:

Y- Coriolis mritriu

Page 125: Adaptive Control for a First-Order System

qv= qv cdc*qiL q = q + dc*qv:

%- MRAC contr~ller m d e i qe =q-qd; %- T ndring error qve = qv - qdv: s = qve + zeta*qe; Y- Velocity enor qw = qdv - zeta*qe; qra = qda - zeta*qve: tq = est-H*qn + est-C*qm - KV*s: O/&- Conuol law

Y11 = qn(l.1); Y&- Y mayt~ Y12 = qra(2.1); Y21 =O; Y22=YlI+Y12: Y 13 = (2*qn( 1.1) + qn(2,1))*c2 - (qv(2.l)*qni 1.1) +

qv( 1.1 )*qni(2, 1) + qv(2.1)*qrv(2. I))*s2: YI4 = (2*qra( 1.1) + qn(2.l))*s2 + (qv(2.L)*qrv(l.l) +

qv( l.l)*qtv(2.1) + qv(2.l)*qrv(2.l))*c2: Y23 = qn(l.l)*cZ + qv(l.l)*qw(l, l)*s2: Y24 = qn( l.l)*sZ - qv(l.l)*qrv(l.l)*cZ: Y = [YI 1 Y 12 Y l3 Y 14: Y21 Y22 Y23 Y2-41;

desta = -(larnbda*Y')*s: Y- Panineter estimation law e s t a = e s t a + dctdcst-a: alplia = esta( 1-11: bcta = esr-a(2.1): eps = est-a(;. 1); eta = est_a(4, 1);

end

Page 126: Adaptive Control for a First-Order System

%- Km: Motor gain Yo- Tm: Motor tiine constant %- Am = [O 1: O - 1ITinl; Bm = [O; KmTinl; ?& state-space muices

%- Mp: Desired Ovenlioot Yo- zeta = ~10g(~lp/100~)/çq~(pi~3+(log(MplIOU))~2): O/&- Vm'i: Setpoint uelocip %- If Open Loop test. Usrep: Step size Yo" if PV tesr. Ts: Desired Sertling T h e

Kv = ( (S8Tf l s ) - I ) /Km: wn = -I/(Ts*reta): Kp = wn*wn7m/Km;

O/o_ If P-only test. Kv = O: Kp = l/(Km*Tm*(2*ze1a)~S); %- dt: T h e Step t = 0:dt:time: uc = O; 5' = 0: sp = y, dxdt = O; yt = s p dytdt = O: dtydtt = 0:

O/&- Main simulation loop for ii= l:length(t);

W ( i i ) = y: Yref(ii1 = s p üü(ii) = u c W(ii) = dydt: AA(ii) = d2ydt2:

tf P-only or PV test if Vrnas-=O:

if t(ii) > 2 & sp > U: sp = sp - Vinas*dt; Y' tnpezoidal move profile

elseif t(ii) > 0.1 & sp < 10; sp = sp + VinsPdt:

end else

if t(ii) > O. I; sp = 10: end %- step tcst if t(ii) > 2: sp = O: end

end e = (sp -y): uc = Kp*e - KPd~dt : %- contml law

else if t(ii) > 0.1; uc = Ustep: end O/&- open loop test

if t(ii) > 0.4: uc = 0: end if t(ii) > 2.0; uc = 0: end if t(ii) > 2.3; uc = 0: end

end if uc> 10: uc = IO: end if us-10: uc = -10; end

% - motor modei d2ydt2 = (Km*uc - dydt)TTm: YOC d2pdt2 = (Krn*uc - dydt)l(j*Tm): O/&- parameter change dydt = dydt + dt8d2!dt2: y = y + dt'dydt:

end

Page 127: Adaptive Control for a First-Order System

O/- Initial conditions t = &dl: time; ucl = k y l =O;spl =yl;dydtl =0;yt1 = spl; dytdtl =O; dZydt21 = 0: uc2 = O: y2 = 0: sp2 = y2; dydt2 = 0: ytî = sp2; dytdt2 = 0; dLydt22 = 0;

for ii= l :(time/dt+l): W l ( i i ) = yl; Yrefl(ii) = spl; Wl(ii) = ucl: Wl( i i ) = dydtl; AAl(ii) = dîydt21: WZ(ii) = y2: Yrefl(ii) = sp2; üiJ2(ii) = uc2; WZ(ii) = dydt2; AA2(ü) = d2ydiZ2;

If P-only or PV test if [(if) >= 0:

sp 1 = sin(2*pi4(ii-l )*dtltirne); end e l = (spl -yl): uc 1 = Kp*e l - Kv*dydt 1: if [(ii) >= O:

sp2 = cos(2*pib(ii-1 )*dtltime); end e2 = (sp2 - y?): uc2 = Kp*e2 - KvZdydt2;

end ifucl> 10; ucl = 10: end ifucle-IO: ucl = -10; end if uc2> 10: uc2 = 10: end i l uc2<- 10: uc2 = -IO: end

O/&- mofor mode1 d2ydt2 1 = (Km4uc 1 - dydt 1 )fiin: d2vdt22 = (Km*ucZ - dvdt2)flm. dGt1 = dydt 1 + dtLd2ydtl 1; dydU = dydt2 + dtqd2!dt22: yl = y 1 + dtfdydtl: ' 2 = y2 + dt*d!.dQ:

end

for kk= 1 :lengtli(t) TERRl(kk) = Yrefl(kk) - W l(kk); TERRZ(kk) = YrefZ(kk) - YY?(kk):

end

Page 128: Adaptive Control for a First-Order System

mu = input('motor tifne constant'): Y&- Motor parameters Km = input('motor gain constant'); F = [O 1; O -1ltauj; G = [O Kmltaul'; [KSI = 1qflF.G.QQ.R): [phi gamma] = cZd(F.G.dt): H=(G*K -F)'; invH = inv(H); C l = Q I lM(I.2) %- calculare parùcular solution C2 = H(Z.Z)rH( 1.2)

for ii= l:lefigth(tt): iJü(ii) = u; Xl(ii) = ~ ( 1 ) ; XZ(ii) = s(2): RXL(ii) = slr. BB2(ii) = b2; if hg&= 1; u = -K(l)*(s( 1) - sir) - K(2)*~(2):

elscif flagP==2 XR =[sir 01'; bss = -invH*QQ*,W:

if flagQ==O; % - step solution b2 = bss(2):

elseif flagQ== 1; % --- exact nmp solution if tt(ii) >=?.O

b2 = bss(2); % - nvitcli to stcady state solution elseif tr(ii) c 3.0 & tt(ii) > 0.1;

b2 = -C 1 *aaf (tt(ii) + C2 - 0.1 }: else

b2 = 0: end

clseif flagQ==2: % - e.ua sinusoid solution if tt(ii) > 0.1:

b2 = -CI*((aalZ)*sin(wn* (tt(ii) + C2 - 2))); end

end u = -K*s - ( l/R)*G'*[O b2j';

end

%- process mode1 (digital implementation) .u = phi% + gamma*^:

end

Page 129: Adaptive Control for a First-Order System

MRAC Cor DC Motor

This code represents the iinpleinentation of Equations 4.22 to 4.53

T = inputlSampling tirne'); n = 3: T p 4 : TF1 4: t=O:T:TI: Ns=length(t); rad=pi/l80; theta = [j: ref = jO.O*rad: for ii=l :length(t) y01 genention of square wave reference signal

if ((i(ii)>=O & t(ii)<2)) reÎt(ii) = O;

elseif ((t(ii)>=i & t(iiF=-t) i (t(ii)X & i(ii)<=8) 1 (t(ii)>lO & t(ii)c=It) 1 (t(iipl4 & t ( i ip16)) reh(ii) = jO*nd

efseif ((t(iiP4 & t(ii)c=6) 1 (t(iiP8 & t(ii)<=LO) 1 (t(iipl2 & t(ii)<=l4) 1 (t(ii)>l6 & f(ii)<=lS)) refv(ii) = -5O*nd;

end end

po = input(' Ovenhoot. dehuIt 5%?); u2 = input(' Settling tiinc. default 0.8s:"): zeta = -Iog(po)/~qn(log(po)~2 + piA2); wn = 4lts2izeta: J = qn(-1): sd = -zeta*wn + Jtwn*sqR( 1-zetaA2): sd = [sd. conj(sd)l: zdc = esp(sd*T): pdc = polgzdc): O/&- closcd-loop poles

npann = 4; P= IOOO*e~e(J): Q=eyeO); Iainbda = esp(-T'rrp): Kin[ = 5.6; Tm[ = 0.28; O/&- tme panmeten Km = 3: Tm = 0.1; 9 1 ~ initial piininelen E = esp(-Tfim): a l = -Tm*(E-1): a Z = E bl = Km8(T + Tm*E - Tm): b2 = Km*( l - E): der0 = b2*(a2*b 1 - b 1 - al *b2): n l = Km*(T + Tm*€ -Tm): n2 = Km*(Tm - Tm*E - T*E): dl = - ( I + E): dZ = E: parm = [dl d2 nl nt]':

Phi = [l al; O a21; O/&- ?stem matrices Gamma = [b 1 b2l': c = [i 01: M = [ p h i - qe(2). Gainmal: [C 01 1; R=[00 11'; N = Ns = N( 112); Nu = N(3);

Page 130: Adaptive Control for a First-Order System

oldul = O;old\;k = [O O]';ol&x2h = O;

for k = I : ( W Det l(k) = 0; tlieta(k) = 0;

end

dydt = O; '-0; u=O: for k = (m+I):length(t) % main siindation loop

if t(k)>= IO d2ydt2 = (Km l *u - dydt)/(Tm 1 9 ) ;

else dQdt2 = (Kml*u - dydt)ITml: end

dydt = dydt + T*dZyd12; y = y + T*dydt;

Plu = [ l al; O a2I; Yi-update .stem marices Gamma = [b 1 b21';

Der L(k) = det(cüb(Plii,Camma)); Kp = [O 1 ~*inv(ctrb(Plii.Ga~nm))~poIy~alm(pdc,Plu);

ytilde = y - oldy - b l *oldu: Lr = a2131; s2Ii = al*olds21i+ bPoldu + Lr*(~lildc - a l *olddIl): .sk = [y .dhl':

ref = refv(k): u = Nu*rcf - Kp*(.xk - Ns*ref);

%-- RLS panrnerer estimation psi = [-oldy oldy 1 oldu oldu II'; K = P*psi/(lambda + psi'*P8psi): P = (eye(nparm) - K*psi')*Pll;uiibdi; parm = parm + K.(! - psi'*parni):

theta(k) = y oldxk = &d<: olddli = .dh; oldu 1 = oldu; oldu = u: oldyl = oldy: oldy = y:

end

Page 131: Adaptive Control for a First-Order System

EXPERIMENTATION SOURCE CODE

The following source code is a listing of the routines used in Visual C++ for experimental

control and data acquisition purpases. For al1 wperiments in this thesis, a sample time of

0.001 sec was used as this was found to be suficient to enable one to assume that contrai

could be considered continuous in nature. Closed loop tests conducted with a sample

time of 0.1 m e c showed no significant change in the results. On the other hand, one

began to see discretization effects when the sample time was increased to 0.0 IO sec. This

is shown in Figure B. 1. The discretization is observed in both velocity and control signal.

It is also apparenr from Figure B. 1 that when a sampIing time of 15 msec was used for

control, the performance gets worse. It was also noted that the control and velocity

signals obcained by using 10 msrc and 25 rnsrc were slightly out of phase with those from

L msec. The PMD[ hardware and software is capable of a sample time of 0.00 1 mec.

Page 132: Adaptive Control for a First-Order System

OptimalMotor5: Q I 1=100, R = l , K=[1O 0.841. ramp input signal

O 0.5 1 1 .S 2 2.5 3 Time (sec)

Figure B. 1 : Optimal tracking experimental test for exact solution for a 5 rot'sec ramp reference signal. cornparison of results for different sampling times: 1 mec (solid line), 10 msec (dash-dotted line) and 25 msrc (dashed line)

Page 133: Adaptive Control for a First-Order System

Figure B.2 shows resutts of a cornpanson of results of experimental test for sarnpling

time of 1 msec and 0.25 mec. Expanded scales are used in the figure to highlight that the

tracking errors decay with time and after 2 sec, the actuai trajectory is a sufficiently good

match with the desired trajectory. The initial 0.5 sec is not shown, as the time period up

to about 0.5 sec is a transient. It is apparent Frorn Figure B.2 that use of sampling time

srnaller than l msec is not warranted as there is Little improvement in accuracy by doing

do. It is also noted that the control and velocity signals obtained by using 0.35 m e c were

slightly out of phase with those from 1 msec.

OptimalMolor6: Q I 1 =100. R=l . K=[ l O 0.841, ramp input signal

Figure B.2: Optimal tracking experimental test with expanded scales for exact solution for a 5 rousec ramp reference signai, cornparison of results for dierent sarnpling tirnes: 1 msec (solid lie) and 0.25 m e c (dash-dotted line)

Page 134: Adaptive Control for a First-Order System

Open loop and closed 1001) (Piinly and PV) control

O/&- Standard NT phtfonn librarïes #inchde <windo\\.s.li> %- windows atatfonn routines

Y- PMDI Header Files #inchde "mc8pnm.li" #inchde "mc8reg.1in

int main(void)

O/&- &ndard UO mutines %- C console and pon UO routines 44- Math fiinctions libncy

Yi- ,W8-DSP-[SA communication primitives %- MC%-DSP-[SA register access hnctions

% MC8 board data structure

O/&- Opcn board O - force it to stay open on nul1

Y&- input: riIn (Open loop, closed Imp P. ciosed lwp PV) switcli(nln) { case '1': /***** OPEN LOOP TEST *****/ iiic8PITload(gpiiic8Info.inten.ril): %- set up PIT incSPITstan(gpinc8Info): %- swn PIT YOI yncronizc PlT and SYNC ~ C ~ S Y N C C ~ ~ ~ ~ ~ ( ~ ~ ~ C ~ I ~ ~ O . E U ~ C ~ S R C P ~ T . ~ . I C C ~ . SRCNONE); % sct intcmpt mask m~8W~teReg(gpmc8InfoMC8~INTEN~OST.Uxl): wliile (!kbliit()) {

Y- check for Pïï interrupi rnc8ReadReg(gpmc8Inf0~h,lC8~~GHOST.&~flag): if ((INTflag&Osl)==0sl) ( mc8EncRead(gpmc8Info.O.&EncCount); Yi-Read encoder EncArra~[iil=EncCount: ii+. if (ii-2000) ( O/&- new output mcSDAC\Mite(gprncSInfo,(int) l.(shon)((Ustep+ 10.0)*8 19.2));

O/&- updale DAC mc8SYNCsofi(gpmc8lnfo): ) eise { if (ii=f 000) { mc8DACwrit~gpmc8Inlo.(int)I.(shon)8 192); %- wite O output mc8SYNCsoR(gpmc8Ido): J else if (ii-6000) : iîont= 1; break: 1) O/&- cIear die intempt ~ c ~ W ~ ~ ~ R ~ ~ ( ~ ~ ~ ~ ~ I ~ ~ O J M C ~ ~ ~ N T F L G H O S T . I N T ~ ~ ~ ~ ) : ) ) mc8PiTsrop(gpmc8 [nfo): Yb- stop P ï ï timer mc8DACwnte(gpmc8Info,(int) l.(shon)8 192); %--zero output

Page 135: Adaptive Control for a First-Order System

nic8SYNCsofi(gpmc81nlo); break-

%- updale DAC

casc '2': au: '3': /***** P-ONLY I PV TEST *****l Km = 5.6; Tm = 0.28: if (ah==?') Y- P-Only control ( scarif("?hi'".&Mp): O/P Desired ovenhooi zeta = -(log(Mp/LOO))/sqn(3. lJA2+(log(Mp/100))*(log(Mp/Lc)0})); Kv = 0: O/- calculate gains Kp = l/(Km*Tin*(2*zeia)*(2*zeta)); tiiiie = 3000; ) if (szIn=='3') O/&-- PV control { scanf("%t".&Mp): scanf("W. &Ts): %- settling tirne zeta = -(log(Mp/ 100))/sqn(3.1 JAZ+(log(Mpl lOO))*(log(bIp/ LOO))); Kv = ((8*Tm/IS) - l)/Kin:O/o- calculate gains wn = J/(Ts*zcta); Kp = wn*wn*Tin~Krn: tirne = 2000: ) for W=O:j<=ti1ne-I ;j++) (

errorb]=O; dydibl=O: ucb]=O: ; %- set up and sran PlT, clear and check intempts if ((INTflaggtOs l)==Osl) ( iiic8EncRead(gpincSInfo.O.~ncCount); EncAmy [ii I=EncCount: if (ii>=tirne && ii<(l*time)) ( IniEncCount = EncArn![time-2); FinEncCount = InitEncCount + TotEncInc: 1 if ((ii>=(Z*tiine)) && ii<(j*tirne)) ( InitEncCount = EncArny[(2*tirne)-21; FinEncCount = InitEncCount - TotEncInc: ) if (ii>=time &B iiV3*tiine)) { erroriiil = 0.0OQ9765*(FinEncCount-EncCount); dydt[ii] = (O.O009765*(EncAmy[iil - EncAmy[ii-l1))/0.00I: uc[ii] = Kp*error[ii] - Kv*dydt[ii]; if (uc[ii]>9); uc[iil=9: if (uc[ii lC-9); uc[ii]=-9; inc8DACtvrite(gpmcSInfo.(int)I.(short)((uc[iij+ L0.0)*8 19.2)): inc8SYNCsoft(gpincSInfo); O/p,up&te DAC ) if ((ii>=(3*tirne)) &Br (ii<(S*time))) ( error[ii] = 0.U009765*(I;inEncCount-EncCount); dydt[ii] = (O.O009765*(EncArray[ii] - EncArray[ii-11))10.00 1 : uc[ii] = Kp*error[ii] - Kv*dydt[ii]; if (uc[ii]>9); uc[iil=9: if (uc[iil<-9); uc[ii]=-9: %- clear the internipi inc8WriteReg(gp1nc8Info.bIC8~u\ITR.GHOST,Mflag ii*: ) ) mcSPITstop(gpmc8Info); O/&- SIOP PTT umer mc8DACwrite(gprnc8Info,(int) I.(short)8192): O/&- zero output mc8SYNCsofi(gprnc81nfo); break O/&-- SVP PIT timer. and update DAC) 1) mc8Close(gprnc8Info): 1 %- Clean up board data structures

Page 136: Adaptive Control for a First-Order System

MRAC Routine Cor DC Motor

/****+ ADAllïVE CONTROL (basPd on Recursive L m t Square Estimation **"*l printf(''In\lirlo. of cycles (default:3). n: "); d ( " ~ 0 d " . &n); printfIWtPeriod of a cycle (default: Jsec). Tp: "1: scanf(""/odn. &Tp); printf("\n\tSerpoint value (default: 1). spt: "1: scanf("%dn. Btspt); printf(WtSamp1ing inten7al (default: lm), interval: "1; d ( " Y C , &intemal): T = 0.00 I*inteml; TOI sampting time Hz = UT: O/&- sampling frequenp time = (Tpll)*(int)Hr: Y,- duration of 1 segment (in no. of intervals) Tf = n4Tp + 2: I* T o d run time (2 scc of initial no-activitp3 cycles of4 sec eacli) *I

/**+ Pan B: Initirilisation for System mode1 and RLS ***/ npann = 4: % number of panmeters for (aa=O: aa<=nparm: aa t t ) { O%- creating rwo J*J Identity matrices

for (bb=il: bb<=npam. tb++) { if(aa==bb) {

P[aal[bbl = LUOU: Q[an] [bbl = 1: ;

Else : P[a;il[bbl =O: Q[aalWl = 0: 1 1 ;

K m = j : T m = O . I : O/&-- [nitid qstem panmeter estimates lambda = mp(-Trip): E = ap(-T/Tml; a l = -Tm*(E-1): d = E : b l = Km*n + Tm*E - Tm): b2 = Km*(l- E): n l = Km*(T + Tm*E - Tm); d = Km*[Tm - TmCE - T*E): dl = 41 + E): d2 = E:

Page 137: Adaptive Control for a First-Order System

parm[OJ = dl; parm[l] = d2; parm[2] = nl; parm[31 = n2:

I*** Pan C: Solve for N s and Nu **Y Phi[01[0] = 1: Phi[Ol[l] = al ; Phi[l][Ol = 0 Plii[il[lj = ril: Gamma[Ol= bl: Gamma[ 11 = bZ: C[Ol = 1.0: Cil 1 = 0.0:

Fpul = fopen("NsNu.ut"."f); '3'0- Reading h m &la file created by MATLAB if( @tri = NLILL )

printf("\n\tERROR: THE FILE WAS NOT OPENED; PLEASE RUN MATLAB FiRSïb" ); fscanf(fpu1, "%f%f Ni". &N 1. &NZ. &N3): Nx[O] = Nl; Ns[l] = NZ: Nu = N3:

I*** Pan D: Control laop ***/ %- Initialise variables o ldv = 0: o l d v 1 = O: old-u = 0: old-ul = 0: old-,uk[0] = 0: old,xk[ll = 0; old-or2h = 0:

rnc8PITload(gpinc8Info.in[e~~al); %- set up PlT inc8PITstan(gpmc8Info): Yi stan PLT YU" syncronizc PIT and SYNC mcc8SYNCconfig(gpmc8Info.MC8SRCP~.MC8SRCNONE.MC8SRCNONE); mcc8WriteReg(gpmc8Info.MC8~INTENAHOST.Oxl): %- set intemipt mask for PIT timer only printf(Wress a key to stan loggingh?; % pause and \a i t for key hit s d n i = getcli(): %- Conml loop s t m while (!kbhit()) {

mcSReadReg(gpmc81nfo.MC8~MTFLGHOST,BiMTflag): ?& check for PIT intemipt if ((MTflag&Os 1 )==Os 1) {

mcSEncRead(gprncSlnfo.O.&EncCount): O/&- read encoder count *I EncArny[ii] = EncCount: Y- Conyen enc count to [rue position ~ [ i i l = 0.0009765*(EncArray[ii] - EncArny[O]): if ((ii>=(time)) && (ii<(f*time))) {

Phi[Ol[OI = i: Phi[Olf LI = 31: Plli[l]{OI = O: Phi[l][l] = d; Gamma[O] = b t ; Gamma[I] = b2;

Page 138: Adaptive Control for a First-Order System

Y&- CUCULATION OF DLFFERENT MATRICES FOR CALCULATION OF Kp %- CalcuIation of INV(CTRB(Phl.Gamma))' matrix . detCO = b2*(aZ2bl - bl - al*b2): KsO[iij = detC0 invCO[l][O] = -bZ/detCO: invCO[I][l]= b IIdetCO:

if ((ii>=tirne && ii<(7*iiinc)) I I (ii>=(3*time) && ii<(-l*iimc)) 11 (ii>=Wtirne) && ii<(6*time))) { reqiij = sp. ;

if ((ii>=2*(time) && ii<(3*tiine)) 11 (ii>=(J*time) && ii<(j*time)) 11 (ii>=(6*time) && ii<(7*time))) reqii] = O: :

s ~ l = &[O1 - ref(iij*Ns[Ol; ss2 = &[ll - reqiil*Ns[I 1: uc[iij = Nu*refliil - (K[OI*ssl + K[I]*ssZ): tnc8DACw~te(gpmc8Info.(int) I.(shon)((ucf ii]+ 10.0)*8 19.2)). Yi- new output inc8SYNCsoft(gpn1cY Mo): TOI update DAC

/*** RLS calculation ***/ psi[Oj = -01d-v: psi[l] = s l d j l : psi [2j = old-u: psi[3 1 = old-u 1;

kkI = psi[01*(psi[01*P[OI[O] + psi(ll*P[OI[lj+ psi[21*P[01[2] +psï[jl*P[01[31) + psi[ll*(psi[O]*P[I][O] + psi[ll*P[11[1] + psi[ll*P[lj[Z] + psi[3]*P[1][31) + psi[2j*(psi[OJ*P[21[01+ psi[lj*P[Zj[II +psi[2]*P[21[2j + psi[3I*P[2][3]) + psi[3J*(psi[Ol*P[3I[Oj + psi[l[*P[3I[lI + psi[21*P[3][21 + psi[3j*P[3][3]); W = lambda + kkl; for (dd=0: ddc=;: dd++) (

K2[dd] = O: for (ee=O: ee(=3: e) (

K2[dd] = KZ[ddl + Pfddl[ee]*psi[eej: ; Kl[dd] = (ICZ[ddl)/kk2: >

for (qq=O: qq<=3: qq*) { for(rr=O: r r=3: rr*) {

PPZ[qqj[rrj = O: for (=O ss<=3: S*) {

Page 139: Adaptive Control for a First-Order System

for (gg=O; g p 3 : gg*) ( for(hli=O; lih<=3: hh++) :

P[gg][hlil= PP2[gg][hh]llambda: 1 1

PR = y[iil - (psi[Oltpann[Ol + psi[ 1 l*parm[ll+ psi[ll*parm[2] + psi[31tparm[3)); for (1t=0; tt<=3; [ t u ) (

parm[rtl = pann[ttl + Kl[ttl*Pk 1

d l = parm[Ol; dl = parm[ll: nl = parm[î]; n2 = parm[31: Tm = -Tnog(dZ); El = eq(-TRm): A = T * ( I - E l ) ; Km = (n 1 + n2)IA: al =-l'm'(El - 1): a2= El; b t = Km*(T + Tm*EI - Tm); bZ=Km*(l -El):

old-.sk[0] = .dc[UI: old-.&[Il = .ski 11: old-u l = old-u. old-u = uc[iil: o l d j l = o l d j : o l d j = ~ [ i i j ; I

if (ii==(7*tiine)) ( Kont = 1; break. )

mc8W~teReg(gpmc8[nfo.MCS-INTFLGHOST.INTflag): Yb- clear the intemipt ii*: ) 1 mc8P1Tstop(gp1nctlInfo ): Yb- stop FR' timer mc8DACwfiteI~mcSInfo.(int) l.(slion)S 192): Yi- zero output mc8SYNCsoft(gptnc8Inlo): %- u@te DAC break:

Page 140: Adaptive Control for a First-Order System

Optimal Tracking

O/&-- input: ah (Approsimate or e.ua soiution) switch(n1n) {

case '1': /***** APPROXUllATE SOLTION *****/ for (ij=Ojj<=tiine-l&+) ( dydtU]=O; ucU]=O; 1 Yi- set up and stan PIT and synchronise PIT and SYNC Y&- set intempt mask for PIT timer while (!kbhit()) { %-check for PIT intempt */ mc8RadReg(gpm~8InfoSvICS-~GHOST.&ïNTnag if ((INTflag&Os l)==O.u 1) ( inc8EncRcad(~inc8lnfo.0.8rEncCount 1; %- R a d encoder count EncAq[ i i l = EncCount; if (ii== 100) ( inidncCount = EncArnyftirne-21: RefEncCount = iniEncCount: 1 if (iixime && ii<(timc+duntion)) ( RefEncCount = RefEncCount + 3: ermr[iil = 0.001)9765*(RefEncCount-EncCounl); d~dt[ii] = (0.000<)76jL(EncArny[iil - EncArray[ii-1 I))/O.Wl: uc[iil = K(l]*error[ii] - K[ZI*dydt[iil; if (uc[iil>9): uc[iil=9 if (uc[iil<-9): uc[iil=-9: O/&- write ncw output, clear rntempt. stop PIT timer and update output case '2': /***** LYACT SOLTION ***Y Yi- set up and stan PIT. synchronise PIT and SYNC O/&- set interrupt tnask for P ï ï titner while (!kbliit()) : ?&- check for PIT intempt mc8RadReg(gpmcS[nfo.MC8-[NTnGHOST.IYt[NTfIag); if ((lNTflag&Os [)==Os 1) ( tncSEncRead(gprncS~nfo.0.&EncCount): O/- R a d encoder count E n c A n [ i i ] = EncCount: if (ii==100) { InitEncCount = EncArray[time-21; RefEncCount = IniEncCount; if (ii>timne && ii<(tinie+duration)) ( RefEncCount = RefEncCount + 5; tirne-elapsed[ii] = 0.00 1 *ii - 0.2; psition[ii] = 1).011119765*(InitEncCount-EncCount): dydt[ii] = (0.0009765*(EncAmy~ - EncArny[ii-1 D)/O.OO 1 : b2[ii] = -Cl*S*(time-eiapsed[iiI + C?): uc[ii] = K[l]*position[ii] - K[2I*dydt[iil - 19.#*bZ[ii]; iF(uc[ii]>9): uc[ii]=9: if (uc[iil<-Y); uc[ii]=-9; %- wite new output clear intempt. stop PtT timer and update ourput )

Page 141: Adaptive Control for a First-Order System

ADAPTIVE CONTROL FOR A FIRST-ORDER SYSTEM

Section 3.1 gave design and simulation results for adaptive (MRAC) control of a pure

second-order systern. This appendix presents the adaptive control of a first-order system

for reference purposes.

Consider a system described by the mode1 (Astrom 1989):

where c. J = process coefficients

Assume that it is desirable to obtain a closed-loop system described by

where a, , b, = rnodel coefficients

Perfect rnodel following can be achieved with the controller

M(t) = t,,llC ( t ) - soy(t)

with the parameters

Page 142: Adaptive Control for a First-Order System

Errur: p z ) ' - Y,

It follows frorn Equation 3.1 and 3.3 that

where y is the differential operator. The sensitivity derivatives obtained by taking partial

denvatives with respect to the regulator parameters t~ and s~ cannot be used because

process parameters c and J are not known. Therefore. some approximations are applied,

and following equations for updatinç the regulator parameters are obtained:

where 7 - adaptation gain. -

Simulation of a first-order system with above MRAS was done using MATLAB with

FI , H . 5 , and b,,,=2. The input signal is a square wave of amplitude 1. Figure C. 1

shows a cornparison of the adaptive conuol of a tirst-order system for two different

adaptation gains ( y =[O. I 21). Two points can be noted fiom the figure: I) cIosed-Ioop

system is close to the desired behavior after onIy a few transients, and 2) the convergence

Page 143: Adaptive Control for a First-Order System

for y =O. 1 is slower than that for y =2. thus showing that the convergence rate depends

critically on the parameters y and d. The MIT rule will perform well if the adaptation

gain y is small. However, it can also give an unstable cIosed-locp system depending on

the magnitude of reference signal and process gain Modified rules can be obtained using

stability theory. These rules are similar to the MIT d e . The sensitivity derivatives are,

however, replaced by other iünctions.

-5 i O 20 40 60 8 0 100 120

Time (sec)

Figure C. 1: Comparison of adapive controI for 1st order system with trajectocy, y, (dotted line) and process output, y for two different adaptation gains, y = [O. 1 (dash-dotted line) 2 (solid Iine)].

Page 144: Adaptive Control for a First-Order System

APPENDIX D

FLRST-ORDER SYSTEM SOLUTION FOR OPTIMAL TRACKING PROBLEM

Section 4.2 gave design and simulation results for optimal (LQRT) controi of a

servomotor second-order systern. This appendix gives the optimal tracking law for a first-

order system for reference purpuses.

For a pure first order system the rnodel is defined as

where

F = - and G = K , / r ,

K, = system gain

- rr - system constant

and the ramp sirgnal is

which gives

(D. 2)

Page 145: Adaptive Control for a First-Order System

and the exact solution for b can be shown to be:

For a step reference signal withx, = a, the exact solution for b becomes:

Figure D. 1 shows the comparison of simulation resdts for approxirr?ate solution and

exact solution for a first order plant in response to a ramp input.

Page 146: Adaptive Control for a First-Order System

I -1

O O . 5 1 1.5

Tirne (sec)

Figure D. 1 : First-order system optimal tracking example, cornparison of simulation of approxirnate solution (dot-dashed line) and exact solution (solid line) in response to a ramp reference sienal (dotted Iine).

For a sinusoidal reference signal wirh x, = Asin " ( w,t - - i) + :, t h exact solution k r 2

b becornes:

b(1) = -0, rr s i n rr )-:)+II 1+K;K 2 I + K , K

Page 147: Adaptive Control for a First-Order System

Figure D.2 shows the cornparison of simulation results for approximate solution and

exact solution for a tirst order plant in response to a sinusoidal input.

Tirne (sec)

Figure D.2: First-order system optima1 tracking example, cornparison of simulation of approximate solution (dot-dashed line) and exact solution (solid line) in response to a sinusoidal reference signai (dotted line).