Citation
Discrete time adaptive control

Material Information

Title:
Discrete time adaptive control
Creator:
Austin, Glen Quentin
Place of Publication:
Denver, CO
Publisher:
University of Colorado Denver
Publication Date:
Language:
English
Physical Description:
ix, 144 leaves : ill. ; 28 cm.

Subjects

Subjects / Keywords:
MATLAB ( lcsh )
MATLAB ( fast )
Adaptive control systems ( lcsh )
Control theory ( lcsh )
Adaptive control systems ( fast )
Control theory ( fast )
Genre:
bibliography ( marcgt )
theses ( marcgt )
non-fiction ( marcgt )

Notes

Thesis:
Thesis (M.S.)--University of Colorado at Denver, 1998. Electrical engineering
Bibliography:
Includes bibliographical references (leaves 144).
General Note:
Department of Electrical Engineering
Statement of Responsibility:
by Glen Quentin Austin.

Record Information

Source Institution:
|University of Colorado Denver
Holding Location:
|Auraria Library
Rights Management:
All applicable rights reserved by the source institution and holding location.
Resource Identifier:
42611883 ( OCLC )
ocm42611883

Downloads

This item is only available as the following downloads:


Full Text

PAGE 1

DISCRETE TIME ADAPTIVE CONTROL by Glen Quentin Austin B.S., University of Colorado Boulder, 1978 A thesis submitted to the University of Colorado at Denver in partial fulfillment of the requirements for the degree of Master of Science Electrical Engineering 1998

PAGE 2

This thesis for the Master of Science degree by Glen Quentin Austin has been approved by Tarnal Bose

PAGE 3

Austin, Glen Quentin (M.S., Electrical Engineering) Discrete Time Adaptive Control Thesis directed by Professor Miloje S. Radenkovic ABSTRACT This thesis is an overview of Adaptive Control theory. Adaptive Control is used to control systems when the parameters for the mathematical model of the process are unknown and/or vary in time. With the availability of low cost digital computers it has become possible to use discrete time Adaptive Control techniques to control systems in real time. These computers can evaluate Adaptive Control algorithms fast enough to achieve and maintain a desired level of dynamic system performance. The Normalized Gradient and Recursive Least Squares Parameter Adaptation Algorithms that provide the parameter values necessary to adjust the adaptive controller are discussed. Adaptive control in both the deterministic and stochastic environment is presented. The robustness or ability of the Adaptive Controller and its Parameter Adaptation Algorithm to provide acceptable performance for a system with external disturbances and/or time varying parameters is investigated by simulating a system on a personal computer. The mathematical matrix manipulation program MATLAB by The Math Works is used to perform the computer simulations and generate plots of the results. This abstract accurately represents the content of the candidate's thesis. I recommend its publication. iii

PAGE 4

Contents Chapter 1. INTRODUCTION ................................................................................................................... 1 1.1 SYSTEM PERFORMANCE ............................................................................... 4 1.1.1 THE PERFORMANCE INDEX FUNCTION ........................................................ 5 1 .2 ADAPTIVE CONTROLLER ............................................................................... 6 1.2.1 THE STRUCTURE OF AN ADAPTIVE CONTROLLER ......................................... 7 1.3 PARAMETER ADAPTATION ALGORITHM .......................................................... 9 2. DETERMINISTIC ENVIRONMENT ..................................................................................... 12 2.1 PLANT MODELS IN DISCRETE-TIME ............................................................. 12 2.2 THE J STEP AHEAD PREDICTOR ...... ;,; ......................................................... 15 3. A SYSTEM MODEL FOR THE STOCHASTIC ENVIRONMENT ....................................... 19 4. PARAMETER ADAPTATION ALGORITHMS ..................................................................... 21 4.1 THE LEAST SQUARES ALGORITHM ............................................................... 22 4.1.1 THE RECURSIVE LEAST SQUARES ALGORITHM .......................................... 27 4.1.2 MATRIX INVERSION LEMMA: ..................................................................... 29 4.1 .3 RLS ALGORITHM INITIALIZATION .............................................................. 30 4.1.4 ADAPTATION GAIN ................................................................................... 31 4.2 THE NORMALIZED GRADIENT ALGORITHM .................................................... 35 5. ADAPTIVE CONTROLLERS ............................................................................................... 39 5.1 POLE-PLACEMENT CONTROLLER ................................................................ 40 5.1.1 ADAPTIVE POLE-PLACEMENT ................................................................... 44 5.2 MODEL-REFERENCE CONTROL ................................................................... 45 5.2.1 ADAPTIVE MODEL-REFERENCE CONTROL ................................................. 51 5.3 CONTROLLERS WITH DISTURBANCES ........................................................... 57 6. STOCHASTIC MINIMUM-VARIANCE CONTROL. ............................................................. 62 6.1 MINIMUM-VARIANCE REGULATION OF MINIMUM PHASE SYSTEMS .................. 65 6.2 MINIMUM-VARIANCE REGULATION FOR NON-MINIMUM PHASE SYSTEMS ........ 70 7. EXAMPLES ......................................................................................................................... 73 7.1 PLANT ESTIMATION EXAMPLES ................................................................... 74 7 .1.1 EXAMPLE USING NG ALGORITHM ............................................................ 75 7.1 .2 EXAMPLE USING RLS ALGORITHM ........................................................... 82 7.2 ADAPTIVE MODEL REFERENCE CONTROL EXAMPLE ..................................... 85 7 .2.1 ADAPTIVE MODEL REFERENCE SIMULATIONS ............................................ 88 7.2.1.1 ESTIMATING THE MODEL REFERENCE CONTROLLER, WITH GAIN ESTIMATION ...................................................................................................................... 89 iv

PAGE 5

7.2.2 ESTIMATING MODEL REFERENCE CONTROLLER, POLYNOMIAL 8 COEFFICIENTS ONLY .............................................................................................................. 91 7.3 ADAPTIVE CONTROL PERFORMANCE EXAMPLES ........................................ 1 02 7 .3.1 A SYSTEM WITH NOISE ADDED TO THE OUTPUT ....................................... 1 03 7.3.2 A SYSTEMWITH UNMODELED DYNAMICS AND NOISEADDEDTOTHEOUTPUT .................................................................................................................... 109 7.3.3 A SYSTEM WITH ONE TIME VARYING PARAMETER AND NOISE ADDED TO THE OUTPUT ........................................................................................................ 114 APPENDIX ............................................................................................................................ 125 REFERENCES ...................................................................................................................... 144 v

PAGE 6

Figures Figure 1 .1 Adaptive control system block diagram ................................................. 3 1.2 Model-Reference system block diagram ............................................... 4 4.1 Parameter Estimation block diagram .................................................. 22 5.1.1 Block diagram of Pole-Placement Controller with RS control loop ...... 42 5.2.1 Block diagram of Mode reference Controller with RST control loop .... 47 5.2.1.1 Direct adaptive control with independent tracking and regulation objectives. Adaptive model reference control block diagram ................ 56 6.1 Minimum-Variance Closed-Loop Control System ................................ 65 7.1.1 Adaptive plant parameter estimation, block diagram ........................ 75 7.1.1.1 Convergence of the NGA parameter estimates ................................ 77 7.1 .1 .2 Servo system output, NGA estimate, .Y(t) ....................................... 78 7 .1.1.3 Servo system output tracking error, y(t)y(t) for NGA. .................. 79 7.1.1.4 System tracking error, y(t).Y(t) with expanded y axis for NGA ..... 79 7 .1.1.5 Convergence of the NGA parameter estimates ................................ 80 7.1.1.6 Servo system output, NG estimate, y(t) .......................................... 81 7.1 .1 7 Servo system output tracking error, y(t) y(t) for NGA ................... 81 7.1.2.1 Convergence of the RLS parameter estimates ................................ 83 7 .1.2.2 Servo system output, RLS estimate, y(t) ........................................ 84 vi

PAGE 7

7.1.2.3 SelVa system output tracking error, y(t)y(t) for RLS .................... 84 7.2.2.1 Model Reference parameter estimate convergence for NGA with noise input reference signal. ............................................................................ 94 7.2.2.2 Model Reference system output, NG estimate, y(t) ....................... 95 7 .2.2.3 Model Reference output tracking error, y(t)y(t) for NGA ............. 95 7 .2.2.4 Model Reference estimated parameter error for NGA ...................... 96 7 .2.2.5 Model Reference parameter estimate convergence for NGA with square wave input reference signal. ...................................................... 97 7.2.2.6 Model Reference system output, NG estimate, y(t) ....................... 97 7.2.2.7 Model Reference output tracking error, y(t).Y(t) for NGA ............. 98 7.2.2.8 Model Reference estimated parameter error for NGA. ..................... 98 7.2.2.9 Model Reference parameter estimate convergence for RLS with Cos2 input reference signal. ............................................................................ 99 7 .2.2.1 0 Model Reference system output, RLS estimate, y(t) .................. 1 00 7.2.2.11 Model Reference output tracking error, y(t)y(t) for RLS ........... 100 7.2.2.12 Model Reference estimated parameter error for RLS .................. 101 7 .3.1 .1 System with output noise disturbance. Parameter estimate convergence for RLS ........................................................................... 1 04 7 .3.1.2 System output with output noise disturbance, RLS ......................... 104 7.3.1.3 Noisy system output tracking error, y(t)y(t) for RLS .................. 105 7.3.1.4 System with output noise disturbance. Input plus noise ................. 105 7 .3.1 .5 System with output noise disturbance. Parameter estimate convergence for RLS run 2 .................................................................. 1 06 vii

PAGE 8

7 .3.1.6 System output with output noise disturbance, RLS run 2 ................ 1 07 7 .3.1. 7 Noisy system output tracking error, y(t)y(t) RLS run 2 .............. 1 07 7.3.1.8 System with output noise disturbance. Input plus noise run 2 ........ 108 7.3.2.1 System with unmodeled dynamics. Parameter estimate convergence for RLS ................................................................................................. 110 7.3.2.2 Output of system with unmodeled dynamics, RLS .......................... 110 7.3.2.3 System with unmodeled dynamics. Output tracking error, y(t)y(t) RLS ...................................................................................................... 111 7.3.2.4 System with unmodeled dynamics. Parameter estimate convergence for RLS run 2 ........................................................................................ 112 7.3.2.5 Output of system with unmodeled dynamics, RLS run 2 ................. 113 7.3.2.6 System with unmodeled dynamics. Output tracking error, y(t)y(t) RLS run 2 ............................................................................................ 113 7.3.3.1 System with time varying a1 Parameter estimate convergence for RLS ...................................................................................................... 115 7 .3.3.2 Output of system with time varying a1 RLS .................................... 115 7.3.3.3 System with time varying a1 output tracking error, y(t)y(t) for RLS ............................................................................................................. 116 7.3.3.4 System with time varying a1 a= 0.1. Parameter estimate convergence for RLS run 1 .................................................................. 117 7 .3.3.5 Output of system with time varying a1 a = 0.1 RLS run 1 .............. 117 7.3.3.6 System with time varying a1 a= 0.1. Output tracking error, y(t)Y(t) RLS run 1 ............................................................................................. 118 viii

PAGE 9

7.3.3.7 System with time varying a11 a= 0.3. Parameter estimate convergence for RLS run 2 ................... ............................................... 118 7.3.3.8 Output of system with time varying a1 a= 0.3 RLS run 2 .............. 119 7.3.3.9 System with time varying a11 a= 0.3. Output tracking error, y(t)y(t) RLS run 2 ............................................................................ 119 7 .3.3.1 0 System with time varying a1 1 a = 0.5 Parameter estimate convergence for RLS run 3 .................................................................. 120 7.3.3.11 Output of system with time varying a11 a= 0.5 RLS run 3 ............ 120 7 .3.3.12 System with time varying a1 1 a = 0.5 Output tracking error, y(t)y(t) RLS run 3 ............................................................................ 121 7 .3.3.13 System with time varying a1 1 a = 1. Parameter estimate convergence for RLS run 4 ...................................................... ........... 122 7 .3.3.14 Output of system with time varying a1 1 a = 1 RLS run 4 .............. 122 7.3.3.15 TVP system output with expanded y axis, a = 1 RLS run 4 ........... 123 7.3.3.16 System with time varying a1 a= 1. Output tracking error, y(t)y(t) RLS run 4 ............................................................................................. 123 lX

PAGE 10

1. Introduction This thesis is a summary of discrete time adaptive control theory and presents some examples illustrating the application of this theory. Adaptive control theory describes how to automatically adjust a controller to provide or sustain a desired level of performance when the plant dynamics are unknown and/or change with time. This leads to a systematic method .for the implementation of controllers that adapt in real time. Adaptive control is used when the ability to compensate for changes in the system and/or surrounding environment is needed. A control system is the combination of a plant or process and a controller. The plant could be a mechanical device like a computer disk drive or an electronic device like an oscillator or amplifier. The process could be the production of steel or paper. An adaptive control system is one that automatically tunes itself, in real time from system data collected in real time, to produce the desired output or performance. Adaptive control can be used to regulate the performance of an automated manufacturing process or the performance of a piece of electronic 1

PAGE 11

equipment when the system needs to be self-adjusting in real time. This type of automatic system is called self-tuning. Each time the system is started it self-tunes, to the current plant parameters and environmental conditions, like noise. To self-tune, the adaptive controller needs a reference signal to guide it. This input reference signal is then compared to the system output and the difference between them becomes the error signal. The error signal indicates to the controller how to adjust itself. To reduce this error signal the adaptive controller adjusts by modifying its parameters or by generating a new signal to drive the plant input. This self-tuning continues until the system output resembling or following the input reference signal. In most applications it is desirable for the adaptive controller to adapt continuously to parameter and environmental changes. All though when its necessary an adaptive controller can be designed to adapt only at system start up. Adaptive controllers that adapt only at start up are more stable and work well for stationary plants that have fixed parameters. Another way for an adaptive control system to determine if it needs to self tune, is to measures the system output and compares it to a predetermined 2

PAGE 12

performance index (P I}. The controller then self-tunes to achieve this desired performance index. The general adaptive control system block diagram is illustrated in Figure 1.1. System Input or Reference Are the Identified plant parameters correct or does system performance match the PI? Ongoing plant identification and compare plant operation to performance index, goals Decision r .......................... r-)oi Index i<... : f,'',,,............ i Performance i ,____lf_n __ o ,..ni-tia-te___. ! ....................................................... .! ! 1 j Controller plantllnput Plant adjustable .,. 1' Disturbances Figure 1.1 Adaptive control system block diagram Numerous systems appear to adapt to environmental changes. Here are two examples of systems that at first appear to be adaptive but their controller is not self-tuning. The first example is a controller that uses outside direct measurement of the environment to set its parameters to achieve the desired performance. This system simply uses parameter values that are known to produce the desired system performance for the measured environmental conditions and is not self-tuning to a change in system performance. 3

PAGE 13

A second example is the simple model-reference control system. This is a system that uses the difference between the output of a reference model and the plant output to produce a signal to drive the plant. The parameters of this system are fixed and not self-tuning. The controller does not interactively change the system input. Figure 1 .2 is a block diagram of the modelreference system. This figure shows that model-reference control can be represented as a simple feedback system with a prefilter. Model-reference system; Simplified model-reference system Input + + Reference + Model LJ Input .....------. + Pre filter Figure 1.2 Model-Reference system block diagram 1.1 System Performance .------. Output Plant System performance is how accurately a controlled plant's output matches the intended output. For a manufacturing process like sheet metal or paper production a consistent metal or paper thickness represent good performance 4

PAGE 14

