MODELREFERENCE ADAPTIVE CONTROL OF A
COMPUTERCONTROLLED DC MOTOR
!
WITH VARIABLE INERTIA LOAD
by
PinHuang Hsieh
B.S., University of Colorado, 1989
A thesis submitted to the
Faculty of the Graduate 'School of the
j
University of Colorado in partial fulfillment
of the requirements for ithe degree of
Master of Science
Department of Electrical Engineering
and Computer Science
This thesis for the Master of Science
degree by
PinHuang Hsieh
has been approved for the
Department of
Electrical Engineering and Computer Science
Edward T. Wall
illii
T Wolfe
Date
Hsieh, PinHuang (M.S., Electrical Engineering)
ModelReference Adaptive Control of a ComputerControlled DC Motor
with Variable Inertia Load
Thesis directed by Associate Professor Jan T. Bialasiewicz
The purpose of this thesis is to investigate the performance
characteristics of a new modelreference adaptive control (MRAC) system
implemented with an actual DC motor controlled by a digital computer.
The design of this new MRAC system is accomplished using Lyapunov
stability theoiy to derive the adaptive control law for the continuoustime
MRAC system, which is then converted to a discretetime system for direct
implementation on the digital computer. It is shown that this design
method can yield good, stable system performance even though global
stability is generally not preserved in the conversion to a discretetime
MRAC system.
As part of the design process, digital computer simulations were
performed for the new MRAC system prior to its implementation with a
realtime digital controller. The simulation program used was written in
BASIC for a digital computer and is capable of simulating linear and
nonlinear systems expressed in state variable form. Simulation results show
that the new adaptive control system is highly robust to the variations in
plant dynamics.
The digital controller which was designed for this thesis can be
entirely contained on a IBM PC/AT or PC/XT. This digital controller is
used to implement the MRAC algorithm derived in this thesis; however, it
may be easily adapted to a wide variety of experimental digital control
applications using most of the same software code developed for this
particular application.
The performance of this MRAC system design is evaluated by
observing how it adapts to changes in load moment of inertia and
compensates for the presence of coulomb friction which is the dominant
nonlinearity in this motor system. The combined effects of modeling
inaccuracies, electrical noise, and quantization noise can be observed in the
performance of the actual system.
It is concluded that while there are some limitations in the
applicability of this MRAC system design approach, it can provide a
dramatic performance improvement over a nonadaptive system when
certain parameters of the system are subject to large, unpredictable
variations.
The form and content of this abstract are approved. I recommend its
publication.
Signed
IV
CONTENTS
CHAPTER
1. INTRODUCTION....................................... 1
2. EXPERIMENTAL SETUP ............................... 3
2.1. Environment ................................. 3
2.2. Modeling the DC Motor System................. 3
2.3. DiscreteTime Plant Model.................... 8
2.4. Reference Model............................. 10
3. CONTINUOUSTIME MODELREFERENCE
ADAPTIVE CONTROL SYSTEM DESIGN................... 12
3.1. Introduction .............................. 12
3.2 ModelReference Intelligent
Control System.............................. 13
3.3. New ModelReference
Adaptive Control System..................... 16
3.4. New MRAC System without an Estimator........ 25
4. DISCRETETIME REALIZATION OF
CONTINUOUSTIME CONTROLLER DESIGN................ 32
4.1. Introduction ............................... 32
4.2. DiscreteTime New
MRAC System Controller...................... 32
4.3. Computer Simulation of the
DiscreteTime New MRAC System .............. 36
5. IMPLEMENTATION.............................. 48
5.1. Introduction .......................... 48
5.2. Hardware Design ....................... 48
5.3. Software Design ....................... 49
5.4. Adaptive DC Motor Position
Control System Test Results ........... 50
6. CONCLUSIONS................................. 78
APPENDIX
A COMPUTER SIMULATION PROGRAMS ............... 80
B. COMPUTER CONTROLLER
PROGRAM LISTING............................. 85
BIBLIOGRAPHY..................................... 96
vi
FIGURES
FIGURE
2.1. DC motor system
mechanical configuration .................... 4
2.2 Completed DC motor system........................... 5
2.3. Model of the DC
motor system........................................ 6
3.1. Modelreference intelligent
control system........................................ 13
3.2. Augmented system ..................................... 16
3.3. Equivalent error system............................... 22
3.4. New MRAC system...................................... 24
3.5. Modified new MRAC system.............................. 26
4.1. Rectangular rule
(a) leftside rule
(b) rightside rule................................ 34
4.2. Angular position response for
the system without adaptive
control (J = 0.6269 ozins2/rad) .................... 42
4.3. Angular position response for
the system with adaptive
control (J = 0.6269 ozins2/rad) .................... 43
4.4. Angular position error
(J = 0.6268 ozins2/rad) ............................ 43
4.5. Adaptive gain
Kj (J = 0.6269 ozins2/rad)
44
4.6. Adaptive gain
K2 (J = 0.6269 ozins2/rad)............................ 44
4.7. Angular position response for
the system without adaptive
control (J = 1.27 ozins2/rad) ....................... 45
4.8. Angular position response for
the system with adaptive
control (J = 1.27 ozins2/rad) ........................ 45
4.9. Angular position error
(J = 1.27 ozins2/rad) ................................ 46
4.10. Adaptive gain
Kj (J = 1.27 ozins2/rad).............................. 46
4.11. Adaptive gain
K2 (J = 1.27 ozins2/rad).............................. 47
5.1. Position step response for the
system without adaptive control......................... 52
5.2. Position step response for the
system with adaptive control ........................... 52
5.3. Position error ......................................... 53
5.4. Plant input ............................................ 53
5.5. Adaptive gain Kj........................................ 54
5.6. Adaptive gain K2........................................ 54
5.7. Position step response for the
system without an estimator............................. 55
5.8. Position error for the
system without an estimator............................. 55
5.9. Plant input for the
system without an estimator............................. 56
vm
5.10. Adaptive gain Kj for the
system without an estimator............................ 56
5.11. Adaptive gain K2 for the
system without an estimator............................ 57
5.12. Position step response for the
system without adaptive control........................ 58
5.13. Position step response.............................. 59
5.14. Position error ........................................ 59
5.15. Plant input ........................................... 60
5.16. Adaptive gain ......................................... 60
5.17. Adaptive gain K2....................................... 61
5.18. Position step response for the
system without an estimator............................ 61
5.19. Position error for the
system without an estimator............................ 62
5.20. Plant input for the
system without an estimator............................ 62
5.21. Adaptive gain for the
system without an estimator............................ 63
5.22. Adaptive gain K2 for the
system without an estimator............................ 63
5.23. Position step response for the
system without adaptive control........................ 65
5.24. Position step response for the
system with adaptive control .......................... 65
5.25. Position error ........................................ 66
5.26. Plant input .......................................... 66
5.27. Adaptive gain ......................................... 67
IX
5.28. Adaptive gain K2....................................... 67
5.29. Position step response for the
system without an estimator........................... 68
5.30. Position error for the
system without an estimator........................... 68
5.31. Plant input for the
system without an estimator........................... 69
5.32. Adaptive gain Kj for the
system without an estimator........................... 69
5.33. Adaptive gain K2 for the
system without an estimator........................... 70
5.34. Position step response for the
system without adaptive control....................... 71
5.35. Position step response................................. 72
5.36. Position error ........................................ 72
5.37. Plant input ........................................... 73
5.38. Adaptive gain Kx....................................... 73
5.39. Adaptive gain K2....................................... 74
5.40. Position step response for the
system without an estimator........................... 74
5.41. Position error for the
system without an estimator........................... 75
5.42. Plant input for the
system without an estimator........................... 75
5.43. Adaptive gain K, for the
system without an estimator........................... 76
5.44. Adaptive gain K2 for the
system without an estimator........................... 76
x
TABLES
Table
4.1. BASIC Computer Program for
Finding the Unit Step Response
of the System Equation (4.10) ................ 37
xi
ACKNOWLEDGEMENTS
This study would not have been possible without the cooperation and
support of many people to whom I will always be grateful.
I especially wish to express my sincere gratitude to my advisor
Professor Jan T. Bialasiewicz for his support and guidance during the
preparation of this thesis. I would also like to thank Professor Edward T.
Wall and Professor William J. Wolfe for their encouragement and also for
serving on my committee.
Finally, this thesis is dedicated to my family for their patience,
support and encouragement.
I
CHAPTER 1
INTRODUCTION
In some control tasks, such as those in robot manipulation, the
robots have to manipulate loads of various sizes and weights. It is very
restrictive to assume that the inertial parameters of the loads are well
known before a robot picks them up and moves them away. Without
continuous redesign of the controller, the initially appropriate controller
design may not be able to control the changing plant in an adequate
manner. The purpose of adaptive control is to maintain consistent
performance of a system in the presence of uncertainty or unknown
variation in plant parameters.
A modelreference adaptive control (MRAC) system was chosen as
the basis for an adaptive controller design in this thesis because it allows for
a precise definition of the needed optimal dynamic response of the system
in terms of a reference model. In addition, a new MRAC algorithm, used
in this thesis is taken from Ampsefidis, AJ. [1]. Here, following the thesis
of Ampsefidis [1], a computercontrolled system with DC motor is studied.
This development, which uses a new algorithm for direct modelreference
adaptive control of a DC motor, which drives a variable inertia load. This
algorithm of reference [1] does not require the satisfaction of the perfect
modelfollowing (PMF) conditions. Also, this algorithm, which is designed
by using Lyapunov techniques, guarantees asymptotic stability, provided that
the transfer function of the equivalent error system is strictly positive real
(SPR). In addition, it is shown that the adaptive algorithm guarantees that
the error will remain bounded under less restrictive positivity conditions.
Furthermore, the new modelreference adaptive control system is extremely
simple compared with other control algorithms.
Finally, this thesis is organized in the following manner. Chapter 2
illustrates the experimental setup of the whole system and derives the plant
and reference model equations under specific assumptions. Chapter 3
presents the design and stability analysis of the new MRAC system. In
Chapter 4 the discretetime new MRAC system and the simulation results
are presented. In Chapter 5 the design of the computer based adaptive
controller for the DC motor is presented and implemented in the realtime
system. The last chapter presents the conclusions and outlines possible
research.
2
CHAPTER 2
EXPERIMENTAL SETUP
2.1 Environment
The system under consideration includes:
1. A DC motor
2. Two sensors: potentiometer and tachometer
3. A Metrabyte DASH16 A/D & D/A board
4. A voltage level shifter
5. IBM PC/AT
By using an A/D and D/A converter and digital I/O, the software on
the IBM PC/AT can then be used to control the system according to some
specific control law. The details about the implementation will be discussed
in Chapter 5. In the next section, the DC motor model will be established.
2.2 Modeling the DC Motor System
The plant considered in this application of adaptive control consists
of a power amplifier driving a DC motor, which is controlling the angular
position of a variable inertia flywheel. This flywheel serves as a nominal
load for the DC motor, and the moment of inertia of the load is easily
adjusted by placing weights on the disc. The angular position of the load is
sensed with a potentiometer coupled to the motor shaft. Angular velocity
of the load is sensed by an analog tachometer, which is an integral part of
the DC motor. Figure 2.1 shows a diagram of the mechanical configuration
of the DC motor system and a picture of the completed unit appears in
Figure 2.2. In this chapter a continuous time model of the DC motor
system (the plant) is derived.
. REMOVABLE LOAD
i
Figure 2.1. DC motor system mechanical configuration.
The motor shaft is connected directly to the load via a rigid shaft
coupler, which has a moment of inertia of .0011 ozins2/rad about the
rotational axis. The load itself consists of a permanently attached metal disc
having a moment of inertia of 0.62 ozins2/rad about the rotational axis, and
a removable weight, which has a moment of inertia of 0.65 ozins2/rad.
This allows the total load inertia to be varied by approximately a factor of
two in a step function manner.
4
Figure 2.2. Completed DC motor system.
A model representing the dynamics of the DC motor system is shown
in Figure 2.3. The system variables and parameter symbol definitions are:
J = total moment of inertia of the system
Ka = power amplifier
Kr = potentiometer
Kt = torque constant of the motor
Kv = tachometer
e = load angular position
0) = load angular velocity
5
transducer
Figure 2.3. Model of the DC motor system.
The plant model has been derived by Kraft [2] under the following
assumptions:
1. It is assumed that the power amplifier, tachometer and
potentiometer transfer functions can be approximated by
constants (K,, Kp) representing their respective DC gains.
2. It is assumed that the nonlinear components of the friction,
which exist in the plant, have been compensated for during
the process of adaptation, thus canceling the nonlinear effects
on the dynamics of the controlled plant.
The corresponding closedloop transfer function is given by
6
(2.1)
C(s) ____________KaKt2/J____________
R(S) S2 + (KaKvKt/J)S + (KnKpKt/J)
where
K. = 1
Kp = 2.0 V/rad
Kt = 10 ozin/A
= 0.668 Vs/rad
For J = 0.6269 ozins2/rad, we have
C(s) _ 31.9
R(s) s2 + 10.655s + 31.9
From this closedloop transfer function, we obtain the natural frequency
on = 5.648, the damping ratio $ = 0.9433, and the time constant which is
ti = 1/ unÂ£ = 0.188 seconds
For J = 1.27 ozins2/rad, we have
C(s) _ 15.75
R(s) s2 + 5.26s + 15.75
(2.3)
7
From this closedloop transfer function, we obtain o>n = 3.969, $ = 0.6627,
and a time constant of
t2 = 1/
23 DiscreteTime Plant Model
There are two main problems for choosing the sampling period T.
First, the smaller the sampling period T, the more closely this discretetime
plant approaches the performance of the original continuoustime plant. A
rule of thumb [3] often given for selection sample rate is that a rate of at
least five times the time constant is a good choice. Second, the sampling
period T must be chosen so that T is at least equal to the computing time
for completing one MRAC algorithm cycle.
In Chapter 5, the computing time will be measured as 5 msec. For
T = 5 msec, we are sampling 23.6 times per time constant x1 and 76 times
per time constant x2. From the above observation, the sampling period
T = 5 msec has been chosen for the control system.
For J = 0.6269 ozins2/rad, the z transfer function of the plant
becomes
C(z) 0.0003917z + 0.0003848
R(z) z2 1.9473z + 0.9481
The state equation and output equation may be written as
8
(2.5)
x(k + 1) = Apx(k) + Bpu(k)
0.9477 0.1553
0.0049 0.9996
x(k) +
0.0049
0.0000123
u(k)
y(k) = Cpx(k)
= [0 31.9]x(k)
(2.6)
For J = 1.27 ozins2/rad, the z transfer function of the plant
becomes
C(z) = 0.0001952Z + 0.0001935
R(z) z2 1.9737z + 0.9740
(2.7)
The state equation and output equation may be written as
x(k + 1) = ApX(k) + BpU(k)
0.9738
0.0049
0.0777
0.9998
x(k) +
0.0049
0.0000124
u(k)
(2.8)
y(k) = CpX(k)
= [0 15.75 ]x(k)
(2.9)
These state equations and output equations will be used as a plant
for simulation in Chapter 4.
9
2.4 Reference Model
In order to define the desired closedloop performance of this
system, its response to a step function input will be used as the criterion for
performance evaluation. Certain characteristics of this step response 
primarily the rise time  must be limited to some minimum value that will
assure that the power amplifier in the plant always operates in its linear
region and does not start limiting the control signal input. This constraint
arises because the MRAC system reference model is defined to be a linear
system and the controlled plant must be capable of matching the response
of this linear reference model after adaptation is complete. Overdriving the
power amplifier would require compensation for an additional nonlinearity
and this would unnecessarily complicate the adaptive controller design.
Therefore, the power amplifier output must always remain less than 6
Amperes in magnitude which yields the fastest rise time t,. = 0.57 seconds
[2]
For a system with rise time tj = 0.57 seconds and no overshoot, the
transfer function of the reference model is chosen to be
Yn = 0)11 4225 (2.10)
Um(s) s2 + 2Â£(o s + s2 + 13s + 42.25
where the damping ratio $ = 1 and the natural frequency o>n = 6.5 rad/sec.
The rise time, which is the time required for the response to rise from 10%
10
to 90% of its final value, is equal to 0.57 sec (t,. = 0.57 sec). Equation
(2.10) can be written in discretetime state space form as
x(k + 1) = Amx(k) + Cmu(k)
0.9366 0.2045
0.0048 0.9995
x(k) +
0.0048
0.000012
u(k)
(2.11)
y(k) = Cmx(k)
= [0 42.25]x(k)
(2.12)
This reference model will be used for simulation in Chapter 4 and
implementation in Chapter 5.
11
CHAPTER 3
CONTINUOUSTIME MODELREFERENCE
ADAPTIVE CONTROL SYSTEM DESIGN
3.1 Introduction
The design of this modelreference adaptive control (MRAC) system
may be carried out using one of two possible approaches: The plant can be
transformed into an equivalent discretetime system for which the adaptive
control laws are derived directly in discretetime form, or the adaptive
control laws can be derived for the plant and the resulting continuoustime
MRAC system converted to a discretetime MRAC system. In this thesis,
the second approach has been chosen.
In both cases the results must be a discretetime system, which can
be implemented on a digital computer controller. Both approaches to
deriving the adaptive control laws rely upon either the Lyapunov stability
theory or the hyperstability theory. This is indicated by most of the recent
work done in this field [4] in order to guarantee global asymptotic stability
for the final MRAC system. This chapter presents the development and
analysis of a new MRAC system. The design of the controller is based on
Lyapunovs Direct Method. The formulation of the design statement
permits a suspension of the conditions for perfect modelfollowing (PMF).
In other words, it is not required that the structure of the plant
resemble that of the model. This chapter is organized in the following
manner. Section 3.2 deals with the modelreference intelligent control
(MRIC) system [5], which is the foundation of the new adaptive algorithm.
Section 3.3 presents the new MRAC design based on Ampsefidiss thesis
[1]. Section 3.4 presents the new MRAC system without the state
estimator.
3.2 ModelReference Intelligent Control System
The idea of the modelreference intelligent control (MRIC) system
was first introduced by J. T. Bialasiewicz and J. C. Proano [5]. The MRIC
system, which is shown in Figure 3.1, consists of three parts.
Figure 3.1. Model reference intelligent control system.
The first part, reference model, incorporates the design characteristics of
the plant. The purpose of the control system is to constrain the plant step
13
response to track the reference model step response. The second part of
the MRIC system consists of the state estimator. The estimator is described
by the differential equation of the reference model with proper feedback.
Due to feedback the estimator response is faster than that of the reference
model. Therefore, the speed of the adaptation process is improved. The
third part of the MRIC system is the adaptive law. This part is designed as
a proportional plus integral (PI) controller whose function is to drive the
error signal, which is defined as the output of the model minus the output
of the plant, to zero. In other words, the adaptive law continuously solves
the pole placement problem.
To complete the analysis of the MRIC system, the differential
equations, which describe the adaptive system of Figure 3.1, are considered
next.
In the following equations the A, B and C are n x n, n x 1 and 1 x n
matrices respectively. The plant is described by
VWBpU (3.1)
II (3.2)
where XpCK11, YpeR and Uel. The reference model is described by
14
(3.3)
Y_ = C X
m tn m
(3.4)
where XmeRn, YmeM and reR. The state estimator equations are
Xe = AmXe + Bmr + Ke2
(3.5)
Ya = CX
e
(3.6)
where Xee Rn and Yee R. and the error, e2, is defined as
iYpY. (3.7)
The adaptive control law is given by
U=0TXe (3.8)
0 = Xe (3.9)
e, Ym Yp (3.10)
where Uc e R, 0 e Rn and e R. Also the input to the plant may be
expressed as
15
(3.11)
U = U + r = eTXB + r
c c
Finally, for convenience it can be assumed, as in reference [5], that
Cp = Cm = Ce = C where C = [1, 0, 0,... 0].
3.3 New ModelReference Adaptive Control System
The design of the new MRAC system is based on a modification of
the MRIC system. This modification is done by using ideas presented in
references [6] and [7], and is developed in Ampsefidiss thesis [1]. In order
to develop the new adaptive algorithm it is necessary to formulate the new
statement of the design problem. This formulation is based on the idea of
the augmented system shown in Figure 3.2.
Figure 3.2. Augmented system.
16
The system shown in Figure 3.2 is a typical feedback control system.
The state estimator and the matrix of gains are located in the feedback
path. The state estimator is simply a filter that supplies the gain controller
with the required auxiliary signals.
All the necessary concepts have now been defined so that the
equation, which defines the behavior of the augmented system, can be
written. The plant shown in Figure 3.2 is given by
VWBpU (3.12)
II (3.13)
The state estimator is described by
Xe = AmXe Bmr + LCpXp LCeXe
(3.14)
= (Am LCe) Xe + LCpXp + Bmr
Ye = CeXe (3.15)
and the input to the plant is assumed to be
U = Uc + r = K(t) Xe + r (3.16)
The combination of equation (3.12) with (3.16) results in the following
17
Xp = \Xp + BpK(t)Xe + Bpr
(3.17)
The augmented system, with state vector X = [x^, XeT]T, described by the
equations (3.17), (3.14) and (3.13), can be written in the following state
space form
\
LCr
BpK(t)
AmLCe
1X1 [bJ
p + p
J o' X 1 .V
(3.18)
Y = [Cp
(3.19)
Note that Y = Yp. Now, equations (3.18) and (3.19) can be rewritten as
follows
X = AX + Br
(3.20)
Y = CX
(3.21)
with the obvious definitions of the matrices A, B and C. The state vector X
is a 2nvector because it is assumed that X and X are nvectors. Also,
the matrices in the equation for Xp and X,. have appropriate dimensions.
The outputs Yp, Ye, Y and the inputs r and U belong to the set R. In
addition, it is assumed that the plant (described by equation (3.12) and
18
(3.13)) is time invariant and linear with unknown parameters. Since the
plant parameters are not known, the elements of the gain matrix (refer to
Figure 3.2) are assumed to be time variant. This gain matrix, of dimension
1 x n, is called K(t). Having developed the augmented system equations,
the design problem can be stated next.
The output of the augmented system (which is of order 2n) is
required to track the output of a nth order reference model of the form
*. AmXm Bnr (3.22)
Ym = CmX (3.23)
This model represents the desired inputoutput behavior of the augmented
system. Since the augmented system input and the reference model input
are the same, the tracking problem can be expressed by the following
equation
Y = Ym (3.24)
Therefore, the purpose of the gain matrix K(t) is to adjust the dynamics of
the augmented system so that it performs as a stable reference model.
For the following adaptive system, it is assumed that there exists an
ideal target system of the form
19
X* = A*X* + Br
(3.25)
Y* = CX*
(3.26)
which satisfies the equation
(3.27)
It is important to note that both the augmented system and the ideal target
system have the same input and output matrices. Also, it is assumed that
the system described by equations (3.25) and (3.26) has the same order as
the augmented system. Moreover, it is assumed that the ideal system matrix
MRAC system [1] it has been shown that if a gain matrix K exists such that
the two positivity constraints are satisfied, the new adaptive control system
is asymptotically stable. The reader should note that the value of K is not
required to be known; only its existence has to be guaranteed.
The generalized state error is defined as
*
A is
A* =
A_ B K
p p
LC A LC
pm e
(3.28)
where K is an unknown constant gain. In the stability analysis of the new
20
(3.29)
ex = X* X
and the output error as
ey = YmY = Y*Y = CXCX=Cex
The differential equations for the state error may be obtained by
differentiating equation (3.29). That is
ex = X* X = X* A*X + A*X X
substituting the appropriate expression for X* and X in (3.31) gives
ex = A*X* + Br A*X + A*X AX Br
= A*(X*X) + (A*A)X
= A*ex + (A* A)X
where
(A* A) X = B* (K(t) K)Xe
with
B*
0
(3.30)
(3.31)
(3.32)
(3.33)
(3.34)
21
Therefore, the generalized error state equation (3.32) can be written in the
following form:
ex = A*ex B* (K(t) K) Xe (3.35)
Equation (3.35) together with equation (3.30) describes the dynamics of the
error system, which is shown in Figure 3.3.
Figure 3.3 Equivalent error system.
Also this system, with input (K K(t)) Xe and output ey, has the
following transfer function
Z(s) = C (SI A*)'1 B * (336)
It is desired that the adaptive controller must make the augmented
system approach the ideal target system asymptotically. In other words,
K(t) has to be chosen so that ex approaches zero as t tends to infinity.
22
Based on the ideas presented in [6], [7], and [8], the adaptive control
law has been chosen to have the following form:
Uc = K(t)X (3.37)
K(t) = Kp(t) K,(t) (3.38)
Kp(t) = eyXeTf (3.39)
K,(t) = ey XeT T (3.40)
where T and T are selected to be positivedefinite symmetric adaptation
coefficient matrices. It is shown in reference [1], that positive definiteness
and symmetricity of these matrices is required for global stability of the
adaptive system. The memory of the adaptive mechanism is provided by the
integral term Kj(t), which is similar to the adaptive gain proposed in
reference [5]. Also, the proportional term Kp(t) and the constant gain
matrices T and T make the new MRAC system much faster than the MRIC
system.
Furthermore, as shown in the reference [1] section 2.3.2, the
proportional term Kp(t) facilitates direct control of the output error ey.
Therefore, as indicated in reference [9], the output error can be ultimately
reduced to zero under the assumption of a disturbancefree environment. A
23
final observation is that the new adaptive algorithm, given in equations
(3.37) through (3.40) is extremely simple. The complete new adaptive
system is shown in Figure 3.4.
Figure 3.4. New MRAC system.
The stability properties of the new MRAC system have been
developed by Ampsefidis [1], which can be summarized as follow:
1. The adaptive system is asymptotically stable or, in other
words, ex and ey (defined by equations (3.29) and (3.30))
approach zero as t tends infinity under the following
conditions:
(a) T is a positive definite symmetric matrix;
(b) T is a positive semidefinite symmetric matrix;
24
(c) Z(s), defined by equation (3.36), is strictly positive real
(SPR).
2. The adaptive system is globally stable or, in other words, the
errors ex and ey are bounded, and their bound can be reduced
arbitrarily under the following conditions:
(a) T is a positive definite symmetric matrix;
(b) T is a positive definite symmetric matrix;
(c) There exists a gain matrix K (refer to equation (3.28))
such that A is a stable matrix that satisfies equation
A*tP + PA*=Q (341)
where Q and P are positive definite symmetric
matrices.
The proof of these stability properties has been developed by Ampsefidis
[1], which will not be repeated here. In the next section, the system without
an estimator will be developed.
3.4 New MRAC System without an Estimator
In section 3.3, if all state variables of plant are available for
feedback, the state estimator of the new MRAC system can be omitted.
The DC motor as mentioned in section 2.2. is assumed to be a second order
plant with position and velocity feedback, which is the full state feedback
25
plant. Therefore, the new MRAC system without an estimator can be used
in this design.
The design procedures are the same as in the previous section with
the modified system shown in Figure 3.5.
Figure 3.5 Modified new MRAC system.
The main modification is replacing state estimator X,, by true state
Xp. Then the elements of the modified system can be described as follows:
The plant shown in Figure 3.5 is given by
X,  BpU (342)
26
vv.
(3.43)
The model is described by
K = AmXm + Bmr
(3.44)
Y_ = CX
in m m.
(3.45)
and the input to the plant is assumed to be
U = Uc + r = K(t) Xp + r
(3.46)
The combination of equation (3.42) with (3.46) results in the following
X = A X_ + B_K(t) Xn + B_r
p pp pv,p p
(3.47)
 (Ap + BpK(t))Xp + Bpr
Now, equations (3.47) and (3.43) can be rewritten as follows
X = AX + Br
(3.48)
Y = CX
(3.49)
The output of the plant is required to track the output of the
reference model (described by equation (3.44) and (3.45)). That is, it is
requested that
27
(3.50)
Y = Y
m
Therefore, the purpose of the gain matrix K(t) is to adjust the dynamics of
the modified system so that it performs as a stable reference model.
For the following adaptive system it is assumed that there exists an
ideal target system of the form
X* = A*X* + Br (351)
Y* = CX* (352)
which satisfies the equation
Y* = Ym (3.53)
It is assumed that the ideal system matrix A is
A' = (Ap + BpK) (354)
where K is an unknown constant gain. In the stability analysis of the new
MRAC system [1] it shows that, if a gain matrix K exists, such that the two
positivity constraints are satisfied, the new adaptive control system is
asymptotically stable. Again, the reader should note that the value of K is
not required to be known; only its existence has to be guaranteed.
28
As in section 3.3, the generalized state error is defined as
ex = X* X
and the output error as
ey = Ym Y = Y* Y = CX* CX = Cex
The differential equations for the state error may be obtained by
differentiating equation (3.55). That is
ex = X* X = X* A*X + A*X X
Substituting the appropriate expression for X* and X in (3.57) gives
ex = A*X* + Br A*X + A*X AX Br
= A*(X*X) + (A*A)X
= A*ex + (A* A)X
where
(A* A)X = [(Ap BpK) (Ap + Bp + BpK(t))]Xp
= B*(K(t) K)Xp
with
(3.55)
(3.56)
(3.57)
(3.58)
(3.59)
29
(3.60)
B* = Bp
Therefore, the generalized error state equation (3.58) can be written in the
following form:
ex = A*ex B* (K(t) K)Xp (3*61)
Equation (3.61) together with equation (3.56) describes the dynamics of the
error system, which is the same as in Figure 3.3 with X,. replacing by Xp.
Also this system, with input (K K(t)) Xp and output has the following
transfer function:
Z(s) = C(SI A*)_1B* (362)
As stated in the previous section, an adaptive control law has been
chosen to have the following form:
Uc = K(t)Xp (3.63)
K(t) = Kp(t) + Kj(t) (3.64)
Kp(t) = eyXpTT (3.65)
KI(t) = eyXpTT (3.66)
30
where T and T are selected to be positivedefinite symmetric adaptation
coefficient matrices. The stability properties of the modified system are the
same as the new MRAC system in section 3.3. The reader may refer to
reference [1] section 2.3.2.
31
CHAPTER 4
DISCRETETIME REALIZATION OF
CONTINUOUSTIME CONTROLLER DESIGN
4.1 Introduction
Having obtained a continuoustime MRAC system design in the
previous chapter, it is now necessary to convert this design to a discrete
time form, which can then be directly implemented with a digital controller.
In this chapter, the general structure of the continuoustime MRAC system
controller will be converted to discretetime form using a discretetime
approximate integrator and ztransform. Then, the resulting discretetime
adaptive control system will then be simulated on a digital computer to
verify overall stable adaptive performance.
42 DiscreteTime MRAC System Controller
Since the continuoustime MRAC system controller in Figure 3.4 is a
nonlinear time varying system, the usual linear techniques for transforming
a continuoustime system to an equivalent discretetime system cannot be
applied to this system as a whole. The approach used involves
approximating the continuous integrations in the controller with analogous
discretetime networks. It should be realized that this method results in
only an approximation of the continuoustime adaptive controller.
Let us determine the numerical approximation for
y(t) = Q*x(t)dt (4.1)
Assume that the upper limit of the integral is t = nT (T = sampling
period). Hence,
y(nT) = oTx(t)dt
(4.2)
Figure 4.1a illustrates the rectangular rule using the left side of
the rectangles. Hence,
tt1
y(nT)=TÂ£ x(iT)
t=0
y(nT + T) = TÂ£ x(iT)
i=0
n1
= T Â£ x(iT) + Tx(nT)
i=0
= y(nT) + Tx(nT)
(43)
Therefore, taking the z transform, the transfer function Y(z)/X(z)
is
D(z) =
Tz1
1 z'1
T
z 1
(44)
33
Figure 4.1 Rectangular rule: (a) leftside rule; (b) rightside rule.
Figure 4.1b illustrates the use of the right side of the rectangle in
approximating equation (4.2). Therefore,
y(nT) = TÂ£ x(iT)
il
n+1
y(nT + T)=T Â£ x(iT)
i=l
n
= TÂ£ x(iT) + Tx(nT + T)
i=l
= y(nT) + Tx(nT + T)
Letting n = n 1,
y(nT) = y(nT T) + Tx(nT) (45)
Therefore, the transfer function is
34
T
D(z) = i
(4.6)
1 z"
The trapezoidal rule takes the average of the left and right sides of the
rectangles in Figure 4.1. Hence,
= x(iT) TÂ£ x(iT)
n1 n
2 i=0 i=l
Using the results of the rectangular rule, equation (4.4) and (4.6), we see
that transfer function Y(z)/X(z) is
This discretetime approximation of the integrator was used in this
thesis for integration (equations (3.40) and (3.66)). For the reference
model and estimator shown in Figure 3.4, the ztransform method can be
used. The following example shows the implementation of a system by its
discretetime transfer function in a digital computer.
Consider the discretetime control system
(4.7)
T 1 +Z"1
2 1 z_1
35
(4.8)
C(z) bjZ1 + bxz~2
R(z) 1 ajZ1 + ajZ"2
which can be rewritten as
C(z) Â£l ajZ1 + ajZ"2] = R(z) jbjZ1 + b2z"2J (49)
Taking the inverse ztransform of this equation and rearranging terms,
yields the difference equation
c(kT) = b1r[(k 1)T] + b2r[(k 2)T]
+ ^c[(kl)T]aac[(k2)T]
(4.10)
This equation may be solved for c(kT), k Â£ 0, with r(kT) = 1, k Â£ 0.
Programming equation (4.10) for a digital computer results in a digital
simulation of the discrete system. A BASIC computer program for finding
the response to a unit step sequence input r(k) = 1 (k = 0, 1, 2, . ) is
shown in Table 4.1. In this program, R1 is r[(k 1)T], R2 is r[(k 2)], and
so on. This system also may be simulated on a hybrid computer, where the
samplerdatahold is simulated by an A/D followed directly by a D/A.
43 Computer Simulation of the
DiscreteTime New MRAC System
Before presenting the simulation results, a brief discussion is given
on how the feedback gains of the state estimator should be chosen. The
choice of the feedback gain matrix L (refer to equation (3.14)) must
36
guarantee the existence of a constant gain matrix, K,which will make A
(refer to equation (3.28)) a stable matrix that satisfies equation
TABLE 4.1. BASIC Computer Program for Finding the Unit
Step Response of the System Equation (4.10).
10 C2 = 0
20 Cl = b,
30 R2 = 1
40 R1 = 1
50 C = at Cl a, C2 + bx R1 + b2 R2
60 c(k) = C
70 C2 = Cl
80 Cl = c
90 r(k) = R2
100 R2 = R1
110 PRINT K, c(k), r(k)
120 K = K + 1
130 IF K < 21 GOTO 50
140 END
A*TPA* P = Q
(4.11)
where P and Q are positive definite symmetric matrices. Note, equation
(4.11) is the equivalent discretetime form of equation (3.41) [10].
37
In order to clarify the procedure for choosing the gain matrix L, a
numerical example is given, which uses the equations of the plant and the
reference model presented in Chapter 2.
When the total moment of inertia J = 0.6269 ozins2/rad, the
numerical expression for A can be written by using equations (2.5), (2.6),
(2.11), (2.12) and (3.28) with matrix Ce = Cm, L = [lj 12]T and
K = Jkx Kjj. This expression is
0.9477 0.1553 0.0049Kx 0.0049K2
0.0049 0.9996 0.0000123Kj 0.0000123Kj (4.12)
0 31.91j 0.9366 0.2045 42.25lj
0 31.912 0.0048 0.9995 42.2512
First, the values of lx and 12 must be such that the submatrix A^> (note
= An, LQ) is a stable matrix. If L is chosen to be equal to
[0.001 0.0001 J7 (or lj = 0.001,12 = 0.0001), the matrix A^ which is equal
to
A22 
0.9366
0.0048
0.2468
0.9953
(4.13)
is a stable matrix. The eigenvalues of A^ are 0.9659 j0.0180 which are
inside the unit circle in zplane. Next, the following question should be
38
addressed. Given the values for lt and 12, does there exist values for
Kj and Kj that will make A a stable matrix? For example, with lt = 0.001
and 12 = 0.0001 there are many possible gain matrices K = [Kj Kjj that
will result in a stable matrix A'. For example, with K = [0.0001 0.0001],
A has the value:
0.9477 0.1553 0.00000049 0.00000049
0.0049 0.9996 0.00000000123 0.00000000123
0 0.0319 0.9366 0.2468
0 0.0032 0.0048 0.9953
(4.14)
The A' matrix given above is stable, because the eigenvalues of A'
are inside the unit circle of the zplane. That is the eigenvalues of A are
0.9737 j0.0094, 0.9659 j0.0180. Next, the designer must verify that A
satisfies equation (4.11). This may be accomplished by selecting a
symmetric positive definite matrix Q. Then, equation (4.11) can be solved
for P, which is a positive definite symmetric matrix. By choosing Q equal to
diag [1, 1, 1, 1] and substituting for A the numerical expression given by
equation (4.14), then equation (4.11) can be solved for P. The matrix P,
which satisfies equation (4.11), is the following positive definite symmetric
matrix:
39
10.2652 4.0080 0.1428 0.2315
4.0080 351.308 3.6983 5.0657
0.1428 3.6983 7.9573 3.4185
0.2315 5.0657 3.4185 335.56
(4.15)
Finally, the designer must make sure that the chosen gain matrix L
guarantees the existence of the required K for all possible plant matrices Ap
and Bp (refer to equation (3.28)). Therefore, it must be determined that the
gain matrix L is adequate when the total moment of inertia of the motor J
= 1.27 ozins2/rad.
For J = 1.27 ozins2/rad (equation (2.8) and (2.9)) and with the
same L and K gain matrices, the A' is found to be equal to:
0.9738 0.0777 0.00000049 0.00000049
0.0049 0.9998 0.00000000124 0.00000000124
0 0.0158 0.9366 0.2468
0 0.0016 0.0048 0.9953
(4.16)
The matrix given above is stable because its eigenvalues are located inside
the unit circle of the zplane. The eigenvalues of A are: 0.9868 j0.0146,
0.9659 j0.0180. Also, by substituting A' and Q = diag [1, 1, 1, 1] in
equation (4.11), it is found that there exists a symmetric positive definite
matrix P that satisfies equation (4.11). This matrix P is equal to:
40
20.751 6.7611 0.0793 0.3597
6.7611 357.28 1.8721 2.0952
0.0793 1.8721 7.9573 3.4185
0.3597 2.0952 3.4185 335.56
(4.17)
Summarizing, it can be said that this analysis indicates that with L =
[0.001 0.0001]T the controlled system will be globally stable if the constant
gain matrices T and T of the adaptation mechanism are symmetric positive
definite. Having shown that the controlled system is stable, the system can
be simulated on a computer.
The adaptive gain matrices used for the following simulation were T
= diag [100 100] and T = [5200 8200]. The estimator feedback gain
matrix was L = [0.001 0.0001]T. Furthermore, the command input to the
controlled plant were amplitude of 1 volt, or in other words, it was
required that the DC motor would rotate from the initial angular position
C = 0 volt to the final angular position C = 1 volt.
The simulation BASIC program is shown in Appendix A. The
simulation results for the plant when the total moment of inertia J = 0.6269
ozins2/rad (equations (2.5) and (2.6)) are shown in Figures 4.2 through 4.6.
Figure 4.2 shows the position response of the plant and the reference model
for the system without adaptive control. Figure 4.3 shows the position
response of the plant and the reference model for the system with adaptive
control. Figure 4.4 shows the output error ey (output of the plant minus the
41
output of the model). Figures 4.5 and 4.6 show adaptive gain K(t) = [Kj
KJ (refer to equation (3.62) and (3.63)). Results of simulation show good
output following with a small bounded error.
The simulation results for the plant when the total moment of inertia
J = 1.27 ozins2/rad (equation (2.8) and (2.9)) are shown in Figures 4.7
through 4.11. Results of simulation shows good output following with small
bounded error.
The simulation results indicate that the new MRAC system performs
really well. All values (er Kx and K2) involved in the adaptation process are
bounded. In the next chapter, the implementation of the realtime system
will be presented.
samples (T=5msec)
: Model ________: Plant
Figure 4.2. Angular position response for the system without
adaptive control (J = 0.6269 ozins2/rad).
42
error ey=ymyp (volt) *2 insular position ym/yp (volt)
a ample (T=5m>ec)
: Model __________: Plant
4.3. Angular position response for the system with
adaptive control (J = 0.6269 ozins2/rad).
Figure 4.4.
Angular position error (J = 0.6269 ozins2/rad).
43
16
I L i i  I
r l 1/ 1/
 
O 200 400 600 800 lOOO 1200 1400 1600 1800 2000
samples (T=5meeo)
Figure 4.5. Adaptive gain Kt (J = 0.6269 ozins2/rad).
Figure 4.6. Adaptive gain K2 (J = 0.6269 ozins2/rad).
44
Figure 4.7. Angular position response for the system without
adaptive control (J = 1.27 ozins2/rad).
Figure 4.8. Angular position response for the system with
adaptive control (J = 1.27 ozins2/rad).
45
error ej=ymyp (volt)
0.16
samples (T=6msec)
Figure 4.9. Angular position error (J = 1.27 ozins2/rad).
Figure 4.10. Adaptive gain (J = 1.27 ozins2/rad).
46
Figure 4.11. Adaptive gain K2 (J = 1.27 ozins2/rad).
47
CHAPTERS
IMPLEMENTATION
5.1 Introduction
To evaluate the performance of the adaptive control system designed
in the previous two chapters, an actual digital controller was designed and
implemented for realtime control of the DC motor system. This digital
controller resides in an IBM PC/AT, which is required to implement the
sampling operations, A/D and D/A conversions, and the arithmetic
operations of the controller algorithm.
5.2 Hardware Design
t
The A/D and D/A converter chosen in the experiment is the DASH
16 board manufactured by the Metrabyte Company. The A/D converter
provides eight differential channels, each with a 12bit successive
approximation converter with a 25 lsec conversion time, a 3channel
programmable interval time (INTEL 8254), and other features (see [11]).
In our experiment, two analog signals ranging over +10 to 10 volts from
the tachometer and the potentiometer are converted to integer numbers
ranging over +2047/2048 by the two channels in DASH16. The timer on
DASH16 is used to set the sampling period T = 5 msec for the control
loop.
The D/A converter provides 2 channels of multiplying 12bit D/A
output. The D/A converters can be operated with a fixed 5 volts reference
available from the DASH16 board to give a 0 to +5 volts unipolar output.
For more information about the DASH16 board, the reader may refer to
the DASH16 Manual [11].
A voltage level shifter was designed to provide 2.5 to +2.5 bipolar
motor voltages from the unipolar D/A output. The experiment has shown
that 2.5 volts satisfied our requirement for motor input voltages.
53 Software Design
For the DASH16 board, there is a software package DASH16.BIN
designed by the manufacturer, which can be a simplified program generation
and may be accessed from BASIC language by a single line CALL
statement. Using the DASH16.BIN driver saves much programming time
and has other benefits as well. To improve the speed of an interpreted
BASIC program, the Microsoft Quick Basic Compiler is used.
In a realtime system, the computing time is crucial in design. The
computing time is defined as the time for completing one cycle of the
MRAC Algorithm. This computing time has been estimated by using the
timer counter on the DASH16 board. The result computing time is equal
to 5 msec.
The listings for the complete implementation program is given in
Appendix B. Using this program, the realtime implementation results will
be presented in the next section.
49
5.4 Adaptive DC Motor Position
Control System Test Results
A computerbased adaptive DC motor position control system was
designed and built as described in previous chapters. The performance of
this adaptive control system is evaluated in this chapter. The effect of
modeling inaccuracies and noise on the adaptive performance of the system
is readily observable in the test data presented here.
The systems implementation results are shown in Figures 5.1
through 5.44. The test signal used as an input to this system is a 0.2 Hz
square wave, which the computer generates internally. The magnitude of
the square wave is equal to 1 volt, which is approximately equal to .5 rad or
28.65 degrees.
The following gain matrices have been experimentally found and
used for the implementation:
For the new MRAC system (equations (3.14), (3.39) and (3.40)),
L = diag (0.001, 0.0001), T = diag (1000, 20000), T = diag (100, 100).
For new MRAC system without an Estimator (equations (3.64) and
(3.65)), T = diag (2, 12), T = diag (0.2, 0.2).
The test results for the new MRAC system when the total moment of
inertia J = 0.6269 ozins2/rad are shown in Figures 5.1 through 5.11.
Figure 5.1 shows the position step response of the plant and the reference
model for the system without an adaptive controller. Figures 5.2 through
5.6 show the position step response (ym and yp), position error er plant
50
input u, adaptive gain Kx and adaptive gain K2, respectively, for the system
with an adaptive controller. From these figures it is seen that the plant
output tracks the model output very well. The maximum position error is
less than 8.5% and reduces to 1% after 1.5 seconds of each step input. The
plant input u is less than 2.5 volts. Steady state values of the adaptive
gain Kj and K2 are reached after 0.85 seconds and 1.5 seconds of each step
input, respectively. Figures 5.7 through 5.11 show the position step
response, position error ey, plant input u, adaptive gain and K2,
respectively, for the system without an estimator. From these figures one
can see that file results of the system without an estimator are as good as
those of the system with an estimator. The maximum position error is less
than 15% and reduces to 1% after 1.5 seconds of each step input. The
plant input u is less than 2.5 volts. Kj and K2 reached steady state values
after 0.83 seconds and 1.67 seconds of each step input, respectively.
51
angular position ym/yp (volt) $Â§ angular position ym/yp (volt)
re 5.1.
: Model _______: Plant
Position step response for the system without adaptive control.
: Model _______: Plant
Figure 5.2. Position step response for the system with adaptive control.
52
0.1
Figure 5.3. Position error.
Figure 5.4. Plant input.
53
Figure 5.5. Adaptive gain Kt.
Figure 5.6. Adaptive gain K2.
54
: Model ________: Plant
Figure 5.7. Position step response for the system without an estimator.
Figure 5.8. Position error for the system without an estimator.
55
Figure 5.9. Plant input for the system without an estimator.
Figure 5.10. Adaptive gain Kx for the system without an estimator.
56
O.B
0.6
0.4
0.2
S
0.2
0.4
0.6
O.B
JlK*' VJ' I^Amr
IipihJ
500
1000 1SOO 2000
lamplsi (T=6 ms.c)
2500
Figure 5.11. Adaptive gain K2 for the system without an estimator.
The test results for the new MRAC system when the total moment of
inertia J = 1.27 ozins2/rad are shown in Figures 5.12 through 5.23. Figure
5.12 shows the position step response of the plant and the reference model
for the system without an adaptive controller. Figures 5.13 through 5.17
show the position step response (ym and yp ), position error ey, plant input u,
adaptive gain Kj and K2, respectively, for the system with an adaptive
controller. From these figures it is seen that the plant output tracks the
model output very well. The maximum position error is less than 10% and
reduces to 1% after 1.5 seconds of each step input. The plant input u is
less than 2.5 volts. Steady state values of the adaptive gain and K2 are
I
reached after 0.83 and 1.5 seconds of each step input, respectively. Figures
57
'i
5.18 through 5.22 show the position step response, position error ey, plant
input u, adaptive gain Kj and Kz, respectively, for the system without an
estimator. From these figures one can see that the results of the system
without an estimator are as good as those of the system with an estimator.
The maximum position error is about 20% and reduces to 1% after 1.5
seconds of each step input. The plant input u is less than 2.5 volts. Kj
and K2 reached steady state values after 0.83 and 1.67 seconds of each step
input, respectively.
pamples (T5 msec)
: Model _______: Plant
Figure 5.12. Position step response for the system without adaptive
control.
58
: Model _______: Plant
Figure 5.13. Position step response.
Figure 5.14. Position error.
59
8
1.5 
O 500 lOOG 1500 2000 2500 3000
samples (T=6 msec)
Figure 5.15. Plant input.
Figure 5.16. Adaptive gain Kj.
60
angular position ym/yp (volt)
Figure 5.17. Adaptive gain K2.
: Model ________: Plant
Figure 5.18. Position step response for the system without an estimator.
61
error ey = ymyp (volt)
0.25
0.2511i__________
O 500 10OD 1500 2000 2500 3000
unpin (T=5 maec)
Figure 5.19. Position error for the system without an estimator.
Figure 5.20. Plant input for the system without an estimator.
62
o.os
L L i i Jl* Jl A
V y
0.05 
01  
0.15  
02 
0.25 
0.3
o 500 1000 1500 2000 2500 3000
ample! (T>6 mioc)
Figure 5.21. Adaptive gain for the system without an estimator.
Figure 5.22. Adaptive gain K2 for the system without an estimator.
63
The next test results, which were used to measure the adaptive
response of this system, involve increasing and then decreasing the load
inertia in a step function manner while the system is operating.
The test results for the new MRAC system when the total moment of
inertia increases from J = 0.6269 to J = 1.27 ozins2/rad are shown in
Figures 5.23 through 5.33. Figure 5.23 shows the position step response for
the system without an adaptive controller. Figures 5.24 through 5.28 show
the position step response, position error, plant input, and adaptive gain Kj
and K2, respectively, for the system with adaptive control. From these
figures, it is seen that the plant output tracks the model output very well, in
spite of increasing the load inertia. The maximum position error is less than
t
10% and reduces to 1% after 1.5 seconds of each step input. The plant
input is less than 2.5 volts. Steady state values of the adaptive gain Kj
and K2 are reached after 1 and 1.5 seconds of each step input, respectively.
Figures 5.29 through 5.33 show the position step response, position error,
plant input, and adaptive gain Kj and K2, respectively, for the system
without an estimator. From these figures one can see that the system
without an estimator still works very well. The maximum position error is
about 20% and reduces to 1% after 1.5 seconds of each step input. The
plant input is less than 2.5 volts. Kj and K2 reached steady state values
after 1 and 1.67 seconds of each step input, respectively.
64
2_______f
J = O;6269 ozinB^/rad ^
J = 1.27 ozinB^/rad
: Model _______: Plant
Figure 5.23. Position step response for the system without adaptive
control.
samples (T=5 msec)
: Model _______: Plant
Figure 5.24. Position step response for the system with adaptive
control.
65
error ey = jmjp (volt)
J
J
0.6269
ozins
2
/rad
1.27 02in
^/rad
Figure 5.25. Position error.
J = 0.6269 Q7.ins/rad
J 1.27 ozins^/rad
Figure 5.26. Plant input.
66
Figure 5.27. Adaptive gain Kt.
900 1000 1SOO 2000 2000 3000
tmplea (T=6 muo)
Figure 5.28. Adaptive gain K2.
67
2
________ J = 1.27 oiina /cad
J = 0.6269 ozlnB2/rad______I
: Model ________: Plant
Figure 5.29. Position step response for the system without
an estimator.
2
_________ J = 1.27 ozins /cad
J = 0.6269 ozins?/Ead___l
Figure 5.30. Position error for the system without an estimator.
68
 J = 127 02in8^/rad
J = 0.6269 ozins^/rad 1
Figure 5.31. Plant input for the system without an estimator.
3
1.21 ozin6^/rad
J = 0.6269 ozins^/Ead
samples (T=5 msec)
Figure 5.32. Adaptive gain Kj for the system without an estimator.
69
2
I j as 1.27 ozins /rad
J = 0.6269 ozlns /rad______
Figure 5.33. Adaptive gain K2 for the system without an estimator.
The test results for the new MRAC system when the total moment of
inertia decreases from J = 1.27 to J = .6269 ozins2/rad is shown in Figures
5.34 through 5.44. Figure 5.34 shows the position step response for the
system without adaptive control. Figures 5.35 through 5.39 show the
position step response, position error, plant input, adaptive gain Kx and K2,
respectively, for the system with adaptive control. From these figures it is
seen that in spite of the decreasing of the load inertia the plant output
tracks the model output quite well. The maximum position error is less
than 10% and reduces to 1% after 1.5 seconds of each step input. The
plant input is less than 2.5 volts. Steady state values of the adaptive gain
Kj and K2 are reached after 1 and 1.67 seconds of each step input respec
tively. Figures 5.40 through 5.44 show the position step response, position
70
error, plant input, adaptive gain Kt and K2, respectively, for the system
without an estimator. From these figures one can see that the test results
for the system without an estimator work as well as those for the system
with an estimator. The maximum position error is about 20% and reduces
to 1% after 1.5 seconds of each step input. The plant input is less than
2.5 volts. Adaptive gain Kj and K2 reached steady state values after 1 and
1.67 seconds of each step input, respectively.
samples (T=5 msec)
: Model _______: Plant
Figure 5.34. Position step response for the system without
adaptive control.
71
angular position jm/yp (volt)
J
= 1.27 Q8lna2/rad
J 0.6269 ozins^/rad
: Model _______: Plant
Figure 5.35. Position step response.
J = 1.27 ozinB2/rad
Figure 5.36. Position error.
72
Figure 5.37. Plant input.
J = 1.27 ozins^/rad
2
*J = 0.6269 ozins /rad
Figure 5.38. Adaptive gain
73
angular position ym/yp (rolt)
painplM (Tb5 mo)
Figure 5.39. Adaptive gain K2.
2
J 1.27 ozinB /rad
2
J  0.6269 ozinB /rad
unplciB (T=5 znaeo)
: Model ________: Plant
Figure 5.40. Position step response for the system without
an estimator.
74
a 1.27 ozino2/rad
Figure 5.41. Position error for the system without an estimator.
Figure 5.42. Plant input for the system without an estimator.
75
3
samples (T=5 msec)
Figure 5.43. Adaptive gain Kx for the system without an estimator.
2
J = 1.27 ozins /rad
J = 0.6269 ozins^/rad
Figure 5.44. Adaptive gain K2 for the system without an estimator.
76
The test results indicate that the new MRAC system performs really
well. Also, it should be noted that the position error never reaches zero but
becomes less than some specified low value and remains within that range.
All values (ey, u, Kl5 K2) involved in the adaption process are bounded.
77
CHAPTER 6
CONCLUSIONS
In this thesis the modelreference adaptive control MRAC, of a
computercontrolled DC motor with variable inertia load has been
presented. A modelreference adaptive control system structure was chosen,
and the adaptive control law was derived for the continuoustime system
using Lyapunov stability theory. The continuoustime adaptive controller
was subsequently converted to a discretetime adaptive controller, and a
discretetime model of the entire system was simulated on a digital
computer to evaluate its relative stability and adaptive response
characteristics.
A computer controller was designed and programmed to implement
the discretetime modelreference adaptive controller algorithm. The
laboratory test results of the MRAC system with and without estimator were
both good.
The test results show that this MRAC system is capable of providing
a dramatic performance improvement over nonadaptive systems when
certain parameters of the system are subject to large unpredictable
variations. Also, it shows that this adaptive controller can successfully
compensate for poorly defined system nonlinearities.
The design method used in this thesis to obtain a discretetime
adaptive controller yields a good stable system performance. A choice of
sampling period that has a rate of more than five times the time constant of
the system results in good adaptive performance.
In future research, application should be to the real robot
manipulator, which is required to manipulate loads of various sizes and
weights.
79
APPENDIX A
COMPUTER SIMULATION PROGRAMS
*******************************************************
program: AD6.bas
*
'This Basic program generates the MRAC algorithm
'*and simulate the sytem
* *
'* PinHuang Hsleh 111591
*
*
*
*
*
*
*
******************************************************
**** save data in *.dat files **********
'OPEN snyml.dat* FOR OUTPUT AS #1
'OPEN "snypl.dat* FOR OUTPUT AS #2
'OPEN *sadey2.dat" FOR OUTPUT AS #3
'OPEN sadkl2.dat* FOR OUTPUT AS #4
OPEN sadk22.dat FOR OUTPUT AS #5
****** screen and plot set up ********
CLS
SCREEN 2
xmin 0
xmax 2000
ym1n 1.2
ymax 1.2
WINDOW (xmin xmax / 7.5. ymin ymax / 2)(xmax + xmax / 7.5, ymax + ymax / 2)
LINE (xmin. ym1n)(xm1n. ymax)
LINE (xmin, ymin)(xmax, ymin)
LOCATE 1, 5: PRINT step response*1 (without adaptive)
xstep xmin
X S Q
FDR xi 1 TO 6
LINE (xstep. ymin)(xstep. ymin .03)
LOCATE 23. xs: PRINT STRKxstep)
xstep xstep + xmax / 5
xs xs + 12
NEXT
ystep = ymin
ys 21
FOR yi 1 TO 5
LINE (xmin. ystep)(xmin 20, ystep)
LOCATE ys. S: PRINT STRt(ystep)
ystep ystep + ymax / 2
ys ys 4
NEXT
*********** initial value of adaptive parameters ******
r l u 0 uc = 0 'comand input of the plant
Ts .005 "sampling rate
ym 0 ymlO 0 ymll .0048 ym20 0 ym21 .000012 'model
yp o "plant
81
y p 10 0
ypll = .0049
yp20 0
yp21 .0000123
yelO 0 'estimator
yell .004B
ye2D 0
ye21 .000012
kpl kp2 0 'adaptive gain
eyO eyl 0 'error
dkill dk121 dkilO dki20 kill ki21 kl k2 0 adaptive gain
*********** adaptive gain matrices ********
LI .001
L2 .0001
sl 5200
s2 8200
tl 100
t2 100
************ begin of main program *********
start:
r = 1
'****** generate square wave *******
sr SIN<.0062 kx)
IF sr > 0 THEN r 1 ELSE IF sr < 0 THEN r 1 ELSE r 0
********* estimator **********
yell .9366 yelO (.2045 + LI 42.25) yeZO + .0048 r + LI yp
yeZl .0048 yelO + (.9995 L2 42.25) yeZO + .000012 r + L2 yp
***** adaptive law **********
eyO ym yp
eyl yml ypl
kpl eyO yelO sl
kp2 eyO ye20 s2
dkilO eyO yelO tl
dki20 eyO ye20 t2
dkill eyl yell tl
dki21 = eyl ye21 t2
kill kilO + (Ts / 2) (dkill + dkilO)
ki21 k120 + (Ts / 2) (dki21 + dki20)
82
kl kpl + kill
k2 kp2 + ki 21
uc (kl yelO + k2 ye20)
kilO kill
ki 20 ki 21
kdlO kdll
kd20 kd21
u r + uc
******** moment of inertia J .6269 02insA2/rad
ypll .9477 yplO .1553 yp20 + .0049 u
yp21 .0049 yplO + .9996 yp20 + .0000123 u
yp = 31.9 yp20
******* J 1.27 ozi nsA2/rad *****
ypll .9738 yplO .0777 yp20 + .0049 u
*yp21 .0049 yplO + .9998 yp20 + .0000124 u
*yp 15.75 yp20
jjg"] ***
ymll .9366 ymlO .2045 ym20 + .0048 r
ym21 = .0048 ymlO + .9995 ym20 + .000012 r
ym = 42.25 ym20
************ update the state ******
yelO yell
ye20 ye21
ymlO ymll
ym20 ym21
yplO ypll
yp20 yp21
ypl = yp
yml ym
kx kx + 1
'PSET (kx.Pkl)
PSET (kx. k2)
PSET (kx. yelO)
PSET (kx. uc)
PSET (kx. eyO)
PSET (kx. ym)
PSET (kx. yp)
LINE (kl. yml)(kx. ymO)
LINE (kl. ypl)(kx. ypO)
LINE (kl. eyl)(kx. eyO)
PRINT #1. ym
PRINT #2. yp
PRINT #3. eyO
PRINT #4, kl
it*r*mnt
83
PRINT #5, k2
IF kx xmas GOTO start
DO: LOOP WHILE INKEY$ =
CLOSE #1
'CLOSE #2
'CLOSE #3
CLOSE #4
CLOSE #5
END
84
APPENDIX B
COMPUTER CONTROLLER
PROGRAM LISTING
*****************************************************************************
ADMOTOR.bas MRAC system Program
OulckBasic Compiler, with subroutines
PlnHuang Hsleh
Subroutines Used:
<*
*
*
*
* PinHuang Hsieh 1115*91
*
*
*
DECLARE SUB Initialize () 'Initialize Dash16. A/D input
* multiplexer scan limits, and sampling rate
DECLARE SUB zerovolts () 'output 2.5 volts to the level shifter, which
supplies 0.0 V to the motor, and stops it.
DECLARE SUB getparameters O 'Using a menu, query user for various control
* parameters
DECLARE SUB 1n1tvalue () adptlve Initial parameter
DECLARE SUB adptive () 'MRAC algorithm
DECLARE SUB setdefaults () 'Loads control parameters with default values
DECLARE SUB loadloopvariables () Copy current parameters into temporary
' array variables for easy menu programming
DECLARE SUB displayparameterl ist () 'Display in menu, for user input
DECLARE SUB updateparameters () After user query, update parameter names
' from temporary arrays
DECLARE SUB readfeedback () 'Read A/D inputs, velocity and position, and
1 increment 'ticks* loop counter
DECLARE SUB outputvoltage {) 'Output calculated armature voltage to motor
DECLARE SUB status O 'After program run. display and print results
*
*
*
*
*
*
*
*
*
*
*
Variables Used:
Epos: motor feedback, position of shaft approx 2V/radian
Evel: motor feedback, from tachometer approx +/ 6V
Gcomp: program Input, feedforward gain compensation
Kvel: program Input, velocity feedback gain
Eref: system input, shaft position desired, same units as Epos
poserror: ErefEpos, error in position required and current position
tolerance: acceptable value of poserror, used to exit control loop
minvel: level of Evel which is considered minimum, motor stopped
V:
Vmax:
'* model:
'* iodatal:
'* flag!:
*
*
*
ticks:
motor armature voltage determined by control law: bipolar
limit of V
dash16 parameter, mode number, type: Integer
dash16 parameter. Input or output data 1n bits, Integer
dash16 parameter, nonzero if error in CALL DAS16...
counts number of iterations in read, output control loop
*
*
*
*
*
+
*
*
*
*
*
Ts: sampling rate *
uc.ym.yp.ye,Ll.L2.sl,s2.tl.t2: adaptive parameters *
*
Graphics Menu Constants (used only in getparamters, status subroutines) *
top 5 'row location of first line of parameter list display *
length 5 'length of parameter list *
cursrcol = 20 column location of cursor in parameter menu display *
labeled  25 'column location of labels in parameter menu display *
valuecol  40 'column location of parameter values 1n menu display *
statscol  14 'column loaction of lines in run status display *
queryrow top + length + 1 'row location for inputting new paramters *
statsrow queryrow + 2 'starting row for writing status display *
blank!n$ ' * *
****************************************************************************
DIM 1odataS(4). labeltd TO 7). valued TO 7). datald TO 3000). data2(l TO 3000)
86
****+ .dat files to save datas
OPEN 'inpdata.dat* FOR OUTPUT AS #1
OPEN "outdata.dat" FOR OUTPUT AS n
******* Main Program Start ********
Initialize 'Dash16 board and Multiplexer Scan Limits
zerovolts 'Stop Motor
INPUT 'Safe to turn motor power on...Press any key to continue"
CLS
uc 0
DO
getparameters
inltvalue
ky 0
i 0
DO loop
kx 0
******* start main control loop *******
DO 'feedback loop
readfeedback
i 1 + 1
adptlve
datal(i) ym
'data2(i) yp
datal(I) eyO
data5(i) kl
*data6(i) k2
yp Epos
u Eref + uc
data2(1) u
poserror * u Epos
IF (ABS(poserror) < tolerance) THEN poserror 0
'Check For Keyboard Interrupt Exit
IF (INKEYS <> ) THEN EXIT DO
'Control Law Programming:
'Calculate Output Voltage
V Gcomp (poserror Kvel Eve!) (1)
'Check for Over Voltage
IF ABS(V) > Vtnax THEN V Vmax SGN(V)
outputvoltage
kx kx + 1
LOOP UNTIL kx > 499 'OR false
responses
87
Eref 1 Eref
ky ky + 1
LOOP UNTIL ky > 5
zerovolts
OPEN 'adym.daf FOR OUTPUT AS #1
OPEN "adyp.dat* FOR OUTPUT AS #2
OPEN adey.dat* FOR OUTPUT AS ffl
OPEN "adu.dat" FOR OUTPUT AS #2
OPEN "adkl.dat" FOR OUTPUT AS #5
OPEN adkZ.dat* FOR OUTPUT AS #6
'**** print out results ******
SCREEN 2
CLS
WINDOW (10. 21 (3001. 2)
FOR 1 1 TO 3000
ur datal(i)
yr data2(1)
PRINT #1, ur
PRINT #2. yr
PRINT #3. data3C1)
PRINT #4. data4(1)
PRINT #5. data5C1)
PRINT #6. data6(1)
LINE (1, ur)(1, ur)
LINE (i. yr)(i, yr)
NEXT
CLOSE #1
CLOSE #2
CLOSE #3
CLOSE #4
CLOSE #5
CLOSE #6
status
LOOP UNTIL response* EXIT*
END 'Main Program
SUB adptive
1 **********************1^'* **##***************+****+*"**********
* *
'* subprogram: adaptive *
* *
'* program to excute MRAC algorithm *
* *
>*********************************************************************
SHARED Ts. Eref, uc. ym. ymlO. ymll. ym20. ym21. yp. yelO. yell. ye20, ye21
SHARED LI, L2, si. s2, Tl, T2, eyO, kl. k2
****** Estimator ****
88
