Professional Documents
Culture Documents
by
ADITYA GARG
A thesis submirted ro the Depi~rtmenr Mechanical Engineering of in conjonnity with the requiremenrsfor the degrw o f Master o Science (Engineering) f
Queen's University
October 2001
canada
The author has grantecl a nonexclusive licence allowing the National Library of Canada to reproduce, loan, distribute or seii copies of this thesis in microform, paper or elecronic formats.
L'auteur a accord une licence non exclusive peunettant a la Bibliothque nationale du Canada de reproduire, prter, distribuer ou vendre des copies de cette thse sous la fome de microfiche/flm, de reproduction sur papier ou sur format lectronique.
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 conserve la proprit du droit d'auteur qui protge cette thse. Ni la thse ni des extraits substantiels de celle-ci ne doivent tre imprims ou autrement reproduits sans son autorisation.
Adiya Garg: Ahplive ami Optimal Tracking Cvritrol of Electromechanical Servosystems. M.Sc. Thesis, Queeti 's Utiiversiiy a Kirigstoti. October, 2O0 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.
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
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 twoyear 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.
TABLE OF CONTENTS
AB STRACT
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 - 2 2 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
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 CONCLUStONS AND RECOMMENDATIONS 5.1 Conclusions 5.2 Recommendations REFERENCES APPENDIX A: SIMULATION SOURCE CODE APPENDIX B: EXPERlEvlENATiON SORCE CODE APPENDIX C: ADAPTIVE CONTROL FOR A FIRST-ORDER SYSTEM APPENDIX D: FIRST-ORDER SYSTEM SOLUTION FOR O P T W TRACKMG PROBLEM
VITA
117
1O5
127
130
134
LlST OF FIGURES
Figure 2.1: Figure 2.2: Figure 2.3: Figure 2.4: Figure 2.5: Figure 2.6: Figure 3.1 : Essential components of an adaptive control system Model Reference Adaptive Control system (parameter adaptation) Model Reference Adaptive Control system (signal synthesis) 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 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 W C for a second-order system using Lyapunov stability theory showing 2"d-order reference trajectory and process output 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 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 Position and velocity open loop remit for DC motor Trapezoidai velocity profile
Figure 3.2:
Figure 3.3:
Figure 3.4: Figure 3.5: Figure 3.6: Figure 3.7: Figure 3.8: Figure 3.9:
Figure 3.12: Cornparison of simulation resu1ts for P-only control of step test for DC motor for two different percent overshoots
Figure 3.13: Comparison of simulation results for P-only control of ramp ifiput test for DC motor for two different percent overshoots Figure 3.14: Comparison of simulation results for PV control of step test for DC motor for two dEerent percent overshoots and a fixed settling time Figure 3.15: Comparison of simulation results for PV control of ramp input test for DC motor for two different percent overshoots and a fixed settling time Figure 3.16: Cornpanson of performance degradation for P-only control of step test for DC motor for two different percent overshoots Figure 3.1 7: Comparison of performance degradation for PV control of step test for DC motor for two different percent overshoots Figure 3.18: Camparison of performance degradation for PV trajectory control of DC motor for two different velocity gains Figure 3.19: Simulation oPPV control for two DC motors in response to sinusoidal reference signal to track a circuiar erajectory Figure 4.1 : Figure 4.2: Figure 4.3: Figure 4.4: 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
Figure 4.5: Figure 4.6: Figure 4.7: Figure 4.8: Figure 4.9: Figure 4.10:
Figure 4.1 1: Simulation response for approximate vs. exact tracking z solution for 0.5 H siusoidai reference Figure 4.12: Simdation response for approximate vs. exact tracking z solution for 0.5 H sinusoidai reference with inertia change
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: Simulation of LQRT control for two DC motors in response to sinusoidal reference signal to track a circular trajectory Figure 4.18: 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 Simulation result for MRAC controller vs. PV controller for a square wave reference signal with inertia change
Figure 4.20:
Figure 4.2 1 : Simulation of MRAC for two DC motors in response to sinusoidal reference signal to track a circular trajectory Figure 4.22: Comparison of simulation of LQRT and MRAC for two motors for tracking a circular trajectory with inertia change Figure B. 1: Optimal tracking experimental test for exact solution for a 5 roosec ramp reference signal, comparison of results for different sampling times Optimal tracking experimental test with expanded scaies for exact solution for a 5 rorsec ramp reference signal, comparison of results for different sampling times 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 B.2:
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
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"dorder 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 y t m sse
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
Il, , Ir2
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
N r* N u
08
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
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 tnctions ofjoint variables controllability rnatrix state vector reference or desired trajectory vector process output or position trajectory output known rnatrix, fnction of q, q, q,, q, a vector used in RLS algorithm
Greek letters
parameter introduced to avoid division by zero saturation tnction parameter unknown parameter - angle relative to original 2"dlink adaptation gain error augmentation controI torques 6rst order system constant motor t h e constant discrete state space matrices
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
Acronyms
DC DOF
DSP GUI
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
LQ
LQR
LQRT MRAC
P-only
PD PV RLS
STC
Proponionai-lntegrai-Derivative
Proponional-Velocity Recursive Least Squares Self Tuning Control
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.
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 i expressed in ternis of a reference model, which gives s 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
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
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 electromechanicalservosystems ? 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
order system, a 2-link robotic manipulator and a DC servomotor. comparative purposes, application of P and PV control is aiso made.
For
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
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
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 i values, the P 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.
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
nonlinear feedback control in which the states of the process cm be separated into two categories, which change at diffrent 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 perturbations
Known perturbations
---r---
ADJUSTABLE SYSTEM
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 determnistic, 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.
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
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
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 i specified by the reference model and the i of the P P 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.
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
parumeferized. Existing adaptive control designs nonally require is said to be li~iearly
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~nis 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
uc -
ADAPTARON MECHAMSM
P L M
2.1.2
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
REGLJLATOR DESIGN
RECURSIVE
PLubuEER ESTMATOR
Adjustable @-stem
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
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
9
=
=
minimum error criterion or index parameter vector error between mode1 and process outputs
To make J smail, it is rettsonable ro change the parameters in the direction of the negative gradient ofJ, that is,
where
Y
1
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.
Augmented error cm be introduced to avoid hrther problems. The augmented error method gives conversence.
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
P P
= =
=
transfer function differential operator vector of negative value of gradient of loss ftnction
The mathematical
manipulations used to derive the e m r model include filteringand error augmentation. The details of complete derivation wiil not be discussed here. The equations needed to implement the general MRAC are:
Ym
B --m
Am
II,
Filtered error:
O O e,. = = e = = ( y
P
- y,)
Ii
-ii
b,Q rl e = t, + . Ad,
$ = y@
tr =
-0'
(4 p)
where
Y Y,
= =
process output trajectory (ideai output fory) polynomiai gains of model controi input signal command signai
A,, B, =
II
= =
'1,
e,.
tiItered error
poiynornids error augmentation factor of polynomid P
P, 0 =
rl
P,
= = = =
ir
- 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 ,
II.
and y. For
complete derivation of this set of equations, see Astrom and Wittenmark (1989).
2.2
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. T i thesis addresses hs the case where modeling error is largely due to structured uncertainty.
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
ti x I ,
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
@ ,
A
=
=
P,
O,0, O
a non-negative matnx
matrix of functions of
CV
EI
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.
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
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 jointspace MRAC scheme to control the noncompliant motion of a Stewan platform-based manipulator (SPBM). Numerous adaptive control schemes were developed for openkinematic 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.
23 .
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
where
F,G,H =
minimation pmblem is to find an optimal control ri'(t) for al1 t E [tu,T ] that Mnirnizes
where
rr0(t) =
optimal control positive definite weighting matriv positive definite weighting matrix solution of Riccati equation
RI
QI
=
=
P ,
is given by the solution of the following Riccati equation, with initial condition P(T) =O
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 trajectorycontrollable 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
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:
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 ,
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
Hl
b,
(GK- F)'
steady state approximate solution for LQR
and Equation 2.26 with b, substituted for 6 reduces tu the standard form of the LQR
control law:
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,
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:
(a f
a, 2
b becornes:
where
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.
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.
0.5
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.
Model Reference Adaptive Control (MRAC) finds a usehl application in robotic servosystems. as robots are fiequently required to perform a variety of tasks dong
known and constant parameters, in which case a complex algorithm like MRAC
may not be desirable.
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
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 i s 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:
d'y -+ c -dy d y +
dt
'
=Bu,
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.
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
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
that the pararneter adjustment rate is always below a given lirnit, and replace the MIT mle in Equation 2.2 with
where
snt (x
.p) = [.ip
c-p
+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 instabii is ail1 possible with the modified rute if the adaptation gain is too large.
-2, O
20
40
6O 80 Time (sec)
1 O0
1 20
140
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
Lyapunov stability theory can be used ta design adaptive control laws that sarantee the stability of a closed-loop system. approach to the probiem.
candidates for the Lyapunov fiinction Equations 2.6 to 2.12 gave the design for one such
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.
32 .
60 80 Time (sec)
Figure 3.3: MRAC for a second-order system using Lyapunov stability theory, with model reference that of standard second-order model, second-order trajectory, ym,(dotted line) and process output, y (solid Sie).
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
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,,
the distance I,, of its mass center to the second joint, and the angle S relative to the original second link.
(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
where
r
hl
IV
where
- a, cos q.
= I , i m , i c ; +nt/,' + m , l , "
4- = f,
4,
+ meice'
= m,Z,le=cos6,
a3 = m, il , sin Je f
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):
r = Y i - K,s,
(3.22)
(3.23)
G = - RYr s. ,
where
such that
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,
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:
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 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). C gives much better performance with srnaller initial position errors and fier 1 sec the maximum error
MRACManipulatorl : Kp=2000,Kv=100
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.
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
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
322 ..
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.
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.
MRACManipulator4: K p = 2 0 . 0 0 , K \ ~ 1 0 0
-600 . O
-200
1
1
O
1
2 Time (sec)
i m e (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.
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 =
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
E e U Y
0)
3.
a l .
Time (sec)
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.
3.2.3
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.
1
j
1.4
'i
i
i
Full extension of the manipulator (small errors in joint angles result in a visible enor in end eiiector position)
Hard bit
Joint 1
Joint 2
A
- 2
v
e -
v
l
- 0g
U
g 'j z ', PI
-C
1 1
p OL
- .
a,/ - ;1
U-2J
'
'
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).
3.3
There are two open-1oop parameters for the SIS0 system (position control of a servo motor). the motor gain,
gain is fied for a servomotor. The value of the time constant is a fiinction of the load on the motor. The fgher 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
i r
- = AX + Bri
air
where
A. B
-r~
=
=
r.
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.
-10 i O
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
Time (sec)
Figure 3.10: Position and velocity open Ioop remit, with K m = 5.6 and rm = L0.0625 (dotted), 0.125 (dashed), and 0.28(solid)]
3.3.1
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.
Assume
where
acceleration time
- Time reqllired
-D
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, 1991): log (lll 100)
,
,--
+ ( l o g ( 1 100))')
where
4 '
K,
=
=
where
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.
- - - -0.5
, .
-y
-- - - - - - - -3
-y--
--
1 1
-5
O 40,
1
1
1.5
2.5
3.5
2 20 i
--
&
---\
--
y-
-----_
0.5
I -
>
1.5
2.5
I
I
-1
i
4
3.5
'0
.Y ,
1 --
O 200
tn
.
I
0.5
1.5
2.5
3.5
1 ime (sec)
O
al
O L
I
,- - ,--.
'
, '
/
-200
1
0.5 1 1.5
j
2.5
2 Tirne (sec)
3.5
Figure 3.12: Cornparison of simulation results for P-only control of DC motor with K m = 5.6, r, = 0.28 sec and percent overshoot hl, = [5 (dotted) 25 (solid)]. Dashed line i the step reference signd. s
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.
E
O
O1
--- --
-----.
1
_./-*
\ -
\-
O
l n
-10~ 10or
O
0.5
y--
1 .S
1 ime
k,- ' /
2
(sec)
2.5
, .-*.
3.5
'< -
y Pi
C)
O?
-100'
0
, -
b*'-
x.
0.5
1.5
2 Time (sec)
2.5
3.5
Figure 3.13: Cornparison of simulation results for P-only control of DC motor with K m = 5.6, r, = 0 . 2 8 ~ ~ percent overshoot M, = 15 (dotted) 25 and (solid)]. Dashed line is the rarnp reference signal.
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
= =
K,.
T,
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.
,UI
2
O
g o - -200r c
I
0.5
1.5
. ---L
2 25 . Time (sec) -
3.5
4
1
i /
1.5
1
l / A kd
Y '. -
3 3.5
1
1
l
-400
O
0.5
1
Figure 3.14: Cornparison of simulation results for PV control of DC motor with K m = 5.6, rm = 0.38sec, percent overshoot M, = [5 (dotted) 25 (soiid)]
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 Ponly control. This is because with PV control. we are allowed to specifj two degrees-offreedom - 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.
O ; 400,
ln 3 200 i- , -----
0.5
1.5
0.5
2 rime (sec)
, /
2.5
3.5
4
A
. v
: -. '
-..
'
,-. .
? .
i
1 I
1.5
2
Time (sec)
2.5
3.5
Figure 2.15: Cornparison of simulation results for PV control of DC motor with K m = 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.
3.3.2
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 i subjected to tive times change in inertia and s controller is designed for two different percent overshoots.
Time (sec)
Figure 3.16: Comparison of performance degradation for P-only control of DC motor with K m = 5 . 5 , r, = 0.28sec, percent overshoot M , = [5 (doned) 25 (solid)] Dashed fine is the step reference signal.
It is evident from acceleration grid of Figure 3.16 chat the response becomes much more sluggish after inertia change at
i=2 sec.
which is clearly a sign of performance degradation. This i tme for both the d u e s of s percent overshoot. Figure 3. L 7 shows that PV control shows a similar trend of degraded performance.
-20 O
200
.;
l
3 Time (sec]
6
+
-200:
i 1
3 Time (sec)
Figure 3.17: Comparison of performance degradation for PV control of DC motor with K m = 5.5, r, = 0.28sec. percent overshoot M , = [5 (dotted) 25 (solid)] and settling time T, = 0.5 sec. Dashed Ln is the step reference signai. ie
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
s three different values of velocity gain. It is clear that when velocity gain i 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.
0.5
1.5
2 Time (sec)
2.5
3.5
Figure 3.18:
Cornparison of performance degradation for PV trajectory control of DC motor with K, = 5.5, r, = 0,28sec, K, = 2, K y= [O (dotted) 1 (dotdashed) 3 (solid)] Dashed line i the reference trajectory. s
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.
-1
-0.5
O Position. Motor 1
0.5
lime (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
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. examined. Again, the etTect on pertbrmance of changing load conditions was 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. T i ,together with the application hs
of MRAC
to
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), linear power amplifier, power supply and a 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 c o ~ e c t e d the DC servomotor via analog and encoder connectors. The DC servomotor to has a digitai encoder which feedbacks position data to the motion card through the
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 tnctions 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 fnctions 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 wrtten
in Visual C*,
m
m
f-\
Linear Power
-,
i i
Power
Digital
Encnd~r
4.1.3
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 sufficientto 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,, motor and
u,,
, where v,
Motor Time Constant, rm : Time taken by motor to reach 63% of the steady state velocity
iet Inspection of Equation 4.1 shows that the steady state veiocity of the motor is in drc
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,,
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
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
Tme (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 dix. Note that r, was 0.28 sec and 0.4 sec for
the fll inertia and reduced inertia cases, respectiveIy.
40L
Reduced inertia
' 4
c U 0 20-
2.
t
Full inenta
>
Figure 4.4: Simulation (dotted line) vs. experirnental (solid line) open loop test, ih cornparison of responses wt change in inenia (5 volt step inpuij.
4.1.4
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 expermefitai 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
simulation (dotted line). Note that the same gains were used in both experiment and simulation. This match in the dosed loop trther 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%).
As mentioned in Section 3.3.1, PV control ailows the user to speciQ the settling t h e and
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
obtained from Equations 3.48 to 3.5 1. Figures 4.6 and 4.7 trther 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).
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
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 Ccode and there was some question as to whether the coding was correct.
0.5
1 .S
2.5
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).
-1 0
0.5
1.5
2.5
Time (sec)
Figure 4.9:
Comparison of experimental results for DC motor in response to a step ih ] input of 1 rot for 3 sec,P-oniy w t K=[IO O (dot-dash line), PV with K=[10 0.421 (dashed line), and PV with K=[10 0.841 (solid line).
4.2
Linear optimal control is a speciar type of optimal controi. The pIant that is 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
4.2. i
y=HTx
where
F,G, H
state-space matrices
where
0,
R,
=
=
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
= - R, .' GP,(t)x(f)
1,'
where
P,
4.2.2
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.
2.
3.
Servo problem (plant outputs are to follow a class of desired trajectones) Tracking problem (the desired trajectory is aparricular prescribed fiinction of time) 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-
s folIowing aircrafl where there i 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 * ,
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.
Merl
= = =
optimal controller gain additional control signai term extemai optimal control variable
Changing notation for the control gain (with K = - K I ), the following equations were adopted for implernentation in MATLAB:
I = Fx
+ Gu
(4. IO)
II=
-KX-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:
and Equation 4.11 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 ( K m = 5.6 and r, = 0.28 sec), then for the case of
RI = 1 and Q, =
MATLAB function
O],
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 trjectory defined as:
The control law uses onIy b2, hence we neglect the solution of b,
and
C1 =-H22
Hl2
For a sinusoidal reference signai, the exact solution for b(I) becomes:
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.
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).
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).
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 c m be seen, this introduces significant tracking errors.
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)
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
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 h e ) .
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 results 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.
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).
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.
2
0,
Y
0.5
10
O-/,"-10:
_--L
1
'-
1.5
2.5
3.5
+.,..
>
'L
.-,--=
,de
>'L -
5
>
3
2-
1 .
-.
----*-
2
C
O 5:
;
0.5
1.5
2
.,-,..)'
2.5
-.v*-/\
3.5
; O
+.
d ' .
.-_ :
1 -
L -
E C
; i
-5; O
0.5
; C ' 1 -, :. -r -.
+ .
1.5
'-
.*,' *
.,4
t--
:, y
v ' L\
6'.
-2..r"u\-J
-.-,
.YI
3.5
Figure 4.15:
Optimal tracking test, cornparison of simulation (dot-dashed line) and experimental result (solid line) of approximate solution for a 0.5 H z sinusoida1 reference signal (dotted line).
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.
5 "
d
O - - - .
. .
-.. - . .
0.5
*. .
i
-5 1'
-... , .
Y , -m - . -
, .. -
'J
\/
3
,i c
j
1
1.5
3.5
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).
42.4
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.
N
L-
0.2 ?j
= g
a
-0.2
2.
;, !
-0.4'
r \
!
-0.61
'...
-.
4.5
O Position. Motor 1
, .)
I !
!
l
-0.8 i
-1
-1
0.5
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
4.3
This section gives the application of Mode1 Reference Control (MRAC) the DC servo to 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
We now discretise the system rnodel. Let h be the sarnpling period; the discrete-time, state-space model is then given by
where
= u(kh)
where A,, AI, il, and A, are unknown parameters of systern mode1 are given by following relations:
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
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
= yi: -
- Aj lir-i
and 0, i the observer gain, which can be obtained h m the Ackermann formula: s
The parameters of the system mode1 are given by A,, AS,A, and A,. They can be directly estimated by using transfer fnction:
the
where
= K , ( h - r, + r,e-L)
11,
1 . = K m ( r m rn,!f 1 -
-L
- he'L)
Ci, = -(1 + e - L )
ci, = r -L
= [di d: t
11.1
L k = [-Y,.,
-h-:U r - ,
"k-iP
Then, we can use RLS algorithm to estimate the parameter vector Wittenmark, 1989):
(Astrom and
Subsequently, the values of K mand 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.
4.3.4
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
.
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,, :
Km = 3, r , = 0.1
K m =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 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
C algorithm
and establishes the fact that MRAC aigorithm is capable of giving desired performance
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 i induded in s Appendix B for reference purposes.
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
6 8 Time ( s e c )
10
12
14
Figure 4.18: 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.
-6 0
O
6 8 Time (sec)
1O
12
14
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.
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.
change
-100 -O
8 10 Time (sec)
12
14
16
18
Figure 4.20: Simulation result for W C controller (solid line) vs. PV controller (dashdotted line) for a square wave reference signal, 500% inenia change at FIO
sec.
4.3.4
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.
-1
4.5
O Portlion. Motor 1
O5
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
4.4
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=
MRAC. M e r 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 available now due to is faster microprocessors, the systems too are growing compiex with a large array of
s variabIes and parameters to account for. Therefore, MEUC i advisable only when the
knowledge of the system is incomplete, uncertain or varying.
Position. Moror 1
-2 ' O
OS
-5 '
0.5
1.5
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.
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
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.
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
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.
CHAPTER 5
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 Clanguage routines. The DC servomotor was modeIed as a second order system and an
appropriate LQRT algorithrn was desigfied. The LQRT algorithm was applied to the DC
.
servomotor for ramp and sinusoidal trajectories. 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 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
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
a sirnilar
GUI for other control algorithms could be developed. It is recommended that such an
ive
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 and Astrom, K.J. Wittenmark. B. (1973): "On Self-Tuning Regulators", Automatica, Vol. 9, pp. 185-199 Astrom, K.J. and Wittenrnark, B. ( 1989): "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-15 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, . (1998): "Digital Control of ynamic 4 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
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. 1OS, 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
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- 1091 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. D. Young. K.-K. (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
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.
Yi- actwl process output %- error between actual and mode1 output
mntmIler parameter
Y corn1 signal -
Y- h c s s for i= l:Iength(Yhl) dy2 = tlieta*UCl(i) al*dyl a*?; dyl = dy 1 sample*dy2: %- actual pmess outpu1 y = y + sample'dy 1; e = y YW); Y panmeter adaptation dtlieta = -(gamma*e)*YM(i): theta = rhcta + sample*dtheta: Y(i) = 5 end
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 theta = theia + sample*dtlieta; Y(i) = y: end
Saturation function
function zI = SAT(e.YMl.thetaO.alpIu.bet2l): theta0 l=ilietac)*2; P = (e*Wl*ibetaO)l(alph*thetaOI + YMIY); Y&- Saturation parainetet if P c -beta zl = -ben: eiseif abs(P) <= beta
21
=P:
Y est-Hl1 = alplu + 2*eps*cZ + 2*ctafs2: at-H 12 = beta + eps*c2 + cta*s2: est-HZ1 = beta + e p s W 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: 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:
Y Coriolis mritriu -
q v = qv cdc*qiL q = q + dc*qv: %- MRAC contr~ller d e i m qe =q-qd; qve = qv qdv: s = qve + zeta*qe; qw = qdv zeta*qe; qra = qda zeta*qve: tq = est-H*qn + est-C*qm - KV*s:
%- Tndring error
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 = [YI1 Y 12 Y l3 Y 14: Y21 Y22 Y23 Y2-41;
end
? &
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
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 :
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: Y' tnpezoidal move profile sp = sp Vinas*dt; elseif t(ii) > 0.1 & sp < 10; sp = sp + VinsPdt: end else %- step tcst if t(ii) > O. I; sp = 10: end if t(ii) > 2: sp = O: end end e = (sp -y): %- contml law uc = Kp*e K P d ~ d t : else O/&- open loop test if t(ii) > 0.1; uc = Ustep: end 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
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: W l ( i i ) = dydtl; AAl(ii) = dydt21: 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 = (Km4uc1 dydt 1)fiin: d2vdt22 = (Km*ucZ dvdt2)flm. dGt1 = dydt 1 + dtLd2ydtl1; dydU = dydt2 + dtqd2!dt22: yl = y 1 + dtfdydtl: ' 2 = y2 + dt*d!.dQ:
end
TERRl(kk) = Yrefl(kk) - W l(kk); TERRZ(kk) = YrefZ(kk) - YY?(kk): end
for kk= 1:lengtli(t)
mu = input('motor tifne constant'): 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) 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: % step solution if flagQ==O; b2 = bss(2): % --- exact n m p solution elseif flagQ== 1; if tt(ii) >=?.O % - nvitcli to stcady state solution b2 = bss(2); elseif tr(ii) c 3.0 & tt(ii) > 0.1; b2 = -C 1*aaf (tt(ii) + C2 - 0.1}: else b2 = 0: end % eu sinusoid solution .a clseif flagQ==2: 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
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): O/&- closcd-loop poles pdc = polgzdc):
npann = 4; P= IOOO*e~e(J): Q=eyeO); Iainbda = esp(-T'rrp): Kin[ = 5.6; Tm[ = 0.28; Km = 3: Tm = 0.1; E = esp(-Tfim): a l = -Tm*(E-1):
aZ=E bl = Km8(T + Tm*E Tm):
O& /-
tme panmeten
9 1 initial piininelen ~
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);
oldul = O;old\;k = [ O]';ol&x2h = O; O for k = I : ( W Det l(k) = 0; tlieta(k) = 0; end dydt = O; '-0; u=O: % main siindation loop for k = (m+I):length(t) 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;
Yi-update .stem
marices
Der L(k) = det(cb(Plii,Camma)); Kp = [ 1~*inv(ctrb(Plii.Ga~nm))~poIy~alm(pdc,Plu); O ytilde = y oldy - b l *oldu: Lr = a2131; s2Ii = al*olds21i+ bPoldu + Lr*(~lildc a l *olddIl): .sk = [y .dhl':
%-- 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
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.
Ti hs
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.001 m e c .
0.5
1 .S
2.5
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)
Figure B.2 shows resutts of a cornpanson of results of experimental test for sarnpling time of 1 msec and 0.25 m e c . 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.35m e c were slightly out of phase with those from 1 msec.
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: 1msec (solid lie) and 0.25 m e c (dash-dotted line)
NT phtfonn librares %- windows atatfonn routines #inchde <windo\\.s.li> O/&- &ndard UO mutines %- C console and pon UO routines 44- Math fiinctions libncy
#inchde "mc8pnm.li" #inchde "mc8reg.1in
Yi- ,W8-DSP-[SA communication primitives %- MC%-DSP-[SAregister access hnctions
% MC8 board data structure
int main(void)
O& /
case '1':
/***** OPEN LOOP TEST *****/ iiic8PITload(gpiiic8Info.inten.ril): %- set up PIT incSPITstan(gpinc8Info): %- swn PIT YOIyncronizc P T and SYNC l
~C~SYNCC~~~~~(~~~C~I~~O.EU~C~SRCP~T.~.ICC~. 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/&- n w output e 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)8192); %- wite O output mc8SYNCsoR(gpmc8Ido): J else if (ii-6000) : iont= 1; break: 1) O/&- cIear die intempt
mc8PiTsrop(gpmc8[nfo):
mc8DACwnte(gpmc8Info,(int) l.(shon)8 192);
~ c ~ W ~ ~ ~ R ~ ~ ( ~ ~ ~ ~ ~ I ~ ~ O J M C ~) ) ~ N T F L G H O S T . I N ~
Yb- stop P timer %--zero output
nic8SYNCsofi(gpmc81nlo);
%- updale DAC
break-
inc8WriteReg(gp1nc8Info.bIC8~u\ITR.GHOST,Mflag
i*: )) mcSPITstop(gpmc8Info);
mc8DACwrite(gprnc8Info,(int)I.(short)8192):
O/&- SIOP PTT umer O/&- zero output
mc8SYNCsofi(gprnc81nfo); break O/&-- SVP PIT timer. and update DAC) 1) %- Clean up board data structures mc8Close(gprnc8Info): 1
d("~0d". &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): TOI sampting time T = 0.00 I*inteml; O/&- sampling frequenp Hz = U : T Y duration of 1 segment (in no. of intervals) , time = (Tpll)*(int)Hr: I* T o d run time (2 scc of initial no-activitp3 cycles of4 sec eacli) *I Tf = n4Tp + 2:
/**+ Pan B: Initirilisation for System mode1and RLS ***/ %number of panmeters npann = 4 :
for (aa=O: aa<=nparm: a a 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
Km=j:Tm=O.I:
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): d l = 41 + E: ) d2 = E :
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:
'3'0- Reading h m &la file created by MATLAB Fpul = fopen("NsNu.ut"."f); i( @tri = NLILL ) f printf("\n\tERROR: THE FILE WAS NOT OPENED; PLEASE RUN MATLAB FiRSb" ); fscanf(fpu1, "%f%f Ni". 1. &NZ. &N3): &N Nx[O] = Nl; Ns[l] = NZ: Nu = N3:
I***
rnc8PITload(gpinc8Info.in[e~~al);%- set up PlT Y i stan PLT inc8PITstan(gpmc8Info): YU"syncronizc PIT and SYNC
mcc8SYNCconfig(gpmc8Info.MC8SRCP~.MC8SRCNONE.MC8SRCNONE);
mcc8WriteReg(gpmc8Info.MC8~INTENAHOST.Oxl): printf(Wressa key to stan loggingh?; s d n i = getcli(): %- Conml loop s t m while (!kbhit()) {
%- set intemipt mask for PIT timer only %pause and \ a i t for key hit
mcSEncRead(gprncSlnfo.O.&EncCount):
EncArny[ii] = EncCount: Y Conyen enc count to [rueposition ~ [ i i= 0.0009765*(EncArray[ii] EncArny[O]): l if ((ii>=(time)) && (ii<(f*time))){ Phi[Ol[OI = i: I Phi[OlfL= 31: Plli[l]{OI = O: Phi[l][l] = d; Gamma[O] = b t ; Gamma[I] = b2;
if ((ii>=tirne && ii<(7*iiinc)) II (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; s2 = &[ll reqiil*Ns[I 1: s uc[iij = Nu*refliil (K[OI*ssl + K[I]*ssZ): tnc8DACw~te(gpmc8Info.(int) I.(shon)((ucfii]+ 10.0)*819.2)). inc8SYNCsoft(gpn1cYMo):
>
for (qq=O: qq<=3: qq*) { for(rr=O: rr=3: rr*) { PPZ[qqj[rrj = O: for (=O ss<=3: S*)
old-.sk[0] = .dc[UI: old-.&[Il = .ski 11: old-u l = old-u. old-u = uc[iil: o l d j l =oldj: o l d j =~[iij; I if (ii==(7*tiine)) ( Kont = 1; break. )
Y - zero output i
%- u@te DAC
break:
Optimal Tracking
O/&-- input: ah (Approsimate or e.ua soiution) switch(n1n) { case '1':
inc8EncRcad(~inc8lnfo.0.8rEncCount 1;
%- R a d encoder count
E n c A q [ 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 )
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
where
a , , b,
rnodel coefficients
Errur:
pz)'-
Y,
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
adaptation gain.
Simulation of a first-order system with above MRAS was done using MATLAB with
FI,
H . 5 ,
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
s s e is close to the desired behavior after onIy a few transients, and 2) the convergence ytm
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 inctions.
-5 i O
20
40
60 Time (sec)
80
100
120
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)].
APPENDIX D
and
G=K,/r,
(D. 2)
where
K,
rr
which gives
For a step reference signal withx, = a, the exact solution for b becomes:
Figure D. 1 shows the comparison of simulation resdts for approxirr?atesolution and exact solution for a first order plant in response to a ramp input.
-1
I
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).
"
( -- + i)
w,t
,:
t h exact solution k r
b becornes:
b(1) = -0,
rr
s
2
rr
1+K;K
I+K,K
)-:)+I
Figure D.2shows 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).