or a high quality product. For a se!Vo system performance is how closely it tracks or repeats the specified movement. To gauge the performance of a system, a set of goals called the performance index (PI) is selected. The adaptive controller's function is to adjust its parameters such that the system performance is optimized to these goals. If these goals are met the desired system performance is achieved. 1.1.1 The Performance Index Function The performance index function indicates how close to the PI a system is operating. The desired system performance specified by the PI will often produce improvements in the plant's reliability and the quality of the output. In most cases this improvement reduces the energy usage, the maintenance and/or the raw material input. These reductions in energy, labor and materials decrease the money cost of operation that is calculated by the cost function. Both the PI function and the cost function quantify a systems performance. By minimizing the performance index function or the cost function, system performance error is minimized. 5

PAGE 15

For stable and reliable operation from a mathematical point of view the PI function should have a single sharply defined optimal operating point. Also in order to implement the system the performance index needs to be physically measurable. The output error signal is one choice for the PI function that is almost always measurable. The output error signal is obtained by taking the difference between the input reference signal and the system output. This error signal has a sharp single point optimum at zero. This signal can also be used without modification as the feedback signal to close the system loop. 1.2 Adaptive Controller In an adaptive control system the adaptive controller is the part that closes the feedback loop around the plant or process to be controlled. For the closed-loop adaptive control system the adaptive controller performs three functions: 1 identification of system dynamics, 2. decision making for optimization, and 3. modification of control parameters. There are two adaptive control configurations illustrated in figure 1 .1 In the first configuration the closed-loop adaptive control system identifies the plant dynamics and compares the dynamics to the Pl. In this case the system 6

PAGE 16

dynamics are being regulated. In the second configuration the closed-loop adaptive control system identifies the system output and compares it to the desired performance, i.e. to the reference trajectory. In the second configuration the tracking of the system is being controlled. The identification comparison generates an error signal. The value of the error signal is used to make a decision to modify or not to modify the controller parameters. The last step is to modify the adjustable controller according to the decision made. 1.2.1 The Structure of an Adaptive Controller For a control system that can provide the desired system performance and adapt to system changes in real time a simple adaptive controller structure is needed. Setting the controller transfer function structure and its order at the beginning of the design limits the number of computation required. This may make it possible for the microprocessor to complete the evaluation of the adaptive control algorithm during each sample period and thus allow it to keep up with the system changes. The selected controller transfer function should be capable of providing the specified performance when the adaptive control algorithm estimates the correct parameter values. For the control structure to provide the desired 7

PAGE 17

performance, it must contain the plant's structure and the control algorithm must be able to identify the plant over its full operating range. In summary, the a priori knowledge needed to select a suitable controller and algorithm design includes information on: the plant structure, the plant complexity, the characteristics of the disturbancas and how the plant parameters vary with time and environment. As mentioned above there are two methods to determine the controller parameters, the direct method and the indirect method. In the direct method the adaptive controller parameters are calculated directly to minimize the error signal. For this method the controller must have enough parameters to match the order of the plant and the system delay. In the second method first the plant parameters are estimated to minimize an error signal. Then the controller parameters are calculated to produce the desired performance for this plant estimate. Thus the controller parameters come indirectly from the error signal. Therefore two separate sets of 8

PAGE 18

parameters are needed, but fewer parameters may have to be determined during each sampling interval. Indirect adaptive control makes it possible for the control feedback signal to be different then the estimation error signal. This allows the controller parameters to be re-calculated every n sampling intervals instead of every interval. With the extra time the computer can improve the plant identification. Thus, the plant parameter estimates used to re-tune or re-design the controller may be better. 1.3 Parameter Adaptation Algorithm Before any adaptive controller can be designed and implemented the necessary component a Parameter Adaptation Algorithm (PAA) needs to be developed. The PAA forms the core of the adaptation mechanism used to estimate the controller parameters, or the plant model parameters. This on line estimation of parameters is a generic part of adaptive control. The PAA up-dates the parameter estimates at each sample interval. In order to select a structure for the PAA, that is compatible with the plant, a comprehensive form for the plant model is needed. 9

PAGE 19

The adaptive control PAAs discussed in this thesis assume the plant model has parameters that are linearly related to the plant input and output signals, even if the parameters are time varying or the plant model is nonlinear. A plant model with these properties has the form y(t + 1) = er
PAGE 20

This structure is represented symbolically by ev + 1)= e(t )+ F(t }fJ(t )vv + 1) with estimated parameter vector B(t) adaptation gain F (t), observations vector (t) that containing the measured signal values, and the adaptation error v(t+ 1) which represents the estimated plant model error. 11

PAGE 21

2. Deterministic Environment 2.1 Plant Models in DiscreteTime A system is deterministic when the plant model accurately gives or determines the plant output from the input. Adaptive control of a plant or process using a computer or a microprocessor controller requires a digital or discrete-time plant model. The deterministic input-output discrete-time plant model works well. The single-input single output (SISO) time invariant (TI) form of this model is y(i+ 1 )+a1y(i)+ ... +any(i+ 1-n)=b1u(i)+b2u(i-1 )+ ... +bmu(i+ 1-m) (2.1.1) with i=O, 1 ,2, ... n=the number of a coefficients and m=the number of b coefficients. Equation (2.1.1) is a difference equation with plant input u(i) and plant output y(i). A more compact way to write (2.1.1) uses the unit delay operator q-1 Equation (2.1 .1) is converted to unit delay q1 notation by using the definition q1y(t)=y(t-1 ). The converted form of (2.1.1) is (1 +a1q-1 + ... +anq-n)y(i+ 1 )=(b1+b2q1 + ... +bmqm+1)u(i) where qn denotes a delay of n units. 12 (2.1.2)

PAGE 22

In compact form (2.1.2) becomes with and B( -t) y(i + 1) = q u(i) A(q-t) A( -I) 1 -I -n q = +alq + ... +anq B( -1) b b -1 b -(m-1) q I + 2q + + mq B( -t) In equation (2.1 .3) q _1 is called the system transfer operator. -A(q ) (2.1.3) (2.1.4) The regressor form of the plant model as indicated in section1.3 is also used. To put the deterministic model in regressor form let the vector of parameters e become the vector of output and input coefficients (2.1.5) The signal measurements then become the regressor vector !)>(i) made up of the current and past inputs and outputs f/J(il = [y(i), ... y(i + 1-n); u(i), ... ,u(i +1-m)] (2.1.6) With e r and 4> r (i) defined by eqs.(2.1.5) and (2.1.6) the plant model becomes y(i) (2.1.7) u(i+1-m) 13

PAGE 23

This equation shows that the plant output is linearly related to the parameter vector e. The parameter adaptation algorithm uses the input-output measurement data that makes up (i) to estimate the model parameters. The parameter estimates are stored in O(i) With the estimated parameter vector O(i + 1), i.e. the most up to date parameter estimate, an estimate of the plant output y(i + 1) is given by 9Ci + 1) = eu + 1l Ci) (2.1.8) This makes estimation of the system output a recursive process. By minimizing the adaptation error the estimated plant output y(i + 1) closely matches the actual plan output y(i + 1) But in general the plant model is not exact and outside disturbances are acting on it. To improve the system model the combined effect of unmodeled system dynamics, system measurement errors and outside disturbances can be includes by adding the term d(i) to the ideal system model. When d(i) is added the model becomes y(i + 1) = eT CO+ d(i) (2.1.7) When these equations are used to model a physical system i the sample number is replaced by the normalized sampling time t. Because all physical 14

PAGE 24

systems operate in real time when they are digitized t will be an integer signifying the number of the sample period. In these equations the input is u(t}, the output is y(t}, and the system delay d is in sampling periods. The parameters a and b are the model coefficients that describe the plant dynamics. Throughout this thesis t represents the time of the sample which is the real time 't normalized by the sampling period T s 2.2 The j Step Ahead Predictor The SISO discrete time system model used up to now is a one step ahead predictor. The output being predicted is one time step ahead of the current input. So at time t, y(t+ 1} is calculated from the previous system inputs and outputs up to timet. This system has an input to output delay (d) of one. The one step ahead equation is repeated here y(t+ 1 }+a1y(t}+ ... +any(t+ 1-n}=b1u(t}+b2u(t-1 }+ ... +bmu(t+ 1-m} Using unit delay operator notation (2.2.1} is written as A(q-1)y(t + 1) = q-d+1B(q-1)u(t) To predict the 0 step ahead output y(t} equation (2.2.2} becomes A(q-1)y(t) = q-d B(q-1)u(t) 15 (2.2.1} (2.2.2} (2.2.3}

PAGE 25

. when multiplied by q1 Using polynomials A and 8 defined by (2.1.4) this equation is written as follows: (1 + + ... + anq-")y(t) = (blq-d +b2q-(d+l) + ... + bmq-(d+m-l))u(t) (2.2.4) which expands to y(t) + -1) + ... + any(t -n) = blu(t-d) +b2u(t-d -1) + ... + bmu(t d m + 1) For the one step ahead equation t is replace by t+ 1 giving y(t+ 1) + ... + any(t+ 1-n) =blu(t + 1-d) +b2u(t -d)+ ... +bmu(t-d-m+2) (2.2.5) (2.2.6) To check this one step ahead predictor 2.2.6 it is compared to 2.2.1 where the delay is one. By Jetting d=1 the two equations match verifying that 2.2.6 is correct. The one step ahead predictor for a plant with a delay of d is (2.2.6). In order to compute y(t+ 1) the previous inputs and outputs are needed. Start by predicting the first output. The first output y(t) that can be predicted is the one calculated form the first available input u(t) For a physical system t 0, referenced to startup, thus the first u(t) is u(O). To compute the first output the first input must be the most recent input. In the one step ahead case the most up-to-date input is u(t + 1..:;. d) ,thus the first input u(O) = u(t + 1-d). This 16

PAGE 26

implies that t+ 1-d=O therefore t=d-1. In the deterministic case of (2.2.1) the delay d=1 so t=1-1=0. Using d=1 (2.1.6) becomes y(t + 1) + + + any(t + 1-n) = b1u(t + 0) + b2u(t -1) + +bmu(t-m+ 1) (2.2.7) The first predictable output is computed from (2.2.7) with t=O. The first y(t) is y(l) = b1u(O) (2.2.8) To derive the j step ahead predictor substitute t+j fort in (2.2.5). The SISO deterministic model then becomes the j step ahead predictor that follows: y(t + j) + a1y(t + j -1) + + any(t + j-n) = b1u(t + j-d)+ b2u(t + j-d -1) + +bmu(t+ j -d -m+l) (2.2.9) Recall that the first available real time system input that one can use to calculate y(t) is u(O). For the j step ahead predictor the most up-to-date input is u(t+j-d), thus the time when t +j-d=O or t=d-j gives the first computable output. Given t=d-j and t 2:: 0 it follows that d -j = t 2:: 0. This implies that d 2:: j therefore the maximum value of j is d. For a physical system the delay d 2:: 0 and for a look ahead predictor j 2:: 0. For a digital system j and d are 17

PAGE 27

integers. This allows the output y(t) to be predicted a maximum of j=d steps ahead. The j step ahead predictor for j::; d is (2.2.9). 18

PAGE 28

3. A System Model for the Stochastic Environment When a system is operating in a noisy environment the noise disturbance is represented as an additive white noise. A stochastic process models the noise. The deterministic input-output system model {2.1.1) becomes the stochastic system model when the white noise is added to it giving {3.1) Here the stochastic process acting on the system at time {t+ 1) is represented by T\{t+1). Stochastic disturbances that appear naturally have the characteristics of a Gaussian white noise sequence. Often this disturbance is filtered or weighted by the system before it is added to the output. The stochastic process model used for adaptive control is a filtered white noise of the following form C( -1) 1'\(t) = q w(t) D(q-1) {3.2) where the filter C(q-1)1 D(q-1 ) is stable and the white noise discrete time sequence {w{t)} is an independent normally distributed random variable with zero mean and variance crw 2 Model {3.2) is known as an auto regressive moving average {ARMA) process. 19

PAGE 29

Starting with the filtered white noise model (3.2) by setting C(q-1 ) = 1 then 11(t) becomes an auto regressive (AR) process, if instead D(q-1 ) = 1 then 11(t) becomes a moving average (MA) process. With D(q-1 ) = 1 the system model becomes an auto regressive moving average with exogenous Input (ARMAX) model (3.3) In transfer operator form (3.3) becomes -dB( -1) C( -1) y(t) = q q u(t) + q w(t) A(q-1) A(q-t) (3.4) This equation models the system with a filtered disturbance added to the output. For adaptive control purposes the system model will take the form y(t + 1) = er !j>(t) + d(t + 1) (2.7) Where {d(t)} is an independent finite power random variable sequence. For independent random processes future values of the disturbance cannot be predicted. 20

PAGE 30

4. Parameter Adaptation Algorithms To construct an adaptive control system a real-time plant model parameter estimator is required. The general structure for such a PAA is presented in section 1.3. The reaJ:..time on-line model parameter estimation is done by a recursive adaptation algorithm that uses input-output measurement data to update the estimated parameters between each sample period. This recursive algorithm calculates the next estimate of each parameter's value from its current value plus the weighted input-output data times the prediction error. The recursive structure of the algorithm generates an estimate that is a weighted summation of the previous system model estimates. It's like a discrete time integrator adding a correction term that can be positive or negative, to the estimate after each measurement sample is taken. An algorithm with this structure acts like an integrator with a finite output and memory. It always outputs a parameter vector with finite parameter values and when the prediction error is zero, it repeats the previous parameter vector. The parameter estimation system is shown in figure 4.1. 21

PAGE 31

Discretized Plant U(t) DAC+ plant ADC y(t) ZOH .. ---+ ... ,. +,, 1f )'(t)Q model Adjustable error .. Discrete-Time Model ,. .... / ..... model parameters Parameter adaptation .... .. ,. algorithm ...._ ...... Figure 4.1 Parameter Estimation block diagram. 4.1 The Least Squares Algorithm The most commonly used P AA for adaptive control applications is the least squares method and similar algorithms based on it. The objective is to find an algorithm that has a single absolute minimum of zero and no other global or local minima. The ideal algorithm will be stable and quickly converge. The simple gradient algorithm that uses only the most recent prediction error to adjust the values of the estimated parameters can easily over shoot the 22

PAGE 32

