Genetic Algorithms, their Applications and Models in Nonlinear Systems Identification. Frank Lup Ki Wan B.A.Sc. University of British Columbia, 1983 A THESIS SUBMITTED IN PARTIAL FULHLLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in THE FACULTY OF GRADUATE STUDIES DEPARTMENT OF ELECTRICAL ENGINEERING We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA March 1991 © Frank Lup Ki Wan, 1991 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of The University of British Columbia Vancouver, Canada DE-6 (2/88) Abstract The Genetic Algorithm was used to estimate the hydraulic compliance of the hydraulic system on the UBC teleoperated heavy duty excavator. Using real recorded and simulation data from the excavator, the Genetic Algorithm has successfully identified the compliance of single link and multilink hydraulic system of the excavator. A Parallel G A ( PGA ) was implemented with 16 T800 Transputers. It achieved a speedup factor of 12 over a traditional GA. With such a high speedup factor, real-time monitoring of hydraulic compliance and other hydraulic parameters is becoming possible. New mechanisms such as the distributed fitness function, the active error analysis were used to enhance the performance of a PGA. A PGA which incorporated these mechanisms actually outperformed a traditional GA in key areas such as variance of the estimated parameter and parameter tracking ability. Finally, a physical model that explains the fundamental properties of GAs was introduced. The physical model ( a hypercube ) not only provides an excellent explanation of GAs searching power, but also gives insight to GAs users ways to improve and to predict the performance of GAs in most applications. ii Table of Contents Abstract ii List of Figures vi Acknowledgements ix 1 Introduction 1 1.1 What are Genetic Algorithms ? 1 1.2 Scope of the thesis 4 2 Related background 7 2.1 Teleoperated heavy duty hydraulic machine 7 2.2 The need for an on-line diagnostic program 8 2.3 How the compliance of the hydraulic system changes 9 2.3.1 Hydraulic fluid ( C flui d 10 ) 2.3.2 Mechanical problems ( C cture ) 13 2.3.3 How hydraulic compliance affects the stability of a P-D controller 16 2.3.4 Comments 20 stni 2.4 Difficulties in identifying the compliance of the hydraulic system 3 Identification of hydraulic compliance with GA 3.1 Identify the compliance of a mobile hydraulic machine 20 23 23 3.1.1 Single link identification 24 3.1.2 Implementation details 27 3.1.3 Experimental Results 29 3.2 Identifying multiple link hydraulic compliance simultaneously 34 3.3 On-line identification of hydraulic compliance with GA 40 3.4 Comment and Discussion 42 iii 4 A Parallel Genetic Algorithm implementation for hydraulic compliance identification 44 4.1 Introduction 44 4.2 Speedup, efficiency, and parallel architectures for PGA 46 4.3 Comparison between PGA and tradition GA performance in identification of hydraulic compliance 5 54 4.4 Comments and discussion 56 PGA in system identification 60 5.1 Previous work on PGA ( algorithm B ) 60 5.2 Important requirements on PGA in system identification 61 5.2.1 The conventional PGA implementation ( algorithm B ) 61 5.2.2 Differences between function maximization and system identification 62 5.3 PGA performance Improvement in system identification 65 5.3.1 Distributed fitness function 65 5.3.2 Broadcasting with active error analysis 66 5.4 Testing the distributed fitness function and active error analysis on various PGA 6 7 configurations 70 5.4.1 Experimental result 73 5.5 Comments and discussion 81 Physical insight into how Genetic Algorithms work 83 6.1 Genetic Algorithms search space 84 6.1.1 The binary unit basis 85 6.1.2 The Reproduction, Crossover and Mutation operators on the hypercube 88 6.2 The importance of encoding the parameter space properly 94 6.3 Comments and discussion 98 Conclusions 100 Appendix A The boom hydraulic circuit and its model iv A.103 Appendix B Dynamic equations for hydraulic system in configuration a, branch #1 . B.106 B.l Equations describing the hydraulic configuration a branch #1 B.107 B.2 Simplified orifices area calculation B.108 Appendix C Speedup and efficiency definitions C.109 Appendix D Overview of available computational resources D.110 Appendix EPGA implementation details E.112 Appendix F Hydraulic compliance identification program listing F.117 References F.l 18 V List of Figures 1.1 A typical Genetic Algorithm flow chart 2.1 Caterpillar 215B excavator 2.2 The physical model of a conventional hydraulic system on a CAT215B excavator 2.3 3 11 11 Effect of pressure on the bulk modulus of an air-oil mixture. The air is free 12 2.4 Rate of solution of air bubbles in hydraulic oil 12 2.5 Schematic of a heavy-duty hydraulic actuated boom 16 2.6 Steady State Flow 2.7 General block diagram of a hydraulically actuated robot with P-D feedback QBOI versus Pressure Peoi and Spool Displacement . 16 control 17 2.8 Response of a P-D controlled hydraulic manipulator to step input . . . . 19 2.9 Response of a P-D controlled hydraulic manipulator with the decreased stiffness 19 2.10 Schematic diagram of the hydraulic main circuit 21 2.11 Different configurations of the hydraulic main circuit 21 2.12 The branch #1 of the main hydraulic valves in configuration ( a ) . . . . 22 3.1 The block diagram of the refitted hydraulic system for teleoperation control 24 3.2 Schematic of a heavy-duty hydraulic actuated boom 28 3.3 Data record 28 3.4 G A interface to the measurement data 29 3.5 Experiment #1 ( with spool data ) 31 3.6 Experiment #2 ( with servo-valve voltage data ) 32 3.7 Block diagram of the identification and simulation setup 33 vi Comparison between measured Peoi and calculated PBCM 34 Simulation of bucket and boom hydraulic circuit 37 Identified internal states from GA 38 Estimated CBUI and CBOI 39 Interface between the control system and diagnostic program 41 Different sets of population for different hydraulic configurations . . . . 42 Two Parallel Genetic Algorithms Architectures 45 Two levels of parallelisation 48 Two parallel architectures for PGA 51 Nonpipeline implementation flow chart 52 Pipeline implementation flow chart 52 Speedup factor of nonpipline implementation versus number of processors 53 Speedup factor of pipeline implementation versus number of processors . 53 Block diagram of GA and PGA for identifying hydraulic compliance . . 55 Experiment #1 ( with spool data ) 58 Experiment #2 ( with servo-voltage data ) 59 Block diagram of GA and PGA in system identification 63 A matrix of fitness error versus different window size 67 PGA configuration #1 with or without distributed fitness function . . . . 76 PGA configuration #2 under highest broadcast rate of 1 per generation with or without distributed fitness function 77 PGA configuration #2 performance with or without distributed fitness function 78 PGA configuration #2 with distributed fitness function and active error analysis 79 Compare PGA configuration #2 ( distributed fitness function and active error analysis ) with traditional GA vii 80 6.1 Mapping an one dimensional signal into a hypercube 87 6.2 A four dimensional hypercube 88 6.3 The possible locations of the offspring as a function of the bit difference between parents 90 6.4 The combined effect of Reproduction, Crossover 94 6.5 An impulse-like fitness function 94 6.6 Block diagram of conventional GA and new combination GA 95 6.7 "Coarse" and "Fine" GA grid size A.l The boom hydraulic circuit. A. 103 A. 2 The mathematical model of the boom hydraulic circuit A. 103 B. l The branch #1 of the main hydraulic valves in configuration a . . . . B.l06 D.l Available hardware resources D . l 11 D. 2 The block diagram of the Transputer T800 D. 111 E. l Software block diagram of the master-slave scheme E.l 14 E.2 The Implementation of a PGA ( algorithm A and B ) E.115 E.3 Measurement Method used for Timing Process E.115 viii . 96 Acknowledgements 1 am grateful to my supervisors Dr Lawrence and Dr. Dumont for being so patient with me, to let me explore many different interesting areas, and to see me through writing my thesis. 1 like to thank K. Kristinsson for permitting me to use the core of his Genetic Algorithm program and his help on translating his program from Pascal to C. 1 am especially grateful to N. Sepehri for his help and the use of his detailed documentation on the hydraulic system of the UBC teleoperated excavator. 1 will always remember and grateful for the encouragement and support from Darrell Wong, Dan Chan, Real Frenette, Edward Lam and David Warkintin. Finally, 1 am indebted to my family. Their faithful support has made this work possible. ix Chapter 1: Introduction Chapter 1 Introduction 1.1 What are Genetic Algorithms ? Genetic Algorithms (GAs ) are search procedures based on the mechanics of natural genetics and natural selection. They extract the ideas of survival of the fittest from nature to form a robust search mechanism. GAs are a parallel, global search technique that can simultaneously search through many points in the parameter space. GAs differ from other search techniques by the use of concepts taken from natural genetics and evolution theory. 1. GAs use finite length codings of the parameters ( usually in binary ), instead of the parameters themselves (The binary string coding of parameters is necessary for the Crossover and Mutation process ). 2. GAs work with a population-by-population approach rather than point-by-point techniques. 3. GAs need onlyfitnessvalues (dependent on application). There is no requirement for derivatives or other auxiliary knowledge. 4. GAs use probabilistic transition rules instead of deterministic ones. A simple GA consists of three operators: Reproduction, Crossover and Mutation. Reproduction is the survival of the fittest within a GA. Based on the survival of the fittest principle, it decides which strings are going to survive and which ones are going to disappear according to their normalized fitness values. Individuals with above averagefitnesswill have more offsprings than those with below average fitness. This step directs the search towards the best individuals. Crossover is a randomized yet structured operator that takes valuable information from both strings ( parents ) and combines it to find a highly fit individual. To apply this operator, 2 individuals are mated at random and a point on the interval l < k < N - l ( N = length of the binary encoded strings ) is chosen randomly. Two new strings are then created by exchanging all characters between positions 1 and k inclusively. For example, given the following two binary encoded strings: 1 Chapter J: Introduction A = '0000000' B = '1111111' 0 0 (1.1) and with crossover point at 4, the new strings will be: Ai = '1111000' B = '0000111' x (1.2) The Reproduction and Crossover operators are responsible for most of the searching power of the Genetic Algorithm. The Mutation operator is used to introduce new information into the population at the bit level. It acts as an insurance policy against the loss of important genetic material at a particular position. Figure 1.1 shows a simplified block diagram of a genetic algorithm. A more rigorous explanation of how the GA work is in Holland's "theory of schemata"[ll]. The GA always converges toward the best from the algorithm's point of view. However there is no guarantee that it will converge to the optimum ( the true value ). Nevertheless it has many advantages over other "identification methods" Identification methods such as recursive least squares, instrumental variable method are based on the principle that a smooth search space exists. These recursive schemes are in essence local search techniques that search for zero gradient by going in a direction suggested by the local gradient. Thus they often fail in the search for a global maximum if the search space is not differentiable and linear in the parameter space. Statistical techniques will do better in multimodal functions ( which have multiple optima), but they require too much computation time for higher dimensional problems. GAs have been shown to behave well on multimodal functions. They work much more subtly than just a random search with preservation of the best Their ability to handle functions that are nonlinear and discontinuous makes them good candidates in function maximization and system identification. GAs do require massive computation power since they are population rather than single point based algorithms. However, GAs are inherently parallel. A l l individuals in a population evolve simultaneously without central coordination. Many parallel implementations of the G A [18][17][16][24][25] for function maximization have been demonstrated recently. With the advent of parallel processing, GAs are becoming a practical on-line identification method for many "difficult" problems. 2 Chapter 1: Introduction Initial ization: - Set the parameters search space - Randomly generate a population I Applying a fitness function Genetic Algorithm Operators: 1. Reproduction 2. Recombination 3. Mutation 1 1 populati uon Output the best fit individual Figure 1.1: A typical Genetic Algorithm flow chart To demonstrate how a GA works, a second-order system of the following form is used: y(k) = a x x y(k - 1) + a x y(k - 2) 4- 6 X (u(k) + bi x u(k - 1)) (1.3) 0 2 Where ai, a2, bo, b\ are the unknown parameters. Assuming the range of the unkown parameters are, - 5 < ai < 5; - 5 < a < 5; 2 - 5 < 60 < 5; -5< b < 5 { (1.4) the unknown parameters are converted into binary numbers. The number of bits ( N ) for each parameter depends on the required resolution. N can be calculated with the following equation: resolution = (upper bound - lower bound) N 2 or : (upper bound — lower bound) N = log2 resolution (1.5) The binary numbers are concatenated to form an individual string as: £(<*,) I B(a ) \ B(b )\ 2 0 (1.6) Bih) If a resolution of 0.01 is used for all the parameters, such an individual string length will be 40 bits long. . Chapter J: Introduction The choice of the population size depends strongly on the individual string length [8]. For string length of 40, a population size between 100 to 400 should be used[8]. A random number generator is initially used to generate all individuals in the population. For discrete parameter identification, a fitness function can be defined as: window size fitness =y^(Bias - (y(k — to) — y(k - w))) (1.7) u>=0 where: y(k) = measured output value of the system. y(k) = calculated output value based on the estimated parameters. Bias : a positive constant that ensures positive fitness for good estimated parameters. Window : used to minimize the estimated parameters' variance. Refering to Figure 1.1, after fitness values of all individuals in the population are calculated, the GA operators such as Reproduction, Crossover and Mutation will operate on the corresponding individual binary strings. The binary string format allows GA operators to create a new generation of binary strings. The search for a better individual ( parameters ) will continue as shown in Figure 1.1 1.2 Scope of the thesis Das and Goldberg[5] have shown that a GA can be used in estimating discrete-time parameters. They have demonstrated the feasibility of a GA in identifying parameters a second-order system and suggested future GA extensions to more complex problems. Kristinsson and Dumont [13] have made use of the unique properties of GAs to directly estimate poles and zeros of a system. By doing so, the design of an adaptive pole-placement controller for such system is simplified. They found that: 1. A GA convergence rate is similar to that of Recursive Least Square ( RLS ) in terms of number of input-output data points. 2. A GA gives unbiased estimates in the presence of colored noise. 4 Chapter 1: Introduction 3,. A GA could be used in cases where the system is not linear in the unknown parameters ( RLS cannot be applied ). Because of its unique advantages, GAs can be applied to areas where conventional identification methods perform poorly or fail. A good example of such an area is the hydraulic system in a typical heavy duty mobile machine, e.g. an excavator, where it is very difficult to apply conventional identification methods. For example, the compliances ( denned later ) of the hydraulic system are very important since they affect the controllability of the hydraulic system. In order to apply GAs in real-time system identification, it is necessary to run the GA on multiple processors. There are several ways to parallelize GAs. It is important to determine the achievable speedup factor, efficiency of a parallel implemented GAs ( PGAs ) that are used for system identification. Many papers have been published on using the PGA in function maximization. However, system identification requirements are quite different from that of function maximization. The performance of PGAs used for system identification can be further enhanced or optimized by various techniques. Thus it is possible that in certain applications, PGAs can outperform traditional GAs in key areas such as convergence rate of estimated parameter and variance of the estimated parameters. This thesis is organized into the following chapters: 1. Chapter 2 describes the operation of the teleoperated heavy duty hydraulic excavator and the related backgrounds of the excavator hydraulic system. It also illustrates mechanisms that can cause the compliance of the system to vary. 2. Chapter 3 shows how a GA is used to estimate single link and multiple links hydraulic compliances on the excavator. It also presents one possible way to estimate mult-link hydraulic compliance on-line with GAs. 3. Chapter 4 discusses ways that GAs can be parallelized. It suggests ways to improve the speedup factor and efficiency of the parallel architectures for PGAs. A PGA is implemented to estimate the hydraulic compliance in the excavator hydraulic system ( Chapter 3 ). The performance of such PGA and traditional GAs is compared. 5 Chapter J: Introduction 4. Chapter 5 discusses ways to improve PGAs performance in system identification. Various techniques will be used and their effectiveness on PGAs performance will be examined. 5. Chapter 6 offers physical insights on the searching power of GAs. 6. Chapter 7 will summarize all the above ideas and suggests future research. 6 Chapter 2: Related background Chapter 2 Related background 2.1 Teleoperated heavy duty hydraulic machine Figure 2.1 shows a typical manual joint mode control found on excavator machines today. The control consists of two two-degree-of-freedom joysticks with a one-to-one mapping between the joystick motions and the links. This method of control is very easy to implement but requires extensive training time for most operators to master. In the Telerobotics Lab at UBC Electrical Engineering, resolved motion control is used on the prototype teleoperated heavy duty hydraulic excavator. Resolved motion control, which is based on end point trajectory technique [23], provides a much more "natural" motion interface to the operators. There are many benefits of applying teleoperation and computer control to heavy duty hydraulic machines: 1. Computers can create a better human interface, such as resolved motion control, to the machine. While it may take one year for operators to be proficient in the manual joint mode control, most operators can usually master the resolved motion control in a much shorter period. Resolved motion can also increase the operator productivity. 2. Advanced control algorithms provide a more efficient and safer way to control the hydraulic actuators in the machine [23]. 3. Overload sensing and stability checking can be added to a teleoperated machine. Such features can prevent dangerous manoeuvres by the operators. The safety of the operators and the machines arc thus increased. Figure 2.1 shows the physical block diagram of the hydraulic system of a conventional manually operated CAT 215B excavator. The major components of the system are: 1. Pilot valves: manual control for the pilot pressure which determines the spools displacement in the main hydraulic valves. The displacement of the spools in the main valves determine the orifices areas of the main values. 7 Chapter 2: Related background 2. Main valves: It is the heart of the hydraulic system. It consists of 2 independent branches. Each branch is connected to a constant flow pump. Branch #1 contains the bucket and the boom valves and branch #2 contains the swing and the stick valves. A cross-over network consists of pressure operated valves which connects both branches together. The cross-over network allows either pump to provide surplus power from one branch to other branch when needed. The schematic of the main valves is in Appendix A. 3. Hydraulic actuators: The boom, the stick and the bucket are moved by linear hydraulic actuators. The swing is powered by a hydraulic motor. A l l the input and output lines of the hydraulic actuators and motor are connected to the main valves by flexible hydraulic hoses. For teleoperated control, the conventional pilot valves are replaced with a new set of servo- valves. The servo-valves will respond to the control voltage and build up the corresponding pressure to move the main hydraulic spool to the desired displacement. Pressure sensors are installed on the input and output lines of the hydraulic actuators ( swing motor, boom, stick, bucket ). Resolvers are installed on the mechanical joints to measure joints angles. The block diagram of the refitted hydraulic system is illustrated in Figure 3.1. 2.2 The need for an on-line diagnostic program Heavy duty hydraulic machines such as excavators are designed to operate in a rugged environments. Periodic maintenance will help cut down the repair frequency of machines. Yet for hydraulic machines operating in a rugged environments, component breakdown is very common. Many machine failures are not foreseeable and repairs are done on as-required basis. In forestry, major repairs are difficult for machines operating in remote areas. The downtime of such machines can be as high as 30% of the machine's life time. Some experienced operators can readily sense malfunction or performance degradation of the hydraulic machines. With the manufacturers' diagnostic procedures and the operators' experience, faulty or damaged components can be isolated and the necessary repairs made. The control of a teleoperated heavy duty hydraulic machine is similar to the "fly-by-wire" control on advanced aircrafts such as Airbus 300 series. The operator's joystick motion is translated into 8 Chapter 2: Related background commands by the computer and the corresponding hydraulic actuators motions are executed using some control algorithm. In a closed loop control system, the operator is isolated from the physical machine. Using the prototype teleoperated excavator as an example, if there was a leakage in the boom hydraulic actuator , both experienced and inexperienced operators could not observe any steady-state error in boom motion since the closed-loop control would have compensated for the leakage. If one of the hydraulic hoses was worn out or damaged, the operator may detect some degradation in the machine performance, but he would rely on the computer to perform the proper diagnosis. For reliable and safe operation of any teleoperated hydraulic machine, the onboard computer must periodically perform on-line self-checking, which involves identifying some important hydraulic parameters of the hydraulic circuit. With the help of a proper on-line diagnostic program, it may be possible to identify early signs of most common mechanical problems, such as worn out hydraulic hoses, dirt build up in the hydraulic valve, and leakage in hydraulic actuator, before they become major problems later. The on-line diagnostic program will reduce the downtime of the machine. 2.3 How the compliance of the hydraulic system changes The hydraulic compliance of a typical mobile hydraulic machine, i.e. an excavator, used in the primary industry can be defined as: + C, system c, (2.1) (2.2) where C.system = the compliance of the hydraulic system the compliance of hydraulic fluid C,•structure = the compliance of the flexible hose and the surrounding structure. 9 Chapter 2: Related background Vfl jd = volume of the fluid y^fluid = the bulk modulus of hydraulic fluid u " 2.3.1 Hydraulic fluid ( C d ) flul The compliance of the hydraulic fluid changes with time due to aeration. Air can be dissolved or entrained in hydraulic fluid. However, the bulk modulus of the hydraulic fluid, (3 is affected by undissolved free air in the fluid ( Figure 2.3, reprinted from [19]). Under high pressure, more air can be dissolved in hydraulic fluid. However as air bubbles are compressed and passed through the pump, they do not dissolve immediately. Figure 2.4 ( reprinted from [19] ) shows the rate of solution of air bubbles in hydraulic oil. Very often tiny bubbles of air accumulate on the surface of the hydraulic actuator or valve, causing the hydraulic compliance of the actuator to increase by an order of magnitude[19]. 10 Chapter 2: Related backgrounds Figure 2.1: Caterpillar 215B excavator Spool Pilot-Valve Pump Pump #1 #2 1 I Spool Operator Manual Control ' PUot-Varve Spool PUot-Valve Main Hydraulic Valves I PU 1 Pilot-Valve Spool hydraulic hose PO I \ 3 Bucket Stick • Boom H-\ oD Swing Figure 2.2: The physical model of a conventional hydraulic system on a CAT215B excavator 11 Chapter 2: Related backgrounds Figure 2.3 Effect of pressure on the bulk modulus of an air-oil mixture. The air is free. Tim* (s) Figure 2. if Rate of solution of air bubbles in hydraulic oil Chapter 2: Related background 2.3.2 Mechanical problems ( Cstmctw-e ) There are many other conditions such as worn out hydraulic hose, leakage inside the hydraulic actuator and seal failure that could cause the compliance of the system to deviate. Leakage in actuator or seal failure In a manually operated hydraulic machine, if there is a significant leakage ( i.e. 5% to 10%) in the hydraulic actuator, the operator will notice some loss of power and unwanted drift motion in the associated link. In a teleoperated hydraulic machine, the closed-loop control would compensate for the loss of power and drift motion. Thus the closed-loop control could mask the symptoms of the leakage or improper sealing in the hydraulic actuator from the operator. If unattended, this minor problem may evolve into a major machine failure and the safety of the machine operator will be compromised. Referring to the boom hydraulic circuit in Figure 2.5, if there is no leakage in the actuator: Qi = dPi + AX (2.3) where : Qi = flow at the pump side d = the hydraulic compliance Pi = change in pump side pressure Ai = area of the pump side cylinder X = velocity of the cylinder rod Assume there is a leakage in the actuator, Qj flows from input chamber along the wall of the cylinder to the output chamber. Q'i = C'iP'i + AiX + Qi 13 (2.5) Chapter 2: Related background where : Qi = new flow at the pump side C'i = apparent hydraulic compliance Pi = new change in pump side pressure Ql = leakage in the boom actuator Because of the closed-loop control, the error in boom angular velocity is small in steady state and X remains unchanged. However the transient response of the system is quite different and the abnormality can be detected by monitoring the compliance. Combining the above two equations, Qi = C'iP'i - dPi / , x • < \ Ci - CAPi • •• since P > P { ( -7) 2 { Thus the change in compliance will be at least proportional to the leakage: (C'i - d) = Ad > ^ (2.8) If the compliance of the hydraulic circuit is monitored periodically, then the abnormal deviation in the measured compliance would be detected and warning can be sent to the controller. Voltage-spool transfer function drift Drift in voltage-spool transfer function can be caused by a worn out spool or poor pressure regulation in the servo-valves. Since such problems affect the flow directly, the measured compliances are affected as well. Referring to the boom hydraulic circuit in Figure 2.5, the sensitivity of steady state flow with respect to pressure and spool displacement can be seen in Table 2.6 which is derived from the hydraulic equations for boom ( Appendix A ). For example, an error of 0.02 inch ( 8 % ) in spool displacement causes a 50% difference in flow QBCM- 14 Chapter 2: Related background In the prototype teleoperated excavator designed at the UBC Robotic Lab, an advanced control algorithm based on a computed flow control is used [23]. This control algorithm consists of feedforward compensation and conventional proportional-derivative feedback. This feedforward compensation technique decouples the nonlinearities in the hydraulic and joint structure of the excavator. With most of the nonlinearities compensated by the feedforward term, the controller can use smaller proportional Kp and derivative Kv gain in the feedback to correct for minor unmodelled dynamics. The controller will be more stable and performs much better than a simple P-D feedback controller. The feedforward term involves calculating the desired spool displacement based on the line pressure readings and the desired joints velocities. Using the spool-voltage transfer function ( the inverse of voltage-spool transfer function, Appendix B), the control voltages for the servo-valves can be found. Thus any offset drift in the servo-valve voltage-spool transfer function will cause the feedforward term to be incorrect. From Table 2.6, an error as high as 50 percent in the feedforward term is possible. The controller performance will deteriorate significantly since the proportional and derivative feedback have to compensate for all 50% of the highly nonlinear flow error. Pump Figure 2.5: Schematic of a heavy-duty hydraulic actuated boom 15 QBOJ PBOJ@ [ 2030 psi PBOI @ [ 1830 psi K13996 kPa ) 12617 kPa ) 11239 kPa ) Spool [ in ]( cm ) Spool [ in ]( cm ) [ in /s ]( cm /s ) Spool [ in ]( cm ) 3 3 ]( PBO;@ t 1630 psi ]( [ 60 ] ( 983.4 ) [ 0.2741 ] ( 0.696 ) [ 0.2688 ] ( 0.6827 ) [ 0.2627 ] ( 0.6673 ) [ 50 ] ( 819.5 ) [ 0.2650 ] ( 0.673 ) [ 0.2592 ] ( 0.6584 ) [ 0.2527 ](0.6419) [ 40 ] ( 655.6 ) [ 0.2561 ] ( 0.650 ) [ 0.2499 ] ( 0.6347 ) [ 0.2427 ] (0.6165 ) Figure 2.6: Steady State Flow versus Pressure Peoi and Spool Displacement QBCH 2.3.3 How hydraulic compliance affects the stability of a P-D controller The effect of hydraulic compliance on the system under P-D closed-loop control was illustrated in [14]. Figure 2.7 shows a block diagram of a hydraulically actuated robot with P - D feedback control. The linearized spool and hydraulic actuator model are combined with the proportional and derivative feedback control to form an overall transfer function: Pips) _ K ag p 5 + as Qf(s) n 2 2 •2K D = v K —j--—; <n = XL a o + (oi + OQK )S + K OQ M PI P 2D 2 ( 2 a = -y-^; M ' 9 ) 2 Where: 0, is the angle of the robot arm, is the desired angle of the robot arm, K p is the proportional feedback gain, K v is the velocity feedback gain, Q is the hydraulic compliance. From the above equations, one can see that C; determines the transfer function pole locations. Thus the stability and closed-loop performance of the hydraulic system depend heavily on the value 16 Chapter 2: Related background 6d r i i i. • PIOCXSS T* MWT AIM I L. Figure 2.7: General block diagram of a hydraulically actuated robot with P-D feedback control of Q . Figure 2.8 ( reprinted from [14] ) shows the response of a P-D controlled hydraulic manipulator to a step input. In Figure 2.9 ( reprinted from [14] ) , the same K and K were used but with Q p v increased by a factor of 4. The increase in Q caused the response to be oscillatory. 17 Chapter 2: 8 TIME, »•* Figure 2«© Respond of a P-D controlled hydraulic manipulator to step input S TMX. x Figure 23 Response of a P-D controlled hydraulic manipulator with the decreased stiffness I2> Chapter 2: Related background 2.3.4 Comments In a teleoperated hydraulic machine, the performance of the controller is affected by the hydraulic compliance of the system. Since many other common problems such as wom-out hoses, trapped air bubbles, leakage in the actuator, and defective seals all affect the compliance, monitoring the compliance will give the diagnostic program an early warning from problems in the hydraulic system. With additional information and help from some other techniques, it is possible for the diagnostic program to isolate the causes. Proper action can be taken before the teleoperated heavy duty hydraulic machine performance starts to degrade significantly or major machine failures happen. 2.4 Difficulties in identifying the compliance of the hydraulic system Difficulties The main hydraulic valve is the heart of the hydraulic system. The schematic diagram of the hydraulic main valves is shown in Figure 2.10. 1. The complexity of the circuit is increased by the presence of the cross-over network. Depending on the internal pressures P12, P13, P22, P23. the hydraulic circuit can have 5 possible configurations ( Figure 2.11 ). 2. The equations that govern the hydraulic system are nonlinear and the steady state solution can only be obtained by iteration method. Fig. 2.12 shows the configuration a, branch #1 and the set of equations that describe the hydraulic circuit Note that the internal states P u , P12, Q11, Q12 have to be solved by iteration method. 3. The hydraulic compliance can only be identified during the transient stage of the hydraulic actuator's motion, i.e. when the line pressures PBUI and Prjoi are still rising. The number of data points available is small. The identification algorithm must have a fast parameter convergence rate. 19 Chapter 2: Related backgrounds M a i n Hydraulic Valves Pump 1 PiiK L_!_l Qt j . . u J u n c t i o n #1 Tank > ^aobu ^ ^aibu Bucket ^ Spool aebu Jon hose <BUo P12 hose BUi > Junction M2 ^aebo | ^ ^ ^aobo aibo I | Tank Boom BOo Q12 Oo hose Bucket Pe Actuator p BOi Tank hose Boom BOo Actuator l*BO Figure 2.12: The branch #1 of the main hydraulic valves in configuration ( a ) 21 Spool Chapter 3: Identification of hydraulic compliance with GA Chapter 3 Identification of hydraulic compliance with G A 3.1 Identify the compliance of a mobile hydraulic machine The G A was used to identify the hydraulic compliance of the refitted hydraulic system of the prototype teleoperated CAT 215B excavator. The block diagram of the hydraulic system is showed in Figure 3.1. Why the Genetic Algorithm ? The Genetic Algorithm ( GA ) is chosen to identify the compliances of the system because: 1. The number of unknown parameters is small. There are 4 independent links and thus only 4 compliances Cswi. CBCH. CSTI. and Cam that need to be identified. The size of the global population for G A depends strongly on the number of unknown parameters. A large global population will require extensive computation power. 2. The unique feature of GA is that it does not put strict requirements on the model. Its population based searching algorithm can easily handle discontinuities and nonlinearities in a model. The GA does not require the hydraulic equations to be arranged in any form. There is no need to rearrange the equations to find a closed form solution for the internal states P u , P12, ... etc. . 3. Due to the cross-over network, the model of the hydraulic system is changing from time to time depending on the operator command and the external loading. It is very difficult to find an identification method, especially a recursive one that can handle such model changes. The GA is a nonrecursive algorithm. It stores the estimated parameters in its population, which is independent from changes in the model of the hydraulic system. 4. Previous work[5][12] showed that the GA parameter convergence rate is similar to ( or slightly faster than ) Recursive Least Square methods. Thus GA parameter convergence rate is sufficiently high for compliance identification. 5. Even though GA is computation intensive, it is a naturally parallelisable algorithm [17] [24]. The GA speed can be improved with parallel processing. 21 Chapter 3: Identification of hydraulic compliance with GA Pump #1 Vbu Operator Vst Vbo 3l Servo-Valve hydraulic hose PO Bucket PI Spool Servo-Valve Servo-Valve Servo-Valve Stick Main Hydraulic Valves Spool Joyslick Intei face Vsw Pump #2 Boom Spool Swing PI PO APressurei_sensor Control Algorithm: Feedforward compensation + P-D feedback control Resolver Figure 3.1: The block diagram of the refitted hydraulic system for teleoperation control Other method ( Recursive Least Square method ) Recursive Least Square ( RLS ) method can be applied to single link hydraulic compliance identification by linearizing the simple single link hydraulic equations. However.there are quite a few difficulties in applying RLS in multi-link example. First, because there is no closed form solution for Pii and P12 (internal states of the hydraulic system ), it is difficult to formulate the constraints into the RLS formula. Second, since the hydraulic equations are highly nonlinear, there is no guarantee that the algorithm RLS will converge at all. Although RLS is much less computational intensive (30 — 50 times less ) than the conventional GA, it can not be used in the hydraulic area because of the problem nature. 3.1.1 Single link identification The boom link was chosen to test GA performance in identifying the hydraulic compliance. Figure 3.2 shows a schematic of a heavy-duty hydraulically actuated boom of an excavator. The three orifices ( ai, ae, ao ) belong to the boom main valve and are controlled by the boom spool. The main valve is connected to the actuator through two flexible hoses ( compliances Ci and Co ). The side of the actuator which is connected to the pump with output flow Q is called the pump 23 Chapter 3: Identification of hydraulic compliance with GA side and the side which is connected to the tank is called the drain side. The pump pressure P is measured but it is too noisy to be useful. Line pressures Pi and Po are measured by pressure sensors and they are related to the flows as follows Pump Side: Qi = AX + Pid = ka ^P-Pi (3.1) Q = ka fP^T (3.2) { e ey e (3.3) Q = Qi + Qe Drain Side: Q = A X0 0 PC 0 0 = ka y/P - P eo 0 e (3.4) where k is the discharge coefficient [20]. Pe is the tank pressure, Qe is the flow to the tank, and Q is the total pump flow ( a known constant ). The above equations are used to identify parameters Q and C . For example to identify Q , the 0 above equations are used as follows: 1- Given the measured values of Pi(m), where (m) denotes measured data, and the boom joint angle at time t, the first order derivative of the pressure Pi and boom angular velocity are determined by linear piece-wise least-square curve-fitting technique. ( X(m) is proportional to the boom angular velocity ) 2- A population consisting of binary encoded string Cj(j), (j=i,2,.. n ) with its range defined already ( 0.1 > Q > 0.0 ) is initially generated randomly. The above equations are used recursively as follows: Qi = AiX(m) + Pi(m)Ci(j) 24 (3.5) Chapter 3: Identification of hydraulic compliance with GA (3.6) Q< = (3.7) ka \Jpe Error = E(j) — Q - (3.8) Qi where Qi, Q P are the intermediate state information. Note that the measured pump pressure e< P is too noisy, the estimated one P is used in the calculation instead. The orifice areas are derived from the spool or the servo-valve voltage measurement ( Appendix A ). Absolute operators are used to prevent Error cancellation due to sign difference in the calculation 3- Step two is performed over a window size to minimize the estimated parameter Q variance and the effect of noise. The fitness value of a particular Q(j) is defined as: window fitness(CiU)) = £ t window {B-E\j))< £ t B (3.9) where : window = 10 B = 400 The value of B ( Bias ) is chosen so that if E (j) is larger than Bias, thefitnessvalue of such 2 C;(j) will become negative. 4- Based on the fitness value, Q(j) with highfitnessvalue will be allowed to have more offspring. Q(j) with small or negative fitness value will be discarded from the population. GA operators ( Crossover and mutation ) will then generate a new population of Q(j) j=i,2 - Step one to three n are then repeated until the transient period is over ( Pi(m) is steady ). Q(j) with the highest fitness value will be outputed or recorded. 25 Chapter 3: Identification of hydraulic compliance with GA 3.1.2 Implementation details The recorded data was obtained from Real Frenette and Nariman Serpehri's feedforward compensation, open loop experiment on the prototype teleoperated CAT215B excavator. Figure 3.3a-d showed the recorded data of boom actuator line pressures ( Psoi and PBOO ) » servo-valve voltage and spool measurement, and boom angle versus time for a boom command angular velocity of 4 deg/s . 26 Chapter 3: Identification of hydraulic compliance with GA Velocity command Boom Angle - 0 Time (Sec) Time ( Sec ) PBOi. PBOo. Ppump V o l t ( m V ) S p o o l f i n c h x .001) 500- -500 Time (Sec) Time (Sec) Figure 3.3 Data record Chapter 3: Identification of hydraulic compliance with GA Preparation and Considerations The accuracy of the mathematical model: The mathematical model should be a good approximation of the physical process. Otherwise, it would be difficult for GA or any other identification method to work properly. In the hydraulic model, thefirst-orderpipe model is only an approximation of the transmission line dynamic. The model ignores the turbulence and all other second-order effects. Filtering out noise in the measured data: Since GA is trying to identify hydraulic parameters during the transient period, it cannot perform much smoothing on the measured data ( even if it is noisy ) , because such an operation would eliminate the transient information. For example, the boom angle must be differentiated to obtain the boom angular velocity. If too many data points were used to find a smooth velocity profile, then the transient information of the boom angular velocity would be lost. The amount of smoothing on measured data should be kept to a minimum to preserve the transient information. Figure 3.4 shows how GA converts the measured data into the variables used in the equations. The first order derivative Psoi of the pressure and boom velocity are determined by a linear piecewise least-squares curve-fitting technique with number of data points limited to 5 samples. The complete detail of the boom hydraulic system is listed in Appendix B. P BOi Derivative r B o o m angle Servo-valve voltage Derivative B o o m angular velocity V- S p o o l transfer function spool positive B o o m l i n k geometry Spool dynamics v BO spool Spool-Orifices aibo transfer function S p o o l position ( i f a v a i l a b l e ) Figure 3.4: GA interface to the measurement data 3.1.3 Experimental Results The first attempt to identify Q failed. A negative value of C; was obtained from the measured data. After comparing the boom, the spool, voltage measurement with the results from simulation, 28 Chapter 3: Identification of hydraulic compliance with GA it was confirmed that both the spool measurement and the voltage-spool transfer function had the same offset error. That both the voltage-spool transfer function and spool measurement had the same offset error may be due to the fact that the voltage-spool transfer function was originally derived from the same measuring equipment An offset of 0.01 inch in spool measurement caused a steady state flow error of 20 percent. In the following experiments, both spool and voltage measurement were compensated by the calculated offset. Two experiments were performed. In the experiment #1, the spool measurement was used to calculate the orifice area ( ai, ae, ao ). In the experiment #2, the servo-valve voltage is used. If the servo-valve voltage is used ( Figure 3.4 ), then the spool dynamics will be involved in orifice area calculation. Even though the spool dynamics is not known precisely and may affect the accuracy of the calculated orifice areas, the servo-valve voltage is preferred because direct spool measurement may not always be available ( special equipment is needed ). The results of experiment #1 and #2 are in Figure 3.5 and 3.6 respectively. Line pressures PBOO PBOL and boom motion are showed in Figure 3.5 a-b. Identification was performed during the pressure rise where the compliance Csoi ( Q ) was effective. The estimated CBOI and Error ( defined earlier ) of both experiments are shown in Figure 3.5c-d and Figure 3.6c-d. In both experiments, during the period when G A was active, the Error was decreasing monotonically. The difference between estimated CBOI from both experiments was small ( 0.005 versus 0.0086 ). 29 Chapter 3: Identification of hydraulic compliance with GA 30 Chapter 3: Identification of hydraulic compliance with GA 2> •a or 2500 1 1 1 1 —i 1 1 •^2000 g 1500 £ 1 1 — ' a | 1000 .E 500 - 1 t r i i 40 LU 20 0 0 1 0.2 i » 0.4 • 0.6 0.8 Time Figure 1 1.2 1.4 1.6 1.8 (Sec) 3.:(5" Experiment #2 ( with servo-valve voltage data ) SI Chapter 3: Identification of hydraulic compliance with GA In order to test the accuracy of the estimated hydraulic compliance Ci, this estimated Ci value, with a different set of measured data ( voltage, boom angle ) are used in a simulation which would calculate the boom actuator input line pressure PBOI- The calculated PBCH would be compared with the measured PBOI- Figure 3.7 shows the block diagram of the excavator model, G A and the simulator. The line pressure PBOJ from the simulator and the measured Psoi are plotted in Figure 3.8a. The agreement between both measured and simulated Pfloi was excellent, an indication that the estimated CBOi ( 0.0086 ) was accurate. In order to see how CBOI affect two different values PBOL CBOJ ( 0.0043 and 0.0172 ) were used in the simulator and the estimated Psoi are plotted side by side with the measured PBOI in Figure 3.8b. There was a significant difference between these three sets of curves. The two experiments with the simulator confirmed the accuracy of the estimated Testing the accuracy of the estimated hydraulic parameters Feedback Joint angles' Actuator pressures 1 Excavator Structure: Control Bucket, Stick, Boom Servo-valves. Actuators of the Excavator Actuator pressure Genetic Algorithm Servo-Valve In Identification Joint angle Voltage (Boom angle) Hydraulic compliance Hydraulic System: Servo-valves, Actuators Excavator Structure: Comparison Bucket, Stick, Boom of the Excavator Simulator Figure 3.7: Block diagram of the identification and simulation setup 32 CBOI- Chapter 3: Identification of hydraulic compliance with GA Measured PBOi and estimated PBCH (Sboom = 4 deg/s 2000 1500 g. 1000 500 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (Second) Measured PBOi and estimated PBOi (5>boom = 4 deg/s 2000 1500 fVcG I. 1000 C ^ s o.otTz. 500 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (Second) Figure 3.8: Comparison between measured PBCH and calculated Peoi 3.2 Identifying multiple link hydraulic compliance simultaneously To demonstrate that G A can identify compliance Caui and CBOI simultaneously, the hydraulic system configuration a, branch #1 is used for illustration ( Figure B . l Appendix B ). To test the performance of G A , a simulation program based on the simplified hydraulics model is used ( Appendix B ). In the simulation, both bucket and boom are activated simultaneously. A l l the states of the simulated hydraulic system are shown on Figure 3.9a and Figure 3.9b. Every individual in the population was made up of a binary coded string ( 20 bits long, 10 bits for each parameter ) corresponding to CBIH and CBOJ- A n individual j was selected from the population pool and its genes CBUiO) and CBOIO) 1. At sample data point k, the Peui{k) w PBOi{k) e r w e c u s e r e d a s follows: obtained from measured PBUiOO, PBOi(k) by linear piece-wise least-square curve fitting technique. 2. Xsuik) Xso{k) were proportional to the bucket and boom joint angular velocity. 33 Chapter 3: Identification of hydraulic compliance with GA 3. CsuiCJ) and CBOIO) Given the flow w e r e u s e a Qsui{k) in Equation B2 ( Appendix B ) to solve for , the internal states Pn, Pi 2, QBOi(k) Qsuiik) Qsoiik) • were obtained Qn(k),Qn(k) from Equation B3 ( Appendix B ) . 4. Given that the flow in junction #1 and junction #2 were: Qt = QBW + Junctional Qn Junction#2 Qn = Qn + QBCH With the estimated Qsui{k), QBOi(k), Qn(k) Qn(k), (3.10) from CBIKCJ) and CBOIO)- the summation of flow errors in junction #1 and #2 were used as the fitness criterion for GA. E rror = (Junctional flow error) + (Junction#2 flow error) (3.11) = 5. {Qt - Q Ui(k) B - Qu(kj) | + | (Qn(k) - Q {k) i2 Q oi(k)) B A window of size 10 was used to minimize the estimated parameter variance and noise effect. window (3.12) t*=0 6. The selection process here was similar to the single link version. If the selected individual j genes CsuiO) and CBOIG) w e r e far from the correct value, the Error attached to the string were large and the string was removed from the population. On the other hand, individuals with high fitness values will reproduce more offsprings. 7. For every sample k, GA calculated the internal pressures P n , P12, and the flows Q n , Q12, Q_BOi for all the individuals j , (j=i,...,n) QBUL in the population and recorded the best individual and its associated internal states. 8. The GA operators ( Crossover and mutation ) operated on all the binary encoded strings and generate a new population. 9. Step 1 - 8 are repeated until the transient period is over (the line pressures PBUIOO and PBOIOO are steady ). 34 Chapter 3: Identification of hydraulic compliance with GA In this experiment, the population size was set to 120. The fitness window size was set to 10. To observe how well G A performed, one can compare GA estimated internal states and the simulated internal states of the hydraulic system ( Figure 3.10a and Figure 3.10b ). The agreement between both sets of curves is excellent. Figure 3.11 shows that estimated CBUI. CBOJ converge very rapidly to their true value. However, when the generation reaches 425, both estimated CBUJ. CBOI start to deviate. This phenomenon is caused by the lack of excitation in the input signal: both simulated PBUi(k) and PBOi(k) approach steady state values and Pnui(k) = 0, Prjoi(k) = 0 . 35 Chapter 3: Identification of hydraulic compliance with GA Figure 3.°, Simulation of bucket and boom hydraulic circuit 36 Chapter 3: Identification of hydraulic compliance with GA Pll .P12 50 . 100 150 Qll 50 W @C ufO0073,C O.011 & 200 Q12 150 bOf 250 300 350 400 QBu Q oi ; 200 B 250 300 350 Figure 3. |0 Identified internal statesfromGA 31 400 Chapter 3: Identification of hydraulic compliance with GA C 0.07 1 1 BuY Bo C @Ceu t 1 • i BQ.0073, 1 ©Cfepga.Ol 1 1 r i fa) 0.06 1r 0.05 0.04 - i- 0.03 0.02 0.01 - /. -JJJ, 1 50 100 150 A j • ( - 1 200 250 - r-\ 1 300 i ^.__^..„.^J.. i 350 400 Tr«ne ( 0.0025 s * ) Figure 3.11 Estimated Cam and CBOJ 38 1 QeAerctflOf] = 0.| SAC Chapter 3: Identification of hydraulic compliance with GA 3.3 On-line identification of hydraulic compliance with GA Interaction between the Control Algorithm and GA Depending on the operator commands and the loading of the system, the control algorithm demonstrated in [23] will respond and the hydraulic configuration will change accordingly. Communication between the control algorithm and the diagnostic program is essential since the on-line diagnostic program based on GA needs the configuration of the hydraulic circuit to track and identify the compliance. The on-line diagnostic program should be an integral part of the control system. The control system determines when and how often to perform a diagnostic check on the hydraulic system. It can also determine which configuration of the hydraulic system and which particular links should be checked by the diagnostic program. How GA handles multiple configurations of the hydraulic circuit There are 4 different compliances, CBUJ. CBOI, CSTI. Cswi that need to be monitored ( assume only the pump side of the hydraulic system is monitored ). Figure 3.12 shows the interface between GA and the control algorithm. The control algorithm supplies the configuration information to the diagnostic program. The diagnostic program will then run GA with the appropriate set of populations. Figure 3.13 shows different sets of population for 15 different hydraulic configurations: If only one link in any configuration is active, then GA will only use population set PI a, or Plb, or Pic, or Pld. For configuration with multiple active links, population sets P2, P3 and P4 will be used. For example, in configuration (a), branch #1 contains the bucket and the boom joints. Assuming that both bucket and boom joints in branch #1 are active, GA must identify the compliance CflUi and CBOI consists of simultaneously. Population set P2a is used because an individual in population set P2a CfiUi and CBOJ encoded in a binary string, and thus the GA operators such as Crossover, mutation can operate on the encoded parameters CBUJO) and CBOJCJ) simultaneously. If only the bucket is active, then GA will use population set Pla. Note, not all possible 15 combinations of CBUi.CBOi.CsTi and Cswi have to be identified. Referring to Figure 2.11 in Appendix A, starting from hydraulic configuration (a), two genetic algorithms are used for the two different branches in the hydraulic circuit GA #1 operates on 39 Chapter 3: Identification of hydraulic compliance with GA Online identification of hydraulic compliance with GA Hydraulic System Sensors Control System Measured Configuration Information Data Diagnostic Program x Estimated Hydraulic circuit (a) Configuration #1 Branch Genetic Algorithm GA Population (b) Compliance (c) (d),(e) #2 GA GA GA GA GA Pla P2a P2e P3a P3d Plb P2b P2f P3b P3e Pic P2c P3c P3f Pld P2d GA P4 Figure 3.12: Interface between the control system and diagnostic program population P2a while GA #2 operates on population P2b. If the hydraulic configurations changes from a to b, GA #1 will continue to operate on population Pla, while GA #2 will operate on population P3. Finally, for hydraulic configuration d and e, both branches are connected by the cross-over network. If all the links are active, then all the compliances must be identified at the same time. A GA will operate on population P4 where an individual is a binary string that encodes CBUJ. CBOI. CSTI. and Cswi- G A stores the estimated parameters in a population and there are redundant copies of the estimated parameters in different sets of population. For example, and P4. Values of CBUI CBUJ is in population sets PI, P2, P3, identified under different population sets correspond to different hydraulic 40 Chapter 3: Identification of hydraulic compliance with GA Population individual binary encoded string Pla CBUi Plb Pic CsTi Pld Cswi P2a CBUJ. CBOI P2b CsTi. Cswi P2c Caui. Csn P2d CBUL Cswi P2e CBOi. CsTi P2f CBOL Cswi P3a CBUi, CBOJ. CSTI P3b CBUI. Csoi. Cswi P3c CBOi. CSTI. Cswi P3d CBUi. CSTI. Cswi P4 CBUL CBOi. CsTi. Cswi Figure 3.13: Different sets of population for different hydraulic configurations configurations. By combining all the estimated compliances Caui. CBOI. CSTJ. Cswi in all different population sets, one can devise: 1. A way to cross check the accuracy of the estimated parameter. 2. A way to identify and to locate the particular faulty condition more precisely. 3.4 Comment and Discussion Results in the single-link and multi-links experiment indicate: 1. GA can accurately identify the compliance of the boom hydraulic circuit. 2. GA can work with a highly nonlinear system. In the multi-links hydraulic system, not only is the system nonlinear but also there is no closed form solution for the internal states such as Pu and P12. GA is able to bypass all the difficulties with its nonrecursive, population based algorithm. 41 Chapter 3: Identification of hydraulic compliance with GA 3. GA has unique searching power. It successfully searched out the right combination of Cnui and CBOI from the parameter space in only a few iterations ( generations ). Such fast parameter convergence rate is very important for real-time identification. In this chapter, the method of applying GA to identify the compliance of the hydraulic system has been demonstrated. It has also been shown how GA can overcome the nonlinearities and online model changes in the hydraulic system. GA has been found to perform exceptionally well in identification of hydraulic parameters. GA limitations The GA is similar to other identification methods in that it requires a good model in order to produce accurate result. An inaccurate model of the system under identification may cause failure of the identification process, poor convergence rate, and multiple local minimums. In discrete parameter identification with the GA, a window size is used to minimize the variance of the parameter and the effect of noise. Because of the secondary effects in the hydraulic system, trying to fit parameters in a large window would result in poor accuracy. From trial and error in the experiments, 10 was found to be the best window size. With a small window size, the variance in the estimated parameter could be quite large due to the effect of noise. Fortunately, in the experiment, the measured Psoi. boom angle were relatively free of noise. 42 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification Chapter 4 A Parallel Genetic Algorithm implementation for hydraulic compliance identification 4.1 Introduction In the previous chapter, the flexibility and searching power of Genetic Algorithms ( GAs ) in identification of hydraulic parameters have been demonstrated. Das [5] and Kristinsson [12] also achieved good performance using GA in process identification and control. However, the GA differs from other algorithms in that it is based on a population, not on a single point, and it is very computation intensive. Fortunately, the GA is an inherently parallel algorithm. With the advent of parallel processing technology, it is becoming feasible to apply GA in real-time applications. Pettey [16] has suggested some possible parallel GA algorithms. The two most promising ones are: the synchronous master-slave GA ( algorithm A ) and the cooperating sequential GA ( algorithm B ) shown in Figure 4.1. Algorithm A is designed for problems which require long evaluation or long fitness calculation time. Algorithm A is organized in a master-slave configuration with n slaves. The master is responsible for distributing individuals ( from a global population ) to slaves. After receiving the fitness results from slaves, the master will perform Reproduction and Crossover on the old population to generate a new one. Algorithm A produces exactly the same sequence of generations as the traditional GA, and thus the same solution too. Algorithm A has some disadvantages: 1. Efficiency ( defined in Appendix C ) per processor decreases as the number of slaves increases since more slaves will be idling while the master performs Reproduction and Crossover. 2. Speedup ( defined in Appendix C ) is linear for only a small number of slaves. The cooperating sequential GA ( algorithm B ) is more generally known since it is the most widely used one. Algorithm B is a collection of many independent (local or nodal ) GAs running and communicating with one another simultaneously. Algorithm B gains speed by dividing the global population into many smaller ones for the local GAs. With a smaller population, all local GAs and thus this PGA will run much faster. Algorithm B retains the characteristic of GA by making 43 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification all local GAs exchange portions of their population with each other. If the communication time in the exchanging phase is much smaller than the processing time, linear speedup can be achieved. Algorithm B introduces some new parameters: frequency of exchange, portion of the population to be exchanged among NGA, and the local population size. The performance and some characteristics of algorithm B are quite different from the traditional GA. Researchers [17][24] have found that algorithm B is more robust and can consistently find a better solution than the traditional GA in function maximization. Master i < Slave #1 Slave #2 Slave #3 Slave #4 The synchronous master-slave GA (algorithm A ) Processor #2 ( Local Population #2 ) Processor #3 ( Local Population #3 ) Processor #4 ( Local Population #4 ) Processor #1 ( Local Population #1 ) t ^ ^ t Exchange ^ ^ Network f* Processor #5 ( Local Population #5 ) ^f *\ ~\ Processor #0 ) (Local Population #0 ) Processor #7 ( Local Population #7 ) Processor #6 ( Local Population #6 ) The cooperating sequential GA (algorithm B ) Figure 4.1: Two Parallel Genetic Algorithms Architectures In system identification, the fitness function requires a window to minimize the variance of the 44 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification estimated parameters and the effect of noise: window size fitness = ^ bias - ( y(k - w) — y(k - w) ) 2 (4.1) tu=0 Where y(k) : measured system output y(k) : estimated system output bias : a positive constant that sets a limit for GA reproduction operator ( only individuals with fitness > 0 can reproduce ). The window in system identification increases thefitnesscomputation cost. From experience, the fitness calculation uses up to 80% - 95% of a GA program execution time, thus satisfying the requirement of algorithm A ( Algorithm A is designed for problems which require long evaluation or long fitness calculation time ). Because of the small global population size ( 100 to 400 ) [12][5] and the need to use sizable local populations in system identification ( explained in the next chapter ), the speedup factor from algorithm B is small. By combining both algorithms A and B in system identification, not only is the overall speedup factor increased, but the robustness of such PGA is improved as well. Objectives: A project was initiated with the overall goal to investigate the effect of combining algorithm A and B into a two level parallel implementation. We would like to determine a suitable parallel architecture and its efficiency for such PGA. Such PGA for identification of the hydraulic compliance ( single joint) will be implemented on the Inmos T800 Transputer and its performance is compared with that of the traditional GA. 4.2 Speedup, efficiency, and parallel architectures for PGA The following information from a traditional GA is important for determining the maximum combined speedup factor from algorithm A and algorithm B: 45 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification 1. The global population size M 2. The parallelizable process (total fitness calculation time for all individuals in the population ) t p t = M x fitness calculation time p = Ix (4.2) window size x Error calculation time 3. The sequential process ( total GA operator time for all individuals in the population ) t s t = M x GA operator time s — M x (Reproduction + Recombination + Mutation) time (4.3) where for system identification, fitness is usually denned as: window size fitness(k) = £ (Bias - Error (k - w)) 2 (4.4) w=0 Define a as the ratio of execution time of parallelizable process vs the sequential process: t t D ex = — g = window size x Error calculation time GA operator time (4.5) then a is independent of the global population size. The above equations indicate that there are 2 intrinsic level of parallelisation in GAs. Dividing the global population M into many smaller local populations ( Mioc ) is level 1 parallelisation ( algorithm B ). Distributing the fitness calculation among slave processors is level 2 parallelisation ( algorithm A ). In level 1 parallelisation ( algorithm B ), the global population is divided into many smaller local populations for local or nodal GAs. The collection of nodal GAs retains the characteristic of traditional Genetic Algorithm by making all local GAs exchange portions of their population with each other. Usually the communication time in level 1 tci in the exchanging phase is much smaller than level 1 sequential process time tsi and can be neglected. Thus linear speedup over traditional GA is possible. The achievable speedup factor in level 1 is: Speedupi = M loc 46 (4.6) „ Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification Master 1 local population # 1 Exchange the best individuals 1 i Slave Slave Slave #1 #2 #3 < Master 2 1 local population # 2 1 Level 1 parallelization (algorithm B) Slave Slave Slave #1 #2 #3 Level 2 parallelization ( algorithm A) Figure 4.2: Two levels of parallelisation Where Mioc is the local population size and depends on the types of applications. In level 2, the fitness calculation is distributed among slave processors. Defining: 1. t i = the parallellizable process timing in Level 1. 2. t i = the sequential process timing in Level 1. 3. t 2 = the parallellizable process timing in Level 2. 4. ts2 = the sequential process timing in Level 2. p s P then the following relationship will be true: ti _ t2 t si t s2 p p _ Mioc X window size x Error calculation time = a Mioc X GA operator time (4.7) Even though the ratio of t 2 to ts2 is equal to a, gain in speedup is possible only if the communication P overhead tc2 is small compared to ts2- ts2 is smaller than tsi since . _ M, oc M (4.8) the communication overhead tc2 is much more critical in level 2 parallelisation. Interconnection network between master and slave processors must support high speed communication. The speedup 47 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification factor of level 2 with n numbers of processors will be ( see derivation in Appendix C ): c J tp2 + ts2 bpeeaup2 = £t 2 + t P s2 + n x + 1 a r tf a 4- t c2 ^ t2 c << t s2 1 Speedup2 > —-— if n = integer(a) (4.10) Where n = number of slave processors The maximum combined speedup factor for both algorithm A and B ( Figure 4.2 ) will be: M Combined speedup = speedupi a + 1 x speedup^ = —— x —-— (4.11) The choice of a parallel architecture for PGA The choice of a parallel architecture for PGA in system identification depends on M , Mioc and a. Figure 4.3 shows two possible parallel architectures for PGA. The hypercube configuration is excellent for applications where M a + 1 » ^"r 2 i M loc (4.12) Thus only level 1 parallelisation is sufficient Since the communication overhead is small, speedup is linear for a large number of processors. For applications where JL M « 2+1 2 loc (4.13) It may be necessary to combine algorithm A and algorithm B to achieve higher speedup factor. A hybrid architecture composed of serial interconnection network for a small number of NGAs and high speed local buses for master-slaves connection can be used. The serial interconnection network handles the nodal GAs ( NGAs ) communication. The fitness calculations of NGA's local population 48 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification are distributed to the slave processes on the local bus. The high speed local bus keeps t<2 small to maximize gain in speedup factor. Efficiency is important in parallel processing. Figure 4.4 shows the software block diagram of a PGA with 2 levels of parallelisation. In this conventional implementation of PGA, the fitness calculation time t and G A operators time U do not overlap. As more and more processors are p added to reduce t , the efficiency per processor decreases because more processors are idling during p GA operators time. At speedup equal to ( + 1) » where t is equal to t , the efficiency per a p s processor is down to only 50%. Using pipeline techniques will not increase the maximum achievable speedup factor. However, for a given speedup factor, the number of processors needed is reduced because of improved efficiency ( 100 % ). Figure 4.5 shows the pipeline implementation and the associate timing diagram. By grouping two local GAs together and combining both GAs slave processors for fitness calculation, t p will be equal to t i + t 2 . Buffer 1 holds the temporary result from the fitness calculation corresponds p P to one of the local populations while a processor performs GA operations on the local population in buffer 2. Such arrangement allows t and ts to overlap each other and forces all slave processors to p work at 100 % efficiency. Figure 4.6 and Figure 4.7 show the speedup factors of nonpipeline and pipeline implementation of algorithm A and algorithm B versus number of processors for various a (8,16,24) ratio. For small number of processors, the different between the two speedup factors is quite small. However, pipeline implementation offers significant saving in number of processors for higher speedup factor. 49 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification NGA link local bus /" ( NGA ^ / £ siave slave X slave NGA . NGA Hypercube architecture: •1 level of parallelization (NGA) -Small local population (6 ) •Linear speedup •Easy to implement link Q ^[ . Hybrid architecture: •2 levels of parallelization: population & fitness calculation •Sizable local population (24) •Almost linear speedup Figure 4.3: Two parallel architectures for PGA 50 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification Local GA#1 LocalGA#2 LocalGA#3 1 LocalGA#4 Z3 Fitness Fitness Fitness Fitness Calculation Calculation Calculation Calculation GA GA G A Operators I Operators Operators ± G A Operators Timing ts Exchange Exchange Exchange Exchange Exchange or Broadcast or Broadcast or Broadcast or Broadcast «P -1—Exchange C o n v e n t i o n a l Implementation Figure 4.4: Nonpipeline implementationflowchart Local GA#1 1 and#2 L o c a l G A # 3 and # 4 Pipeline Implementation Figure 4.5: Pipeline implementationflowchart 51 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification N o n p i p e l i n e speedup factor versus processors u s e d 50 45 40 35 I 30 25 20 15 10 5 0 10 20 30 40 50 N u m b e r o f processors Figure S p e e d u p factor o f nonpipline implementation versus n u m b e r o f processors 4.6 50 P i p e l i n e speedup factor versus n u m b e r o f processors u s e d ! ! ! 45 \ a* 40 35 ! 30 <S o. 25 CO 20 ! t - j * * — 15 10 1 /S .A • \S~ -t- j ... J - i 5 i 10 • 20 ' '• 30 40 50 N u m b e r o f processors Figure 4.*) Speedup factor of pipeline implementation versus number of processors 52. Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification 43 Comparison between PGA and tradition GA performance in identification of hydraulic compliance A PGA with combined algorithms A and B is used to identify the hydraulic compliance of the boom hydraulic circuit. It is implemented with transputer T800. The block diagram of this PGA and the traditional GA is showed in Figure 4.8. To estimate the hydraulic compliance of boom link, the following parameters are used in the PGA: 1. Global population size = sum of all local population = 120. 2. Local population size = 30. 3. Window size forfitnessfunction = 10. 4. Trial ( number of iterations per data sample ) = 5. 5. Exchange ( best individual ) number = 1. 6. Exchange frequency = 1 per 3 generations. 7. GA operators ( Mutation, Crossover rate ) are identical to traditional GA. Table 4.1 shows the combined algorithm A and B performance. Note that an impressive speedup factor of 12 is achieved without using any pipelining techniques ( for more details on PGA implementation, please consult the appendix ). The data used in PGA experiment is identical to the hydraulic data used in single link compliance estimation. In the PGA experiment, given four local GAs, the estimated compliance of the boom hydraulic circuit is taken from one of local GAs. Figure 4.9a-d and Figure 4.10a-d show the identification process of boom hydraulic compliance with actual spool measurement and indirectly with servo-valve voltage using PGA respectively. In this application, the parameter convergence rate and the estimated CBCH from PGA are almost identical to that from traditional GA. 4.4 Comments and discussion In system identification, it is possible to combine the synchronous master-slave GA (algorithm A ) and the cooperating sequential GA (algorithm B ) to increase the speedup factor and robustness of such PGA. Such PGA can be implemented on a hybrid parallel architecture with pipeline techniques. 53 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification System parameters Input/Output P BOi Boom Angle Trial System Model global population fitness function GA operators 'BOi ( window size ) GA ( Sequential Genetic Algorithm ) Input/Output P BOi Boom Angle System parameters Trial Local population / System Model fitness function GA operators Local GA #4 System parameters System Model fitness function Local population « (local window size=10 ) System parameters System Model > fitness function Exchange frequency GA operators System parameters fitness function Local GA #3 Local population (local window size=10 ) System Model Exchange number GA operators Local GA n Local population « (local window size=10) G A operators C BOi Local GA #1 A PGA ( A Parallel Implementation of GA) Figure 4.8: Block diagram of GA and PGA for identifying hydraulic compliance the identification process of boom hydraulic compliance with actual spool measurement and indirectly with servo-valve voltage using PGA respectively. In this application, the parameter convergence rate and the estimated Ceoi from PGA are almost identical to that from the traditional GA. 54 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification GA and PGA in identifying single link hydraulic compliance : GA Level 1 Algorithm (B) Level 2 Algorithm (A) Combined Algorithm (A + B ) Number of processors used 1 4 4 16 Global Population size 120 120 N/A 120 Local population size N/A 30 30 30 Number of generations calculated per sec. 9.8 N/A N/A 117.6 Speedup achieved 1 4 3 12 Efficiency ( Speedup / processors ) 1 1 0.74 0.74 Table 4.2 The measured speedup factor of various PGAs 4.4 Comments and discussion In system identification, it is possible to combine the synchronous master-slave GA ( algorithm A ) and the cooperating sequential GA ( algorithm B ) to increase the speedup factor and robustness of such PGA. Such PGA can be implemented on a hybrid parallel architecture with pipeline techniques. The efficiency and speedup factor of such implementation can approach ideal ( 100% efficiency and linear speedup ). In this application, the communication overhead of PGA is small. Even without direct connections among master and slaves, the communication time is still much smaller than the sequential GA operators time. With an adequate communication network, maximum combined speedup factor of such PGA will be: Maximum combined speedup = Jf X ——— Mioc (4.14) 2 Both GA and PGA have accurately identified compliance of the boom hydraulic circuit. A typical transient interval in which compliance can be identified lasts 0.4 sec ond and contains 20 sample points. From Table E.2, the execution time for traditional G A for 20 sample points can be calculated: GA time = sample number x trial -j- (generations per second) = 20 X 5 9.8 « 10 second 55 (4.15) Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification The execution time for PGA will be : PGA time = GA time -f- speedup factor (4.16) = 10 -fl2 » 0.8 second Since PGA-time is twice as long as the transient interval ( 0.8 second versus 0.4 second ), it is necessary to increase the speedup by at least a factor of 2 ffiofti. In the future, T800 Transputer can be replaced by the H9 processor from Inmos Inc. . The H9 processor is about 10 times faster than the T800 Transputer. Real-time identification or control of the hydraulic parameters with PGA will be possible. 56 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification 2500 1 i i 1 1— i i i '£,2000 - % 1500 - 9 | 1000 .1 5 0 0 0 } 0.2 0.4 0.6 0.8 12 1 1.4 1.6 Time (Sec) 100 \ • 80 60 w 40 U 20 0 Figure 4.9 Experiment #1 ( with spool data ) 57 1.8 2 Chapter 4: A Parallel Genetic Algorithm implementation for hydraulic compliance identification eo *> •a *> CO c < E •6 I 1 1 1 1— 1 I ! I •£2000 g 1500 s I 1000 .1 500 • ^ ,—'* B0 - P C 1— 0 — i . ._• /—* "Sito" 100 80 60 40 u Error • 20 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time (Sec) Figure 4.10 Experiment #2 ( with servo-voltage data ) 5$ 2 Chapter 5: PGA in system identification Chapter 5 PGA in system identification 5.1 Previous work on P G A ( algorithm B ) Pettey, Leuze and Grefenstette[17][16][21] experimented with PGA in function maximization. They implemented a PGA on a hypercube processor network with a local population size of 50. Their experimental results agreed well with Goldberg's paper [9] on the optimum global population size. In [21], based on the assumption of uniformly distributed communication among NGAs, Pettey suggested that PGA maintains efficiency similar to that observed in a traditional sequential GA. Tanese [24] implemented a PGA on a medium-grained hypercube computer for function maximization. He experimented with a number of important parameters such as exchange frequency, number of individuals exchanged, Mutation and Crossover rates, and local population size. He suggested that: 1. Exchange frequency and the number of individuals exchanged depend on the problem domain. Exchanging too frequently or too infrequently may degrade PGA performance. 2. Different Mutation and Crossover rates may be used among nodal GAs ( NGAs ). A NGA with a high Mutation rate would emphasize exploration and a NGA with low Mutation rate exploitation. 3. The local population size can be as small as 6 without affecting the measured parameter convergence rate. Previous works on PGA ( algorithm B ) can be summarized as follow: 1. Global and local population size of PGA depends on applications. 2. PGA is consistently able to find a better solution than the sequential GA[25]. 3. PGA may be more robust than sequential GA. [24] 4. PGA parameter convergence rate may be slower than the sequential G A running on the same population. A super-individual is seen only by a local population and it takes several exchanges before such a super-individual can be seen by the global population. 59 / Chapter 5: PGA in system identification Objectives: While many experiments have been done on function maximization with GA and PGA, there are very few works [5][13]on using PGA in system identification and control. It is in this area that we would explore the full potential of PGA in system identification. 5.2 Important requirements on PGA in system identification 5.2.1 The conventional PGA implementation ( algorithm B ) In a conventional PGA, each processor runs a genetic algorithm on its own local population, periodically selects good individuals from its local population, and sends copies of good individuals to one of its nearest neighbours. Under such an exchange scheme, the local GAs are best connected in a hypercube multiprocessor network. The hypercube network is showed in Figure 4.3. There are many implementations of PGA on the hypercube network [24][17]. By sequentially sending and receiving just one best individual from one of its nearest neighbours, each processor on the hypercube network can keep the ratio of local population size to incoming external member sufficiently high to maintain the local population diversity. In [24], a PGA was implemented on a hypercube network and the smallest local population size was 6. If the hypercube network is used, by dividing the global population ( 100 ) into many small local populations ( 6 ), PGA can achieve a speedup factor of 16 time over sequential GA. For a PGA with small local population ( 6 ), it is necessary not to broadcast any "best individual" from one local GA to the others. Such an individual may destroy the diversity of all the local populations ( a best individual may be a local minimum ). Sequential exchange of good individuals among local GAs is necessary. In the case of a super individual ( global minimum ), depending on the hypercube network, it will take several exchanges before the entire population will be aware of such super individual. Thus such an exchanging scheme will cause the total population to converge at a slower rate than sequential GA, since a "super individual" would be seen by subpopulations instead of the global population. 60 Chapter 5: PGA in system identification From experience in working with simple PGA exchange mechanisms, with the diversity of the population preserved, a slower convergence rate avoids premature convergence and leads to a global minimum. For conventional PGA, such a trade off between the robustness and the parameter convergence rate is unavoidable. Many papers have been published in the last few years on PGA performance in function maximization [17][24]. In function maximization, PGAs have been shown to be more robust than the sequential GA. Even though there have been many successful implementations of PGA for function maximization, the requirements and the nature of the problem in system identification are quite different from those in function maximization. 5.2.2 Differences between function maximization and system identification There are many differences between function maximization and system identification for PGA: 1. In function maximization, the environment is static; the function is time invariant. In system identification, the working environment is usually dynamic and in real-time. 2. In function maximization, it is possible to use different Mutation rates among nodal GAs ( NGAs ) so that some NGAs will place emphasis on exploration and others on exploitation [24]. However a higher Mutation Rate will increase the variance of the estimated parameter. In function maximization, where only the final value is needed, higher variance in parameters is not important But in many applications of system identification and control, where tracking the parameter changes is important for control and diagnosis, the variance of parameters must be minimized. Therefore only a low Mutation Rate should be used in system identification. 3. In function maximization, the global population size plays a significant role in determining the parameter convergence rate ( measured with respect to time ) [17]. In system identification, the parameter convergence also depends on data sample rate and excitation in the sampled signal. Thus the role the global population plays is secondary in system identification. 4. In real-time system identification and control, a high parameter convergence rate is one of the most important requirements. 61 Chapter 5: PGA in system identification Figure 5.1 shows the block diagram of GA and PGA for system identification. Several important areas in the figure are: the global and local population size, the communication network and the fitness function. System parameters Input/Output System Measurement System Model global population fitness function Best fit system parameters GA operators ( window size) GA ( Sequential Genetic Algorithm) Communication Network for exchanging best members among local population InputyOutput System Measurement System parameters System Model *. fitness function Local population GA operators (local window size ) System parameters System Model fitness function Local population GA operators (local window size ) System parameters System Model fitness function Local population GA operators . Best fit system parameters ( local window size ) PGA (Parallel Implementation of GA) Figure 5.1: Block diagram of GA and PGA in system identification Global population size In function maximization, according to Goldberg [7][8], the size of the global population should depend on the length of an individual string. Using Goldberg's criteria, very large global population 62 Chapter 5: PGA in system identification sizes, from 500 to 1000 are usually used in function maximization. R. Das [5] and K . Kristinsson [12] demonstrated that in system identification with a small number of parameters ( 4 - 6 ) with GA, good performance can be obtained from small global population size of 100. Such a result is encouraging since the computation cost is directly proportional to the global population size. In parallel implementation of Genetic Algorithm ( PGA ), it will be advantageous to keep the same small global population size of 100. Only if the performance of PGA with such a small global population size is unsatisfactorary, then more local GAs can be added to increase the global population. Local population size In a static environment, Tanese[24] demonstrated that a very small local population size of 6 could be used in his application. For system identification, it is necessary to use a larger local population. In a dynamic environment, diversity of small local populations can be destroyed easily. For example, when the parameters of the system under identification become constant, then many small local populations may become identical or very similar ( low Mutation rate is used ). Larger local population offers better protection. Based on the simulations and the above considerations, PGA's local population size for system identification was selected to be at least 20. Communication network In real-time system identification, the measured input and output of the system must be broadcasted to every local GA. The communication network should have very small and deterministic delays in broadcasting. Most PGAs mentioned in the literature were used in the area of function maximization and did not require much communication among local GAs. Depending on the speed of the processor, applications, and sampling rate, a high speed communication network among NGAs is needed in some real-time applications. 63 Chapter 5: PGA in system identification 5.3 PGA performance Improvement in system identification 5.3.1 Distributed fitness function In discrete time parameter identification, GA's fitness function requires a window to minimize the variance of the estimated parameters and the effect of noise: window size fitness = ^ bias — ( y(k — w) — y(k — w) ) 2 w=Q Where y(k) = measured system output y(k) = estimated system output bias = a positive constant that set a limit for GA reproduction operator ( only individual with fitness > 0 can reproduce ). window size = used to minimize the estimated parameter variance. GA with a large window size will be more immune to noise, but will be slower in tracking changes in parameters. Conversely, GA with a small window size may perform poorly in noise, but is excellent in tracking changes. With multiple local GAs exchanging their best individuals, PGA may perform better if the local GAs use different window sizes. A local GA with large window size could estimate parameters with good immunity to noise, and a local GA with smaller window size may track changes in the system parameters better. In exchanging their best individuals, both local GAs may complement and compensate each other's advantages and disadvantages. Thus a PGA with such settings may improve its parameter convergence rate and maintain a good noise immunity at the same time . The robustness of the PGA, and to some extent, the PGA parameter convergence rate, can be improved by increasing the global population size. However, for a given sample rate, increasing the global population will require more computation power. With different window sizes on the local GAs, a local GA with smaller window size has a smaller computational load. Thus it is feasible to increase the population of such local GA to obtain the same computation load. With a smaller window size and a larger local population, the tracking performance of such local G A is further enhanced. 64 (5.1) Chapter 5: PGA in system identification By varying the window size and local population accordingly to maintain the same computation load, the global population of PGA is increased and the robustness of PGA is also improved. The term distributed fitness function is used to describe the combination of different fitness function and local populations. In real-time system identification and control, the ability to track changes in the system parameters ( a fast parameter convergence rate ) is essential. 5.3.2 Broadcasting with active error analysis Instead of exchanging the best individual with only one of the neighbours, all local GAs will periodically broadcast their best individuals to one another. Broadcasting has the following advantages over sequential exchange: 1. Since all local GAs receive the best individuals from one another, it is equivalent to having every local GA sees the entire global population. The parameter convergence rate will be comparable to that of sequential GA. 2. Broadcasting allows the distributed fitness function's full potential to be exploited. Based on the Maximum Likelihood technique, extra information from the distributed fitness function can be analyzed and be used in a more active role in estimating the unknown system parameters. During the exchange phase, broadcasting ensures that every local GA receives copies of the best individuals from other local GAs with different window sizes. One generation later, every local GA would calculate the fitness value for its own population, which also includes the best individuals from other local GAs. Assuming there are 4 different local GAs with window sizes of 30, 24, 16, 10 respectively, a matrix of fitness of best parameters versus different window size can be extracted from the local GAs with no computation cost: 65 Chapter 5: PGA in system identification window size SWJ wi=30 Error(wi, A i ) Emor(wi, A2 ) Error(wi, A3 ) Error(wi, A4) W2=24 Error(w2, A i ) Error(w2, A2) Error(w2, A3) Error(w2, A4) Sw W3=16 Error(w3, Ai) w =10 Error(w4, Ai) Error(w3, A2) Error(w3, A3) Error(w3, A4) Sw Error(w4, A2) Error(w4, A3) Error(w4, A4) Sw SA; SAj SA 4 SA 2 Swi 2 3 4 SA4 3 Figure 5.2: A matrix offitnesserror versus different window size Where Given a local GA with window W{ : fitness(wi,Aj) = ] P (B - (y(k - n) - y(k - n) . )) A (5.2) n=0 Wi Error(wi,Aj) = ^ (y(k - n) - y(k - n) Ai ) n=0 Aj = parameters from a local GA with window Wj = J A f\ Error(wi,Aj) \ \ ^V|Error(wj,Aj)|J = ^2 normalized Error for parameter Aj (derived from Wj) evaluated under all other window sizes : Wj (, i.. ) = 4 (5.3) 4 Sw;_ ^ / j Error (w^Ajm ^ V l Error ( , A j ) | ; Wj = ]P normalized Error for parameters Aj (,=1,2,3,4 window size) evaluated under window w. For example: Swi SAi Error Ai) Error (wi, A2) Error ( w i , A3) Error (w\, A4) + + Error (wi,A\) Error (103,(103, A3) A3) Error Error (u>2, (w2,A2) A2) Error Err(w\, A 4 ) (5.4) Error (toj (wi,Ai)\ + \Error (w2,A\)\ + {Error (u>3,Ai)| + {Error (w\, Ai)\ {Error (wi, A i ) | + 66 + Chapter 5: PGA in system identification Active error analysis: From the definition of Saj and SWJ, the following statements can be made: 1. Under a noiseless and transitional environment ( i.e. a system parameter is changing ) the local GA with smallest window would be first to track such change. During the transient time, Error(w4, A 4 ) would be smaller than Error(W4, A3 ), Error(w4, A2), Error(w4, Aj). From the definition for SWJ, SW4 will be larger than Swi, Sw2, and SW3 with high probability: Noiseless and transitional Su>4 > Sw$ > Sw2 > : Swi with high probability where : A4 = estimated parameter from GA with W4 parameter from GA with w\ (5.5) A*... A ... 2 A\ = estimated Thus the magnitude of Swj indicates which window is most suitable for the present time. 2. In a noisy but steady-state condition, the summation of Error across all window sizes should indicate which estimated parameter ai has the best overall Error. Since the variance of the estimated parameter in window 30 is smallest, Errorfwi, A i ) will be less than Error(w2, A ) , 2 Error(w3, A3), Emor(w4, A4). In this case, SAi should be less than SA2, SA3, and SA4. Noise SAi and steady state : < SA2 < SAz < SA4 with high probability where : w\ > W2 > t f . i > w$ 3. (window (5.6) size) The information in SAi and Sw; can be used in choosing the best parameter from the four different windows under noisy, noiseless and transitional environment. There are many ways to use the information in SWJ and SAi. One obvious way is to use the ratio Swj/SAi as a selection criteria. The ratio Sw;/SAj will compensate for some of the noise effect and account for the 61 Chapter 5: PGA in system identification transient condition. The highest ratio of SWJ/SAJ is used to select the best parameter from the window size i . Under most conditions : $ ID' — — (,•=!...4) is a good indication of which window is most appropriate For example : */ ~7TT > 7Ti T T i Tnr" then window w? is probably the most appropriate one (5.7) The computation cost for the active error analysis is insignificant. By combining the distributed fitness function with the active error analysis, it may be possible to improve PGA performance in parameter convergence rate, noise immunity such that they are equal or better than the sequential GA. The active error analysis will output the estimated parameters at the broadcasting frequency. Disadvantage of broadcasting: Broadcasting the best individuals among local GAs could destroy diversity of the local population. Several measures have to be taken to avoid the destruction of local diversity that could lead to premature convergence: 1. The local population size should not be smaller than 20 ( mentioned in previous sections ) to maintain the high ratio between local population size and incoming exchange individuals ( 6 : 1). 2. The broadcasting frequency should be kept low ( less than 1 per 10 generations ) The distributed fitness function will provide additional protection on the local population diver- sity. Although higher Mutation rates can also be used to protect the diversity of local population too, it does severely affect the variance of the estimated parameters. Also, since Mutation is a random process, it is difficult to determine the effectiveness of such mechanism. Thus a higher Mutation rates will not be used unless all other methods have failed. Chapter 5: PGA in system identification 5.4 Testing the distributed fitness function and active error analysis on various P G A configurations In GA and PGA, the initial population is usually created by a random number generator. Thus the initial parameter convergence rate depends on the population size and the random number generator seed. The dependency becomes more noticeable in PGA since each local GA has its own population size and random number generator seeds. For example, a good individual in the initial population will distort the measurement of the parameter convergence rate. Some of the distortion can be removed by averaging many runs of GA or PGA to give a better estimate of the parameter convergence rate. In discrete time parameter identification, the interest is not only on the initial parameter convergence rate, but also on how well PGA can track the changes in the system parameters. A second-order system of the following form ( the same one in [12] ): y(k) = ai * y(k - l ) + 02 * y(k - 2) + ba(u(k) + 6, * u(k - 1)) (5.8) Where ai=1.5, a =-0.7, bo=1.0 bi=0.5. 2 is used to test the performance of various PGA configurations. Because GAs do not require linearity in the parameters, they can directly identify the poles and zeros of the system. In pole-zero form, the plant can be written as: ^(? )»(0 = Biq-^uit _1 -d) + C ^ e W (5.9) Where : A{q- ) = {l-(a ±jfo)q- ) 1 ^(g- ) = 1 1 1 - (71 ± ^ i ) 9 _ 1 ) d = delay e(t) = noise For a stable minimum phase plant, the poles and zeros are inside the unit circle. Therefore the search space can be limited to the unit circle or a box enclosing the unit circle. With GA, the prior 69 Chapter 5: PGA in system identification lower bound upper bound # of bits resolution d 1 4 2 1 bo 0.0 2.0 7 0.016 «!./?!. 71. ^1 -1.0 1.0 7 0.016 Table 5.1 Search space for a stable minimum phase system PGA Nodal Exchange ( E ) Broadcast ( B ) Comment E : 1 per every 3 generations Use sequential GA Configuration #1 4 exchange Configuration #2 4 B : 1 per every 12 generations Use broadcast Table 5.2 Two different PGA configurations knowledge of the exact size of the search space is an important advantage of using pole-zero form instead of the parameter form. The second order system has six parameters that need to be identified: delay d, gain b and Q poles-zeros a i , fix, 71, #1 . The delay is coded as a two bit string to give 4 choices and the other parameters are coded as five 7-bit strings, making totally a 37 bit string. This results in a search space with total 2 =1.371*10 combinations. The parameters have been concatenated as follows 37 n d I i I Pi I 7i I ^1 I °o • Upper and lower bounds on the parameters are defined and the a resolution of the coding is in Table 5.1 A PRBS ( Pseudo Random Bit Sequence ) signal[12] is used as an input for the system. The PRBS input has a period of 127 with the bit interval equal to four times the sampling interval ( PRBS signal is persistently excited signal ) . Unless stated otherwise, the genetic operator settings are : 1. The Crossover rate ( p ) = 0.8 2. The Mutation rate ( p c m ) = 0.01 Two PGA configurations are tested: the PGA configuration #1 and the PGA configuration #2 in Table 5.2. To Chapter 5: PGA in system identification The experiment setup is listed in Table 5.3. In experiment #1, the effectiveness of the distributed fitness function with different local population sizes and fitness window sizes on a PGA using sequential exchange mechanism is tested. Experiment #2 is designed to test whether the distributed fitness function can effectively protect the local population diversity against broadcasting. The highest broadcasting frequency is used ( 1 per generation ), and the performance of different local GAs is compared. Experiment #3 and #4 are designed to test how the combination of distributed fitness function and active error analysis can help to improve the performance of PGA in system identification. Finally, the performance of PGA and GA is compared in experiment #5. Experiment Fitness Number of Local Function local GAs Fitness B=Broadcast window size E=Exchange 24:24:24:24 30:30:30:30 E = 1 per every 3 24:30:40:50 30:24:16:10 generations 24:24:24:24 30:30:30:30 B = 1 per every 24:30:40:50 30:24:16:10 generation 24:24:24:24 30:30:30:30 B = 1 per every 24:30:40:50 30:24:16:10 12 generations 24:30:40:50 30:24:16:10 B = 1 per every population size #1 ( PGA ) traditional 4 distributed #2 ( PGA ) traditional 4 distributed #3 ( PGA ) traditional 4 distributed #4 ( P G A ) distributed + 4 active error 12 generations analysis #5 ( GA ) traditional 1 100 30 N/A Table 5.3 Experiment setup In Table 5.3 , notation such as 24:30:40:50 under column heading "Local population size" implys that local GAs #1, #2, #3, #4 population size are 24, 30, 40, 50 respectively. To observe how well PGA tracks changes in the system parameters, the parameter ai of the second order system is altered as shown in Table 5.4. Chapter 5: PGA in system identification Case 0-199 generation 200-399 generation 400-600 generation 1 ai=-1.5 ai=-1.5+1.0*(gen-200) ai=-0.5 Table 5.4 How ai of the second order system is altered 5.4.1 Experimental result Initially the fitness value was assumed to be a good indication of how well G A can track the system parameters. However, further examination showed that sometimes a small fitness error only indicates good tracking on the output of the system, and is not necessarily an indication of the convergence of the estimated parameters. A good example would be the fitness error from a GA with a window size of 10. Even though the fitness error was small in the presence of noise, the variance of the estimated parameter can be very large. Thus fitness error alone would not indicate the performance of various PGA configurations. In all the experiments, various PGA configurations were used to identify the pole and zero of the second order system. The estimated real and imaginary part of the dominant second order system pole ( o i , from various PGA configurations were plotted. Experiment #1: Testing the performance of the PGA configuration #1 with the distributed fitness function PGA configuration #1 based on a simple 2 dimensional hypercube ( 4 processors ) was implemented to test whether the distributed fitness function could improve performance. The experimental results are shown in Figure 5.3a-d. The variance of the estimated parameter seemed to be reduced slightly ( compare to Figure 5.3a and Figure 5.3c ), but there is no other indication of any significant improvement. The passive exchange mechanism of the PGA configuration #1 could not utilize the full potential of the distributed fitness function. Experiment #2: Testing the effectiveness of the distributedfitnessfunction in protecting the local population diversity For the PGA configuration #2, the local population diversity was threatened by the broadcasting mechanism. The distributedfitnessfunction with a different local population and window size, should give some protection to the local population diversity. In the experiment, the PGA configuration #2 72 Chapter 5: PGA in system identification with the same fitness and distributed fitness function were subjected to a broadcasting frequency of one per generation. Under such a high broadcasting frequency, without sufficient protection, the local population diversity would be destroyed and led to premature convergence. Figure 5.4a and Figure 5.4b show two local GAs from the PGA configuration #2 with the same fitness function performed. After 200 generations, the estimated poles from two different local GAs became identical and converged prematurely. The performance of the PGA configuration #2 with the distributed fitness function, is shown in Figure 5.4c and Figure 5.4d . After 400 generations, the estimated poles from the two local GAs were close but remained different. Even though the convergence rate of the estimated pole was much slower than normal, there was no indication of premature convergence. The distributed fitness function had successfully preserved the local population diversity. Experiment #3: Testing the performance of the PGA configuration #2 with the distributed fitness Figure 5.5 shows how the real and imaginary part of the pole changed with generation ( time ). Window size affected the G A parameter tracking ability. In a noiseless environment, the local GA with a window size of 10 could track the change in the pole better than one with a window size of 30. Given that the pole started to change at 200 generation, the local GAs with window size 10 and 30 started responding to such change at 250 generation and 300 generation respectively. The different delay in the response was caused by the local GA different window size. ( Figure 5.5c and Figure 5.5d ). In a noisy environment, the local G A with a window size 30 could filter out noise much better than the GA with a window size 10 ( Figure 5.5g and Figure 5.5h ). Without active error analysis, the estimated parameter would be taken from the local GA with a window size of 30. The large window size would minimize the variance of estimated parameter, and filtered out the transient information from other local GAs with smaller window sizes. As shown by Figure 5.5f and Figure 5.5g , there was no observable improvement on tracking the change in the system pole. This experiment illustrated that distributed fitness function's full potential would not be utilized if active error analysis was not applied on the extra information available. Experiment #4: Combining the distributedfitnessfunction with active error analysis Figure 5.6a and Figure 5.6b show that the tracking performance of the PGA configuration #2 with 73 Chapter 5: PGA in system identification and without active error analysis in a noiseless environment. The active error analysis reduced the response delay from 100 generations to 50 generations. Active error analysis had used the transient information from the local G A of window size 10 to reduce the delay. In a noisy environment, the active error analysis would be biasd more towards the local GA with large window size. In the present of noise and under steady state condition, estimated parameters variance from the local GA with a small window size would be quite large and the local GA with larger window size gave better estimation of system parameters. Comparing Figure 5.6c and Figure 5.6d , one would notice that both set of curves were very similar, confirming that under noisy conditions, active error analysis would be biased towards the local G A with window size 30. However, the active error analysis did not reject transient information from other GA with smaller window sizes. It still managed to reduce the response delay from 100 to 50 generations. Experiment #5: Compare PGA and GA performance The performances of GA and the PGA configuration #2 with the distributed fitness function and active error analysis were compared. The results are shown in Figure 5.7a to Figure 5.7d . The PGA configuration #2 actually outperformed GA in tracking parameter changes and had smaller variance in estimated parameters under both noiseless and noisy environment. 74 600 : same fitness, noiseless. w = 3 0 . p o p = 2 4 e x c h = l / 3 200 300 400 500 (0.) 600 generation (3 generation/sample) d i f f fitness, noiseless. w=30. p o p = 2 4 exch=I/3 200 300 400 500 600 generation (3 generation/sample) same fitness, noise. w = 3 0 . p o p = 2 4 e x c h = l / 3 100 200 300 400 500 generation (3 generation/sample) d i f f fitness, noise. w = 3 0 . p o p = 2 4 e x c h = l / 3 200 300 400 generation (3 generation/sample) p7* 5.5 1*7 ( ExpenfWit * ) 1 600 300 600 generation P G A c o n f i g u r a t i o n 0 2 : same fitness, noiseless. w = 3 0 . PQP=24 B = l CPU 1 0.5 0 Co.") « ... j. <-- , ; CO.) ;v-yvr t -0.5 100 200 300 400 500 600 generation (3 generations/sample) P G A c o n f i g u r a t i o n 0 2 : same fitness, noiseless. w=30. PQP=24 B = l c p u 4 -0.5 200 300 400 generation (3 generations/sample) P G A c o n f i g u r a t i o n #2: d i f f fitness, noiseless. w=30. pop=24 B = l c p u 1 0.5 CO - c CuT.Lt, P -0.5 - • * -1 100 200 300 400 500 600 generation (3 generation/sample) 0.5 P G A c o n f i g u r a t i o n 0 2 : d i f f fitness, noiseless. w = l 0. p o p = 5 0 B=l c p u 4 u>., >1 f :i Q |. ' * •• >-'. '. 1 100 1 R 200 300 400 generation (3 generation/sample) 76 500 600 300 400 600 500 generation PGA config. #2: same fitness, noiseless. w=30. PQP=24 200 300 400 600 500 generation (3 generations/sample) PGA config. 02: difffitness,noiseless. w=30. pop=24 200 300 600 400 generation (3 generations/sample) P G A c o n f i g . #2: d i f f fitness, noiseless. w = 1 0 . p o p = 5 0 200 300 400 600 generation (3 generations/sample) Frgur* 5 . F "71-1 ( &f««MA{ #3) T h e real and imaeinery p a n o f the transfer function r o l e 0 Ce). -0.2 1? •g Cm -°A -0.6 - -0.8 -1 100 200 300 400 500 600 generation P G A confiE. 0 2 : samefitness,noise. w = 3 0 . pop=24 100 200 300 400 500 600 500 600 generation (3 generation/sample) P G A c o n f i g . #2: d i f f fitness, n o i s e . w = 3 0 . p o p = 2 4 ID 200 300 400 generation (3 generation/sample) P G A c o n f i g . » 2 : d i f f fitness, n o i s e . yy=10. p q p = 5 0 generation (3 generations/sample) P^urc 5.5" (Batmen! *3) G A : noiseless, w = 3 0 . p o p = 1 0 0 -0.2 ^ -0.4 •5 -0.6 4 Co) Tsi •0.8 -1 100 200 300 400 500 600 generation (3 generations/sample) P G A c o n f i g . ¥2 + active analysis: d i f f fitness, noiseless. w = 3 0 p o p = 2 4 200 300 400 generation (3 generations/sample) 600 Therealand 600 GA: noiseless, w=30, pop=100 -0.2 -0.4 -0.6 -J. •0.8 -1 100 200 300 400 generation (3 generations/sample) 500 600 PGA config. #2 + active analysis: diff fitness, noiseless. w=30 pop=24 200 300 400 generation (3 generations/sample) generation (3 generation/sample) "71 600 Chapter 5: PGA in system identification 5.5 Comments and discussion There are many advangages in using PGA ( algorithm B ) to gain speed over the traditional GA. Most of the advangages are mentioned in the beginning of the Chapter. Almost all the PGAs implementation in the literature emulated the traditional GA by sequentially exchanging portions of the local populations among local or nodal GAs. Such exchange process is a passive mechanism since it may take several exchanges before a super individual be noticed by all the local populations. In system identification ( and control ), the passive nature of the exchange mechanism of PGA can affect the parameter tracking rates of the algorithm. To improve PGA performance in system identification, three new mechanisms are used: 1. The distributed fitness function. 2. Broadcasting best individual among local GAs. 3. The active error analysis. The distributed fitness function lets local GAs have different combination of window and local population size. It can significantly improve PGA parameter tracking rates and robustness. Broadcasting removes the passive exchange mechanism so that all local GAs can interact with one and other simultaneously. Active error analysis is a method to compare best results from all local GAs and to choose the most appropriate output. It is a reality that broadcasting may destroy the local population diversity. Fortunately, the distributed fitness function offers the local population effective protection against the disadvantages of broadcasting. The robustness and effectiveness of the distributed fitness function in protecting the local population diversity was tested. Experiments showed that PGA with distributed fitness function is much more robust than the conventional implmented PGA even when subjected to the highest broadcasting frequency of one per generation. Note that in the conventional PGA implementation, a sizable local population ( >= 24 ) and a G A operator such as ranking[12] ( to prevent a superindividual to reproduce too many and too quickly to dominate the local population ) cannot protect local population diversity against broadcasting. 80 Chapter 5: PGA in system identification Experiment #3 and #4 show that the combination of the distributed fitness function, the broadcasting mechanism and the active error analysis produces noticeable improvement in estimated parameters tracking rate and estimated parameters variance. In experiment #5, PGA with these three new mechanisms actually outperformed the traditional GA in the key areas mentioned above. A PGA with these three new mechanisms is a promising tool for many real-time, nonlinear system identification problems. 81 Chapter 6: Physical insight into how Genetic Algorithms work Chapter 6 Physical insight into how Genetic Algorithms work The theory of schemata proposed by Holland Holland ( 1975 ) has proposed the theory of schemata to explain some theoretical properties of Genetic Algorithms. A schema is a template describing a subset of strings with similarities over certain string positions. For example, given the following binary strings: A = 11100011 B = 11011011 (6.1) C = 11011111 the template "ii****n" is the common schema h for string A, B and C ( " * " is the "don't care" state ). Holland introduced two important terms: the denning length of schema, 6(h) and the order of schema 0(h). 6(h) is the length between a schema outermost defining positions. For example 6(u****n) = 8 - 1 = 7 and £(10*11**1) = 8 - 1 = 7. The order of a schema is the number of defining positions for a string. For example 0(11****11) is equal to four. The defining length £(h) is a measure of the probability that a crossover may destroy such schemata. A schema with large 6Q\) has a higher probability of being destroyed by a Crossover process than a smaller one. A small 0(h) is better protected from Mutation than a larger 0(h). Thus schemata with short defining length and low order stand the biggest chance of surviving to the next generation. The combined effect of the three transition rules, Reproduction, Crossover, and Mutation can be estimated. The expected number of schemata h to survive into the next generation is the product of the 82 Chapter 6: Physical insight into how Genetic Algorithms work expected number from Reproduction and the survival probabilities of Crossover and Mutation [11]. m(h, t + 1) = m(h, t)*W> ( i _ (i _ fW Pm where : m(h, t), m(h, t + 1) = number of schema hatt, t + 1 F(h t) = the average fitness of strings with schema h at t f F(t) = the average fitness of the population at t (6.2) F(h,t) , „ , . p = the Reproduction factor (1 — p )°^ m = the probability schema h survives Mutation 6(h)\ ( 1 — p -—- J = the probability schema h survives Crossover c Note that the m(h,t+l) is a conservative estimate of schema h at t+1 since it assumes no Crossover among strings with similar schema. Holland's schemata theory states that the algorithm is going to. converge towards the best, but there is no guarantee that it is converging to the optimum. While Holland's schemata theory is helpful for predicting the searching power of GAs, it does not address many problems encountered in using GAs. Such as: 1. how to encode the parameter space to help the GAs searching process 2. how to avoid premature convergence 3. how to choose a realistic population size 4. how to modify the simple GA so that it becomes a less stochastic and more determinstic algorithm ( for certain applications only ) We attempt to give a physical picture of how GAs work. With better understanding, it is easier to predict and even improve the performance of GAs in certain applications. 6.1 Genetic Algorithms search space To understand the searching power and efficiency of GAs, one must visualize the search space of GAs. In everyday life, most of us work with real or integer number system. Functions such as F( x ), F( x, y ), F( x, y, z ) are defined in a real number system as: 83 Chapter 6: Physical insight into how Genetic Algorithms work 1. F( x ) is a function defined in an one dimensional space spanned by the x unit basis 2. F( x, y ) is a function defined in a two dimensional space spanned by the x and y unit basis. 3. F( x, y, z ) is a function defined in a three dimensional space spanned by the x, y, and z unit basis. The real number and the integer systems are easy for humans to understand. However, the binary number system is the key to unlock and to understand the searching power of GAs. 6.1.1 The binary unit basis For a given resolution, it is possible to convert any real numbers x, y, z into binary notations B(x), B(y), B(z) of / bits long. Instead of associating B(x) as a decimal number, B(x) = aia ..at = 2 x = c i X 2 ~ + a X 2'~ + ... + a l l 2 2 t (6.3) B(x) can be treated as the summation of / binary unit basis. B(x) = a\ai...ai = a\V\ + a V + — + a/Vj 2 2 where : ai, a 2 ... a/ = 1 or 0 V! = 00...001 (6.4) V = 00...010 2 = 00...100 V, = 10...000 Where V V Vn, ... V} are the binary unit basis for any binary notation of / bits long, and ii oi, a 2i 2r ... o/ are the associated binary unit values. Since any real ( at a given resolution ) or integer number can be converted to an unique binary notation, the binary unit bases, Vi V2, VJj, ... V/ are the fundamental unit basis vectors that are t similar to any real axis unit basis. A hypercube spanned by the binary unit bases Vi, V2, Ki, ... V} ( detailed description of the hypercube in later section ). Given a function F( x ) defined in 0 < 84 Chapter 6: Physical insight into how Genetic Algorithms work x < x m a x ( assuming x is an integer ), the corresponding function in the binary domain will be F(ai,a>2r" °', with / = Rounded Integer(log2(x ))max F(aia2,...ai V\V2,...Vi) is a t function defined in a / dimension space spanned by the binary unit basis V\ V2, V3, ... Vi t Finding the maximum or minimum of a function ( optimization problem ) If a function F(x) is well behaved ( continuous and monotonic ) in the real number domain of interest, then many conventional gradient based methods can be used to locate the maximum or minimum of such a function. However if the function is poorly defined ( discontinuous, multimodal or highly nonlinear ), most conventional methods will perform poorly since such methods depend on a well defined function gradient. Figure 6.1 shows that a function F(x) can be linear or highly nonlinear, continuous or discontinuous in different regions of x . If one wants to locate the maximum or minimum of F(x), either all the values of F(x) over the interested domain are examined sequentially ( analytical form of F may not exist ) or a statistical method such as Monte Carlo is used to give rough estimation of the optimum location ( multiple simultaneous searches are possible but they are very difficult to coordinate ). However, if the real number ( at a given resolution ) domain x is mapped into the binary domain spanned by Vi V2, V3, ••• Vi, then a hypercube is formed. Figure 6.1 shows the mapping from a linear t one dimensional variable x to a hypercube. The advantage of such binary mapping is that with a / dimensional space, there can be at least / possible coordinated search directions for the locations of F(x)'s maxima and minima. It turns out that GAs operators Reproduction, Crossover, Mutation are tools that designed for coordinated searches in a hypercube space. GAs search space and the hypercube In GAs, the parameter space is usually encoded in a binary string format. Letting / be the length of the binary string, the parameters search space of a G A will contain 2 ( x 1 m a x ) different combinations. Instead of working on the real number system, GAs map the search space into a hypercube of dimension / ( refer to Chapter 1 "Introduction" ). Since a GA search space is mapped into a hypercube of dimension /, many interesting properties of the hypercube can be used to give some insights into how a GA works. Figure 6.2 shows a four 85 Chapter 6: Physical insight into how Genetic Algorithms work Hypercubesof /dimensions Figure 6.1: Mapping an one dimensional signal into a hypercube dimensional hypercube with its vertices and links. Some of the important properties of a hypercube of dimension / are: 1. The search space of a G A is within the hypercube. 2. The optimum solutions sought by the GA are vertices of the hypercube. 3. The number of bit difference between any two different vertices is 0 < 4. the number of bit difference < I. The minimum number of links between any two vertices on the hypercube is equal to the number of binary bit difference between them. For example, in Figure 6.2, going from vertex #12 ( 1100 ) to vertex #5 ( 0101 ) requires the spanning of at least 2 links. Thus there are 2 bits which are different between these two vertices. 5. Given any vertex on the hypercube of dimension /, the number of neighbours with n binary bit difference are shown in Table 6.1: 86 Chapter 6: Physical insight into how Genetic Algorithms work number of bit number of neighbours difference 0 0 1 / 2 /! / ( 2! ( 1-2 )! ) 3 /! / ( 3 ! (/-3)! ) .. . .. . /- 1 / / 1 Table 6.1 Number of neighbours vs number of bit difference Figure 6.2: A four dimensional hypercube 6.1.2 The Reproduction, Crossover and Mutation operators on the hypercube The Reproduction operator ensures that vertices (individuals ) on the hypercube with good fitness will have many identical clones while vertices with poor fitness will be eliminated. The Reproduction 87 Chapter 6: Physical insight into how Genetic Algorithms work Number of Location of the offsprings bit difference 1 ( no new location ) 2 On a plane ( 4 vertices ) which contains the original parents 3 On a cube ( 8 vertices ) which contains the original parents 4 On a hypercube of dimension 4 ( 16 vertices ) which contains the original parents n On a hypercube of dimension n which contains the original parents. Table 6.2 Locations of offspring cu be n dimensional hypercube plane 1 bit difference between parents 2 bits difference between parents 3 bits difference between parents original parent (|||| a vertex on the hypercube n bits difference between parents offsprings maximum bit difference from parents = ( n 12) bits possible offspring ( after Crossover ) Figure 6.3: The possible locations of the offspring as a function of the bit difference between parents The Crossover operator generates two new vertices ( offsprings ) that are in the proximity of the parents as shown in Figure 6.3. Thus the Crossover operator uses the bit difference information of the parents to generate offsprings such that the space spanned by the bit difference between the parents is searched. Chapter 6: Physical insight into how Genetic Algorithms work operator is responsible for identifying relevant regions ( many identical clones will be located in such region ) in which the Crossover operator can perform intensive multiple direction searchs. The Crossover operator is the most difficult operator to understand. It takes any two individual strings ( vertices ) and randomly selects a crossover point ( the crossover point is randomly selected in a simple GA ) interval 1 < k < / - l ( / = length of binary encoded strings ). Two new strings are then created by changing all bits between position k and / inclusively. For example: Before : B 0 = &1&2&3— (6.5) After (k = 2) : B\ = 6i02a,T...a/_ia/ The Crossover operator can be more easily visualized much better on the hypercube space. Let Ao = ai 02 a . i . . . a j - 1 a / BQ = 61626.1. (6.6) be two vertices on a hypercube with dimension equal to /, using the concept of bit difference between vertices on the hypercube, the following statements can be made: 1. The bit difference between An and Bo determines the location of the offsprings A i and B i on the hypercube ( Table 6.2 and Figure 6.3 ) . 2. If there is n bit difference between strings Ao and Bo, the bit difference between offsprings A i and B i must also be n bits. 3. Depending on the value of k ( the crossover point ), offspring A i and B i can have 0 , 1,2, ... , integer ( n/2) bit difference from AQ, BQ respectively ( n is the bit difference between Ao and BQ . 89 Chapter 6: Physical insight into how Genetic Algorithms work The Crossover process can also be explained in term of the binary basis V\ V Vs, ... V}: t 2t 1. Given two vertices An and Bo on a hypercube of dimension / AQ = a\a a%. ••<*/—IGJ 2 (6.7) BQ = Ol0203...5/-lO/ where : d\ = complement of ai(l,0) 2. An and Bo can be rewritten as AQ = a Vi + a V + 03 V3 + — + a/-iV/_i + a V x 2 2 t t (6.8) BQ = aiVi + a V + 63V3 + ... +'oj_iV/_i + a/V/ 2 2 Let Aj and B i be the products of Crossover process of Ao and Bo, then Ai = a{V\ + 02^2 + a V3 + ... + o/_iVj_i + a,V 3 t Bi = aiVi + a V + a Vn + ... + ai_iV}_i + a,F, 2 2 (6.9) 3 ty»7ft A; = 3 (t/te crossover point) 3. Then Ao - BQ = (01 - oi)Vi + - o )V3 + ... + (o/_i - a,_i)F/_i (03 3 (6.10) A i - Bi = (ai - 6i)Vi + (03 - a )V3 + ... + (6/_i - a/_i)V/_i 3 = (ai - oi)Vi + (a - a )Vh + ... + (o/_i - ai_!)Vi_i 3 3 (6.11) where : I4 = — Vi Since the binary basis are the same for Ao - B 0 and A - B x X (6.12) implies that the bit difference between A] and B i must be the same as that of Ao and Bo. 4. Crossover is similar to exchanging binary basis. For example, the new offspring A i loses the binary vectors V 3 , ... V n ( from Crossover ) and B i gains the binary vector V 3 , V i + i ( from the Crossover ). Thus the direction A i moves from Ao should be exactly opposite to the direction Bi moves from Bo within the smaller hypercube denned by the bit difference between the parents. 90 Chapter 6: Physical insight into how Genetic Algorithms work While choosing two parents is a random process ( in the conventional GAs ), Crossover is a structure searching process in the hypercube space ( Even though the Crossover point k is randomly chosen, the offsprings will still be inside the hypercube space spanned by the bit difference between the parents ). Since each binary basis signifies a move in a certain direction in the hypercube, exchanging binary basis in crossover is actually a way to use one, two, or all different binary basis between the two parents to find new vertices in the space spanned by all the different binary basis between the two parents. For example, given the following strings: A o = 01020304030(5 (6.13) 1. If the crossover point k is 2, the offsprings A i will move move 2. 02030403 02030405 away from Ao and B i will away from Bo. Thus no new offsprings are created. If the crossover point k is 3, then A i will move 030403 from Ao and B i will move 020304 from Bo. Thus 3 different bits are tested. The probability of applying the Mutation operator to any bit in a string is usually quite low. Mutation can be seen as a local search algorithm on the hypercube. Mutation operator allows any vertex ( an individual ) to move to any one of its closest neighbour randomly. This operator is a random process and is effective only when the solution is only a few bit differences from the estimated one. Visualizing the combined effect of Reproduction, Crossover, and Mutation process Figure 6.4 shows the combined effect of Reproduction, Crossover on a randomly generated initial population. In step #0, the randomly generated individualsfitnessvalues are calculated. Individuals with poor fitness are eliminated and individuals with good fitness are rewarded with more duplicates ( step #1 ). The Reproduction operator seeks out the important space of the hypercube by letting vertices with good fitness to have more duplicates. 91 Chapter 6: Physical insight into how Genetic Algorithms work Although Crossover is a stochastic operator (the parents are randomly chosen and the crossover point k is randomly generated ), its outcome ( offspring ) is quite predictable. It is seeking a combination of bit difference from the two individual parents to generate offsprings that may be closer to the solutions space. Since there are more copies of individuals with good fitness, there could be several different mates for such individuals. Thus the hypercube space ( or bit patterns ) around such individuals is searched more intensively ( step #2 ). The combination of the G A operators Reproduction and Crossover gives GA the searching power. The offsprings of the 2nd generation ( step #3 ) fitness are calculated. The process of Reproduction, Crossover is repeated. Mutation operator is a local searching technique ( on the hypercube ). It is effective when the estimated solution is only one or two bits from the optimum one. The searching power of GA is demonstrated since space around good individuals are searched from multiple directions simultaneously with coordination. After only a few generations, one can see that more and more offspring will be much closer to the optimum solutions. Hz. Chapter 6: Physical insight into how Genetic Algorithms work Offsprings ( 2 nd generation ) Reproduction ( 2 nd generation ) Crossover ( 2 nd generation ) Figure 6.4: The combined effect of Reproduction, Crossover 6.2 The importance of encoding the parameter space properly The effectiveness of G A s in searching toward the optimum value depends on how the parameters are encoded. Improper encoding of the parameters for G A s can increase the difficulties of the search similar to that of finding a needle in a haystack. For example, an impulse-like fitness function ( Figure 6.5 ) would reduce G A s ( or any other methods ) to something no better than a blind search. Fitness(x) x Figure 6.5: An impulse-like fitness function 93 Chapter 6: Physical insight into how Genetic Algorithms work In one of the experiments of system identification using GAs, we tried to reduce the size of the global population and increase the parameters convergence rate by shortening the individual binary string length. Instead of using the conventional GAs, a new combination G A is devised. Figure 6.6 shows how the conventional GA is divided into "coarse" G A and "fine" GA. The "coarse" GA will try to give a rough estimation of the system parameter ( Figure 6.7, using a coarse grid space — less bit ) to the "fine" GA. The "fine" G A will use the rough estimation of system parameters from "coarse" G A as a bias point to set a search space with much finer grid size to achieve the proper resolution. Since "coarse" GA is designed to give only a rough estimation of the parameter, its parameter convergence rate should be much higher than that of the conventional GA. Table 6.3 shows the number of bits used by the conventional, the "coarse" and the "fine" GA. System parameters Input/Output System Measurement System Model fitness function global population GA operators Bestfitsystem parameters ( window size ) GA (Sequential Genetic Algorithm) System parameters System Model » fitness function Local population GA operators (local window size ) Input/Output System Measurement "coarse" GA System Model fitness function Best estimated parameter ( Bias Point for the Fine grain GA) GA operators .Best estimated parameters (local window size ) Local population System parameters Tine" GA The new combination GA Figure 6.6: Block diagram of conventional GA and new combination GA 94 Chapter 6: Physical insight into how Genetic Algorithms work Coarse GA search grid FineGA search grid Simplified 2 dimensional parameter space Figure 6.7: "Coarse" and "Fine" GA grid size Parameters Conventional GA ( "Coarse"GA "Fine" GA bits used ) ( bits used ) ( bits used ) d (delay ) 2 2 2 a P 7 4-5 4- 5 7 4-5 4- 5 7 7 4-5 4- 5 6 7 4-5 4-5 g 7 4-5 4- 5 Length of 37 22-27 22-27 individual binary string Table 6.3 Number of bits used for the system parameters Since the string length of the "coarse" and the "fine" GAs are less than the original one, then based on [8] theory, the population size of "coarse" and "fine" GA can be reduced significantly. Thus the execution time of the new combination GA could be much shorter than that of the conventional 95 Chapter 6: Physical insight into how Genetic Algorithms work GA. The system model, fitness function and setup in the experiment are identical to those described in Chaper 5. The experimental result of the new combination GA is shown in Table 6.4. "Coarse" G A Length of Population size individual Results binary string 24 30 50 22 failed to converge 27 good ( converge rapidly ) 22 failed to converge 27 failed to converge 22 failed to converge 27 slow convergence rate Table 6.4 The performance of "coarse" GA with various size of population Contrary to our expectations, the performance of the new combination G A was poor and unreliable. For individual string length of 22, the "coarse" GA failed to converge for all three different population sizes ( 4 bits are used to encode a, /?, 7, 6, g ). With string of 27 bits long ( 5 bits for each parameter ), "coarse" GA is still unreliable. In an attempt to reduce the string length for the "coarse" GA, the parameters were encoded incorrectly. By encoding the parameters into only four or five bits ( Only the most significant bits of the parameters are used ), all bits have equal importance. In the other word, any individual that does not match completely the solution bit by bit will have a poorfitness.From the hypercube model, the solution space for the "coarse" GA is reduced to a few locations on the hypercube. This is similar to having a impulse-like fitness function and a GA is no better than a random blind search. If seven bits are used for each parameter, out of the 37 bits in an individual string, 15 bits ( the lower order bits of the encoded parameters ) are very similar to the "don't care" bits. Such individuals havefitnessvalues very similar to the optimum ones. With 15 "don't care" bits, more than two or three thousands of such individuals will locate at many sections of the hypercube ( see the neighbours of the hypercube in Table 6.1 ). For some applications ( system identification ) and 96 Chapter 6: Physical insight into how Genetic Algorithms work certain combination of / and D, ( / = the dimension of the hypercube and D = the number of "don't care" bit, the probability offindinga good solution ( not the optimum ) can increase significantly. 6.3 Comments and discussion While Holland's schemata theorem gives an excellent explanation to the searching power of GAs, it does not provide a good physical model of GA since the theorem is based on stochastic models. We have shown that by mapping the search space of GAs into a hypercube, a working physical model of GAs can be built. With a physical model, GA mechanisms can be analyzed with more precision. Such a physical model may also allow one to further fine tune the GA mechanisms for better performance in a specific area. The physical model gives a more precise explanation of GAs searching power, and it can help to resolve many other future technical issues such as the following: A more realistic estimation of GA's population size In the past, the schemata processing rate [11] ( based on Holland schemata theorem ) is used to estimate the optimum population size. The analysis [8] may be too conservative since it states that the population size of GAs should increase exponentially as string length is increased. Such analysis contradicts with concept of the bit difference geometry of the hypercube. How to encode the parameter space In the past, trial and error was used tofindthe optimum encoding for the parameters. The "coarse" and "fine" G A example illustrates how easily a mistake can be made in encoding. The hypercube physical model explained why "coarse" GA performed so unreliably. In certain applications, stuffing binary string with "don't care" bits can help GAs to find good solutions ( vertices ) on the hypercube easier. For example, given the following binary string: a 1020,104 it can be converted to ... ai^ i-\ i a a (6.14) Chapter 6: Physical insight into how Genetic Algorithms work Oi * 02 * 03 * 04 ... aj_2 * * a,i (6.15) The "don't care" bits " * " increase the bit range spanned by the number of vertices with fitness that are close to optimum, and thus increase the chance that GAs canfindgood solutions. Although the global search space increases exponential with number of bits in the binary string ( 2 ), the l dimension of the search space increases only linearly ( / ). Initial randomly generated population replaced by predefined populations A different initial GAs population pattern can be used instead of a randomly generated one. Some prior knowledge of the search space, such as minimum space resolution, can be used to improve convergence rate. Such a technique can provide a better coverage of the search space than a randomly generated one. Improving the Crossover operator Choosing two individuals for Crossover should not be totally random. The hypercube physical model of the search space states that 1. Crossover between parents of 1 bit difference produces no new offsprings 2. Crossover between parents with bits difference in the "don't care" region produces no "new" offsprings. If the above precautions are taken, the Crossover operator should become much less noisy ( stochastic ) and behaves more like a structure search. Modified GAs are powerful multidimensional, almost deterministic ( with some stochastic favors ) optimization algorithms. 98 11 Chapter 7: Conclusions Chapter 7 Conclusions The G A was used to estimate the compliance of the hydraulic system on the UBC teleoperated heavy duty excavator. Using real recorded data from the excavator, the G A successfully identified the compliance of the boom hydraulic circuit The accuracy of the estimated compliance from G A was cross checked by a simulator. We found that the simulator output PRCM agreed very well with measured PBCH ( Figure 3.8, within 10% ), indicating that the estimated compliance CBCH was accurate. GA was also used to estimate the compliances of multiple links simultaneously. The agreement between the simulation and estimated internal states of the hydraulic circuit ( shows in Figure 3.9 to Figure 3.11 ) indicated that both the estimated compliances and the estimated internal states of the hydraulic system from G A were accurate ( within 10% ). The searching ability and power of G A were well demonstrated in this example. Different algorithms and architectures were studied for a parallel implementation of G A . For the G A used in system identification, both population and fitness calculation could be parallelized. Such combination allows the use of the pipeline techniques, which improved the efficiency of the parallel system. A P G A was implemented with sixteen T800 Transputers. It achieved a speedup factor of 12 over a traditional G A . This P G A was used to identify the compliance of the boom hydraulic circuit ( Chapter 3 ). The estimated compliance from this P G A was almost identical to the one from traditional G A . With such a high speedup factor, real-time monitoring of hydraulic compliance and other hydraulic parameters is becoming possible. While many papers on " P G A in function maximization" can be found in the literature, there seems to be no published paper on " P G A in system identification". This may be because of the inherent disadvantages in P G A , such as slower parameter convergence rate and lack of guarantee that it will converge to an optimum. In Chapter 5, we addressed the different requirements between function maximization and system identification and introduced three new mechanisms: the distributed fitness function, the broadcasting 100 Chapter 7: Conclusions mechanism and the active error analysis that could be used to enhance the performance of PGA. Simulation results confirmed the effectiveness of these three mechanisms. A PGA which incorporates these three mechanisms can actually outperform GA in key areas such as variance of the estimated parameter and parameter tracking ability. There are many conventional methods available for linear system identification. If the system is nonlinear, the identification problem is much more complex and difficult The GA is not recommended for nonlinear system identification if other identification methods can be used. However there are many nonlinear systems where conventional identification methods perform poorly or fail, the G A may become the only alternative method available. Even through there is no guarantee that GA will converge to an optimum solution, from our experience with nonlinear systems identification using the GA, we find that the GA usually provides solutions that are close to the optimum ones. In Chapter 6, we derived a physical model that explain the fundamental properties of GAs. The physical model ( a hypercube ) not only provide an excellent explanation of GA searching power, but also provide insights to GAs user ways to improve the performance of GAs in most applications. The hypercube physical model also explains why the GA and PGA are so successful in locating solutions near the optimum one in nonlinear system identification. In a typical nonlinear system identification application, the parameters are encoded in a binary string as follow: a\/3\f\6 ...|A (7.1) aia2a^..a bib2b^...b ... m n Where n bit is used to encode a, m bit is used to encode /?, ... etc. Usually only half of the bit used for each parameter is significant ( the most significant bits of the parameters, eg. 0102030405). The insignificant or unimportant bits of the parameters can be classified as the "don't care" bits. Thus with so much "don't care" bits encoded in the binary string, the probability for the GA or PGA to find a solution in the hypercube space is quite high. Finally, The fundamental properties of GAs are as followed: 1. By converting parameter search space from a real number system into a binary number system, GAs increase the dimension of the search space. Higher dimension search space allows multiple 101 Chapter 7: Conclusions search with different directions, thus increasing the efficiency of function maximization process in the search space by at least / times the linear method. 2. The hypercube configuration is an excellent tool to illustrate the operation of G A operators: Reproduction, Crossover, and Mutation. By eliminating individuals with poor fitness and cloning individuals with good fitness, the Reproduction operator can quickly locate areas of interest on the hypercube. On the hypercube, Crossover can be seen as a directed structural search method that uses the difference between the two parents to produce offspring in the direction ( derived from the bit difference between parents ) toward the optimum. Mutation is just a simple random neighborhood search around any vertex. The physical model provides a new way to re-evaluate most of the important parameter settings of the GAs. From the last chapter, we point out that it is possible to derive: 1. A realistic population size that grows linearly instead of exponentially with respect to the binary string length ( / = dimension of the hypercube ) for certain applications. 2. The Crossover operator can be tuned so that it is behaves much more like a structural search and resembles much less as a stochastic operator. 3. Encoding the parameters properly so that premature convergence or blind search can be avoided. With all the technical issues resolved, the structured GA is a powerful multidimensional, deterministic ( with some stochastic flavor ) optimization algorithm. 102 Appendix A The boom hydraulic circuit and its model Voltage-Spool Transfer function VBOOC) Spool Dynamic Desired Spool(k) Spool-Orifices Transfer function SpoolQc) Hydraulic circuit and First order pipe model aibo(k) aebo(k) aobo(k) ( main valve orifices area ) Boom Angle(k) PBOi(k) PBOo(k) Figure A . 2 : The mathematical model of the boom hydraulic circuit A . 102 The Voltage-Spool Transfer function for the b o o m : Desired Spool(k) = 0.0892FJ + 0.2352Fj + 0.2815Veo + 0.1297 o o The Spool dynamic: Discrete time model : Spool(k) = Desired Spool(k) x (l - e- ' ) + e^ a T aoT) The Spool-Orifices Transfer function: HminSpooip] = the dead band in the Spool = 0.188 inch. a ebo-' if ( Spool <= HminSpool[l] ) a bo = e (-7.85 in. X Spool) + 1.5235 in. else if ( Spool <= 0.376 in.) a bo e else aebo -0.25 in. x (Spool - 0.376 in.) = 0.0 in.; Uibc if ( Spool <= HminSpooirj] ) aibo = 0.0 ; else if ( Spool <= 0.376 ia) a.to — 1-247 in. X (Spool — HminSpool[l]) else a^o - (3.927 in. x (Spool - 0.376)) + 0.2346 in. A. 103 x Spool(k) Oobo if ( Spool <= HminSpool[l] ) aobo=0-0 in.; else if (Spool < 0.248 in.) a bo = (Spool - 0.248 0 tn.) X HminSpool[l] + 0.0113 in. (A.7) else if ( Spool < 0.376 in. ) a bo = (Spool - 0.376 in.) x 1.09 in. + 0.1509 in. (A.8) a bo = (Spool - 0.376 in.) x 3.927 in. + 0.1509 in. (A.9) 0 else 0 A.104 Appendix B Dynamic equations for hydraulic system in configuration a, branch #1 Main Hydraulic Valves Pump 1 I I Junction #1 Tank > Bucket Spool ^aobu ^ ^aibu ^ aebu | Qn hose 'BUo hose | Q B , Ui BUi P12 > | Junction #2 | Tank Boom Spool ^ ^ ^ a e b o BOo aibo ^ QBOI Q12 ^ a o b o Oo hose Bucket Actuator Pe BOi Tank Boom Actuator hose BOo Figure B.l: The branch #1 of the main hydraulic valves in configuration a B.105 B.l Equations describing the hydraulic configuration a branch #1 Measured variables : PBUI, PBOi, #BU, OBO, VBU, VBO (or Spool u and Spool o) B B Calculated from measured variables : PBUi, PBOi, XBU, XBO, the orifices areas (B.l) Estimated parameters : (pump side compliance) CBIH, CBOi Unknown internal states : QBUi, QBOi, Qn, Q12, Pu, P\i First order pipe model : CBOi ^ = QBOi - A-BOiX-BO CBUi—^ (B.2) = QBUi - AsuiXsu Where ABOJ = the boom actuator pump side piston area, ABUI = the actuator pump side piston area, Equations for hydraulic flow : = Q Ui(t) B k a (t) y/P {t) ibu P ui(t) n B Quit) = k a (t) y/P (t) - Pu(t) ebu n (B.3) Q Oi(t) = k aiboitWPnit) - P oi{t) B B <3i(0 = k a (tWPn(t) 2 ebo - P e Flow Constraint: Qt = Qn + QBUi Qn = Qn + QBOi B.106 (B.4) B.2 Simplified orifices area calculation The simplified hydraulic model does not contain the Voltage-Spool and the Spool-Orifices transfer functions. It assumes a step input and the orifices areas are described by the following equations: The dynamics o.'6u(0 =a ibu of the hydraulic i (l - exp - 0 0 ') K i m O - a bui)exp~ e a,-6 i(l 0 a bo(t) (a 6o0 e e valves : aot + a e b u l exp- ) aat - Oe6oi)exp B.107 - O o t + a bol e (B-5) Speedup and efficiency definitions Appendix C Speedup is defined as: _ , GA execution time for 1 processor Speedup = — GA execution time for N processores where : GA execution time for 1 processor = GA fitness calculation time(tp) + GA operator time GA execution time for N processors — GA fitness calculation time(t /N) + GA operator ti p t = Communication overhead for N processor. c Thus : Speedup = . P^~ — % + t + t i t s ts s c ;s ft + «. if t >> t s c (Cl) Efficiency is defined as: „ ,,. Speedup obtained from N processsors Speedup Efficency = = C.108 ._ (C.2) Appendix D Overview of available computational resources Details of the available hardware resources are shown in Figure D . l . The host computer is a Sun 3/280 68020 based CPU equipped with a terminal board, an Ethernet interface, and a disk storage subsystem. The distributed system consists of the following modules: 1. The Bus Masters ( Parsytec-BBKV2 ): A transputer bus master is composed of an T800 transputer with 2 MBytes of dual-ported memory which is asynchronously accessible by the transputer and the VMEbus. The bus master also performs automatic conversion of data format, allowing compatible messages to be exchanged efficiendy with the host computer. 2. Clusters ( Parsytec-VMTM ): Each cluster module consists of four Inmos T800 transputers each with 1 MByte of local memory, nine external serial ports, a 32x32 crossbar switch, and four link adapters for interfacing a transputer connection link to the VMEbus. The external serial ports and the crossbar can be used to connect a transputer from a cluster module to another transputer on any other cluster module. The 4 link adapters on the VMEbus provide the facilities to support broadcasting of data from the host computer or the Transputer bus master. The Transputer T800 architecture: The Transputer is designed and built on Hoare's concept "Communication Sequential Processing" [10]. All processes on the Transputers communicate synchronously through soft ( internal channel ) or hard ( external transputer links ) channels and therefore all concurrent processes synchronize automatically. The Transputer has a built in scheduler for all its processes. Any process that is waiting for input will be de-scheduled until its data become available. Thus the CPU does not spend any time idling. With high speed data links of ( 20 Mbit/s ) and direct memory addressing to support the hard link features, there is very little interruption for the local CPU for communication among two Transputers. Such features make parallel processing on multiple Transputers feasible and efficient. The T800 Transputer hardware block diagram is shown on Figure D.2. D.109 Interconnection Network Interconnection Network Figure D.| Available hardware resources Floating Point Unit System Services Timer 32 bits 4 Kbyte On-chip RAM Link Interface Externa! Memory Interlace Link Interface Link Interface Link Interface 32 bits Figure The block diagram of the Transputer T800 D.IK? Appendix E P G A implementation details As discussed in Chapter 3 "Identification of hydraulic compliance with GA", to identify the single link hydraulic compliance, the global population size is set between 100-120. The ratio a is in the range between 8 to 16. The minimum local population size Mioc is set at 30 to protect the diversity of the local population ( using the criteria discussed in next Chapter ). To achieve as much speedup as possible, algorithm A and algorithm B are combined. The maximum speedup is: 120 8 + 1 Max. speedup = —— x —-— « 16 oU (E.l) 2 Level 1: global population ( algorithm B ) Given the minimum local population size of 30 and a global population of 120, there will be 4 local GAs. The 4 local GAs are connected in a ring network using the hard link of the Transputer. Level 2: The Fitness Calculation ( algorithm A ) With a local population size of 30, fitness calculation time tp2 and the sequential G A operators time ( Reproduction, Crossover, Mutation ) U2 accounts for 80% and 20% of the execution time respectively. Such high ratio of a ( tp2 /to)fitsthe master- slaves scheme requirement. Each local GA unit will consist of one master and several slave processors. The master processor distributes individuals from the local population to slave processors. Slave processors calculate the fitness value and return the result to the master. For the master-slaves scheme to work efficiently, the total communication time tc2 between master and slaves must be much smaller than t 2- The T800 S Transputer high speed serial link ( 20 Mbit/s ) should be able to cut down tc2 substantially. Due to the limited number of T800 transputers available, 3 slaves are used for each NGA. The total number of Transputers used in this PGA implementation is 16. With one master and 3 slaves, the data on the communication channel will be: 1. the length of individual string times the number of individuals ( 240 bytes ) E.111 2. the input and output measurements of the system ( 148 bytes ) 3. the fitness values of the individuals ( 240 bytes ) The total size of data is approximately 600 bytes. Assuming direct connection between the master and slaves, ( in direct connection, each slave is connected to the master by a dedicated serial link ), the communication overhead (task switching) on the Transputer should be small, and the master-slave communication time will then be approximately equal to the transmission time of data on the serial links. With transmission rate of 20 Mbit/s, the master- slaves communication time would be 0.4 ms. Since 0.4 ms is much smaller than the measured GA operators time ( 10.9 ms ), the fitness calculation can be successfully parallelized. Figure E . l shows the software block diagram of the master-slave scheme. Due to the limited number of Transputer serial channels, only 1 link on the master node is available for sending and receiving data to and from slave processors. Figure E.2 showed the hardware implementation of the PGA. The communication overhead tc2 would increase since direct connection is not possible and data must be re-routed among slave processors. To make sure that in the worst case master-slave communication time would still be small, the timing of processes are measured. The results of the measurement are summarized on Table E . l . It is important to note that the measured t& is significantly higher than the computed one ( 1.89 ms vs 0.4 ms ). However it is still much smaller than the G A operators time ( 1.89 ms vs 10.5 ms ). With 1 master and 3 slave processors, the measured speedup factor for level 2 parallelisation is 3.0, which agrees with the calculated speedup factor. The combined speedup factor for algorithm A and B is: Combined speedup = level 1 speedup x level 2 speedup M loc la + 1 The pipeline technique is not used in here because 1. The communication overhead tc2 will increase rapidly if direct connection between master-slaves is not possible ( pipeline implementation will double the number of slaves ) E.112 2. a is relatively small in this example and the difference between pipeline and nonpipeline implementation speedup factor will be small. GA, PGA with algorithm B, and PGA with combined algorithm A & B achieved speedup factors are listed in Table E.l for comparison. | Initialization""! Local GA node (with local population size of 24) 1 Sample data I Master Slave 1 T T Fitness Calculation Fitness Calculation! Slave 3 Slave 2 Fitness Calculation 1 Fitness Calculation Average all fitness value Reproduction ( protect diversity Is there a Vyes super-individual 7 J Ranking Reproduction Recombination Mutation Exchange Keepbest From other local GAs X Recording X Nextgeneration To other local GAs GA Operators Figure E.1: Software block diagram of the master-slave scheme E.113 VGA2 NGA3 SUN3/60 User InUrface link-3 NGA1 Unk-0 Iink-1 NGAO llnk-2 • Slavel Slave 2 Slave 3 T800 Transputer Highspeed Data link Figure E.2: The Implementation of a PGA ( algorithm A and B ) Master ».Q Start Tl t Send data T2 Slave #1 Slave #2 T3 io^ Fitness Calculation ^Fitness Calculation^ fitness Calculation' io^ T4 T5 Receive data T6 V Operators -6T7End Defination: I Send & Receivetime(Tsr) =T5 -T2 GA operator time (Tga) = T7-T6 Fitness function time (Tfit) =T4 -T3 Total execution time (Texe) = T7 - T l Communication Overhead ( Tcom ) = Tsr - Tfit Figure E.3: Measurement Method used for Timing Process E.l 14 Number of slave processors 0 1 2 3 Execution time ( Texe ) 97.0 ms 54.0 ms 39.7 ms 32.8 ms Send - Receive time ( Tsr ) 86.4 ms 43.3 ms 29.5 ms 22.5 ms Fitness calculation time ( 86.4 ms 43.3 ms 29.0 ms 21.8 ms Communication Overhead ( Cfaxa ) 0.0 ms 0.6 ms 1.28 ms 1.89 ms GA operator time ( Stung ) 10.S ms 10.5 ms 10.5 ms 10.5 ms Pom2 ) Table E . l Measurement of processes timing GA and PGA in identifying single link hydraulic compliance : GA Level 1 Algorithm (B) Level 2 Algorithm (A) Combined Algorithm (A + B) Number of processors used 1 4 4 16 Global Population size 120 120 N/A 120 Local population size N/A 30 30 30 Number of generations calculated per sec. 9.8 N/A N/A 117.6 Speedup achieved 1 4 3 12 Efficiency ( Speedup / processors ) 1 1 0.74 0.74 Table E.2 The measured speedup factor of various PGAs E.115 References [I] An and H. Chae. Model-based control of a robot manipulator. The MIT Press, Cambridge, Massachusettes, 1988. [2] B. Armstrong. On finding 'exciting* trajectories for identification experiments involving systems with non-linear dynamics. Proc. IEEE Int. Conf. Robotics and Automation, pages 1131-1139, 1987. [3] An C.H. Atkeson and C.G. Griffiths. Experiment evaluation of feedforward and computed torque control. Proc. IEEE Int. Conf. Robotics and Automation, pages 165-168, 1987. [4] An C.H. Atkeson and Hollerbach. Estimation of inertia parameters of rigid body links of manipulators. Proc. 24th IEEE Conf. Decision and Control, pages 990-995, 1987. [5] R. Das and D. E. Goldberg. Discrete-time parameter estimation with genetic algorithms. The Modelling and Simulation Conference Proceedings, 1988. [6] Edward D. Lazowska Derek L. Eager, John Zahorjan. Speedup versus efficiency in parallel systems. IEEE Transactions on Computers, 38(3):408^22, March 1988. [7] David Goldberg. Optimal initial population size for binary-coded genetic algorithms. TCGA Report No. 85001, 1985. [8] David Goldberg. Sizing population for serial and parallel genetic algorithms. The International Conference on Genetic Algorithms, 89, pages 70-79, 1989. [9] David Goldberg and Jon Richardson. Genetic algorithms with sharing for multimodal function optimization. Genetic algorithms and their applications: Proceedings of the Second International Conference on Genetic Algorithms, pages 41-49, 1987. [10] C.A.R. Hoare. Communicating sequential processes. Communications of the ACM, 8:666-677, August 1978. [II] J. H. Holland. Adaptation in Natural and Artificial Systems. University of Michigan Press, 1975. E.116 [12] K. Kjistinssoa Genetic algorithms in system identification and control. Master's thesis, Univ. of British Columbia, Vancouver, B.C., 1988. [13] K. Kristinsson and G.A. Dumont. Genetic algorithm in system identification. IEEE International Symposium on Intelligent Control, 3, 1988. [ 14] N. Sepehri G. Dumont P.D. Lawrence and F. Sassani. Cascade control of hydraulically-actuated manipulators. Robotica, 8:207-216, 1990. [15] N . Sepehri P.D. Lawrence and F. Sassani. Gear backlash and stick-slip friction in a teleoperated heavy-duty hydraulic manipulator. Proc. Canadian Conference on Electrical and Computer Eng., pages 45-49, 89. [16] Crisila B. Pettey Michael R. Leuze and John J. Grefenstette. Genetic algorithms on a hypercube multiprocessor. Hypercube Multiprocessors, pages 333-341, 1987. [17] Crisila B. Pettey Michael R. Leuze and John J. Grefenstette. A parallel genetic algorithm. Proceedings of the Second International Conference on Genetic Algorithms, pages 155-161, 1987. [18] B. Manderick and P. Spiessens. Fine-grained parallel genetic algorithms. The International Conference on Genetic Algorithms, 89, pages 428-433, 1989. [19] D. McCloy and H.R. Martin. The Control offluidpower. John Wiley and Sons, New York, 1982. [20] H.E. MerriL Hydraulic Control System. John Wiley and Sons, New York, 1967. [21] Chrisila C. Pettey and Michael R. Leuze. A theoretical investigation of a parallel genetic algorithm. The International Conference on Genetic Algorithms, 89, pages 398-405, 1989. [22] M.B. Priestley. Non-Linear and Non-Stationary Time Series Analysis. Academic Press, New York, 1988. [23] Nariman Sepehri. Dynamic Simulation and Control of Teleoperated Heavy-Duty Hydraulic Manipulators. PhD thesis, Univ. of British Columbia, Vancouver, B.C., 1990. [24] Reiko Tanese. Parallel genetic algorithm for a hypercube. Genetic Algorithms and Their Applications: Proceedings of the Second International Conference on Genetic Algorithms, E.117 pages 177-183, 1987. Reiko Tanese. Distributed genetic algorithm. The International Conference on Genetic Algorithms, 89, pages 434-439, 1989. E.l 18
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Genetic algorithms, their applications and models in...
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
Genetic algorithms, their applications and models in nonlinear systems identification Wan, Frank Lup Ki 1991
pdf
Page Metadata
Item Metadata
Title | Genetic algorithms, their applications and models in nonlinear systems identification |
Creator |
Wan, Frank Lup Ki |
Publisher | University of British Columbia |
Date Issued | 1991 |
Description | The Genetic Algorithm was used to estimate the hydraulic compliance of the hydraulic system on the UBC teleoperated heavy duty excavator. Using real recorded and simulation data from the excavator, the Genetic Algorithm has successfully identified the compliance of single link and multi-link hydraulic system of the excavator. A Parallel GA ( PGA ) was implemented with 16 T800 Transputers. It achieved a speedup factor of 12 over a traditional GA. With such a high speedup factor, real-time monitoring of hydraulic compliance and other hydraulic parameters is becoming possible. New mechanisms such as the distributed fitness function, the active error analysis were used to enhance the performance of a PGA. A PGA which incorporated these mechanisms actually outperformed a traditional GA in key areas such as variance of the estimated parameter and parameter tracking ability. Finally, a physical model that explains the fundamental properties of GAs was introduced. The physical model ( a hypercube ) not only provides an excellent explanation of GAs searching power, but also gives insight to GAs users ways to improve and to predict the performance of GAs in most applications. |
Subject |
Algorithms Hydraulics -- Mathematical models |
Genre |
Thesis/Dissertation |
Type |
Text |
Language | eng |
Date Available | 2010-11-23 |
Provider | Vancouver : University of British Columbia Library |
Rights | For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use. |
DOI | 10.14288/1.0098602 |
URI | http://hdl.handle.net/2429/30107 |
Degree |
Master of Applied Science - MASc |
Program |
Electrical and Computer Engineering |
Affiliation |
Applied Science, Faculty of Electrical and Computer Engineering, Department of |
Degree Grantor | University of British Columbia |
Campus |
UBCV |
Scholarly Level | Graduate |
Aggregated Source Repository | DSpace |
Download
- Media
- 831-UBC_1991_A7 W36.pdf [ 5.82MB ]
- Metadata
- JSON: 831-1.0098602.json
- JSON-LD: 831-1.0098602-ld.json
- RDF/XML (Pretty): 831-1.0098602-rdf.xml
- RDF/JSON: 831-1.0098602-rdf.json
- Turtle: 831-1.0098602-turtle.txt
- N-Triples: 831-1.0098602-rdf-ntriples.txt
- Original Record: 831-1.0098602-source.json
- Full Text
- 831-1.0098602-fulltext.txt
- Citation
- 831-1.0098602.ris
Full Text
Cite
Citation Scheme:
Usage Statistics
Share
Embed
Customize your widget with the following options, then copy and paste the code below into the HTML
of your page to embed this item in your website.
<div id="ubcOpenCollectionsWidgetDisplay">
<script id="ubcOpenCollectionsWidget"
src="{[{embed.src}]}"
data-item="{[{embed.item}]}"
data-collection="{[{embed.collection}]}"
data-metadata="{[{embed.showMetadata}]}"
data-width="{[{embed.width}]}"
async >
</script>
</div>
Our image viewer uses the IIIF 2.0 standard.
To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0098602/manifest