minima. If the gain is to high the algorithm may never settle on the minima. But a high gain is desirable for faster convergence. The least squares algorithm with its decreasing adaptation gain starts out with a high gain for fast convergence then as the gain decreases over shoot is reduced and it settles on the minima. For the least squares method the algorithm is to find the estimated parameter vector S(t + 1) that minimizes the sum of the squared prediction error. The prediction error is e(t + 1) = y(t + 1)y(t + 1) (4.1.1) Using (2 .1 7) for y(t + 1) the prediction error becomes e(t + 1) = y(t + 1)B(t + 1l f/J(t) (4.1.2) The sum of the squared errors is V(B) = i>2(i+1) = :t&(i+1)-B(t+1l f/J(i)J (4.1.3) i=O i=O Note that B(t + 1l f/J(i) = y(i + 1) in (4.1.3) predicts the output for the sample period i+ 1 where (i + 1) t + 1. At each of the sample periods up to t+ 1 the predicted output y(i + 1) is calculated from the most resent parameter estimate, assumed the must accurate, and the observation measurements 23

PAGE 33

collected during that sample period i. As timet increases the sum of the squared errors is recalculated from a new set of predicted output values, computed using the new parameter estimate, giving a new V(B) To find a minimum for the prediction error a necessary condition is for its derivative to equal zero. The partial derivative of the prediction error is given by oV(S) _0 oS(t+ 1)-(4.1.4) When (4.1.3) is inserted for V(B) the partial derivative with respect to S(t + 1) becomes t 2 + 1)B(t + 1l {b(i)][ -{b(i)l = o (4.1.5) i=O Divide (4.1.5) by 2 and expand the product to get t t + 1)T {b(i)]{b(i) = LY(i + 1){b(i) (4.1.6) i=O i=O Then the relationship [B(t + l)r {b(i)]{b(i) = {b(i){b(i)r B(t + 1) is used for the left side of (4.1.6) to get ( t, b(t + J) = t, y(i + (4.1.7) 24

PAGE 34

The squared error V(8) as defined by equation (4.1.3) has the following properties: i. its nonnegative for all 8 and ii. its a quadratic function in 8 Therefore the squared error has only one point where the slope is zero and this point is the closest to V(8) = 0. This makes (4.1.7) the necessary and sufficient condition for the squared error to be minimized. This implies that B(i + 1) is the best estimate of the actual system parameters at sample interval i, for the plant model used of the chosen order. To find the parameter estimate B(t + 1) that satisfies (4.1.7) begin with the covariance matrix for (i) defined by t R(t) = LJ(i)rjJ(i)T (4.1.8) i=O If R(tf1 exists or R(t) is invertable then (4.1.7) is satisfied by the unique least squares estimate of the parameters given by t B(t + 1) = R(t)-1 LY(i + 1)rjJ(i) (4.1.9) i=O 25

PAGE 35

Now consider the ideal system, the one with no disturbances or unmodeled dynamics, that is described exactly by y(t + 1) = f/J(t)7 eo then it follows that So makes the data fit exactly at each sample step therefore by definition 60 minimizes V(8) eq.(4.1.3). Recalling that V(S);;::: 0 for all 8 then its minimum value is zero and because 60 minimizes V(8), then V(80 ) = 0. Equation (4.1.7) says the least squares estimate S(t + 1) that minimizes V(S) is unique if R(t) is invertable. In this case 80 minimizes V(S) so the unique least squares estimate, which also minimizes V(8) is the exact fit thus S(t + 1) = 80 The matrix R(t) is invertable if the set of simultaneous equations constructed from the measurement vectors (i) fori= O,l, ... ,t y(1) = f/J(O)r 8 y(2) = f/J(1)7 8 y(t + 1) = f/J(t)T 8 has the unique solution e = 80 If this set of simultaneous equations does not have a unique solution, there are not enough equation and the set of measurement data {y(i + 1), (i), 0 i t} is too small or the data does not sufficiently describe the system. 26

PAGE 36

4.1.1 The Recursive Least Squares Algorithm In order to implement the least squares algorithm in real-time the recursive form of (4.1. 7) is needed. The recursive equation will express S(t + 1) as a function of S(t) Start with eqs.(4.1.7) and (4.1.8) ( ll(i)ll(i)T :(t +I) y(i + l)l'(i) R(t) ll(i)ll(i)T and replace the first summation in (4.1.7) with the covariance (4.1.8). Equation (4.1.7) then becomes t R(t)O(t + 1) = LY(i + 1){/}(i) (4.1.1.1) i=O Next separate out the last term of the summation to get t-1 = LYCi + 1){/}(i) + y(t + 1){/}(t) (4.1.1.2) i=O Then go back to eqs. (4.1.7) and (4.1.8) and set t=t-1 which gives (4.1.1.3) Combining these two eqs. gives t-1 R(t -1)0(t) = LY(i + l)(i) (4.1.1.4) i=O Eq.(4.1.1.4) is then used to eliminate the summation in (4.1.1.2) giving 27

PAGE 37

R(t)O(t + 1) = R(t -l)O(t) + y(t + 1)(b(t) (4.1.1.5) This is a recursive formula for S(t). Now we need a recursive formula for R(t). Starting with eq.(4.1.8) and separating out the last term of the summation gives r-1 R(t) = L(O(i)(O(il + (O(t)(O(tl i=O Then using (4.1.1.3) the summation is removed giving a recursive formula for R(t) R(t) = R(t -1) + (O(t)(O(t)T (4.1.1.6) To link (4.1.1.5) and (4.1.1.6), solve (4.1.1.6) for R(t -1) then substitute it into (4.1.1.5). Thus the linked equation is R(t)O(t + 1) = (R(t)(O(t)(O(t)r p(t) + y(t + 1)(b(t) (4.1.1.7) Expanding the first term on the right side gives R(t)B(t + 1) = R(t)B(t)-(O(t)(O(t)T O(t) + y(t + 1)(b(t) (4.1.1.8) Factor out (t) to get R(t)B(t + 1) = R(t)B(t) + + 1)(b(t)T B(t) J (4.1.1.9) Then as before, if R(t) is invertable one has a recursive formula for S(t) 28

PAGE 38

O(t + 1) = O(t) + R(t)-1 + 1)O(t)] (4.1.1.1 0) Eqs.(4.1.1.6) and (4.1.1.1 0) form a recursive algorithm to calculate S(t + 1) and R(t) from the stored values of S(t) and R(t -1) along with the measurements of y(t + 1) and Evaluating (4.1.1.1 0) requires the inverse of matrix R(t) at each time step. To reduce the number of computations needed a method to calculate R(t)-1 at each step from it's components is obtained by using the matrix inversion lemma. 4.1.2 Matrix Inversion Lemma: Let A be a (nxn) dimensional nonsingular matrix, 8 a (nxm) dimensional matrix of maximum rank, C a (mxm) dimensional nonsingular matrix, and D a (mxn) dimensional matrix of maximum rank. Then the following identity holds: (A+BCDt =A-1-A-'B(C-1 +DA-1BtDA-1 (4.1.2.1) Before applying (4.1.2.1) to the covariance matrix define R(t) as P(t) = R(tr1 or R(t) = P(tr1 Replace R(t) with PCtr1 in (4.1.1.6) to get P(t) -I = P(t -1) -I + 29 (4.1.2.2)

PAGE 39

Taking the inverse of (4.1.2.2) gives R(t)-1 The inverse of (4.1.2.2) is written as follows: (4.1.2.3) Matching the right side of this equation with the left side of the matrix inversion lemma and letting A= P(t -1)-1 B = J(t), c = 1, and D = J(t)r the matrix inversion lemma (4.1.2.1) gives P(t) = R(t)-1 as [P(t)_1 Jl = P(t) = P(t _1 ) P(t -1)J(t)J(t)r P(t -1) 1 + J(t)T P(t -1)J(t) Replacing R(tf1 in (4.1.1.1 0) with P(t) gives B(t + 1) = B(t) + P(t)J(t)[y(t + 1)J(t)T B(t)] (4.1.2.4) (4.1.2.5) Equations (4.1.2.4) and (4.1.2.5) taken together make up the recursive least squares (RLS) parameter adaptation algorithm. With this RLS algorithm a matrix inversion is not require each it is repeated. Starting with the initial condition on P(t) that P(O) = P(Ol > 0 or P(O) is Hermitian the conditions of the matrix inversion lemma will be satisfied for all t. 4.1.3 RLS Algorithm Initialization 30

PAGE 40

To precisely initialize the RLS algorithm recursive equations (4.1.2.4) and (4.1.2.5) are started with the correct estimate for S(t0 ) and P(t0 -1) calculated at time t0 The parameter estimate S(t0 ) for time t0 has dim
PAGE 41

t V(t) = L,Cy(i+1)-8(t+1l (i))2 _.r-; (4.1.4.1) i=O For 0
PAGE 42

In (4.1.4.4) take the i = t term and substitute (4.1.4.3) for the summation then the recursive formula for R(t) is R(t) = AR(t -1) + rp(t)rp(t)T (4.1.4.5) Again let P(t) = R(tr1 assuming R(t) is invertable. Then P(tr1 = R(t) and P(t -1)-1 = R(t -1) substituting p-I for R in (4.1.4.5) gives (4.1.4.6) Applying the matrix inversion lemma to (4.1.4.6) with A= AP(t -1)-1 B = (t), D = rp(tl, and C = 1 the adaptation gain becomes [PCtr1 J1 = A -I -A -I B(C-1 + DA -I B J1 DA -I with A -I = IL-1 P(t -1) P(t) = IL-1 P(t -1) -IL-1 P(t -1)rp(t)(1 + rp(tliL-1 P(t -1)rp(t) t rp(t)T IL-1 P(t -1) P(t -1) rp(t)rp(t)T = IL 1 + rp(tl rp(t) P(t -1) = rp(t)rp(t)T IL IL 1 + rp(tl rp(t) IL P(t -1) P(t -1) rp(t)rp(tl P(t -1) = IL IL IL + rp(tl P(t -1)rp(t) P(t -1) 1 P(t -1)rp(t)rp(tl P(t -1) (4.1.4.7) = IL IL IL+rp(t)T P(t-1)rp(t) 33

PAGE 43

= _!_[P(t _1 ) P(t -1)f/J(t)f/J(t)T P(t -1)] A. A.+f/J(t)T P(t-1)f/J(t) This gain works well for a slowly time varying system. Now consider the case where the forgetting factor is constant and the system reaches steady state. With the system operating in the steady state mode the prediction error becomes zero and the parameter estimates no longer change so B(t + 1) = B(t) from (4.1.2.5}. When this happens the average of the sequence {(t}(t}T} becomes zero. Under these conditions (4.1.4.6} becomes P(t + i) =A-; P(t), or P(t + i)-1 = A!.P(tf1 In this situation with a constant 'A<1 the adaptation gain will tend toward infinity, i.e. = oo and P(t + i) asymptotically approaches infinity. This infinite gain can not be seen in the system output. On the other hand if It > 1 the adaptation gain will go to zero. In either case the algorithm will not give usable results if some time later a parameter value changes. In these cases a variable-forgetting factor is needed or the computer can monitor the gain and limit it or reset it to some finite value. 34

PAGE 44

4.2 The Normalized Gradient Algorithm The gradient algorithm is the simplest algorithm that has a single point minimum. This algorithm is used to find the estimated parameter vector O(t + 1) that minimizes the squared system output error. The system output error, prediction error, is given by (4.1.1 ). Squaring (4.1.1) gives the error to be minimized at each step (4.2.1) The gradient of V(B) with respect to O(t) is av<;{8<,>. Using (4.2.1) the gradient is .!_ = aec:+1) e(t+ 1 ) 2 d8(t) d8(t) (4.2.2) With e(t + 1) given by (4.1.2) the derivative with respect to O(t) is de(:+ 1) = a(y(t + OT f/J(t)) = -f/J(t) d8(t) d8(t) (4.2.3) To minimize the value of the prediction error, the estimated parameter value is moved in the direction that is opposite to the gradient of the squared error curve, i.e. down the slope of the squared error curve. The parameter adaptation algorithm for O(t) is 35

PAGE 45

O(t + 1) = O(t)F ()O(t) Substituting (4.2.3} into (4.2.2} and then into (4.2.4} produces O(t + 1) = O(t) + F(J(t)e(t + 1) (4.2.4} (4.2.5} This recursive PAA has an integral structure. Therefore it has memory and when the error is zero, e(t + 1) = 0, the new parameter estimate becomes the stored parameter estimate, O(t + 1) = O(t) There are two possible choices for the matrix adaptation gain F: 1 F = ai : a > 0 or 2. F > 0 i.e. is a positive definite matrix. As discussed in section 4.1 if the adaptation gain a is too large (4.2.5} may be unstable. To improve the stability of this algorithm the prediction error term is examined. The prediction error as give by (4.1.2} is e(t + 1) = y(t + 1)O(t + 1)T (J(t) (4.2.6} This can be written as e(t + 1) = y(t + 1)OT (t)J(t)+ 1)O(t) J (J(t) (4.2.7} The first two terms represent the a priori prediction error + 1). The last term can be rewritten using (4.2.5}. Rearranging {4.2.5} gives O(t + 1)O(t) = F(J(t)e(t + 1) (4.2.8} 36

PAGE 46

This allows (4.2.7) to be written as e(t + 1) = + 1)l/JT (t)Ff/J(t)e(t + 1) (4.2.9) Solving (4.2.9) for e(t + 1) an expression for the a posteriori prediction error is obtained e(t + 1) = + 1 ) 1 + l/JT (t)Fl/J(t) Using this expression for the prediction error (4.2.5) becomes B(t + 1) = O(t) + + 1) 1 + l/JT (t)Ff/J(t) This PAA is stable for any value of the positive definite gain matrix F. (4.2.10) (4.2.11) The P AA of (4.2.11) is normalized by r 1 This reduces the 1+J (t)Ff/J(t) sensitivity of the algorithm with respect to F and (t). With (4.2.11) the new estimated parameters can be computed from the current parameter estimates and observation vector. Another form for the normalized gradient algorithm is B(t + 1) = O(t) + + 1 ) C + l/JT (t)l/J(t) 37 (4.2.12)

PAGE 47

In this case F=l and for faster convergence select 0 11 < 1 or 1 < 11 2 and 0 c 2. Also recall that l (t)f/J(t) = J2 (t). 38

PAGE 48

5. Adaptive Controllers For applications where adaptive control is needed conventional feedback control concepts are used to chose a system configuration and design a controller. Once the controller design is complete adaptive control techniques are applied to the system. All of the discrete time control methods considered here are based on the design of a controller for a known plant model. Taking the linear input-output system equations for the known plant model and selected system configuration, the equations for the controller parameters are derived. Then for the adaptive version of the control system the techniques discussed above are used to estimate the plant parameters. These estimated parameters are then used to calculate the corresponding controller parameters from the derived equations. The parameter estimates and calculations are repeated recursively. The next plant model will often be estimated in closed-loop with the previous controller closing the loop. In the limit as t approaches infinity the calculated controller should make the system perform as desired. 39

PAGE 49

5.1 Pole-Placement Controller It is well known that system performance depends on the location of the closed-loop poles. This suggests that if a controller is designed that can assign each closed-loop pole to a specified location the desired system performance will be achieved. To design a controller that will provide a system with the desired pole locations take a plant and controller configured as in figure 5.1.1. Then with the desired pole locations, the plant model parameters, and control law the controller parameters can be obtained. The plant model considered here is described by A(q-1)y(t) = q-d B(q-1)u(t) where polynomials A(q-1 ) and B(q-1 ) are defined by The control law as shown in figure 5.1.1 has the form R(q-1)u(t) = -S(q-1)y(t) + y"(t +d) 40 (5.1.1) (5.1.2) (5.1.3)

PAGE 50

The input of this RS controller is the reference trajectory, command signal, y (t) and the polynomials describing the controller are S( -1) -1 -ns q =s +sq ++s q 0 I ns (5.1.4) The last element needed is the preferred location of the closed-loop system poles. These pole locations are specified by the polynomial (5.1.5) To fully describe the system pole locations the degree of polynomial P(q-1),np. needs to be equal to twice the maximum degree of the plant model polynomials minus one, i.e. twice the degree of A(q-1 ) or B(q-1 ) + d -l which ever is larger minus one or (5.1.6) where (5.1.7) If the degree of P(q-1 ) is greater then the number of poles to be specified, the extra ones can be placed at the origin by setting the extra coefficients to zero. 41

PAGE 51

The next step is to find the coefficients for the controller polynomials that will place the poles where polynomial P(q-1 ) specifies. If the coefficients of polynomials A(q-1 ), B(q-1 ) and P(q-1 ) are known, the controller coefficients are found by solving the closed-loop equation of the system shown in figure 5.1.1. CONTROLLER u(t) ... Plant q-dB A ............................... i ...---, s i ' i i i ........................ -....... _,,, ...................................... -......... _,, __ ,, .. .. __ j disturbance t y(t) ... Figure 5.1.1 Block diagram of Pole-Placement Controller with RS control loop. ... ... This figure represents a digital controller in canonical form with two degrees of freedom. Polynomials R(q-1 ) and S(q-1 ) give the controller two degrees of freedom to regulate the system performance. The equation to solve is 42

PAGE 52

(5.1.8) This Diophantine, polynomial, equation has a unique solution only if the degree of the controller polynomials R(q-1 ) and S(q-1 ) are equal to nAB -1 or (5.1.9) where nAB is defined as above by relationship (5.1.7). To obtain the controller coefficients, solve (5.1.8) by expanding the polynomials and equating the coefficients of like powers of q-1 on the left side with those on the right side. The closed-loop system equation is obtained by solving the control law (5.1.3) for u(t) and substituting it into (5.1.1 ). Rearranging the result gives (5.1.1 0) The denominator of (5.1.1 0) matches (5.1.8) thus the system equation can be written as -dB( -1) y(t) = q q y* (t) P(q-1) (5.1.10) If one recalls that the closed-loop system poles are the roots, zeros, of the transfer operator denominator it is clear that polynomial P(q-1 ) defines the 43

PAGE 53

closed-loop system poles. When (5.1.8) is satisfied the poles will have the locations specified by P(q-1 ) as desired. 5.1.1 Adaptive Pole-Placement Adaptive pole-placement is used when plant model (5.1.1) polynomials A(q-1 ) and B(q-1 ) are unknown. In this case the coefficients of A(q-1 ) and B(q-1 ) can be estimated by using one of the PAA. Before proceeding the following assumptions are made about the system model (5.1.1 ): i. The coefficients of A(q-1 ) and B(q-1), there orders nA and n8 and the delay dare known. ii. Polynomials A(q-1 ) and B(q-1 ) have no common factor, i.e. there are no pole zero cancellations. With the information listed in assumption i polynomial equation (5.1.8) can be solved to get polynomials R(q -1) and S(q -1) for the pole-placement controller. As before the system model (5.1.1) can be written in the recursive form for the one step ahead predictor y(t + 1) = er f/J(t) (5.1 .1.1) 44

PAGE 54

The RLS PAA can generate the following estimates for polynomials A(q-1 ) and B(q-1): A(t,q-') = 1 +a, (t)q-' + ... +a," (t)q-"" B(t,q-1 ) = b0(t) +b1 (t)q-1 + +b,8 (t)q-"s with b0 ":/: 0 With estimated polynomials (5.1 .1 .2) equation (5.1 .8) becomes A(t,q-1)R(t,q-1 ) + q-d B(t,q-1)S(t,q-1 ) = P(q-1 ) (5.1.1.2) (5.1.1.3) Then polynomial equation (5.1 .1 .3) is solved to obtain the estimates for the controller polynomials R(t,q-1 ) and S(t,q-1). The estimated adaptive pole placement controller is R(t,q-')u(t) = -s(t,q-')y(t) + y* (t) (5.1.1.4) If in the limit A, B, R, and S converge to A, B, R, and S, the closed-loop system that results will have the poles at the desired locations defined by P(q-'). 5.2 Model-Reference Control Another practical way to specify the desired system performance is by the use of a reference model. In this case an actual system that exhibits the desired system dynamics can be used as the reference, although typically a 45

PAGE 55

mathematical representation of the desired closed-loop system response, in the form of a transfer function is used. The model reference control design starts with a plant described by (5.1.1 ). The objective is to design a digital controller of the form (5.2.1) that will make the plant track the desired trajectory y (t + d + 1) This reference trajectory is d+ 1 steps ahead of the system output y(t) and is generated by the reference model from reference signal r(t) The reference model is (5.2.2) Where the polynomials are defined as B ( -1) b b -1 b -mn8 m q = mO + mlq + + mnBm q m (5.2.3) and the reference model transfer operator is Hm(q-1). It is assumed that the reference model has no zero-pole cancellations or Bm(q-1 ) and A"'(q-1 ) do not have any common factors. Typically the reference model is a second order system with a natural frequency ro0 and a damping factor that gives the desired rise time, overshoot, and settling time. 46

PAGE 56

Sometimes two second-order systems are cascaded to get the needed tracking response. CONTROLLER ......................... -........................................................... I 1 I T R 1------iiH Reference Model Bm Am Plant disturbance v t) q-dB + u(t) A y(t) ... y(t+d +d I ( ............. ..... ,_,,_,,,,,,,, ................................................................................... Figure 5.2.1 Block diagram of Mode reference Controller with RST control loop. A block diagram of model-reference control is shown in figure 5.2.1. This figure represents a digital controller in canonical form with two degrees of freedom. Polynomials R and S give the controller a two-degree freedom to regulate the system performance and polynomial T represents a prefilter that modifies the reference trajectory y (t) For now the output disturbance is 47

PAGE 57

assumed to be zero. The goal here is to periectly follow or track the reference model output, this requires the proper selection of polynomial R, S and T. The system input y(t) to output y(t) transfer function is HcL From figure (5.2.1) the following system transfer operator is obtained (5.2.4) Equation (5.2.4) indicates that with the RST controller the system poles are defined by P(q-1 ) eq.(5.1.7), as they where for the RS controlled system. The overall system transfer operator from r(t) to y(t) is (5.2.5) where H, (q-1 ) the model-reference transfer operator comes from {5.2.2). The model-reference periect tracking goal implies that the system will follow the reference trajectory during both the transient and steady state part of y* (t) To have periect steady state tracking H cL must have a steady state gain of 1 (one). For periect transient tracking polynomial Tis selected to compensate for the existing system dynamics. The three following system cases are considered: 48

PAGE 58

i. none of the closed loop system poles are included in A,.(q1 ) the desired tracking dynamics, ii. some of the CL system poles P0(q-1 ) in P(q-1 ) are included in A'"(q-1 ) the tracking dynamics, iii. all of the CL system zeros and poles are included in Hm(q-1 ) or the tracking and regulating dynamics are the same. In case (i.) the closed loop system poles should be canceled by T(q-1 ) in addition to H cL ( q -1 ) having a steady state gain of 1. This leads to With steady state gain a scalar, such that 1 = B(l) Using (5.2.2), (5.2.4), (5.2.6), and (5.2.7) eq.(5.2.5) becomes q-d A,.(q-1)P(q-1) q-d B'"(q-1)B(q-1) A,.(q1)B(l) 49 (5.2.6) (5.2.7) (5.2.8)

PAGE 59

In case (ii.) polynomials and P are separate into two polynomials each. The first polynomial on the right side contains the distinct poles and the second one contains the common poles. The model-reference polynomial Am (q-1 ) becomes (5.2.9) (5.2.1 0) In this case the tracking reference model is (5.2.11) and polynomial T will be (5.2.12) Taking eqs.(5.2.7), (5.2.11 ), and (5.2.12) eq.(5.2.5) the system transfer operator becomes q-d A,(q-I)Po(q-')F(q-1) q-d Bm(q-I)B(q-1) .4,(q-I)Pc,(q-I)B(l) In case (iii.) the reference model used to drive the system is 50 (5.2.13)

PAGE 60

H =1 m (5.2.14) and for unity steady state gain (5.2.15) In this case the system transfer operator is q-d -P(q-I) q-d B(q-I)P(l) -P(q-1)B(l) (5.2.16) If polynomial S contains an integrator then the system poles are defied by (5.2.17) Therefore in the steady state condition with q = 1 (5.2.17) gives P(l) = R(l)B(l) (5.2.18) (5.2.18) and (5.2.15) are combined to obtain (5.2.19) 5.2.1 Adaptive Model-Reference Control 51

PAGE 61

One way to satisfy the model-reference design goal is for the transfer function of the closed-loop system to equal the transfer function of the reference model. This implies that (5.2.4) HCL(q-1 ) = Hm(q-1 ) from eq.(5.2.2) thus (5.2.1.1) This equation is satisfied if the polynomials are defined as follows: (5.2.1.2) and (5.2.1.3) where deg. R1 =d-1 ,deg. S=max{degAm -d;degA-1} With these equations the controller polynomials are specified. Another way to obtain this solution tor the controller polynomials is to take the equation for the output error multiplied by Am and (5.2.1.3). The weighted error is Using (5.2.1.3) for the right Am gives (5.2.1.4) 52

PAGE 62

From the plant model (5.1.1) the d step ahead predictor is Ay(t +d) = Bu(t) (5.2.1.5) and from the reference model Amy(t) = q-d Bmr(t) the d step ahead predictor is AmYm (t +d)= Bmr(t) Substitute (5.2.1.5) and (5.2.1.6) into (5.2.1.4) to obtain Am [y(t +d)Ym (t +d)]= BR1u(t) + Sy(t)-Bmr(t) (5.2.1.6} (5.2.1.7} By setting the output error to zero the model reference controller that gives y(t) = y m (t) is obtained from (5.2.1.7). Let y(t +d)-y m (t +d)= 0 then (5.2.1.7} becomes 0 = BR1u(t) + Sy(t)-Bmr(t) or by rearranging the terms the model reference controller is BR1u(t) = -Sy(t) + Bmr(t) (5.2.1.8} Using polynomial equation (5.2.1.3) to obtain R1 (q-1 ) and S(q-1 ) the controller is the same as the RST controller above. To derive the regressive form of (5.2.1.7) define BR1 as a(q-1) = B(q-1 )RI (q-1) where the degree of a is na = deg a(q-1 ) = deg B(q -1) + deg R1 (q-1 ) = deg B(q-1 ) = d -l 53 (5.2.1.9}

PAGE 63

The regressive form of (5.2.1.7) is written as (5.2.1.10) Here the parameter vector 6 a is (5.2.1.11) and the measurement vector (t) is defined as t/JT (t) = [u(t), u(t -1), u(t-na ); y(t), y(t -1), y(t-ns)] (5.2.1.12) If the output error is set to zero (5.2.1 .1 0) becomes the model reference controller that gives y(t) = Ym (t). The controller obtained is in the following vector recursive from: f/J(t) = Bm (q-1 )r(t) (5.2.1.13) Adaptive control concepts are used to estimate the parameter vector when the true parameters are unknown. The adaptive model reference controller is OT (t + d -1)J(t) = Bm (q-1 )r(t) (5.2.1.14) The parameter vector can be obtained from the NG PAA discussed in section 4.2. The estimated vector is O(t +d)= O(t + d -1) + ,LL(t)(y(t +d)Ym (t +d)] c + lll/JCt)f 0<,LL<2,0
PAGE 64

where (t) from eq.(5.2.1.12) is the regressor. The NG algorithm above will be globally stable if Re{Am( )-f.L}>O j2 =-1 cosJSID 2 for all 0 ::;; m ::;; 2n Am(q-1) Am(Z-1 ) Am (e-jliJ) (5.2.1.16) This condition is very restrictive therefore many of the reference models with the desired polynomial Am(q-1 ) will not be globally stable. To remove this restriction Am is filtered out of the PAA by multiplying (5.2.1.1 0) by +. After m filtering (5.2.1.1 0) becomes B [y(t +d)-y m (t +d)]= o; 'lf(t)-___!!!_ r(t) Am with (5.2.1.18) Substituting (5.2.1.6) for the last term in (5.2.1.17) to get [y(t +d)Ynr (t +d)]= o; 'lf(t)-Ym (t+ d) (5.2.1.19) Again if the output error is set to zero the model reference controller becomes (5.2.1.20) This time the adaptive model reference controller is or (t + d -l)'lf(t) = y m (t +d) 55

PAGE 65

Now the NG PAA that generates the parameter estimate is OCt+ d)= O(t + d _1 ) + ,wp(t)(y(t+d)-Ct+ d)] c + 0
PAGE 66

where the gain matrix p(t) is defined by ( ) ( 1 ) p(t -1)f//(1)f//T (t) p(t -1) p t -p t --=-----:':------'--'---=-"'---'1 + lf/T (t) p(t -1)f//(1) (5.2.1.23) p(O) = Pol Po > 0 5.3 Controllers with disturbances In this section the presence of a system disturbance is taken into account. The disturbance considered here is additive and defined by v (t) The plant input-output model (5.1.1) with the disturbance v(t) included becomes -dB( -1) y(t) = q u(t) + V(t) A(q ) multiply both sides by A(q-1 ) to get (5.3.1} Using this plant model, (5.1.3) and the canonical form RST controller of figure 5.2.1, the control law is (5.2.1) and the closed-loop system poles are defined by (5.1.7). In this discussion for clarity the delay operator q-1 is not written out. To derive the equation for this system including the disturbance (5.2.1) is used to replace u(t) in (5.3.1 ). The system equation obtained is 57

PAGE 67

y(t) =--y (t + d + 1) --y(t) I+V(t) B (T S '\ A R R J Expanding the first term gives BT BS y(t) =-y (t+d +1) --y(t) +V(t) AR AR Solving for the system output leads to IY(t) =-y (t + d + 1) + V(t) (AR+BS'\ BT AR J AR BT AR BT AR y(t) = y (t + d + 1) + v(t) =-y (t + d + 1) + -v(t) AR+M AR+M P P where P = AR + BS as defined by (5.1.7) The above equation can be written as (5.3.2) where HCL is the closed-loop transfer operator from (5.2.4) and SYr is S = A(q-I)R(q-1) Yr P(q-I) (5.3.3) Equation (5.3.3), S ,.r is called the output sensitivity function which indicates how the system output is affected by the disturbance v(t). 58

PAGE 68

Solving eqs.(5.2.1) and (5.3.1) for the plant input u(t) by eliminating y(t) gives the plant input as a function of the system input y (t) and the disturbance. The control law and the plant model are B Ru + Sy = Ty and y = -u + v A Substituting the second eq. into the first eq. gives BS Ru+-u+Sv =Ty A By solving for u(t) the plant input equation is obtained with and ( AR:BS}=Ty' -Sv AT AS u=-y --v p p (5.3.4) (5.3.5) (5.3.6) In (5.3.4) Su/q-1 ) is the input sensitivity function and Hu(q-1 ) the transfer operator. 59

PAGE 69

The transfer operator from the disturbance to the plant input is Sur ( q _,) from (5.3.4). Also equation (5.3.2) indicates that the transfer operator from the disturbance to the plant output is SYr(q-1). If the system is to operate as if in open loop and thus make the disturbance unobservable at the plant input polynomial S(q-1 ) in Sur(q-1 ) should include a model of the disturbance. Looking at the plant output end to make the disturbance unobservable polynomial R(q-1 ) in SY/q-1 ) should include a model of the disturbance. Another way to look at this is for perfect disturbance rejection polynomials R and S will have the form S(q-1 ) = S(q-1)Hs(q-1 ) R(q-1 ) = R(q-')H R(q-1 ) (5.3.7) (5.3.8) where Hs(q-1 ) and HR(q-1 ) are fixed polynomials that contains the known characteristics of the disturbance and combines them with the controller polynomials. Using (5.3.7), (5.3.8) for Sand R in (5.1.7) the closed-loop system poles are P(q-1 ) = A(q-1)H R(q-1)R(q-1 ) + q-d B(q-1)H s(q-1)S(q-1 ) (5.3.9} 60

PAGE 70

If fixed polynomials H5(q-1 ) and HR(q-1 ) are combined with the plant model instead of the controller then the computations needed to obtain the controller are reduced to computing only R(q-1 ) and S(q-1). 61

PAGE 71

6. Stochastic Minimum-Variance Control Minimum-variance control is used for systems with random disturbances, which are generally systems in a noisy environment. For this stochastic environment the plant with it's disturbance is modeled by the Auto Regressive Moving Average with Exogenous Input (ARMAX) system model. This ARMAX model is discussed in chapter 3 eq.(3.3). The model equation is (6.1) written in the transfer operator form the equation error model is -dB( -t) C( -1) y(t) = q q u(t) + q w(t) A(q-1) A(q-1) (6.2) with b0 0 where b0 is the first coefficient in polynomial B. As before y(t) is the system output, u(t) the plant input and d is the system delay. Polynomials A and 8 are given by (5.1 .2) and polynomial C is (6.3) The disturbance w(t) in (6.1) and (6.2) is modeled by a white noise sequence {w(t)}. This sequence {w(t)} is an independent normally distributed random variable with zero mean and variance crw2 A random variable sequence with these characteristics is Gaussian with 62

PAGE 72

E{w(t)}=O E{w(t)2 }=a; where E{ } is the mathematical expectation operator. (6.4) To explain minimum-variance control systems consider figure 5.2.1, the canonical form RST controller and plant. The plant input-output model including disturbance v(t) is (5.3.1) and the digital controller has the form (5.2.1) where the system input y* (t + d + 1) is the desired tracking trajectory. When minimum variance control is used the output disturbance v(t) is modeled by the image of a random disturbance. If w(t) the white noise random disturbance is filtered by C the image becomes v(t) = C(q-:) w(t), and the A A(q-) plant model is given by (6.1 ). The system is now operating in a noisy environment. Most of the time when a system is in a noisy environment, the control objective is to minimize the system output noise. This is a regulation problem and not a tracking one, so 63

PAGE 73

the tracking trajectory is set to zero, y (t + d + 1) = 0. The controller that is now just a regulator becomes (6.5) Figure 6.1 represents this closed loop system. For this system to minimize the output noise adaptive control techniques are applied. For this system with an output disturbance that is random and therefore unpredictable the next output noise value can not be estimated. Without an estimate for the output noise the prediction error or output error will never be zero even if the parameter estimate 6 exactly matches the plant parameters 60 Thus with the adaptive controller unable to predict the output noise there will be a residual error or bias. In this situation the adaptive controller become a minimum-variance controller. For it is possible to predict what performance level or what output variance can be achieved. The achievable performance level indicates the relative effect of the following: the noise or disturbances with different spectral characteristics or various data filters and error filters can have on system performance. 64

PAGE 74

For the regulator of (6.5) to provide optimum performance polynomials R(q-1 ) and S(q-1 ) are selected so that the system output variance is minimized. The system output variance is 1 N I= lim -Iy(t)2 = E{y(t)2 } N-+ ... N t=l CONTROLLER 1 R s u(t) ,,, ............................. l i ; ....................................................... .. ,_,,.,,,_,_,,,_.,,,._ ....... _, .................... .1 Plant Noise Disturbance Wit) c A V(t) Figure 6.1 Minimum-Variance Closed-Loop Control System 6.1 Minimum-Variance Regulation of Minimum Phase Systems (6.6) Before proceeding with the design it is assumed that plant polynomial 8 is stable. 65

PAGE 75

To minimize (6.6) the system output y(t) is needed. To derive the equation for the closed-loop system output y(t) substitute u(t) from (6.5) into the ARMAX model of (6.1 ). The output equation obtained is y(t) = CR d w(t) = D(q-1)w(t) AR+qBS where defines the closed-loop system transfer operator D(q-1). Using (6.1.1) the system output variance to minimize is I= E{D(q-1)w(t)f }= :z lzl=1 (6.1.1) (6.1.2) (6.1.3) By taking into consideration that D(z-1 ) is a function of the regulator transfer function S(z-1)/ R(z-1), then (6.1.3) indicates that I can be minimized by the proper selection of polynomials S and R. The minimum output variance regulator is the one that minimizes the integral in eq.(6.1.3). From optimization theory and variational calculus the R and S that minimize I are (6.1.4) and (6.1.5) 66

PAGE 76

Where F(q-1 ) and G(q-1 ) are the polynomials with the smallest degree that satisfy the Diophantine equation (6.1.6) Polynomials F(q-1 ) and G(q-1 ) are referred to as the minimum degree solution. The solution of minimum degree is made up of the following three equations: (6.1.7) and (6.1.8) with (6.1.9) When polynomials (6.1.4) and (6.1.5) are substituted into the regulator of (6.5) the minimum-variance regulator obtained is (6.1.1 0) With this regulator the system represented by figure 6.1 will have the minimum possible output variance. When the system is regulator by (6.1.1 0) eqs.(6.1.4) and (6.1.5) are used for polynomials A and S and (6.1.1) gives the system output as CBF y(t) = ABF + q-d BG w(t) (6.1.11) 67

PAGE 77

CF = AF + q-dG w(t) (6.1.12) Using (6.1.6) AF + q-d G = C for the denominator, (6.1.12} can be written y(t) = CF w(t) = F(q-1)w(t) c (6.1.13) The system output variance can now be computed from (6.1.13). The expectation value of y(t) squared is where polynomial F is given by (6.1. 7) as d-l F = Lhq-;, fo =1 i=O Placing (6.1.15) into (6.1.14) and taking into account that E{tJiw(t-i)w(t-j)}= 0, i i= j (6.1.14) (6.1.15) because the sequence of random variables {w(t)} is independent yields (6.1.16} d-l = "'f.J/ E{w(t)2 } i=O Using (6.4) this becomes 68

PAGE 78

d-1 E{y(t)2 }= I,J/a;, fo = 1 (6.1.17) i=O Because F is the minimum degree solution of eq.(6.1.6) this is the minimum possible variance of the system output with this regulator configuration. Take another look at the system closed-loop transfer operator in (6.1.12), polynomial B has been canceled out, this makes the plant zeros unobservable at the system output. Thus the regulator of (6.1.1 0) is usable only for a minimum phase plant, i.e. one that has all of it's zeros inside the unit circle. For if there are any zeros outside the unit circle, any unstable modes that become excited will be observed in u(t), eq.(6.1.1 0), and end up over driving the plant input. The controller output, i.e. the plant input obtained from (6.1 .1 0) is G u(t) = --y(t) BF using equation (6.1.13) for y(t) gives G G u(t) = --Fw(t) = --w(t) BF B (6.1.17) (6.1.18) This equation indicates that if B is unstable, u(t) has unstable poles. Each unstable pole represents an unstable mode that can be excited by the disturbance. In this case the disturbance is white noise, which contains energy at all frequencies and therefore will easily excite these modes. When 69

PAGE 79

this occurs the control signal will grow exponentially wasting energy and overdriving the plant input. The plant zeros will cancel these oscillations and it's output will be bounded until the system becomes saturated. At saturation the system becomes nonlinear and the plant output will oscillate. The computer simulation will not show saturation. 6.2 Minimum-Variance Regulation for Non-Minimum Phase Systems To design a minimum-variance regulator for a non-minimum phase plant the system model of eq. (6.1) is used as before. This time the plant polynomial B(q-1 ) has unstable zeros. When the plant has unstable zeros B(q-1 ) is factored into two polynomials. One B(q-1 ) with all of the stable zeros lzl 1 and the other B(q-1 ) representing all of the unstable zeros, those outside the unit circle. With the roots separated B(q-1 ) becomes (6.2.1) It is also assumed that there are no plant pole-zero cancellations, i.e. polynomials A(q-1 ) and B(q-1 ) do not have any common factors. Under these conditions the non-minimum phase plant model is obtained when eq.(6.2.1) is substituted into (6.1.1) and (6.1.2.). Again the plant and controller are configured as shown in figure 6.1. 70

PAGE 80

This time when eq.(6.1.3) is minimized the minimum-variance regulator of (6.1.1 0) becomes G( -1) u(t)-q (t) B(q-I)F(q-1) y (6.2.2) In this case the Diophantine equation to solve becomes (6.2.3) where F(q-1 ) and G(q-1 ) are the solution of minimum degree and jj-1(q-1 ) is the reciprocal of polynomial B(q-1). The degree of polynomial F and G are nF = degF(q-1 ) = d -1 + n8 n0 = degG(q-1 ) = max{nA -1; nc + n8 d} (6.2.4) To calculate the system output variance the equation for y(t) is needed. When (6.1) represents a non-minimum phase plant and (6.2.2) is the minimum-variance regulator, the output y(t) is obtained by substituting (6.2.2) for u(t) in Eq.(6.1 ): G Ay(t) = -qBB-=y(t) + Cw(t) BF (6.2.5) where only the stable zeros of the plant are canceled leaving (AF + q-d JiG )y(t) = CFw(t) (6.2.6) When (6.2.3) AF + q-d JiG= cii-1 is used to replaces the quantity in parentheses on the left side eq.(6.2.6) becomes 71

PAGE 81

cB-1 y(t) = CFw(t) (6.2.7) this reduces to F( -1) (t)-q w(t) Y B-1cq-1) (6.2.8) The output y(t) is a stationary process because B-1 the polynomial reciprocal is stable. In this case the output variance is (6.2.9) This example shows that the reciprocal of an unstable polynomial is stable. Let B(q-1 ) = 0.9 + q-1 then B(q-1 ) =I and B(q-1 ) = 0.9 + q-1 The reciprocal of 72

PAGE 82

7. Examples This chapter contains several examples illustrating plant parameter estimation and adaptive control. Both the normalized gradient and recursive least squares algorithms are used. For these examples the plant is a servomotor. The continuous time transfer function of the servomotor from voltage input to shaft position output is given by K G(s)=--s(-rs + 1) where K is the plant gain and 'Z is the time constant. In this example the servomotor parameters are K=30 -r=O.lsec The discrete time transfer function for this servomotor is H(z)= Kd(z-/3) (z -l)(z +a) The discrete plant gain is Ka = K(-ra -'Z +T) and the constants are given by 73 (7.1) (7.2) (7.3) (7.4)

PAGE 83

_T/ a=e / P= -ra+dl'--r -ra --z +T (7.5) where T is the sampling period. With a sampling rate of 40msec. the discrete time plant parameters are a= e = 0.6703 p = 0.1 0.67 + 0.67 0.04-0.1 = -0.8753 0.1 *0.67 -0.1 +0.04 Kd = 30(0.1 *0.67-0.1 + 0.04) = 0.211 Using these parameter values the discrete time transfer function is H (z) = 0.2(z + 0.875) (z -1)(z0.67) With this transfer function the discrete time model obtained is y(t) = H(q-1)u(t) y(t + 1) -1.67 y(t) + 0.67 y(t -1) = 0.2u(t) + 0.18u(t -1) (7.6) (7.7) (7.8) The appendix contains a listing of each MATLAB script file used to generate the plots in this section. 7.1 Plant Estimation Examples Parameter estimation is discussed in chapter 4 where the PAAs are introduced. Refer to figure 4.1 for a block diagram showing the configuration 74

PAGE 84

used to estimate a plant's parameters. The system configuration used for the MATLAB simulation is shown in figure 7 .1.1. System Input or Reference Are the identified plant parameters correct or does system performance match the PI? Ongoing plant identification and compare plant operation to performance index, goals -"'''''"'''.......................... -..................................... If no in tiate i Error signal Modif cation j Controller plant input Plant I Output adjustable + Figure 7.1.1 Adaptive plant parameter estimation, block diagram 7.1.1 Example Using NG Algorithm Estimation of the servomotor plant parameters using the NG algorithm. Matlab script file number 1 in the appendix generated the plots for this example. The plant model developed above is y(t+1 )-1.67y(t)+0.67y(t-1) = 0.2u{t)+0.18u(t-1) and the parameter values to be estimated are a1= -1.67 a2=0.67 bO= 0.2 b1= 0.18 75

PAGE 85

For MATLAB the plant model is defined as y1 (t+ 1 )=theta'* phi; or y(t+1)=8T
PAGE 86

The following figures show the simulation results. The algorithm parameter values that were used are J.l = 0.985 c = 0.18 They give quick convergence with minimum system parameter oscillation. Note it takes about 600 iterations for the algorithm to converge. 2 1.5 1 0.5 :J =E 0 -0.5 -1 -1.5 -2 0 Estimate of Parameters (NG algorithm) 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time Figure 7 .1.1.1 Convergence of the NGA parameter estimates. After the estimated value of each parameter has settled out the tracking error goes to zero and the estimated model output follows the input signal that 77

PAGE 87

excited the system. In order to see the rescaled. This Cuts off the output that parameter estimates are way off. System 0 25 20 15 10 5 :::J -0 'E f -5 -10 -15 -20 -25 0 100 200 300 400 No. of Iter Figure 7.1.1.2 Servo system output, The next two figures show the tracking e expanded to show that the error does no 600 after the algorithm has tried to conve iteration 225 to 380 the gradient was more measurement data to find the minir 78

PAGE 88

5 4 3 2 1 J 0 -1 -2 -3 -4 -5 0 Tracking Error for (NG) 100 200 300 400 500 600 700 No. of Iteration or time 800 900 10C Figure 7.1.1.3 Servo system output tracking error, y(t)y(t) for NGA. Tracking Error for (NG) 300 M"""---y---"T"" 200 100 -100 -200 -300 .._ __.__ __ .._ 0 50 100 150 200 250 300 350 400 450 500 5! No. of Iteration or time Figure 7.1.1.4 System tracking error, y(t)y(t) with expanded y axis fc NGA. 79

PAGE 89

The simulation is run again at a higher gain. The figures that follow show the simulation results. The algorithm parameter values that were used are .u=I.15 c = 0.47 They give the quickest convergence with minimum estimated system parameter oscillation. Note it takes about 420 iterations for the algorithm to converge. Estimate of Parameters (NG algorithm) 2 1.5 1 0.5 ::J +-' 0 c: f -0.5 -1 0 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time Figure 7 .1.1.5 Convergence of the NGA parameter estimates. 80

PAGE 90

50 40 30 20 10 0 I -10 -20 -30 -40 -50 0 System Output for (NG) 100 200 300 400 500 600 700 BOO 900 100 No. of Iteration or time Figure 7.1.1.6 Servo system output, NG estimate, y(t). 5 4 3 2 1 0 -1 -2 -3 -4 -5 0 Tracking Error for (NG) 100 200 300 400 500 600 700 BOO No. of Iteration or time 900 1001 Figure 7.1.1.7 Servo system output tracking error, y(t)y(t) for NGA. 81

PAGE 91

7.1.2 Example Using RLS Algorithm Estimation of the servomotor plant parameters using the RLS algorithm. Matlab script file number 2 in the appendix generated the plots for this example. The plant model developed above is y(t+l)-1.67y(t)+0.67y(t-1) = 0.2u(t)+0.18u(t-1) The RLS algorithm is B(t + 1) = B(t) + p(t)f/J(t) with ( ) 1 [ ( 1 ) p(t -1)f/J(t)f/JT (t) p(t -1)] p t = A p t + -'--( t--=) p-(t----=1=---)fjJ-( t-)-or in the MATLAB script file p=(1/lambda)*(p-((p*phi*phi'*p)/(lambda+phi'*p*phi))); and thetahat=thetahat+p*phi*(Err(t+ 1) ); The system input is ytre(t)=15*sin(2*pi*t/30) The simulation results are presented in figures 7.1.2.1 through 7.1.2.3. 82

PAGE 92

For this set of simulations the initial parameter estimate is thetahat =[ 1; 1; 1; 1] and A was varied from 0.1 to 1.0. With A= 0.25 to 1.0 the algorithm converges after about nine steps. When the forgetting factor, A, is less then 0.25 there is bursting in the estimated parameter values. 1.5 1 0.5 0 s, -0.5 -1 -1.5 Estimate of Parameters (LMS algorithm} I \ . . -2 0 20 40 60 80 100 120 140 160 180 200 No. of Iteration or time Figure 7.1.2.1 Convergence of the RLS parameter estimates. After the estimated value of each parameter has settled out the tracking error goes to zero and the estimated model output follows the input signal that excited the system. 83

PAGE 93

System Output for (LMS algorithm) 40 30 20 v 0 IJ -10 -20 0 20 40 60 80 100 120 140 160 180 2( No. of Iteration or time Figure 7.1.2.2 Servo system output, RLS estimate, y(t). Tracking Error for (LMS algorithm) 25 20 -15 10 5 i 0 v -5 -10 -15 0 20 40 60 80 100 120 140 160 180 2( No. of Iteration or time Figure 7.1.2.3 Servo system output tracking error, y(t)Y(t) for RLS 84

PAGE 94

The simulations where rerun with the parameters initialized to thetahat =[0;0;1 ;0]. This time the algorithm converges in 7 steps. The NGA simulations converged in about 400 steps. The RLS algorithm converges much faster then the NGA for a noise-free time invariant plant. 7.2 Adaptive Model Reference Control Example Model reference control is discussed in chapter 5 section 5.2. In this example a controller is designed that makes the existing plant behave like the desired reference model. The existing plant that will be considered is described by y(t) -l.7y(t -1) + 0.9y(t2) = 1.5u(t -1) + 0.6u(t2) In the delay operator form the plant equation is where the delay d=1. The plant equation can also be written as The plant zero is the zero of 8 (1.5 = -0.6q-1 = -.4 ). This zero is inside the unit circle, therefore 8 is stable and the plant is minimum phase. 85

PAGE 95

The desired closed-loop system response has a natural frequency m0 = 0.9 rad I sec, with a damping factor of = 0.8 and a steady state error ess = 0 to a step input. A reference model with this response is described by a continuous-time, second-order system of the form A continuous-time system reaches steady state when s=O. This system will have a zero steady state (SS) error if the system output signal matches the system input signal when s=O, i.e. e = 0 if Y(s) = 1 at s = 0. For this model ss U(s) Y(O) mg --=-=1 so e =0. U(O) mg ss In discrete time the desired reference model has the form y(t)-q-IBm -koq-1 u(t) -Am -1 + a1q-1 + a2q-2 where -IB For zero SS error the system gain =1 with q=1. Therefore q na =1 with q=1 Am 86

PAGE 96

Using m0 = 0.9 = 0.8 and sampling period h = 1 the reference model parameters are a1 = -2e-.s<.9>1 (.8)2 (9 X1) )= -0.835 a2 = e-2<.S><.9>1 = 0.237 and Following the steps in section 5.2 the polynomials R, S, and T for the modelreference controller will be Referring to figure 5.2.1 the model-reference controller as given in eq.(5.2.1.8) is 1.5u(t) = -0.6u(t -1) + 0.4r(t)-0.865 y(t) + 0.663 y(t -1) or u(t) = -.04u(t -1) + 0.268r(t)-0.5767 y(t) + 0.442 y(t -1) A MATLAB simulation of this system produced the data and plots below. The Matlab scripts are files number 3 and 4 printed in the appendix. 87

PAGE 97

7.2.1 Adaptive Model Reference Simulations Model reference simulations using the recursive lest squares and normalized gradient algorithm where run. The effect of reference signal frequency content, algorithm variable value (A. or J.L), and controller gain estimation on the periormance of each algorithm is explored. Four reference signals with the following frequency content are used: 1. a cosine for a single frequency signal, 2. the sum of two cosines for a duel frequency signal, 3. a square wave with many frequencies, and 4. a zero mean Gaussian random number sequence, white noise, for all frequencies, The algorithm variable A. or Jl are varied over there allowable range. The Matlab script files are in appendix A. Files 3 and 4. 88

PAGE 98

7.2.1.1 Estimating the model reference controller, with gain estimation. When the adaptive controller is set up to estimate both the gain, and the poles of the controller, polynomial B's parameter and polynomial A's parameters, the parameters can not be uniquely determined. The parameter estimate plot verifies this. The plot shows the parameters converging to some value for several hundred iterations followed by step changes in the parameter values. This indicates that when the controller algorithm selects a gain the other parameters are adjusted to minimize the tracking error. With the algorithm converging the tracking error becomes small but not zero. This causes the algorithm to change the gain forcing a large change in the parameters. The algorithm then tries to converge again. For each gain that the controller selects a different set of A parameter values will minimize the tracking error but the tracking error never goes to zero. The available simulation results for the adaptive controller designed to estimate the five parameters b1 (gain}, a1, a2, aa, a4 are given in the tables below. The RLS algorithm results are in table 7 .2.1.1 and the NGA are in table 7.2.1.2. 89

PAGE 99

Input reference signal Single Double Square wave Noise hmin frequency frequency error N (0, 1.5) ')..= 1.0 >1000 0.99 300 0.98 320 610 400 200 0.97 210 310 300 0.95 Burst 210 burst 0.94 burst 0.93 0.8 0.6 0.5 0.4 Output follows Output Square wave Follows Noise Always some parameter error Param error Table 7.2.1.1: Model reference simulations using RLS algorithm with four different reference signals. Input reference signal Single Double Square wave Noise h min frequency frequency error N (0, 1.5)_ 1.1 = 0.9 500 Smallest number Is for 1.1 shown 0.6 1000 0.4 200 >2000 .;1109 A Parameter error @ min 0.4 0.25 .6 1.1=.6, .2 1.1=.2 0.6 step Estimated parameter 1.1707 1.29 1.2877 1.1=.2 values 0.8090 1.05 1.1865 1.4961 1.34 1.298 -.8308 -.71 -.6787 -.6893 -.64 -.6232 Table 7.2.1.2: Model reference simulations using NG algorithm with four different reference signals. 90

PAGE 100

The NGA does not produce acceptable results for model reference control with gain parameter estimation. The simulation results presented in table 7.2.1.1 and 7.2.1.2 show that the value selected for the algorithm variable affects if and how fast parameter convergence occurs. The higher the reference signals frequency content the quicker the control algorithm converges. 7.2.2 Estimating model reference controller, polynomial B coefficients only. For the following model reference simulations the gain parameter is fixed with T = Bm, and the adaptive controller is designed to estimate the parameters for polynomial A. This time the adaptive algorithm converges to a very small parameter estimate error and as expected the tracking error approaches zero. The simulation results for the adaptive controller designed to estimate the four parameters a1 a2 a3 at are given in the tables below. The RLS algorithm results are in table 7.2.2.1 and the NGA are in table 7.2.2.2. 91

PAGE 101

Input reference signal Single frequency Double Square wave Noise hmin frequency error N (0, 1.5) A.= 1.0 600 w/offset error 3000 0.98 550 0.96 bursting 560 380 0.95 285 0.92 400 0.9 240 360 200 0.88 170 300 0.85 170 0.82 400 200 0.8 100 600 173 0.78 170 0.75 190 0.7 bursting Paramseters follow input 250 0.6 2000 Estimated parameter Always some .95@ 300 & .8 @173 & values error .9@ 245 .. 78 @176 1.4928 1.4927 0.5970 0.5971 0.8608 0.8608 -0.6549 -0.6599 Table 7.2.2.1: Model reference simulations using RLS algorithm with four different reference signals. 92

PAGE 102

Input reference signal Single frequency Double Square wave Noise h min frequency error N (0, 1.5) fl = 1.0 0.98 1200 0.95 1500 0.9 180 >2000 Burstina 1200 0.89 125 err 0.05 0.87 150 err 0.02 1000 0.86 150err 0.025 1000 0.85 70 1000 500 0.83 1900 1000 0.8 50 err 0.06 2000 800 800 0.79 800 1200 0.77 800 0.76 900 0.74 0.73 1800 0.71 1500 0.7 50err0.14 1800 1400 0.69 2200 0.6 50 err 0.25 >3000 1500 0.5 2000 Estimated parameter .88@ 200 err .027 .73@ 1800 .78@ 800 .84@ 480 values 1.3979 1.4900 1.4904 1.4906 0.7295 0.5989 0.5980 0.5978 0.8645 0.8609 0.8602 0.8589 -0.6665 -0.6599 -0.6599 -0.6584 Table 7.2.2.2: Model reference simulations using NG algorithm with four different reference signals. The plots from some of the computer simulation used to estimate the model reference controller are presented in figures 7.2.2.1 through 7.2.2.6. The Matlab script files are in the appendix. The simulation inputs asked for by the Matlab NGA program are 93

PAGE 103

Reference Signal SQuare, Cos, Cos2, or Noise ? n =Noise input mu= .84 The simulation results give the estimated parameter values at iteration 1 000 as T(:, 1 000)= 1.4906 0.5978 0.8598 -0.6584 Estimate of Parameters (NG algorithm) 1.5( 1 0. 5 lrr"'"" 0 -0.5 0 500 1000 1500 2000 2500 No. of Iteration or time Figure 7.2.2.1 Model Reference parameter estimate convergence for NGA with noise input reference signal. 94 3000

PAGE 104

System Output for (NG algorithm) 500 1000 1500 2000 2500 3000 No. of Iteration or time '7.2.2.2 Model Reference system output, NG estimate, Y(t). Tracking Error for (NG algorithm) l 500 1000 1500 2000 2500 3000 No. of Iteration or time 7.2.2.3 Model Reference output tracking error, y(t)y(t) for NGA 95

PAGE 105

Parameter Error for (NG algorithm) 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time r.2.2.4 Model Reference estimated parameter error forNGA. simulation the estimated parameter error is very small after iteration e adaptive model reference control simulation using the normalized algorithm is rerun with a different input signal. ulation inputs used by the Matlab NGA program for the next set of ce Signal SQuare, Cos, Cos2, or Noise ? SQ Square 1put mu= .78 mated parameter values at iteration 800 are (:,800)= 1.4904 0.5980 0.8602 -0.6599 96

PAGE 106

2 1.5 r 1 .. F-. 0.5 0 -0.5 ... -1 -1.5 0 Estimate of Parameters (NG algorithm) 500 1000 1500 2000 2500 No. of Iteration or time Figure 7.2.2.5 Model Reference parameter estimate convergence for NGA with square wave input reference signal. System Output for (NG algorithm) 20 15 10 5 i 0 -5 -10 -15 -20 0 100 200 300 400 500 600 700 800 900 100( No. of Iteration or time Figure 7.2.2.6 Model Reference system output, NG estimate, y(t). 97

PAGE 107

Tracking Error for (NG algorithm) lu .. 500 1000 1500 2000 2500 3000 No. of Iteration or time 7.2.2.7 Model Reference output tracking error, y(t)y(t) for NGA Parameter Error for (NG algorithm) 100 200 300 400 500 600 700 BOO 900 1000 No. of Iteration or time 7.2.2.8 Model Reference estimated parameter error for NGA. 98

PAGE 108

The next set of plots are for the adaptive model reference control recursive least squares algorithm. The simulation inputs asked for by the Matlab RLS algorithm program are Reference Signal SQuare, Cos, cos2, or Noise ? Cos2 = 15cos(2pi*t/15)+ 1 Ocos(2pi*t/25) 0 -0.5 -1 input lambda= .85 0 50 Estimate of Parameters (RLS algorithm) 100 150 200 250 300 350 400 450 500 No. of Iteration or time Figure 7.2.2.9 Model Reference parameter estimate convergence for RLS with Cos2 input reference signal. 99

PAGE 109

25 20 15 10 i 5 0 -5 -10 -15 -20 -25 0 50 System Output for (RLS algorithm) 100 150 200 250 300 350 400 No. of Iteration or time 450 5( Figure 7.2.2.10 Model Reference system output, RLS estimate, y(t). Tracking Error for (RLS algorithm) 10 5 -5 -10 0 50 100 150 200 250 300 350 400 450 5( No. of Iteration or time Figure 7.2.2.11 Model Reference output tracking error, y(t)y(t) for RL 100

PAGE 110

180 160 140 120 100 "6, 80 60 40 20 \ 0 0 50 Figure 7.2.2.12 Parameter Error for (RLS algorithm) I 100 150 200 250 300 350 400 450 500 No. of Iteration or time Model Reference estimated parameter error for RLS. The adaptive model reference control system with a double frequency input using the RLS converges in about 150 iterations as opposed to 800 for the NGA with a square wave input which has more frequency content to help it converge fast. 101

PAGE 111

7.3 Adaptive Control Performance Examples The examples in this section are given to illustrate how an adaptive control system performs in three specific cases. These cases are selected to indicate how robust an adaptive controller will be in some commonly encountered situations. The three cases are 1 a system with noise, 2. a system with noise and unmodeled dynamics, and 3. a system with noise and one time varying parameter. For each of these cases the nominal system model used is with white noise w(t) that is a Gaussian with zero mean and standard deviation one. Thus E{w(t)}= 0 ; E{w(t)2 }= o-; = 1 In each case the reference signal is y*(t) =15sin 2n t T For case one the reference signal periods used are T = 15 ; 20 ; 30. In case number two the unmodeled dynamics are 102

PAGE 112

1 r(t-1)=v 1 2y(t-1), V=0.001,.01,.1,. 1-0.1q0.56qThe system model consists of the nominal system model plus the unmodeled dynamics giving And the reference signal period T is 60. In case number three the first parameter of polynomial A is made time varying. Parameter a1 is a1 (t) = -(1.9 +a cos t) a = 0.1 ; 0.5 ; 1 ; 1.5 T.. = 30 ; 60. The system model is (1-(1.9 +a cos', t)q-1 + 0.1q-2)y(t) = q-1 (1.6 +0.5q-1)u(t) + m(t) I A reference signal with a period of T =1 00 is used. 7 .3.1 A system with noise added to the output. The simulations for case number one are presented next. In this case the simulation shows the behavior of a simple servo system with self-tuning control and Gaussian noise as an output disturbance. Program inputs for the simulation that follows are input number of iterations n= 999 input RLS forgetting factor lambda= 0.8 Sine wave reference signal period(15; 20; 30;)= 30 103

PAGE 113

Parameter Estimats (thetahat) Part I 2 1 -1 -2 0 100 200 300 400 500 600 700 800 900 10 No. of Iteration or time Dashed lines indicate actual plant parameter values. Figure 7.3.1.1 System with output noise disturbance. Parameter estimate convergence for RLS. Output of System with Estimated Controller Part I 30 20 0 -10 0 100 200 300 400 500 600 700 800 900 10 No. of Iteration or time Figure 7.3.1.2 System output with output noise disturbance, RLS. 104

PAGE 114

Output Tracking Error of Estimated System Part I 30 25 20 15 .... 10 5 0 -5 -10 0 100 200 300 400 500 600 700 BOO 900 10 No. of Iteration or time Figure 7.3.1.3 Noisy system output tracking error, y(t)y(t) for RLS Noisy System Input Signal Part I 15 10 5 0 -5 -10 -15 0 100 200 300 400 500 600 700 BOO 900 101 No. of Iteration or time Figure 7.3.1.4 System with output noise disturbance. Input plus noise. 105

PAGE 115

Notice that the noisy systems output, the system output with disturbance, looks like the system input when the same noise is added to the input. The output tracking error data from iteration 12 to the end of the simulation is used to calculate these statistics. Mean_Err = 0.0056 Max_Err = 3.937 4 Min_Err = -4.4509 STD_Err = 1.2562 The simulation is rerun with the following inputs input number of iterations n= 999 input RLS forgetting factor lampda= 0.98 Sine wave reference signal period(15; 20; 30;)= 15 Parameter Estimats (thetahat) Part I 2 1.5 1 05L .. ..... i 0 -0.5 -1 -1.5 0 1 00 200 300 400 500 600 700 800 900 1 000 No. of Iteration or time Dashed lines indicate nominal parameter values. Figure 7.3.1.5 System with output noise disturbance. Parameter estimate convergence for RLS run 2. 106

PAGE 116

Output of System with Estimated Controller Part I 70 60 50 40 30 i 20 10 0 -10 -20 0 100 200 300 400 500 600 700 BOO 900 101 No. of Iteration or time Figure 7.3.1.6 System output with output noise disturbance, RLS run 2. Output Tracking Error of Estimated System Part I 50 40 30 20 i 10 0 -10 -20 0 100 200 300 400 500 600 700 BOO 900 101 No. of Iteration or time Figure 7.3.1.7 Noisy system output tracking error, y(t)y(t) RLS run 2 107

PAGE 117

20 15 10 5 0 i -5 -10 -15 -20 0 Noisy System Input Signal Part I 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time Figure 7.3.1.8 System with output noise disturbance. Input plus noise run 2. Run 2 tracking error statistics calculated from iteration 12 to the end of simulation. Mean_Err = 0.0440 Max_Err = 3.7163 Min_Err = -3.3586 STD_Err = 1.0051 The results from additional simulations that were run indicate that varying the input signal period from15 to 30 has little or no effect on how well the 108

PAGE 118

controller performs. Similarly varying A from 0.8 to 1.0 has little or no effect on tracking performance. Comparing the parameter estimates of figure 7 .3.1.1, were the smaller forgetting factor is used to those in figure 7.3.1.5 confirms that with a smaller A. the algorithm uses the more resent measurements only. Or with out long term averaging the estimates follow the noise. 7.3.2 A system with unmodeled dynamics and noise added to the output. The simulations for case number two are presented in this section. In this case the simulation shows the behavior of a simple servo system with selftuning control, unmodeled dynamics and Gaussian noise as an output disturbance. Program inputs for the simulation that follows are input number of iterations n= 1499 input RLS forgetting factor lambda= .98 input gain of unmodeled dynamics (0.001 ,0.01 ,0.1, 1) gamma 1 = .1 Sine wave reference signal period(60; 15; 20; 30;)= 60 For these conditions the parameter estimates converges at about iteration 150. 109

PAGE 119

Parameter Estimates(thetahat) Part II 2.5 2 1.5 1 i 0.5 0 -0.5 -1 -1.5 -2 -2.5 0 500 1000 151 No. of Iteration or time Dashed lines indicate nominal parameter values. Figure 7.3.2.1 System with unmodeled dynamics. Parameter estimate converaence for RLS. Output of System with Estimated Parameters Part II. 50 40 30 20 i 10 0 -10 -20 0 500 1000 15( No. of Iteration or time Figure 7 .3.2.2 Output of system with unmodeled dynamics, RLS. 110

PAGE 120

Output Tracking Error of Estimated System Part II 500 1000 1500 No. of Iteration or time 7.3.2.3 System with unmodeled dynamics. Output tracking error, y(t) RLS. 1g error statistics from iteration 12 to end. Mean_Err= 0.0102 Max_Err= 4.7760 Min_Err = -3.2427 STD_Err = 1.1099 oise and unmodeled dynamics the parameters converge to a value that from the nominal plant model parameters. If the unmodeled 1ics gain is too large the system will become unstable. The ripples in timated parameter values are due to the output noise disturbance. The of the input reference signal sets the input frequency. The algorithm ges slightly faster at the higher input frequency. The control loop 111

PAGE 121

feedback of the noisy output to the input provides the necessary signal frequency content needed for the RLS algorithm to converge. In the following simulation the gain of the unmodeled dynamics is set to the point where the RLS algorithm no longer is capable of estimating the parameters. The algorithm becomes unstable if additional iterations are simulated. Note parameter values shifted as expected for larger gain. Program inputs for the simulation that follows are 2.5 2 "1.5 "1 0.5 0 -0.5 -"1 -"1.5 input number of iterations n= 1499 input RLS forgetting factor lambda= .98 input gain of unmodeled dynamics (0.001,0.01,0.1,1) gamma 1 = .3 Sine wave reference sianal oeriod(60: 15: 20: 30:)= 60 Parameter Estimates(thetahat) Part II ooooo-oOOOoooOOoOooOOOOOoOOOOOoooooooooooooooooo-ooooooooooooooooooooooooOOoooOO-ooOoooooOoonoOOooooOOoooOOOOoooOOOOo-a.ooo.ao-ooooo-oooooo-oooooooooooooooooooooooooooooo--oooooooooooooa.-oooo-000 -2 0 500 "1000 "1500 No. of Iteration or time Dashed lines indicate nominal parameter values. Figure 7.3.2.4 System with unmodeled dynamics. Parameter estimate convergence for RLS run 2. 112

PAGE 122

Output of System with Estimated Parameters Part II. 50 40 30 20 10 i 0 -10 -20 -30 0 No. of Iteration or time Figure 7.3.2.5 Output of system with unmodeled dynamics, RLS run 2. Output Tracking Error of Estimated System Part II 40 35 30 25 20 15 t 10 5 0 -5 -10 0 500 1000 15 No. of Iteration or time Figure 7 .3.2.6 System with unmodeled dynamics. Output tracking errc y(t)y(t) RLS run 2. 113

PAGE 123

Tracking error statistics from iteration 12 to end. Mean_Err = 0.1 038 Max_Err = 10.5445 Min_Err = -8.3027 STD_Err = 2.1941 The mean of the error is larger and the peak minimum and maximum tracking error are large. 7.3.3 A system with one time varying parameter and noise added to the output. The simulations for case number three are presented in this section. In this case the simulation shows the behavior of a simple servo system with selftuning control, one time varying parameter (TVP) and Gaussian noise as an output disturbance. For this simulation parameter a1 is made time varying. The simulation inputs variables for the first set of plots is input number of iterations n= 999 input RLS forgetting factor lambda= .87 input gain of time varying parameter alpha(0.1 ,0.5, 1, 1.5)= 0.5 input period of time varying parameter (30; 60;)= 60 114

PAGE 124

Parameter Estimates(thetahat) of Part Ill 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time Dashed lines indicate nominal parameter values. 7.3.3.1 System with time varying a1 Parameter estimate gence for RLS. Output of System with Estimated Controller part Ill 100 200 300 400 500 600 700 800 900 1000 No. of Iteration or time .3.3.2 Output of system with time varying a1 RLS. 115

PAGE 125

Output Tracking Error of Estimated System part Ill 1 00 200 300 400 500 600 700 800 900 1 000 No. of Iteration or time 7.3.3.3 System with time varying a1 output tracking error, (t) for RLS. g error statistics from iteration 12 to end. Jlean_Err = -0.1941 Max_Err = 22.7288 Jlin_Err = -29.1923 STD_Err = 4.5785 ts on the next eight pages show the results of four additional on runs. In each of the succeeding simulations the amplitude, a of 1 wave time varying parameter is increased. The forgetting factor in nulation is 0.72, this is small enough to allow the parameter estimate v parameter a1 for all a used. :nulation 1, a = 0.1. 116

PAGE 126

input number of iterations n= 1499 input RLS forgetting factor lambda= .72 input gain of time varying parameter alpha(0.1 ,0.5, 1 1.5)= 0.1 input period of time varying parameter (30; 60;)= 30 Mean_Err = 0.0278 Max_Err = 24.6538 Min_Err = -21.8216 STD_Err = 2.2967 Parameter Estimates(thetahat) of Part Ill 4 500 "'1000 No. of Iteration or time Figure 7 .3.3.4 System with time varying a1 a = 0.1 Parameter estimate convergence for RLS run 1. Output of System with Estimated Controller part Ill 50 40 30 20 i 10 0 -10 -20 -30 -40 -50 0 No. of Iteration or time Figure 7.3.3.5 Output of system with time varying a,, a = 0.1 RLS run 1. 117 "'15

PAGE 127

Output Tracking Error of Estimated System part Ill 25 20 "15 J -"10 -"15 -20 -25 0 sao "1000 No. of Iteration or tlrne Figure 7.3.3.6 System with time varying a1 a= 0.1. Output tracking error, y(t)y(t) RLS run 1. TVP Simulation 2, a = 0.3. input number of iterations n= 1499 input RLS forgetting factor lambda= 72 input gain of time varying parameter alpha(0.1 ,0.5, 1, 1.5)= 0.3 input period of time varying parameter (30; 60;)= 30 Mean_Err = 0.0596 Max_Err = 52.4379 Min_Err = -33.4347 STD_Err = 5.3058 Parameter Estimates(thetahat) of Part Ill "1500 4 -4 -6 0 500 1000 1500 No. of Iteration or time Figure 7.3.3.7 System with time varying a1 a= 0.3. Parameter estimate convergence for RLS run 2. 118

PAGE 128

Output of System with Estimated Controller part Ill No. of Iteration or time 7.3.3.8 Output of system with time varying a1 a= 0.3 RLS run 2. Output Tracking Error of Estimated System part Ill -' ) 500 1000 No. of Iteration or time 7.3.3.9 System with time varying a1 a = 0.3. Output tracking y(t)y(t) RLS run 2. iimulation 3, a = 0.5. Jmber of iterations.n= 1499 LS forgetting factor lambda= .72 :tin of time varying parameter alpha(0.1 ,0.5, 1, 1.5)= 0.5 of time varying parameter (30; 0 119 Mean_Err = 0.1206 Max_Err = 168.7229 Min_Err = -95.6091 STD_Err = 10.3963 1500

PAGE 129

3 2 1 0 -1 -2 -3 -4 Parameter Estimates(thetahat} of Part Ill 500 1000 151 No. of Iteration or time Figure 7.3.3.10 System with time varying a1 a= 0.5. Parameter estima convergence for RLS run 3. Output of System with Estimated Controller part Ill 100 -100 0 500 1000 15( No. of Iteration or time Figure 7 .3.3.11 Output of system with time varying a1 a = 0.5 RLS run : 120

PAGE 130

Output Tracking Error of Estimated System part Ill 200 150 100 i 50 0 -50 -100 0 500 1000 1500 No. of Iteration or time Figure 7.3.3.12 System with time varying a1 a= 0.5. Output tracking error, y(t)y(t) RLS run 3. TVP Simulation 4, a = 1. input number of iterations n= 1499 Mean_Err = -0.5262 input RLS forgetting factor lambda= 72 input gain of time varying parameter Max_ Err = 267.4522 alpha(0.1,0.5,1,1.5)= 1 input period of time varying parameter (30; Min_Err = -298.1929 60;)= 30 STD _Err = 22.5103 Dashed lines indicate nominal parameter values. 121

PAGE 131

Parameter Estimates(thetahat) of Part Ill 4 3 -4 0 500 '1000 151 No. of Iteration or time Figure 7.3.3.13 System with time varying a1 a= 1. Parameter estimate convergence for RLS run 4. Output of System with Estimated Controller part Ill 600 400 -200 0 500 1000 151 No. of Iteration or time Figure 7.3.3.14 Output of system with time varying a1 a= 1. RLS run 4. 122

PAGE 132

Output of System with Estimated Controller part Ill 200 150 100 50 0 1 -50 -100 -150 -200 0 500 1000 No. of Iteration or time Figure 7.3.3.15 TVP system output with expanded y axis, a= 1 RLS run Output Tracking Error of Estimated System part Ill 600 500 400 300 i 200 100 0 -100 -200 -300 -400 0 500 1000 No. of Iteration or time Figure 7.3.3.16 System with time varying a1 a = 1. Output tracking error, y(t)y(t) RLS run 4. 123 15C

PAGE 133

These four simulations indicate that an adaptive controller can follow parameter variations. When the parameter varies more then 50% the system output does not track the input vary accurately. 124

PAGE 134

Appendix Computer Programs 1 Plant parameter identification for a simple servo system using the normalized gradient parameter adaptation algorithm. % MATLAB script file % filename Adp 1 nga.m OJo ******************************************************************** % Glen Austin % Adaptive Control Systems % Normalized Gradient algorithm simple servo system OJo ******************************************************************** % dif. eq. y(t+ 1 )-1.67y(t)+0.67y(t-1) = 0.2u(t)+0.18u(t-1) for servo system % or y(t+ 1) = theta'*phi close all; clear all; n=input('input n= '); % Input number of iteration. mu=input('input mu= '); % Input mu (0 to 1 and 1 to 2) algorithm variable c=input('input c= '); % Input c {0 to 2 ) algorithm variable R=[ ]; % --------------reference trajectory. t=O:n; Ytre=15*square(pi*t/25); % -initialize variables thetahat1 =[1; 1; 1; 1 ]; u=ones(1 ,n)*0.3; phi=ones(4, 1 ); Err1 =ones(1 ,n)*0.3; 125

PAGE 135

y1 =ones(1 ,n)*0.2; o;o ------------------------------% Calculate the system output, controller and parameter estimator. theta=[ -1.67;0.67;0.2;0.18]; % coefficients of y{t} and u{t} for t=2:n; % -Controller output (servo input) based on past outputs and % current input u(t)=(1/thetahat1 (3))*(-thetahat1 (4}*u(t1 }+thetahat1 (1 )*y1 {t)+thetahat1 {2)*y1 {t-1 )+ Ytre(t+ 1 )); phi=[-y1 (t);-y1 {t-1 );u(t);u(t-1 )]; % -Actual servo system output y1 (t+ 1 )=theta'*phi; Err1 (t+ 1 )=y1 {t+ 1 )Ytre{t+ 1 ); phiseq=phi'*phi; %--Normalized gradient algorithm. thetahat1 =thetahat1 +mu*phi*(Err1 (t+ 1 ))/{c+phiseq); A=[ A thetahat1 ]; % Accumulation of parameter estimates end figure; plot(R');title('Estimate of Parameters (NG algorithm)') xlabei{'No. of Iteration or time') ylabei{'Magnitude') figure; plot{y1 );title('System Output for {NG)') xlabei{'No. of Iteration or time') ylabei{'Magnitude') figure; plot{Err1 );title('Tracking Error for (NG)') xlabei{'No. of Iteration or time') ylabei{'Magnitude') 126

PAGE 136

2. Plant parameter identification for a simple servo system using the RLS parameter adaptation algorithm. %MATLAB script file % filename Adp11ms.m *********************************************************************** % Glen Austin % Adaptive Control Systems % Least mean Square algorithm simple servo system ************************************************************************* % dif. eq. y(t+1}-1.67y(t}+0.67y(t-1} = 0.2u(t)+0.18u(t-1) % or y(t+ 1) = theta'*phi close all; clear all; n=input('input n (number of iterations)= '); % Input number of iteration lambda=input('input lambda ( 1 or 0.98}= '); % Input lambda ( 1 or 0.98}. D=[ ]; % ---------reference trajectory. t=O:n; Ytre=15*square(pi*t/25); % -Initial condition. thetahat=[1 ;1 ;1 ;1]; y=ones(1 ,n)*0.2; u=ones(1 ,n)*0.3; phi=ones(4, 1 ); Err=ones(1 ,n)*0.3; p0=10; % Calculate the identity matrix. for i=1 :4; p1 (i,i}=1; end 127

PAGE 137

----------------------------p=p0*p1; % Calculate the system output, controller, p matrix and parameter estimator. theta=[ -1.67;0.67;0.2;0.18]; % coefficients of y(t) and u(t) for t=2:n; %--Controller output (servo input) based on past outputs and current input u(t)=(1/thetahat(3))*(-thetahat(4)*u(t1 )+thetahat(1 )*y(t)+thetahat(2)*y(t-1 )+ Ytre(t+ 1) ); phi=[ -y(t);-y(t-1) ;u(t);u(t-1 )]; % -Actual servo system output y(t+ 1 )=theta'*phi; Err(t+ 1 )=y(t+ 1 )Ytre(t+ 1 ); % -Least square algorithm. p=(1/lambda)*(p-((p*phi*phi'*p)/(lambda+phi'*p*phi))); % -next parameter estimate thetahat=thetahat+p*phi*(Err(t+ 1 )); D=[D thetahat]; % accumulation of parameter estimates end figure; plot(D');title('Estimate of Parameters (LMS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(y);title('System Output for (LMS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(Err);title('Tracking Error for (LMS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') 128

PAGE 138

3. Model Reference control of a simple servo system. %MATLA8 script file % Adpmrefcnga.m ******************************************************************** % Glen Austin % Adaptive Control Systems % Model Reference control for simple servo system % Normalized Gradient algorithm o/o ******************************************************************** % dif. eq. y(t+ 1 )-1.7y(t)+0.9y(t-1) = 1.5u(t)+0.6u(t-1) % or y(t+ 1) = theta'*phi clear all close all n=3000; ref_sig=input('Reference Signal SQuare, Cos, Cos2, or Noise? ','s'); switch ref_sig case 'SQ' y_ref=15*square(pi*[1 :n]/25); disp('Square') case 'Cos' y_ref=1 O*cos(2*pi*[1 :n]/25); disp('1 Ocos(2pi*V25)') case 'Cos2' y_ref=15*cos(2*pi/15*[1 :n])+ 1 O*cos(2*pi*[1 :n]/25); disp('15cos(2pi*V15)+ 1 Ocos(2pi*V25)') otherwise y_ref=sqrt(1.5)*rand(1 ,n}; disp('Noise') end p=eye(4); theta=[1 0 0 0]'; theta_p=[1.5;0.6;1.7;-0.9];%[1.0368 .95396 1.7788 -.7788]';% Plant [8 A] theta_m=[.834983;-0.236927;0.401945];%[.7505 -.2466 .4961 ]'; % Reference Model [A 8] theta_0=[1.5; .6; .865017; -.663072];%[1.0368 .95396 1.0283 -.5322]'; % Controller mod ref. [8 A] 129

PAGE 139

y=zeros(1 ,n); y_m=zeros (1 ,n); u=zeros(1 ,n); u_f=zeros(1 ,n); e=zeros(1 ,n); %mu=1; mu=input('input mu= '); % Input mu (0 to 1 and 1 to 2} algorithm variable %L=.92; T=[]; for k=3:n-1 phi=[u(k) u(k-1} y(k} y(k-1)]'; u(k)=(1 /theta(1 ))*( -theta(2:4)'*phi(2:4)+.4*y_ref(k)); phi=[u(k) u(k-1) y(k) y(k-1 )]'; phi_m=[y_m(k) y_m(k-1) y_ref(k)]'; y_m(k+ 1 )=theta_m'*phi_m; %y_m(k+ 1 )=.7505*y_m(k)-.2466*y_m(k-1 )+.4961 *y_ref(k); y(k+ 1 )=theta_p'*phi; %y(k+ 1 )+ 1.7788*y(k)-.7788*y(k-1 ); e (k+ 1) =Y (k+ 1) -y_m (k+ 1}; %Insert one of below to implement desired algorithm % ForNGA theta=theta+mu*phi*e(k+ 1 )/(1 +norm(phi)A2); % For RLS %p=(1/L)*(p-p*phi*phi'*p/(L+phi'*p*phi)); %theta=theta+p*phi*e(k+ 1 ); theta_tild=theta-theta_O; %err(k)=theta_tild'*inv(p)*theta_tild; err(k)=norm(theta_tild)A2; T =[T theta]; end % -------Plots --------figure; plot(T');title('Estimate of Parameters (NG algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; 130

PAGE 140

plot(y);title('System Output for (NG algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(e);title('Tracking Error for (NG algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(err);title('Parameter Error for (NG algorithm)') xlabei('No. of Iteration or time') ylabel ('Magnitude') 131

PAGE 141

4. Adaptive Model Reference control of a simple servo system using the RLS algorithm. %MATLAB script file % Adpmrefcrls.m ******************************************************************** % Glen Austin % Adaptive Control Systems % Model Reference control simple servo system % recursive least squares ******************************************************************** % dif. eq. y(t+1)-1.7y(t)+0.9y(t-1) = 1.5i.J(t)+0.6u(t-1) % or y(t+ 1) = theta'*phi clear all close all n=3000; ref_sig=input('Reference Signal SQuare, Cos, Cos2, or Noise? ','s'); switch ref_sig case 'SQ' y_ref=15*square(pi*[1 :n]/25); disp('Square') case 'Cos' y_ref=1 O*cos(2*pi*[1 :n]/25); disp('1 Ocos(2pi*t/25)') case 'Cos2' y_ref=15*cos(2*pi/15*[1 :n])+ 1 O*cos(2*pi*[1 :n]/25); disp('15cos(2pi*t/15)+ 1 Ocos(2pi*t/25)') otherwise y_ref=sqrt(1.5)*rand(1 ,n); disp('Noise') end p=eye(4); theta=[1 0 0 0]'; theta_p=[1.5;0.6;1.7;-0.9];%[1.0368 .95396 1.7788 -.7788]';% Plant [B A] theta_m=[.834983;-0.236927;0.401945];%[. 7505 -.2466 .4961 ]'; % Reference Model [A 8] theta_0=[1 .5; .6; .865017; -.663072];%[1 .0368 .95396 1.0283 -.5322]'; 132

PAGE 142

y=zeros(1,n); y_m=zeros {1,n); u=zeros(1,n); u_f=zeros(1,n); e=zeros(1,n); %mu=1; % Controller mod ref. [8 A] L=input('input lambda= '); % Input (0 to 1 ) algorithm variable %L=.92; T=O; for k=3:n-1 phi=[u(k) u(k-1) y(k) y(k-1 )]'; u(k)=(1/theta(1))*(-theta(2:4)'*phi{2:4)+.4*y_ref(k)); phi=[u(k) u(k-1) y(k) y(k-1 )]'; phi_m=[y_m(k) y_m(k-1) y_ref(k)]'; y_m(k+ 1 )=theta_m'*phi_m; %y_m(k+ 1 )=.7505*y_m(k)-.2466*y_m(k-1 )+.4961 *y_ref(k); y(k+ 1 )=theta_p'*phi; %y(k+1 )=1.0368*u(k)+.95396*u(k-1)+ 1.7788*y(k)-.7788*y(k-1 ); e (k+ 1) =Y (k+ 1) -y_m (k+ 1); %Insert one of below to implement desired algorithm % ForNGA % theta=theta+mu*phi*e(k+ 1 )/(1 +norm(phi)A2); % For RLS p=(1/L)*(p-p*phi*phi'*p/(L+phi'*p*phi)); theta=theta+p*phi*e(k+ 1 ); theta_tild=theta-theta_O; err(k)=theta_tild'*inv(p )*theta_tild; %err(k)=norm(theta_tild)A2; T =[T theta]; end % -------Plots --------figure; plot(T');title('Estimate of Parameters (RLS algorithm)') xlabei('No. of Iteration or time') 133

PAGE 143

ylabei('Magnitude') figure; plot(y);title('System Output for (RLS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(e);title('Tracking Error for (RLS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(err);title('Parameter Error for (RLS algorithm)') xlabei('No. of Iteration or time') ylabei('Magnitude') 134

PAGE 144

5. Self-tuning. control of a simple servo system using the RLS parameter adaptation algorithm with a white noise disturbance. %MATLAB script file % filename Adp2p1.m % ************************************************************************** % Glen Austin % Adaptive Control Systems Self tuning control, % simple servo system w/noise % ************************************************************************** % dif. eq. y(t+1}-1.9y(t}+0.7y(t-1} = 1.6u(t}+0.5u(t-1}+w(t+1} % or y(t+ 1} = theta'*phi close all; clear all; n=input('input number of iterations n= '}; % 500 to 1000. lambda=input('input RLS forgetting factor lambda= '}; % between 1 & 0.98. T =input('Sine wave reference signal period(15; 20; 30;}= '); D=[ ]; % -white noise mean=O, vareance=1. t=O:n; w=randn ( size(t)}; % ---------reference trajectory. Ytre=15*sin(2*pi*t/T}; % -Initial condition. thetahat=[1 ;1 ;1 ;1]; y=ones(1,n)*0.2; u=ones(1,n)*0.3; phi=ones(4,1 ); Err=ones(1,n)*0.3; Err(3)=0.1; p0=10; % -Calculate the identity matrix. for i=1 :4; p1 (i,i)=1; 135

PAGE 145

end --------------------------------p=p0*p1; % -Calculate the system output, controller, p matrix and parameter estimator. theta=[-1.9;0.7;1.6;0.5]; %coefficients of y(t) and u(t) for t=2:n; %--Controller output (setvo input) based on past outputs and current input u(t)=(1/thetahat{3) )*( -thetahat(4 )*u(t-1 )+thetahat(1 )*y(t)+thetahat(2)* y(t-1 )+ Ytre(t+ 1 )); phi=[ -y(t);-y(t-1 );u(t);u(t-1 )]; % -Actual setvo system output y(t+ 1 )=theta'*phi+w(t+ 1 ); % -Least square algorithm. p=( 1/lambda)* (p-( (p*phi*phi'*p )/(lambda+phi'*p*phi)) ); Err(t+ 1 )=y(t+ 1 )Ytre(t+ 1 ); % -next parameter estimate thetahat=thetahat+p*phi*(Err(t+ 1 )); D=[D thetahat]; % accumulation of parameter estimates end %----plot parameter estimates, system output and tracking error. Mean_Err=mean(Err(12:n)), Max_Err=max(Err(12:n)), Min_Err=min(Err(12:n)) STD_Err=std(Err(12:n)) figure; % -plot actual plant parameters tt=[O n+1]; a 1 =[theta(1) theta(1 )]; a2=[theta(2) theta(2)]; b1 =[theta(3) theta(3)]; b2=[theta(4) theta(4)]; plot(tt,a1,'k:',tt,a2,'k:',tt,b1,'k:',tt,b2,'k:') hold on plot(D');title('Parameter Estimates (thetahat) Part I') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; 136

PAGE 146

plot(y);title{'Output of System with Estimated Controller Part I') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(Err);title('Output Tracking Error of Estimated System Part I') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; Ytrepw= Ytre+w; plot(Ytrepw);title('Noisy System Input Signal Part I') xlabei('No. of Iteration or time') ylabei('Magnitude') 137

PAGE 147

6. Self tuning control of a simple servo system using the RLS parameter adaptation algorithm with a white noise disturbance and unmodeled system dynamics. %MATLAB script file % filename Adp2p2.m ******************************************************************** % Glen Austin % Adaptive Control Systems % Self tuning control, simple servo system w/noise + unmodeled dynamics 0/o ******************************************************************** % dif. eq. y(t+1)-1.9y(t)+0.7y(t-1) = 1.6u(t)+0.5u(t-1)+w(t+1). % or y(t+ 1) = theta'*phi close all; clear all; n=input('input n= '); % Input number of iteration. lambda=input('input lambda= '); % Input lambda value 1 or 0.98. LMS gain gamma1=input('input gamma1= ');%Input gamma1 (0.001,0.01,0.1,1) % gain of unmodeled dynamics %--Initial condition. 0=[ ]; u=ones(1,n); y=ones(1,n); gamma=ones(1,n); phi=ones(4,1 ); thetahat=[1 ;1 ;1 ;1]; p0=10; % -white noise mean=O, vareance=1. t=O:n; w=randn(size(t)); 138

PAGE 148

% ---------reference trajectory. t=O:n; Ytre=15*sin(2*pi*V60); % -Calculate the identity matrix. for i=1 :4; p1 (i,i)=1; end --------------------------------p=p0*p1; % -Calculate the system output, controller, p matrix and parameter estimator. theta=[-1.9;0.7;1.6;0.5];% coefficients of y(t) and u(t) for t=4:n; %--Controller output (servo input) based on past outputs and current input u(t)=(1 /thetahat(3))*(thetahat(1 )*y(t)+thetahat(2)*y(t-1 ) thetahat(4)*u(t-1 )+ Ytre(t+ 1 )); phi=[ -y(t);-y(t-1 );u(t);u(t-1 )]; % -Unmodeled system dynamics gamma(t-1 )=0.1 *gamma(t-2)+0.56*gamma(t-3)+gamma 1 *y(t-1 ); % -Actual servo system output y(t+ 1 )=theta'*phi+w(t+ 1 }+gamma(t-1 ); %--Least square algorithm. p=(1/lambda)*(p-((p*phi*phi'*p)/(lambda+phi'*p*phi))); Err(t+ 1 )=y(t+ 1 )Ytre(t+ 1 ); % -next parameter estimate thetahat=thetahat+p*phi*(Err(t+ 1 )); 0=[0 thetahat]; % accumulation of parameter estimates end % ---plot parameter estimates, system output and tracking error. Mean_Err=mean(Err(12:n)), Max_Err=max(Err(12:n)), Min_Err=min(Err(12:n)) STO_Err=std(Err(12:n)) 139

PAGE 149

figure; % --plot actual plant parameters tt=[O n+1]; a 1 =[theta(1) theta(1 )]; a2=[theta(2) theta(2)]; b1 =[theta(3) theta(3)]; b2=[theta(4) theta(4)]; plot(tt,a1 ,'k:',tt,a2,'k:',tt,b1 ,'k:',tt,b2,'k:') hold on plot(D');title('Parameter Estimator(thetahat) Part II') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(y);title('System Output of Parameter Estimator Part II. ') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(Err);title('Tracking Error of Parameter Estimator Part II' ) xlabei('No. of Iteration or time') ylabei('Magnitude') 140

PAGE 150

7. Self tuning control of a simple servo system using the RLS parameter adaptation algorithm with a white noise disturbance and time varying plant parameter a 1 %MATLAB script file % filename Adp2p3.m ******************************************************************** % Glen Austin % Adaptive Control Systems % Self tuning control, simple servo system w/noise+time varying a1 ************************************************************************** % dif. eq. % y(t+ 1 )-[1.9+alpha*cos(2*pi*t/30)]y(t)+O. 7y(t-1 )=1.6u(t)+0.5u(t-1 )+w(t+ 1) % or y(t+ 1) = theta'*phi close all; clear all; n=input('input n= '); % Input number of iteration. lampda=input('input lampda= ');%Input lampda value 1 or 0.98. alpha=input(' input alpha= '); % Input alpha (0.1 ,0.5, 1, 1.5) % gain of time varying parameter D=[ ]; % empty matrix to collect values. % -Initial condition. u=ones(1 ,n); y=ones(1 ,n); phi=ones(4, 1 ); % -white noise mean=O, vareance=1. t=O:n; w=randn ( size(t)); % ---------reference trajectory. t=O:n; Ytre=25*sin(2*pi*t/1 00); % plant time varying parameter a1 =-1.9-alpha*cos(2*pi*t0/T1 ); 141

PAGE 151

p0=10; % --Calculate the identity matrix. for i=1 :4; p1 (i,i)=1; end --------------------------------p=p0*p1; thetahat(1, 1 )=1; thetahat{2, 1 )=1; thetahat(3, 1 )=1; thetahat(4, 1 )=1; % -Calculate parameter estimator, output system and tracking error for t=2:n; % -Controller output (servo input) based on past outputs and current input theta [a 1 (t);0.7;1.6;0.5]; %coefficients of y(t) and u(t) u(t)=(1 /thetahat(3))*(thetahat(1 )*y(t)+thetahat(2)*y(t-1 ) thetahat(4)*u(t-1 )+Ytre(t+ 1 )); phi=[ -y(t);-y(t-1 );u(t);u(t-1 )]; % -Actual servo system output y(t+ 1 )=theta'*phi+w(t+ 1 ); %--Least square algorithm. p=( 1 /lampda)*(p-( (p*phi*phi'*p )/(lampda+phi'*p*phi))); Err(t+ 1 )=y(t+ 1 )Ytre(t+ 1 ); % -next parameter estimate thetahat=thetahat+p*phi*(Err(t+ 1 )); D=[D thetahat]; % accumulation of parameter estimates end % ---plot parameter estimates, system output and tracking error. Mean_Err=mean(Err(12:n)), Max_Err=max(Err(12:n)), Min_Err=min(Err(12:n)) STD_Err=std(Err(12:n)) figure; % -plot actual plant parameters tt=[O n+1]; 142

PAGE 152

a2=[theta(2) theta(2)]; b1=[theta(3) theta(3)]; b2=[theta(4) theta(4)]; plot(tO,a1 ,'k:',tt,a2,'k:',tt,b1 ,'k:',tt,b2,'k:') hold on plot(D');title('Parameter Estimator(thetahat) of Part Ill') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(y);title('System Output of parameter estimator part Ill') xlabei('No. of Iteration or time') ylabei('Magnitude') figure; plot(Err);title('Tracking Error of parameter estimator of part Ill') xlabei('No. of Iteration or time') ylabei('Magnitude') 143

PAGE 153

References These references contain more information on adaptive control. Astrom, K. J. & Wittenmark B.: Adaptive Control, Addison-Wesley, Reading, Mass., 1989 Juang, J.-N.: Applied System Identification, Prentice Hall, Englewood Cliffs, New Jersey, 1994 Landau, I. D., Lozano, R. & M'Saad, M.: Adaptive Control, Springer-Verlag, London, Great Britain, 1998 MATLAB User's Guide, The MathWorks, Inc., South Natick, Mass. 1997 Ogata, K.: Modern Control Engineering second edition, Prentice Hall, Englewood Cliffs, New Jersey, 1990 Rohrs, C. E., Melsa, J. L., & Schultz, D. G.: Linear control Systems, McGraw Hill, New York, New York, 1993 144