A D A P T I V E CONTROL OF T H E MILLING PROCESS By Fariborz Talebzade Ordubadi B.Sc. (Mechanical Engineering) S.U.T. ,Tehran M.Sc (Mechanical Engineering)University of California,Berkeley A THESIS SUBMITTED IN PARTIAL F U L F I L L M E N T O F T H E REQUIREMENTS F O R T H E D E G R E E O F M A S T E R OF APPLIED SCIENCE in T H E F A C U L T Y O F G R A D U A T E STUDIES M E C H A N I C A L ENGINEERING We accept this thesis as conforming to the required standard T H E UNIVERSITY O F BRITISH COLUMBIA March 1989 © Fariborz Talebzade Ordubadi, 1989 In presenting degree this at the thesis in University of partial fulfilment of of department this or publication of thesis for by his or requirements British Columbia, I agree that the freely available for reference and study. I further copying the representatives. It this thesis for financial gain shall not granted is of M e x W /x y v J ^ C rx Q The University of British Columbia Vancouver, Canada Date DE-6 (2/88) T X ^ ^ L <h , Pf\ Library shall make by the understood it that head of copying my or be allowed without my written permission. Department an advanced agree that permission for extensive scholarly purposes may be her for ^I/V^A^-C^V ~ ^ ^ T ) Abstract Cutting forces in the milling process vary depending on the work-piece geometry and cutting parameters. When the cutting forces exceed a certain limit, the tool may break and cause damage to the work-piece and eventually to the machine tool. Adaptive cutting force control systems can be used to manipulate cutting operation parameters in order to keep the cutting forces at a safe level. Successful application of the method leads to increased metal removal rate and productivity in machining processes. In this thesis, a second order transfer function is used to represent the time invariant dynamics of a research milling machine's feed drive servo system. The command feed velocity is the input and the actual feed is the output of the servo system. The actual feed manipulates the cutting forces which are modelled by a first order time varying dynamic system. Three existing adaptive control methods have been designed to control the milling process. Adaptive Proportional Integral Derivative (PID), Pole-Placement and Model Reference Adaptive Control (MRAC) algorithms have been simulated and experimentally verified. It has been shown that when the dynamics of both the time invariant servo and the time variant cutting process are modelled correctly, the adaptive control algorithms can perform well. Simulations and experiments, which have been carried out with identical cutting conditions, show that PID and Pole-Placement controllers can be successfully applied to milling force control. ii Table of Contents Abstract ii List of Tables vi List of Figures vii Nomenclature ix Acknowledgement xii 1 Introduction 1 2 Literature Review 4 2.1 Introduction 4 2.2 NC and CNC Machines 4 2.3 Adaptive Control 5 2.3.1 Gain Scheduling 5 2.3.2 Model Reference Adaptive Control (MRAC) 6 2.3.3 Self-Tuning Control (STC) 6 2.4 3 Adaptive Control of Metal Cutting Process 10 Milling Process 17 3.1 Introduction 17 3.2 Modelling of Cutting Forces in Milling 17 3.3 Modelling of the Milling Process 20 iii 4 3.4 Experimental Set-up 26 3.5 Experimental Verification of the Milling Process Modelling 32 Controller Design and Application 41 4.1 Introduction 41 4.2 Modelling of the Feed Drive Controller 41 4.3 Parameter Identification Method 45 4.4 4.5 4.6 Adaptive PID Control Design 4.4.1 Introduction 48 4.4.2 Adaptive PID Design for Milling Process Control 48 4.4.3 Simulation and Experimental Results 54 Adaptive Pole-Placement Control Design 60 4.5.1 Introduction 60 4.5.2 Model Considerations 66 4.5.3 Theory of Pole-placement Design for Machining Process Control 68 4.5.4 Application of Pole-Placement Design for Milling Process Control 71 4.5.5 Simulation and Experimental Results 74 Model Reference Adaptive Control Design 81 4.6.1 Introduction 81 4.6.2 Theory of MRAC for Machining Process Control 81 4.6.3 Application of MRAC Design for Milling Process Control . . . . 89 4.6.4 5 48 Simulation and Experimental Results Concluding Remarks 91 102 Bibliography 104 iv Appendices 109 A P I D Control Algorithm 109 B Pole-Placement Control Algorithm 112 C M R A C Algorithm 115 D Data Acquisition Software 119 v List of Tables 4.1 Psuedo Code for Parameter Identification Method 4.2 Psuedo Code for PID Control Algorithm 73 4.3 Psuedo Code for Pole-Placement Control Algorithm 73 4.4 Psuedo Code for MRAC Design 90 vi . 47 List of Figures 2.1 Block Diagram of Gain Scheduling Method 7 2.2 Block Diagram of Model Reference Adaptive Control Method 8 2.3 Block Diagram of Self-Tuning Control Method 9 3.4 Chip Thickness Variation in Milling 19 3.5 Resultant Force Simulation in Half Immersion Cutting 21 3.6 Modelling of Cutting Process in Milling 23 3.7 Schematic View of Experimental Setup 27 3.8 Schematic View of Servomotors . 28 3.9 General Layout of Peak Detector 31 3.10 Measured Peak Resultant Cutting Force 33 3.11 Measured Average Forces in X and Y Directions 35 3.12 Deflection of the Cutter on the Spindle 36 3.13 Simulated Peak Resultant Cutting Force 37 3.14 Measured Peak Resultant Force and Simulated First Order Model . . . 39 3.15 Measured Peak Resultant Force and Predicted Forces 40 4.16 Block Diagram of Feed Drive Controller 42 4.17 Adaptive PID Control Loop 49 4.18 Root Locus for PID Design 55 4.19 Cutting Profile 56 4.20 PID Controller Simulation 57 4.21 PID Controller Simulation with Run-out 59 vii 4.22 Adaptive PID Controller Machining Test, Peak Force Measurement . . . 61 4.23 Adaptive PID Controller Machining Test, Control Input 62 4.24 Adaptive PID Controller Machining Test, Feed-rate Measurement . . . . 63 4.25 Adaptive PID Controller Machining Test, Estimated Parameters . . . . 64 4.26 Adaptive Pole-Placement Control Loop 65 4.27 Pole-Placement Controller Simulation 75 4.28 Pole-Placement Simulation with Run-out 76 4.29 Adaptive Pole-Placement Machining Test, Peak Force Measurement . . 4.30 Adaptive Pole-Placement Machining Test, Control Input 4.31 Adaptive Pole-Placement Machining Test, Feed-rate Measurement 77 78 . . . 79 4.32 Adaptive Pole-Placement Machining Test, Estimated Parameters . . . . 80 4.33 Tracking and Regulation Control Block for a Known Plant 85 4.34 Tracking and Regulation Adaptive Control Block 88 4.35 M R A C Simulation 92 4.36 MRAC Simulation with Run-out 93 4.37 MRAC Machining Test, Measured Peak Force 94 4.38 MRAC Machining Test, Control Input 95 4.39 M R A C Machining Test, Measured Feed-rate 96 4.40 M R A C Machining Test, Estimated Parameter 97 4.41 MRAC with Integral Action, Measured Peak Force 99 4.42 MRAC with Integral Action, Control Input 100 4.43 M R A C with Integral Action, Measured Feed-rate 101 viii Nomenclature A: process denominator polynomial A: M model denominator polynomial AQ: observer polynomial a: axial depth of cut a,fe:digital filter parameters ai,feo: estimated parameters of model a : weighting factor t Bfi friction coefficient B: process numerator polynomial B : model numerator polynomial m C\\ model denominator polynomial C2: regulation dynamics polynomial D: model numerator polynomial d: time delay 8: deflection of the tool e: plant-model error e: auxiHary error e'rfiltered plant-model error £*: augmented error F: resultant force F : average force in longitudinal direction ax F '. average force in transverse direction ay ix F : radial force r F : tangential force t F : force in longitudinal direction x F : force in transverse direction y / : linear feeding velocity GCL- closed loop transfer function GOL' open loop transfer function Gp: cutting process transfer function Gpi'. plant transfer function Gs- servo motor transfer function H : tachometer constant g h: instantaneous chip thickness J : equivalent inertia reflected to motor shaft K: table's leadscrew gain Kd'- derivative gain Kda' K: e D / A converter gain encoder gain Ki'. integral gain Kp\ proportional gain K: digital filter gain K: specific cutting pressure p s Kt'. torque constant of the motor K: x equivalent stiffness of the tool on the spindle k: time index L: gain vector x N: spindle speed P: covariance matrix observation vector <f>i\ immersion angle <f>s'- swept angle </>7/: cutter pitch angle q~ : backward shift operator l R,S,T: controller polynomials R : current amplifier gain g T V ratio of radial to tangential forces S : velocity command signal gain of the amplifier g s: Laplace transform variable s : feed-rate t T: sampling period of control loop T\-. sampling period of digital filter 9: parameter vector u: control input u : reference input signal c u: M reference input to model ui '. natural frequency of servo n y: process output y : model output M Z: number of teeth on the cutter z\ Z transform variable £: damping ratio xi Acknowledgement I would like to thank my supervisors Professors F.Sassani and Y.Altintas for their support in the development of this work. Professor Altintas stimulated my interest in this area and gave me valuable comments and suggestions for which I am grateful. I would like to thank Research Engineers G. Rohling, P.K. Chan and G. Wright for helping to develop necessary software and hardware for this work. I am indebted to my wife, Faati, whose support has made this work possible and also to my son, Kaveh, who sacrificed a lot of time so that this work could be completed. This work was supported by NSERC of Canada under Grant Numbers OGP0006164 and OGP-0005542. xii Chapter 1 Introduction The need for machining work-pieces of complex geometry with high precision led to development of numerically controlled (NC) and computer numerically controlled (CNC) machines. These machines relieved the operators from difficult and sometimes impossible tasks in machining parts. Nevertheless the problem of selecting cutting parameters, such as feed-rate and cutting speed has remained. The work-piece could be very complex. For example, consider the machining of an engine block with many holes and slots and variable axial depth and radial width of cut. Because of these variations the magnitude of the cutting force changes during the machining and if the peak force exceeds a certain limit, the tool breakage is almost certain. The problem is not limited to this and since the machine may still be moving, there is a great likelihood of damage to the work-piece and possibly the machine itself. The total loss regardless of labor cost for frequent tool changes and maintenance can be substantial. In order to save the tool part programmers usually take a conservative approach and choose cutting parameters according to the worst possible case, such as largest depth of cut, which exists in the work-piece in order to save the tool. It is clear that although the machine may be working at optimum conditions for that section, it will be slow for the rest of the job resulting in lower metal removal rate and productivity. One way to overcome this problem is to design a controller in such a way that by manipulating the operating parameters one can maintain the desired specifications. Generally there are three approaches to design the controller: open loop adaptive 1 Chapter 1. Introduction 2 control, closed loop fixed gain and closed loop adaptive control. In open loop adaptive control the operating conditions are optimized in order to maximize a performance index. This kind of controller in manufacturing literature is referred to as Adaptive Control with Optimization (ACO). There are a few drawbacks in ACO systems such as difficulty in establishing a suitable performance index, and the need for better sensors and high computation power [1]. Fixed gain or conventional feed-back controllers are popular among manufacturing designers. The controller is a simple gain or at most a lead-lag compensator and the feed-back force is used to adjust the operating parameters to keep the cutting force at a constant level. This type of controller which operates well in certain circumstances will become unstable when cutting conditions such as axial depth of cut, material properties or tool condition change [23,2]. In closed loop adaptive systems it is assumed that the process parameters are unknown and time varying. Generally there are two control loops in this controller. The first one is a force feed-back loop as in the case of the conventional controllers. The other loop is designed to adjust controller parameters by getting information from input and output to the plant in such a way that the cutting force remains constant. The last two controllers are based on imposing a constraint, such as constant power or force, on the process. These controllers in manufacturing literature are referred to as Adaptive Control with Constraints (ACC). In this thesis closed loop adaptive control is used to adjust feed-rate to keep the peak resultant force at a desired level. Therefore at a shallow depth of cut the milling table moves faster and vice versa. This way, the metal removal rate and productivity could be increased compared to the constant feed-rate operation[1,3,4,11]. On the other hand by keeping the cutting force at constant level, tool (shank) breakage could be reduced or eliminated. Peak resultant cutting force is the main cause for shank breakage but other factors such as torsional torque on the cutter, vibration and fatigue Chapter 1. Introduction 3 can contribute to shank breakage. It is worth mentioning that by keeping the cutting force at a constant level, the tool deflection would remain constant both in low and high depths of cut, therefore the finished part would have better surface finish [40]. This thesis is organized as follows: in chapter two a brief history of NC and CNC machines is presented. Adaptive control is defined and different methods in the theory of adaptive control are discussed. Classification of adaptive control in manufacturing is discussed and finally a literature review of attempts to model and control the cutting process is presented. In chapter three cutting forces in milling are reviewed and a first order model based on static deflection of the tool is developed for the milling process. This model relates feed-rate to the peak resultant cutting force. To verify the derived model two experiments have been carried out and the results are presented. A description of experimental setup is also included in this chapter. The servomotor as part of the process is analyzed in chapter four and a second order transfer function is derived. A model of the cutting process is developed in chapter three which together with the model of the servo are used to design the controllers. Three different control algorithms, adaptive proportional-integral-derivative (PID)control, Pole-Placement Control and Model Reference Adaptive Control (MRAC) are designed , simulated and the results are shown. The algorithms are implemented on the milling machine and results are presented. A brief description of the Recursive Least Square (RLS) method for identifying the parameters of the process is included in chapter four. Finally in chapter five results of the thesis work are summarized and specific conclusions are drawn. Chapter 2 Literature Review 2.1 Introduction In this chapter, the history of Numerically controlled (NC) and Computer numerically Controlled (CNC) machines is briefly described and the application of adaptive control methods in metal removal processes is reviewed. 2.2 N C and C N C Machines Development of NC and CNC machines was initiated after the World War II. The need for high precision parts in the U.S. Air Force promoted research for development of NC machines. It was clear that conventional machine tools could not satisfy the requirements of precision and complex parts. The first attempt was made by John Parsons of The Parsons Company in Michigan who presented methods of generating accurate smooth curves. In the late 1940's The Air Force asked the Massachussets Institute of Technology Servomechanism Laboratory to develop NC machines and eventually by 1952 the first NC milling machine with three controlled axes was constructed [1]. Development of NC machines, which was based on principles of digital electronics, was a revolution at that time in the machine tool industry. CNC systems, which replaced dedicated hard-wired control logic by a computer, were introduced in the early seventies. The trend away from NC to CNC systems means evolution from hardware-based to software-based equipment. Dedication of a computer to the system gives flexibility 4 Chapter 2. Literature Review 5 in implementing more complicated control algorithms. 2.3 Adaptive Control In this section development of adaptive control theory is briefly discussed and different schemes are explained. The idea of adaptive control(AC) was originated in the 1950s. A general definition for A C systems is : "Adaptive control systems are those which automatically adjust the controller settings to accommodate changes in the process to be controlled or its environment " [6]. As Astrom [5] describes, A C started with " a lot of enthusiasm, poor hardware, and non existent theory" and resulted in a flight disaster. Although the activities halted in this area for almost a decade, many contributions to control theory such as development of state space and stability theory, further improvement in stochastic control theory and system identification straightened the way. On the other hand the recent revolution in the electronics industry made it possible to implement adaptive control in a simple and inexpensive way. In general there are three different schemes for adaptive control: gain scheduling, model reference adaptive control and self tuning control. All schemes consist of a control loop with an adjustable parameter controller, process and an ordinary feed-back loop. The main task is to change controller parameters in the presence of disturbances and / or changes in process dynamics to achieve control specifications. An excellent review of adaptive control is given in reference[7]. 2.3.1 Gain Scheduling Gain scheduling is used when an auxiliary variable can be found which correlates well with changes in the process dynamics(Fig.2.1). Then the parameters of the controller can be changed as a function of an auxiliary variable to accommodate changes in the Chapter 2. Literature Review 6 process gain. As this scheme was first used to set changes in process gain it is called gain scheduling. To apply the gain scheduling scheme a thorough knowledge of the physics of the system in question is required to find the auxiliary variable. Another drawback of gain scheduling is that the adaptation part of the control is open loop therefore the system is like a feed-back control where controller parameters are set by feed-forward compensation. 2.3.2 Model Reference Adaptive Control ( M R A C ) Model reference adaptive control was originated by Whitaker, Yarmon and Kezer in 1958 [8]. The idea is to find a control input in such a way that the output of an unknown plant asymptotically approaches that of a given reference model (Fig.2.2). The difference between the output of the process and that of the model is the error signal. This error signal along with the plants inputs and outputs are used by an adjustment mechanism to change controller parameters and reduce the error signal to zero. There are two approaches in MRAC: direct and indirect. In the direct method the controller parameters are calculated directly from the adjustment mechanism. In the indirect method first the values of process parameters are estimated and then the controller parameters are calculated based on those values. The second approach has the advantage of availability of the process parameters. 2.3.3 Self-Tuning Control ( S T C ) A schematic diagram of self tuning control is shown in Figure2.3. The system consists of two loops: The inner loop is a simple feed-back loop and the outer loop is used to update the controller at each sampling time. Here the task is to estimate the parameters of the process recursively with an assumed dynamic model from input and output data. The estimated parameters and process model are then assumed to be exactly correct. Controller Parameters Uc Gain Schedule U Controller Process Figure 2.1: Block Diagram of Gain Scheduling Method Model Ym Controller parameters Adjustment Mechanism U Controller Process Figure 2.2: Block Diagram of Model Reference Adaptive Control Method Process Parameters Controller Design Parameter Estimator Controller Parameters Uc U Controller Process Figure 2.3: Block Diagram of Self-Tuning Control Method Chapter 2. Literature Review 10 This is called "certainty equivalence principle" and controller parameters are changed by the control algorithm. STC was first developed by Kalman in 1958 [9] and due to application of different estimators and control algorithms there are variations of this scheme in literature. 2.4 Adaptive Control of Metal Cutting Process Application of adaptive control schemes in industrial processes is a fairly recent development. Before reviewing the literature it is necessary to clarify the meaning of adaptive control from two different view points. In the past, manufacturing literature considered the simple feed-back control as an adaptive scheme. It is clear that this approach was completely different from what was stated in the previous section. Feedback controllers are mainly simple gains and they will become unstable in response to changes in process dynamics. In this thesis adaptive control is analyzed from a control engineering point of view. Adaptive control systems for machine tools can also be classified into three categories : Geometric Adaptive Control(GAC), Adaptive Control with Optimization (ACO) and Adaptive Control with Constraints (ACC). In GAC the machining parameters such as feed-rate or spindle speed are changed in such a way that the required geometry or accuracy of the work-piece is maintained. There are two general categories in GAC. In the first, there are controllers which change machine parameters such that the tool deflection remains at a certain level . In the second category, inaccuracies in the machine tool such as spindle or guideway errors are measured before hand or on line and then the tool path is compensated according to this information. The idea in Adaptive Control with Optimization is to find a performance index, Chapter 2. Literature Review 11 usually in the form of a cost function, which is then optimized subject to the machining constraints. For example, in milling, sensors measure cutting conditions such as tool temperature, feed, torque, etc. Then these values are used to calculate power consumption, tool wear or metal removal rates. Next a performance algorithm is set up based on calculated values to find the performance index. Using the optimization algorithm and the process constraints the performance index is then maximized to yield operating conditions such as feed-rate or spindle speed. Constraints could be chosen as maximum torque, feed, temperature, maximum and minimum spindle speed etc. Research in the area of ACO started with Centner and Idelson[10] in the early 1960's. They tried to model tool wear rate as a function of tool edge temperature and the rate of change of cutting torque. The work revealed the problems associated with ACO systems as follows: 1) more knowledge of the cutting process is needed to develop an accurate model of tool wear. This model definitely should relate more than two variables as they used. 2) better and more accurate sensors are needed to collect data. For instance, at that time, they could measure the temperature at tool work-piece contact area rather than the flank side. 3) ACO algorithms are more sophisticated than A C C algorithms, therefore more computational power is required. In another case Bendini and Pinotti[ll] tried to apply ACO system on a peripheral milling process. Their cost function was based on width and depth of cut, spindle speed, feed-rate and tool wear rate. The constraints they chose were bending moment on the tool, spindle torque and cutting power. They cited difficulties in measuring bending moment on the tool. Because of aforementioned problems ACO has not been widely accepted in industry (except in grinding process[14]). Nevertheless research activities in this field have continued. Lately, Koren[12] developed a new model for tool wear and Yen and Wright[13] tried to combine A C C and ACO approaches in a unified manner. Chapter 2. Literature Review 12 Recently Watanabe[15] applied ACO system on a model of the end milling process. He identified shear stress and work-piece hardness, shear angle and true contact area at the flank wear land along with axial and radial depth of cut. Then he calculated the tool wear rate based on identified parameters. He claimed that ACO system gives higher cost efficiency than ACC when process parameters change. In this thesis application of ACC systems on milling has been studied. In ACC systems the machining parameters are maximized subject to process and system constraints. For example in this work feed-rate is manipulated through the control algorithms such that the resultant cutting force remains at a level below the tool breakage limit. A C C systems have simpler algorithms compared with ACO systems and utilize low computational power. On the other hand sensors needed for A C C are fewer and relatively simpler. One drawback of A C C systems is that the number of constraints used is limited and other constraints are treated indirectly. For example in this work the constraint is cutting force to prevent shank breakage. But other important aspects such as tool breakage, tool wear, surface finish, etc. are not addressed here. These are important issues which could be considered in a further extension of this work. The idea of using A C C systems with different control strategies in metal cutting has been examined by several researchers. Beadle and Bollinger[16] used an A C C system for a face milling machine. They considered the whole system as a gain with one sampling time delay. Then, they designed the controller with a dead-beat closed loop response. Finally to find the gain of the system they imposed a constraint on maximum power consumption of the machine and manipulated both spindle speed and feed-rate to keep the critically damped system at the stability boundary. Stute and Goetz[17] applied A C C system for turning and milling process. They used a closed loop proportional-integral controller with the control input sent to the Chapter 2. Literature Review 13 process and a model which was parallel to the process. For example in turning they used a fourth order model comprising of a first order servo feed drive, second order cutting process and a first order main drive. They were concerned about rapid changes in process gain because of changes in axial depth of cut. They compared the output from the model and the process and by simple division found the gain of the controller. They used the same technique for milling but included a smoothingfilterfor undulations inherent in the milling process. In another approach Tlusty and Elbestawi[18] applied A C C on an end milling process. They developed the transfer function of the servo as a third order system and used a simple gain with one tooth period delay as the cutting process dynamics. They simulated this system with a constant gain and also a PI controller such that the force could be kept constant by manipulating the controller gain. Later Ulsoy, Koren and Rasmussen [14] summarized the previous works in the area of A C C systems and for the first time they distinguished between two different views of control as discussed before. They presented simulations for a first order turning process and a second order servo loop dynamics. For the controller they used an integral controller and by using a parallel model they manipulated the controller gain to keep the actual gain of the system constant( same as [17]). This algorithm which is simple, was applied later by Masory and Koren [20] on a lathe. They had to find the critical gain of the system at the limit of stability before hand to ensure stability. On the other hand selecting a lower gain to guarantee the stability is harmful too because it would result in a sluggish transient response which might damage the tool. Regarding the stability of the whole process it is worth mentioning that up to now the changes in cutting process dynamics (the parameters of the process) are either neglected by assuming the process as a simple gain or is not identified from the control engineering point of view. In a manufacturing environment identification means Chapter 2. Literature Review 14 nothing but simple algebraic calculations based on empirical formulations. But process identification for system dynamics denned by a discrete auto-regressive moving average model is to find all the parameters of the model at every sampling time while the process dynamics are changing. By identifying the process parameters, the control theory could be used to ensure the overall stability of the system in a correct way. The first comprehensive approach toward application of adaptive control theory on machine tools was by Tomizuka et al.,[19]. They developed a first order discrete model of milling process and since their machine feed drive was a stepping motor they considered it as a gain. They applied model reference adaptive control design based on Landau and Lozano's [21] scheme. There were two unknown parameters in the model of the cutting process. The first one was the gain of the process and the second one was related to the time constant. They noticed that the second parameter is almost constant. Therefore they fixed this parameter and tried a single parameter adaptation algorithm. This indicated that a good estimate of the gain of the system is essential and proved the work of previous researches [17,20,18]. One drawback of their work is that their reference force was about 50 Newton which is below the friction forces during many cutting operations. Later Daneshmand and Pak[22] applied MRAC scheme[21] on a turning machine. They used a first order dynamics for the cutting process and servo together. They also used a nonadaptive feed-back loop with a PI controller around the system, ie. instead of reference force, the signal from the PI controller was sent to the model. Then through a series of tests by changing the regulation dynamics parameters and covariance matrix elements (see chapter four) they found the optimum operating condition. Their best result was also with single parameter adaptation. They filtered the force signal with a 5 Hz low pass filter but did not use its dynamics in the control loop. At the same time Laderbaugh and Ulsoy[23] applied MRAC on a milling machine. Chapter 2. Literature Review 15 Their scheme was based on the identification of the model parameters and application of model following controller. They developed a non-linear second order differential equation for the process based on experiments and neglected the servo dynamics as did Tomizuka et al.,[19]. They noticed that run-out has a detonating effect on the controller and therefore passed the force signal through a low pass filter. Elbestawi and Sagherian[24] simulated several AC algorithms for an end mill process. They considered the servo as a third order dynamics with fixed parameters based on previous research[18] on their machine. They also used a first order linear (and in one case non-linear) model for the cutting process. Their simulations showed that with linear model of the cutting force dead-beat controllers of an increased order and discrete PID controller have superior performance. For the non-linear model they used a dead-beat controller. Recently Mohamad et al.[25] applied the latter controller under the same conditions to a milling machine. They showed that the controller was capable of handling changes in process dynamics. For the first time they introduced a stochastic part in their model to account for transducer and environmental noise along with noise due to cutter run-out. Another approach to apply MRAC system was done by Fussel and Srinivasan [26]. They considered the end milling process as a gain and with one tooth period delay and used a parameter identification method to estimate the only parameter in the process. The servo was treated as a second order dynamic system and coupled with cutting dynamics represented the model. They used a series-parallel reference model approach based on [27]. They noticed some problems associated with run-out and indicated that have used an algebraic scheme to identify run-out on-line and then subtract the measured force from the run-out component of the force. In their work the force signal was filtered with a low pass second order filter before being sent to the adaptive controller. They used a non-adaptive feed-back loop similar to Daneshmand Chapter 2. Literature Review 16 and Pak[22] around the AC control loop with and without a PI controller. The reason to use PI controller is to minimize the error signal from the reference and measured signals. They obtained better results from the PI controller with fixed parameters. Chapter 3 Milling Process 3.1 Introduction Cutting forces generated in milling are modelled in this chapter. The transfer function of the milling process which is used for the development of control algorithms in chapter four is derived. Finally the experimental set-up is described and an experimental verification of the model is presented. Milling is a cutting process in which the work-piece is sheared by the cutter and discontinuous chips are formed. Cutter is single-tooth or multi-tooth where the cutting edges are usually equally spaced around the cutter. Cutting is performed by rotation of cutter by means of the spindle while the work-piece, which is clamped onto the table, moves. Milling is a complex process because of interruptions in cutting which results in periodical variations of cutting forces. 3.2 Modelling of Cutting Forces in Milling The resultant cutting force in milling has three components: tangential, radial and axial. The axial component is negligible. Figure 3.4 shows forces acting on a workpiece. The same forces but in opposite direction act on the tool. The tangential force is proportional to the axial depth of cut and the chip thickness. F = K ah t s where 17 (3.1) Chapter 3. Milling Process 18 Kg specific cutting pressure a axial depth of cut h instantaneous chip thickness The radial force is proportional to the tangential force. F r = n F (3.2) t Where r\ is the radial to tangential force ratio. The resultant force is: F = y/W+F? (3.3) Specific cutting pressure which depends on tool-material geometry is a function of chip thickness K where K B a =K s h' (3.4) c and c are tool- material constants. Equation 3.4 shows the nonlinear nature of the cutting forces. This nonlinearity which is significant at low feed-rates is due to the flank and nose forces on the tool. Chip thickness variation in milling is shown in Figure 3.4. The feed-rate is defined as the linear travel of one tooth in one revolution of the cutter. " " jfz <-> 3 5 where / is the linear feeding velocity(mm/min) , N is the spindle speed(rev/min) and Z is the number of teeth. Note that the tooth path is considered as a circular arc which is close to the actual torchoidal path. Instantaneous chip thickness is related to feed-rate as h(<p) = s sin(</>) t (3.6) Chapter 3. Milling Process Figure 3.4: Chip Thickness Variation in Milling Chapter 3. Milling Process 20 where <f> is immersion angle. Substituting Eq.3.6 into Eqs.3.1 and 3.2 yields F — K a s sin(^) (3.7) F = K a s T\ sin(<^>) (3.8) t s r s t t The components of the cutting force in cartesian coordinates are expressed as F = F cos(^) + F sin(^) (3.9) F = F sin(<£) - F cos(<£) (3.10) x y t t r r Resultant cutting force from a simulation of two teeth and four teeth cutters are shown in figure3.5. Both simulations were performed for half immersion up-milling under identical cutting conditions. As it is shown the resultant cutting force is periodic at tooth passing frequency. There are identical wave forms as the number of teeth in cutter in every revolution. Peak forces are important and must be constrained to avoid tool breakage. 3.3 Modelling of the Milling Process In this section a transfer function model for milling process is presented which is further extension of early works by Tlusty [28] and Tomizuka et al. [19]. This model which is an essential part for designing controller and simulation studies, is a difference equation which relates the response of cutting forces to variations of feed-rate for a two teeth cutter. A number of assumptions are necessary before developing the model: • The model is derived for full slotting condition. • Cutting process is sampled at tooth periods. • Tool is flexible and deflects mainly in feed direction. B A Figure 3.5: Resultant Force Simulation in Half Immersion Cutting a) Two Teeth Cutter b) Four Teeth Cutter Entry Angle Zero, Exit Angle 90 Degrees, K = 2000 N/mm , ADC=25 mm, Feed-rate 0.2 mm/rev 2 t Chapter 3. Milling Process 22 • Edge forces are neglected assuming the tool is sharp. In Fig. 3.6 commanded position of the tool is shown with dashed line while the solid line is the actual position of the tool after deflection. The tool and work-piece are shown at 180 degrees immersion angle windows. Actual chip thickness at tooth period(i + 1) is derived from the geometry (Fig.3.6) as, hi+i = -sti + Si - (3.11) 8 i i+ where hi+i resultant chip thickness si feed-rate/rev/tooth 8i deflection due to F i t r F i and F % are the maximum radial and tangential forces at each instant r t Fu+i F i ri+ a, h = K e = n K, a, h i + 1 i + 1 = K di (s s + ti = r K a, (s e a ti - S ) i+1 + Si - 8 ) i+1 = F y i + 1 (3.12) = F x i + 1 (3.13) The radial force deflects the end mill in the opposite direction of the feeding velocity F = K Si ri (3.14) x where K is the equivalent stiffness of the tool on the spindle. Equating equations 3.13 x and 3.14 K x 8i = ri K a, (s i + 6, - i+ s S ) t i+1 (3.15) Rearrangement of the above equation leads to 6 i=\ i+ ^ (s 1 + ri u ti + 8) t (3.16) Commanded Position 8 •8 % CO Figure 3.6: Modelling of Cutting Process in Milling to co Chapter 3. Milling Process 24 where substituting equations 3.14 into 3.16 F ri+1 = 1 -t-rj (i + 7~r^~~ (Fn) 1 +ri \i K (3.18) F i and -F ,+i are present and future values of the radial force and are related by the r r forward shift operator (z) as F ri+1 = zF (3.19) ri Substituting equation 3.19 into 3.18 gives Maximum resultant force (J*i)is derived from equations 3.3 and 3.19 F = y/F& + = . ^ + = Eli ( 3 . 2 1 ) substituting equation 3.21 into 3.20 one gets F = [K / x / ( i + n ii)] y T T r j X 2 - [ n •Sti + T X fl)] Equation 3.22 is the dynamic model of feed-force in milling process which is a first order system. The pole of the process is clear that if ri fi < 1 or T\ K S (ii/K X which is always less than one. It is is very small then the milling process could be considered as a simple gain with one step delay. This is the situation when the axial depth of cut is small or the tool is very rigid. The transfer function derived above is for a special case where only one tooth is cutting at a time. However it can be extended to situations where more than one tooth Chapter 3. Milling Process 25 are in cut. In general for rigid milling the maximum cutting force Fi can be expressed as Fi = K C (4>i , Z) yjl + r\ o, s 8 x ti (3.23) where Ci (</>,• ,Z) is a parameter which depends on the current immersion (<£;) and the number of teeth in cut. A time varying cutting constant which is common for any immersion and number of teeth can be expressed as K ci = K. y/l + rl C (cj>i,Z) (3.24) x The cutting constantX , changes as a function of immersion ($,•) which may vary with c time. The maximum force (Fi) is related to the tool deflection as Fi = Ki Si (3.25) where Ki is oriented stiffness in the direction of the feeding velocity. Note that since the immersion may change with time as a function of the machined work-piece geometry, the oriented stiffness Ki may also be time varying. Equating two cutting forces yields K ci a, sti = Ki Si (3.26) It is assumed that the oriented stiffness Ki changes gradually ( ie. gradual immersion change ) Ki ~ K i+1 =K (3.27) s i is replaced by the actual equivalent feed-rate of the cutter centre from Eq. 3.11 t KS i+1 = K ai(sti ci + Si - S ) t+1 (3.28) or Si+i = r - j - (s 1 "T~ LI ti + Si) (3.29) Chapter 3. Milling Process 26 where P = Zj± (3.30) The maximum cutting force (i^+i) due to deflection at tooth period (i + 1) can be expressed as F i+1 = K S I + 1 = 1 +p (s ti + 6.) = 1+ n s + -£-Fi 1 + (i ti (3.31) The discrete transfer function of the milling process due to static deflection of the tool is derived from Eq.3.31 as m = - h - S (z) Z t (3.32) +0,1. where b 0 = ai = Kp 1+ p P l+P Note that the process parameters bo and a\ are time varying and a function of the work-piece geometry. For example, during the machining of engine blocks or aircraft wings, both width of cut (i.e. immersion ) and depth of cut may change according to work-piece and selected tool path geometry. 3.4 Experimental Set-up A Superior Electric Slo-Syn Knee type vertical milling machine was used for the cutting test(Figure3.7). The machine was retrofitted with three BALDOR pulse-widthmodulated (PWM) permanent magnet DC motors [31]. Each motor has tachometer and encoder devices for velocity and position feed-back respectively(Figure3.8). The encoder has a resolution of 1000 counts per revolution in each of two channels in quadrature which gives a combined resolution of 4000 counts per revolution.One count is the o Motlc n Cont roller Servo Amplifier Figure 3.7: Schematic View of Experimental Setup to POSITION FEEDBACK IBM DC SERVO MOTOR AMPLIFIER PC PC BUS TO MULTIBUS ADAPTOR U Y////////A DC SERVO MOTOR (X-AXIS) VELOCITY FEEDBACK POSITION FEEDBACK _i_ DMC-230 MOTION CONTROLLER MULTIBUS CARD CAGE l O O TERMINAL n W//////A DC SERVO MOTOR (Y-AXIS) VELOCITY FEEDBACK RS 232 V T DC SERVO MOTOR IAMPLIFIER POSITION FEEDBACK DC SERVO MOTOR IAMPLIFIER VELOCITY FEEDBACK Figure 3.8: Schematic View of Servomotors \V/////////A DC SERVO MOTOR (Z-AXIS) Chapter 3. Milling Process 29 resolution of servo position and is equal to one basic length Unit (BLU). The encoder is mounted on the motor shaft which is directly connected to the lead screw shaft. The lead screw has a pitch of 0.2 inches per revolution therefore every 0.001 inch linear movement of the table is equal to twenty encoder counts. Signals to the servomotors are sent through UNIDRIVE amplifiers. The amplifiers receive tachometer feed-back signals for accurate speed control. A fully programmable three axis servomotor controller (DMC 230) is used to control positions of the three linear axis of the machine [30]. The motion control card has a Motorola 68008 Processor and 16 Input/Output (I/O) lines for logic control functions. The controller has the encoder feed-back input and a digitally controlled lead-lag compensator with a real time adjustable parameters. To send the commands to the motors, a V T 100 terminal is connected to the motion controller via an RS 232 link. For control purposes ,an Intel 80286 Central Processing Unit and a 80287 math co-processor based personal computer (PC)is used. The PC is fitted with an interface adapter ULTRALINK PC to a multibus card Cage which holds the DMC-230 controller. The controller was developed and retrofitted at UBC [29] A three component piezo-electric dynamometer( Kistler Model 9257a) is mounted on the table to measure the cutting forces in the longitudinal and transverse directions (X and Y). On the dynamometer for each force component a proportional electrical charge is set up. These charges are sent into charge amplifiers (Dual mode model 5004) where they are converted into proportional voltages. The dynamometer has a large bandwidth with natural frequency of over 4 KHz for each axis which is much higher than the cutting force frequency of 25 Hz used in the cutting experiment. Thus the dynamics of the dynamometer could be considered as a gain. The data acquisition system consists of two primary parts; hardware and software. The hardware includes the PC and data acquisition card model Data Translation D T Chapter 3. Milling Process 30 2801-A with an external connector box. An existing real time data collection software was modified at the laboratory to handle the speed of data collection. The data acquisition board can sample 8 double ended analog channels with a range of +/- 10 volts and 12 bit resolution. Data are transferred to memory via a Direct Memory Access unit, therefore the control program can continue execution independent of the data acquisition process. In order to synchronize sampling with tooth passing frequency an external trigger is used. The external trigger is an optical encoder with a disk mounted on the spindle. The disk has a number of slots which by passing through the optical sensor send trigger signals to the data acquisition board. Two disks were used in the experiments. The first disk had 64 slots and was used in data collection for off-line analysis. For cutting process control a disk with two slots was used. The reason was that in the entire work a two teeth carbide cutter was used and the peak force at every tooth period (sample time) was needed in the control algorithms. The force signals in X and Y directions were first sent to the peak detector box where they were squared and added together(Figure 3.9). Then the peak value at each tooth period was collected and sent along with the tacho-generator signal to the data acquisition board at each tooth period. The force signal was square rooted in software to obtain the maximum resultant force. Both tacho and force signals were multiplied by their appropriate gains to convert them from measured voltage to real values. This sampled data was processed according to the control algorithm and the controlled input signal, the feeding velocity, was sent at every sample time to the motor controller DMC 230. 8 •S Peak Detect Dirtput X Input X + Y+ E I 2 2 fcj 12K -AArV v2 + y 2 + 1'3 - 2 —I _f\ - £ > 1/4 TL084 1/4 TL084 3 A X w o o r— 1N4148 P cn fX. L — rTL 1 / 4 I TL084 lOn Y Input Reset i e K ENCODER INPUT 1/4 4011 4.7K --A^A/-j—-t^)*- I" lOn 2N4184 1/4 4011 1/4 Shaft Encoder _ | Data Aquisition Trigger 4011 [ [J Data Aquisition Trigger Reset Figure 3 . 9 : General Layout of Peak Detector CO Chapter 3. Milling Process 3.5 32 Experimental Verification of the Milling Process Modelling An experiment was carried out in order to verify the developed model. Work-piece material was Aluminum 7075T651. The cutter was one inch in diameter with two carbide teeth and 5 degrees negative rake angle. Spindle speed and axial depth of cut(ADC) were 775 rev/min and 2.54 mm respectively. The feed-rate was varied during a full immersion milling and the cutting forces in X and Y directions, and tacho-generator signals were measured. The measurements were collected by the data acquisition system using a 64 slot shaft encoder, resulting in a sampling period of 1.21 ms. The peak resultant force at each tooth period (32 samples) is calculated from measured forces in X and Y directions. Note that the component of the cutting force in the Z direction "( perpendicular to the table) is negligible for the cutter used and it is not measured. Measured peak resultant cutting force history is shown in figure3.10. To simulate the model presented by Eq. 3.22 it is necessary to calculate the cutting constants K s and ri from the above measurements. One way to calculate these parameters is to derive average forces per tooth period in feeding and normal or X and Y directions using equations 3.9 , 3.10 and 3.6 [32] F = - J - [* F d<p (3.33) S ax x JO <PT F = - J - [* F d4> (3.34) S ay y or F F ay = ax = f (sin < $ > cos (j) + ri sin (j))d(f> <PT Jo a S t —— / <f>T 2 (sin <j> — r\ sin (j> cos (j))d(j) 2 Jo where Z the number of teeth on the cutter (3.35) (3.36) Chapter 3. Milling Process 33 Figure 3.10: Measured Peak Resultant Cutting Force for 2.54 mm Two Teeth Carbide Cutter, Axial Depth of Cut 2.54 mm, Spindle Speed 775 R P M , Feed-rates .024, .049, .073, .098, .147, .196 , .245 mm/rev/tooth Chapter 3. Milling Process <f>T = ^ <f>s 34 cutter pitch angle swept angle of cut It is assumed that there is no run-out and the tooth spacing is uniform. Integrating the above equations Fax = K ' * S O Fay = °£* K t Z i {(1 - cosies) +r (2(j>s - sin2<£ )} 1 (3.37) s 7T Z {(^s - sin 2<f> ) - n ( l - cos 2<f> )} s s (3.38) For two teeth cutter and full immersion one gets F ax = F ay = (3.39) (3.40) -y-* Average forces in the X and Y directions in every tooth period were calculated from measurements and plotted versus the feed-rate. The results are shown in figure3.11. Note that the curves do not pass the origin due to presence of edge forces at low feed-rates. The cutting constants are calculated from above equations and figure3.11 Kg =1212 N / m m 2 rj =.78 The equivalent stiffness of the tool on the spindle, K x ,was measured statically. A prox- imeter sensor was used to measure deflection of the tool in response to the horizontal loads applied to the tool. Deflection of the spindle was measured separately and was negligible. Figure 3.12 shows deflection of the cutter under the load. The value of K x is equal to 12100 N/mm. The model of milling process (Eq.3.22) is simulated with the above cutting constants and the result is shown in Figure3.13. The effect of run-out is simulated and 0.006 0.031 0.055 Peed-rate 0.079 0.127 0.177 0.225 mm/rev/tooth Figure 3.11: Measured Average Cutting Forces in X and Y Directions for One Inch Two Teeth Carbide Cutter, Axial Depth of Cut 2.54 mm, Spindle Speed 775 RPM CO Deflection (mm) Figure 3.12: Deflection of One Inch Two Teeth Carbide Cutter Mounted on the Spindle under Varying Load CO Chapter 3. Milling Process 37 o o o CM o 0.0 50.0 100.0 150.0 SAMPLE (TOOTH PERIOD) 200.0 250.0 Figure 3.13: Simulated Peak Resultant Cutting Force for One Inch Two Teeth Carbide Cutter, Axial Depth of Cut 2.54 mm, Feed-rates .024, .049, .073, .098, .147, .196, .245 mm/rev/tooth Chapter 3. Milling Process 38 superimposed on the peak force. Comparing Figs. 3.10 and 3.13 which have identical conditions shows that the model is following the same trend as the experiment. The DC offset in the measured value is not crucial in the control design because the parameters of the model are estimated on line in the control loop. This point is further clarified in the next experiment. It was stated previously that the cutting process model is first order but under special conditions it could be treated as a gain. In another experiment the feed-rate was changed alternatively between .295 and .59 mm/rev/tooth while the axial depth of cut was kept constant (2.54 mm). Feed-rate was changed after 10 spindle revolutions. In order to completely get rid of the effect of run-out a cutter with one tooth was used. The spindle speed was 362 RPM. Both tacho and force signals were passed through a 100 Hz low pass filter. The history of measured peak force is shown in Fig.3.14. The transients of the measured peak force show the dynamics of milling forces which is different from a simple gain. A first order model can follow the transients and is simulated according to Eq. 3.22 with the same cutting constants calculated above. The result is shown in Fig.3.14. In control algorithms the tacho and peak resultant force signals are used for identification. Here the cutting process model is treated as a gain and also a first order system and these signals are used to build the predicted output. Figure 3.15 shows the measured peak resultant force along with predicted forces for gain and first order systems. The first order system is following the measured force better than the gain. The cost function, based on summation of squares of errors, is also lower for the first order system. Chapter 3. Milling Process 39 o o o Figure 3.14: Measured Peak Resultant Force and Simulated First Order Model Feed-rates .295 and .59 mm/rev/tooth, Axial Depth of Cut 2.54 mm, Spindle Speed 362 R P M Chapter 3. Milling Process 40 o o . ro Figure 3.15: Measured Peak Resultant Force and Predicted Forces a) Measured Peak Resultant Force b) Predicted Force for the Cutting Process as a Gain c) Predicted Force for the Cutting Process as a First Order System Feed-rates .295 and .59 mm/rev/tooth, Axial Depth of Cut 2.54 mm, spindle speed 362 RPM Chapter 4 Controller Design and Application 4.1 Introduction The adaptive control loop of machining processes has three fundamental control blocks. The first part is the controller which adaptively manipulates the feed-rate in order to keep the cutting forces below a desired level. The second block is the time invariant dynamics of the feed drive position control system. The third block represents the time varying dynamics of the machining process which was modelled in the previous section. In this chapter first the discrete time model of the feed drive control system will be derived. Since the machining process parameters are time varying the method used for their real time identification will be briefly discussed. Three adaptive control algorithms, which are used to control the milling forces are simulated and implemented on the CNC machine. 4.2 Modelling of the Feed Drive Controller The research machine is a vertical knee type three axis milling machine, namely longitudinal, normal and vertical. Each axis has a recirculating ball screw drive controlled by a permanent magnet, pulse width modulated direct current servo motors. The motors are directly connected to the feed drive shafts without any gear reduction. The velocity and position of each axis is controlled by an analog and a digital control modules. A block diagram of the feed drive controller is shown in figure 4.16. 41 Load Torque Feed Drive Input CCounts/secJ X —Hg> •, CBLU3 Digital Filter Zero Order Hold T Encoder Gam Up-Down Counter 1-e s Digital t o Analog Converter POSITION FEEDBACK Figure 4.16: Block Diagram of Feed Drive Controller Feed Drive Output CCounts/secJ Chapter 4. Controller Design and Application 43 The analog part of the system consists of an analog amplifier card and a motor. The amplifier card has a velocity feed-back signal from tacho-generator with tacho constant H g and tacho gain T , amplifier signal gain S , current amplifier gain R and motor g g g torque constant K . Motor consists of the dc motor's first order transfer function and t up-down counter encoder gain K . The transfer function of the continuous part is e calculated as follows From the feed forward part of the velocity feed-back loop one gets > = ' ' J7TW, G w <- > R K 4 41 where J is equivalent inertia reflected to the motor shaft and Bj is friction coefficient. Then the closed loop transfer function of the velocity feed-back loop is calculated as G j a) n <h = } 1 + G X fkJSl = H \ J s + Bf + (4 R KT g t g H g .42) { ) Note that load torque is set equal to zero. Combining the above equation with the D / A gain, amplifier gain and encoder gain results in G («) = G (s) 3 K d a5 g K (4.43) e s 2 or ^ ' 1 s [s + + (B, R g K t T g H )/J] g ^ V The digital part consists of a digital filter with gain Kp , zero order hold, D / A gain Kja and position feed-back signal from encoder. The digital filter has transfer function G (z) = K 4 p Z - ^ ~ (4.45) z — 0 The sampling period of the adaptive control is equal to the tooth period which is far greater than the sampling time of the digitalfilterT\. Thus using Tustin transformation z = (2 + « T ) / ( 2 - sTr) a (4.46) Chapter 4. Controller Design and Application 44 and setting 6 = 0 results in G (z) = K 4 a + p 2 2 ~ 2 a /»+" > (4.47) r The CNC system is tuned such that the zero of the digital filter cancels the velocity feed-back pole 2 - 2a = B +R K T H J f 9 Ti + o T , t g (4.48) g multiplying together Gs{s) - G (s) G (s) - K 3 4 P { 2 + s r ^ 0 (4.49) The closed loop transfer function with encoder feed-back is OM =r f ^ (4.50) or Q( \ — s SK ' [(1 + a) K S R K K K ]/J s* + (2 *)(r0 + [(1 + a) K S R K K ]/J da g g t e da (A^\ p g g t { J e where J=0.006 Kg m 2 K =0.0781 V/Count d 5 =0.0627 V / V g ^=208.3 A/V 1^=0.3 N m/A K =636.6 Counts/rad Ti =0.001 sec e From equation 4.48 one gets a = 0.882 and K is designed as K = 2.5 to obtain a p p damped position response. Substitution of the parameters into equation 4.51 yields GM ^ £ 1 ^ 1 ' » + 2000 a + 152591.6 ! ( 4 1 . 5 2 ) ' Chapter 4. Controller Design and Application 45 Therefore a second order transfer function is obtained for the servo. The natural frequency and damping ratio of the servo feeding velocity are 390.67 rad/sec and 2.56 respectively. Readers are referred to [34] for more information regarding the dynamics of the feed drive controller. 4.3 Parameter Identification Method There are several methods to estimate the parameters of a time varying linear process. The recursive least square technique (RLS) is most popular in control problems and is briefly discussed here. A detailed description of the identification methods can be found in [35]. Consider a dynamic system with the sampled input signal u(t) and output signal y(t). The sampled values can be related through a linear difference equation A{z~ ) {t) x y where A(z ) -1 = Biz-^uit) (4.53) and £ ( z ) are polynomials defined in backward shift operator (z ) - 1 -1 A(z~ ) = 1 + a ^ " + •••+ a z~ l B(z~ ) l 1 (4.54) n n = b z~ + b z~ + ••• + b zl x 2 2 m m (4.55) n and m are the order of the polynomials A and B respectively. The above model could be written in a concise form as y(t) = 0 4it) (4-56) T where e T = (ai,...,a„, b ...,b ) u m (4.57) is the parameter vector and f{t) = (- (t y - 1 ) , . . . , -y{t - n), u(t - ! ) , . . . , « ( * - m)) (4.58) Chapter 4. Controller Design and Application 46 is the observation vector and its components are called regressors. The parameter vector 8 is to be estimated from measurements of input and output over N sampling time i.e. y(t) ,(f>(t),t = 1,2,... ,N and by minimizing a cost function V (6) N MO) = ^ E J V - ° W)} [v(0 T (4.59) 2 t=l The above equation represents the variance of measured and estimated output. ct is t a weighting factor for observations and often selected equal to one. This criterion is quadratic in 8 therefore it can be minimized analytically with respect to 6 which gives an estimated parameter vector as -i 8(N) = E «* W) N E«t 4>(tf t=i (4.60) W) provided that the inverse of the matrix exists. It could be shown that [35] the estimated parameter vector could be found in recursive form at each sampling interval by 8(t) = 8(t-l) + L(t)[y(t) L(t) = ffr(t-l)<p(t)] (4.61) Pit - l)<p{t) 1/ott + <F{t) P(t - l)<f>(t) P(i - l)<f>(t)<f> (t)p{t - 1) (4.62) T Pit) = ~ x P(i - 1) - X/a + <p (t)p{t-l)<p(t) T t (4.63) m Where A is the discounting or forgetting factor, L(t) is the gain vector and P(t) is the covariance matrix. The covariance matrix and parameter vector should be initialized before start up. The choice of forgetting factor is stated in simulations. Table 4.1 presents a psuedo code for recursive least square method. Chapter 4. Controller Design and Application 47 Table 4.1: Psuedo Code for Parameter Identification Method 1) Define the model of the process according to equation 4.53 i.e. order of parameters A and B 2) Setup parameter vector and covariance matrix and initialize them( equations 4.57 and 4.63). A common choice of initial values is 9(0) = 0 and P(0) = C.I where C is some large constant and J is the unity matrix. 3) Update the observation vector with the new data(equation 4.58). 4) Calculate the covariance matrix (equation 4.63). 5) Calculate the gain vector(equation 4.62). 6) Calculate the new parameters(equation 4.61). 7) Return to 3 and repeat. Chapter 4. Controller Design and Application 4.4 4.4.1 48 Adaptive P I D Control Design Introduction PID control is popular in industry, because it is simple and relatively easy to implement. In PID control, a proper combination of three control actions manipulate a variable, say the error signal. To obtain the control input signal, the error is multiplied by a proportional gain, integrated , differentiated and multiplied by integral and derivative gains respectively where all three actions combined together. PID control is similar to a phase lead-lag compensator. It affects both high and low frequency regions, improves system stability, increases speed of response and reduces steady-state error[33]. As long as the plant parameters do not change, the gains of a PID controller could be set for a stable operation. For time varying processes these parameters should be calculated adaptively. Although PID control is popular its implementation on machining processes has not been yet reported. 4.4.2 Adaptive P I D Design for Milling Process Control Here a self-tuning structure is used as shown in figure 4.17. In general the parameters of the plant should be identified at every sampling time and the controller parameters adjusted according to the design procedure. There are a couple of problems associated with this approach, namely convergence of the parameters and computation time necessary to identify the parameters of the process. One way to overcome this problem is to decouple the time invariant feed-drive servo from the time varying cutting process block. Therefore only the parameters of the cutting process are identified from feed-rate and force measurements, using RLS, and then those parameters are used to determine the PID gains as will be explained later. This technique will decrease the number of estimated parameters fromfiveto two and not only reduces the computation Chapter 4. Controller Design and Application Chapter 4. Controller Design and Application 50 time, which is crucial in real time applications, but also increases the accuracy of the identification for finding the control input. The choice of sampling time is important in control design. High sampling rates are favorable but then the cost of hardware increases. On the other hand, low sampling rates would corrupt the control input and may result in instability [37,33,38]. Sampling time should be small but greater than the time required to identify the parameters and calculate the control input. In this work sampling time of one tooth period is chosen. The reason is that cutting forces in milling are periodic with tooth passing frequency and the most important information is the peak resultant force at each tooth period. A two teeth cutter was used in all experiments shown in this thesis. Spindle speed was 775 R P M in control design. Therefore the sampling period is calculated as =Wz = ($rs) = - T <- > 0 0387 4 64 Considering the available computation power , this sampling time is sufficient to estimate the parameters and calculate the control input. The zero order hold equivalence of the servo with sampling time equal to one tooth period is G s W 0.9518086(z + 0.0020946) " . ( . - : 0.0461992) <' > 4 65 The cutting process was shown to have the structure of G (z) P = —^ (4.66) z — d\ The structure of the PID controller is [33] G {z) c = K + p K l + K (1 - z- ) (4.67) 1 I — z 1 d or , •> n G (z) c * 2 (K p = — — + Kj + K d + z (-K - 2K ) + TT—~ z\z — 1) ) - p ( d K d (4-68) Chapter 4. Controller Design and Application 51 Three unknown parameters of the controller (i.e. Kp,Ki and Kd) are to be identified at each tooth period. The parameters of the feed drive servo are time invariant and are given in equation 4.65. The feed drive servo has two poles, one at the center (z=0 ) and the other is close to the center (i.e. z=0.0461992). The second pole can be safely canceled by one of the zeros of the PID controller. The cutting parameters are estimated recursively at each tooth period. It was shown in the last chapter that the parameter a,\ is always less than one in the mining process, thus the estimated pole of the process is expected to be within the unit circle and it can safely be canceled by another zero of the PID controller. The coupled transfer function of the feed drive servo and the cutting process can be denned as plant Gpi(z) n , \ s* t \/~* / \ G (z) = GS(Z)GP(Z) = 1 Pl Where K Z [ Z 2 _ 0.9518086(z + 0.0020946)^60 + (0.0461992)0!] { O M Q 1 9 9 2 + & L ) ( 4 Z - 6 9 ) is the gain of the table's leadscrew and equal to 0.0000491 mm/rev/tooth/counts/sec. So and di are the estimates of the cutting process pa- rameters. To have pole-zero cancelations Z * ~ Kp^K^+Kd Z + KP+ K +K I i S d " " (°2 0 4 6 1 9 9 2 + + (°- 0 4 6 1 1 9 2 )«i (4.70) The polynomial coefficients must be equal to satisfy the above equation K + 2K K + Ki + Kd = at + 0.0461992 K K + Kj + K = oi (0.0461992) p d p (4.71) d p (4.72) d There are three unknown parameters with two equations. The third necessary equation can be found from the stability requirement of the system. Jury's stability test shows Chapter 4. Controller Design and Application 52 whether the roots of a polynomial are inside the unit circle. The procedure is simple to apply and can be found in most control text books. To apply jury's test the characteristic equation should be derived. Assuming that the two polynomials are canceled due to pole-zero cancelation, the remaining open loop transfer function of the system reduces to _ , v GOL(Z) K (K + Kj + K ) b (0.9518086) (z + .0020946) p d 0 = Z 2 { Z _ i (4.73) ) The closed loop transfer function of the system becomes G c ~ 1 + G (z) L ( 4 J 4 ) 0L G = C L z* - (A 7 ^ °) z* + Az + (0.0020946)A A { Z + 0 0 2 0 9 4 6 K } where A = K(K P + Ki + X )(0.9518086)6 (4.76) - z (4.77) d 0 The characteristic equation is F(z) = z 3 +Az 2 + .0020946 A or F(z) = z 3 - + (K P z 2 + (K + Ki + K )(Kb P d 0 0.9518086) (4.78) + K + X )(i:cSo)(0.0020946)(.9518086) t d The general form of characteristic equation is F(z) = dQZ n +a 2 n 1 1 +••• +a„_ 2 + a 1 n (4.79) The requirements for Jury's test are as follows 1) | a„ |< 1 which means 0.0020946 A<\ (4.80) Chapter 4. Controller Design and Application 53 or K(K P + Ki + /G)(0.0019936) < 1 (4.81) A + 0.0020946A > 0 (4.82) 2) F(z = 1) > 0 or and because both lead screw gain K and cutting process gain bo are positive results to K + Ki + K > 0 (4.83) - 2 - A + 0.0020946,4 < 0 (4.84) P d 3) F(z = -1) < 0 which does not give any new information 4) From Jury's table | (0.0020946A - 1 |>| 0.0020946A + A | 2 (4.85) which with the help of the first condition and neglecting the second order term reduces to A < 0.9979097 (4.86) or 1-0484353 — —— K + Kj + K < P d , (4.87) r Equations 4.83 and 4.87 show the limits of stability of PID controller. However, these equations do not indicate where the poles of the closed loop system are located. The two conditions can be unified as 1.0484353 K G 0 < Kp + X / + K d < s boK where KQ is a factor between zero and one. (4.88) Chapter 4. Controller Design and Application 54 To have a better insight about the location of the poles, equation4.88 is inserted in equation4.73 and the root locus of the system is plotted as shown in figure4.18. One pole always remains close to the centre of the unit circle. As KQ increases, the two poles one from origin and the other on the unit circle move towards each other on real axis. When the poles coincide KG has a value of 0.2495 and the system becomes critically damped. The poles branch from the real axis and reach to their final values of the 0.5019 ± .8618j on the unit circle where the system reaches the margin of stability and KG becomes unity. In this work KG is selected as 35 % of its final value, which corresponds to one pole at the origin and two others at 0.5019 ± 0.3158jf. The system has a damping ratio of 0.71 and natural frequency of 20.3 rad/sec. The rise time and settling time for the system are 123 millisec and 323 millisec respectively. Classically this is the optimum choice because with a small overshoot the fastest response is achieved. Table4.2 shows a psuedo code for PID control, algorithm 4.4.3 Simulation and Experimental Results This controller is simulated for varying axial depth of cut to evaluate the performance of the system. The cutting pattern is shown infigure4.19.The same work-piece profile was used for all the experiments. Figure4.20 shows the cutting force and control input respectively. The controller adjusts to the feed rate such that after each step change in axial depth of cut the resultant force tracks the required reference force. The jumps in the cutting force are due to the time required to identify plant parameters after sudden changes in axial depth of cut. Identification plays a major rule in performance of this type of controllers. Ideally the time required to identify the parameters is at least equal to the number of parameters multiply by the sampling time (which in this case is one revolution of the cutter). In practice it is larger and relates to the richness of input excitation. The forgetting factor is set equal to one. When the difference between the Chapter 4. Controller Design and Application Figure 4.18: Root Locus for PID Design 55 Chapter 4. Controller Design and Application 57 o o ro O CO <-> 0.0 40.0 0.0 40.0 80.0 SAMPLE 80.0 SAMPLE Figure 4.20: PID Controller Simulation a) Cutting Force Response b) Control Input 120.0 (T00TH 120.0 (TOOTH 160.0 PERIOD) 160.0 PERIOD) 200.0 200.0 240.0 240.0 Chapter 4. Controller Design and Application 58 predicted and measured output ,i.e. the predicted error, is greater than 5 percent of the reference force, the covariance matrix is reset to a large value (1000) and forgetting factor decreased to 0.995. This will help the identification method converge faster [41,6,39]. Note that under "steady state conditions" or when there are no changes in the process, the value of the covariance matrix goes to zero and it is commonly said that the estimator "sleeps". When there is a sudden change in axial depth of cut, identification cannot work well and the controller becomes oscillatory. This oscillation although eventually will help the estimator to converge but it is undesirable. Resetting is done infrequently by checking a counter because resetting too frequently is also harmful. A bound is imposed on the pole of the cutting process. The reason is that after every change in the process, it is possible that the few initial estimated parameters are wrong. The pole of the process is limited to the unit circle in these cases. The same simulation was repeated but this time in the presence of run-out which is simulated by imposing an alternating 10% depth of cut variation at each tooth period. This is important because although run-out was always minimized, by adjusting the inserts on the tool, it still existed. This phenomenon, which acts like a deterministic noise on the system, has a detonating effect on the controller during cutting[39]. Figure 4.21 shows the cutting force and control input for a PID controller in the presence of run-out. It is clear that the system is responding well. In a series of tests the PID controller was implemented on the CNC machine. The work-piece material was aluminum 7075T651. Straight slotting was performed to test the algorithm. The spindle speed was 775 RPM and cutter diameter was 2.54 mm. The reference force was 1000 Newtons. To eliminate the measured high frequency noise a low pass filter with break frequency of 100 Hz was used. Force signals in X and Y direction and the tacho signal were passed through the filter. To prevent unexpected control inputs to the machine , which is most likely during the passing steps, the Chapter 4. Controller Design and Application Figure 4.21: PID Controller Simulation with Run-out a) Cutting Force Response b) Control Input 59 Chapter 4. Controller Design and Application 60 controller was bounded to a maximum value. On the other hand to prevent the table from moving backward a lower bound was also imposed on the controller. Before and after machining , or during air cutting, the controller was set to move the table at a constant velocity. The measured peak force is shown in figure 4.22. The peak force is tracking the reference force although there are "spikes" in the force signal during the changes in axial depth of cuts. The control input, the measured feed-rate signal from the tacho and estimated parameters are shown in Figs. 4.23, 4.24 and 4.25 respectively. The control input response is the mirror image of the cutting profile. One draw-back of this controller is that a thorough knowledge of the servo and cutting process is necessary to implement the pole-zero cancelations. Otherwise the characteristic equation may have higher orders with possible pole or poles outside the unit circle. The source code for the PID algorithm is given in Appendix A . Supplementary softwares such as data acquisition system, setup and saving data software are given in appendix D . 4.5 4.5.1 Adaptive Pole-Placement Control Design Introduction Self tuning controllers with the controller design based on Pole-Placement were first proposed by Wellstead et al.[36] and Astrom and Wittenmark[37]. Here again the model parameters are first identified and then the controller is designed assuming that these parameter estimates are correct. The design procedure explained here is based on the input-output model. The main idea is to choose a linear controller structure, as is shown in figure 4.26, and change its parameters such that the closed loop system has the desired specifications. One advantage of a Pole-Placement controller is that 1.3 1.2 1.1 1 0.0 0.8 0.7 0.6 0.5 0.4 0.3 0.2 -| | 0.1 0.2 0.4 T 0.6 T T 0.8 (Thousands) Sample (Tooth Period) ~i l r I 1.2 I 1.4 Figure 4.22: Adaptive PID Controller Machining Test, Peak Force Measurement Figure 4.23: Adaptive PID Controller Machining Test, Control Input 05 to Chapter 4. Controller Design and Application 8 feJ g: ESTIMATOR 3 B U(Ref) U R U = T U - S Y 7" ^ SERVO o Figure 4.25: Adaptive Pole-Placement Control Loop CUTTING PROCESS I § Chapter 4. Controller Design and Application 66 by appropriate selection of closed loop poles the stability of the system could be safeguarded. On the other hand by manipulating the zeros of the closed loop the transient response is improved. 4.5.2 Model Considerations It is desired to design an adaptive controller which can keep the applied cutting force on the shank of the cutter at a safe constant level. The controller must be stable, robust to changes in the cutting conditions and have an acceptable transient response. The process to be controlled has two cascaded dynamics. The first being the time invariant feed drive control dynamics (see Eq. 4.65), and the second is the time varying cutting process whose parameters change depending on the changes in the work-piece geometry during machining. The combined feed drive control and machining process dynamics are referred to as the plant The plant's transfer function is given as: M^Erl) (489) where y(t) and u(t) are the force and control input signal respectively and q is a forward shift time operator. It is assumed that polynomials A and B are relatively prime and deg-4 > degi?, i.e., the system is causal. The polynomial A is assumed to be monic, i.e., the first coefficient is unity. Substitution of the feed drive control and process parameters into the equation 4.89 gives the plant's transfer function which has all the above requirements. y(t) u(t) hjz + a) z{z + A + A ) = 2 lZ where fcj = a K b 0.9518 0 = 0.0020946 2 v ' ' Chapter 4. Controller Design and Application Ai = - a A = +0.04614 a! 2 x 67 - 0.04614 The cutting process parameters Si and 6o, are time varying, and are estimated at each tooth period using the RLS identification method. The aim of the adaptive controller based on Pole-Placement design is that the closed loop transfer function between the reference force and the actual force obey the following desired model dynamics m _ u (t) c = M2l (491) A (q) ^' m y i ; For the stability of the system, the roots of the characteristic equation, A , are sem lected within the unit circle. Furthermore, A m is designed to satisfy transient response characteristics of the controller. A second order dynamics is selected to represent the desired response A (z) = z -2 e" " cos{u J\ - ( T) z + ~ ^ cu 2 lT m 2 nS 2 T e (4.92) which corresponds to a continuous system with a desired damping ratio of £ and natural frequency of u>„. T is the sampling time which is equal to one tooth period. An ideal damping ratio of £ = 0.7 is selected to obtain minimum overshoot during the transients. A rise time of four tooth periods is selected, which corresponds to the natural frequency of 16 rad/sec [38]. 2.5 u) = — 16 rad/sec. n The resulting model characteristic equation is found from equation 4.92 as A (z) = z - 1.162 z + 0.4132 2 m (4.93) (4.94) Chapter 4. Controller Design and Application 68 In order to have a unit closed loop gain, the numerator of the model is selected as B (z) = A (z = 1) = 0.2512 m (4.95) m The desired closed loop transfer function of the system is then given by . B (z) A (z) 0.2512 z* - 1.162 z + 0.4132 m m 4.5.3 (4.96) Theory of Pole-placement Design for Machining Process Control A general form of a self tuning regulator is shown in Fig. 4.26. The polynomials S^g ), -1 T ( g ) and i2(g ) represent feed-back, feed-forward and error regulators respectively, -1 _1 which have to be determined adaptively at each tooth period. The plant to be controlled was given by Eq. 4.90 which can be rewritten in difference equation form as Eq. 4.89. The closed loop transfer function of the controller is derived from figure 4.26 as : (4 97)' i*JU tt (fc) AR + BS B T K c where k is the sampling counter. Note that for simplicity the q operator is omitted as an argument of the polynomials. In order for the system to behave like the desired model, the following equivalence must hold. B T AR + BS = ^ A (4.98) ' K m The design problem is defined as finding the polynomials R, S and T using the plant and desired model transfer functions. The relationship between the desired reference force F and regulated feeding ver locity u can be expressed as R u(k) = T u (k) - S y(k) c (4.99) Chapter 4. Controller Design and Application 69 It is shown in state space theory that the regulator given by Eq. 4.99 corresponds to a combination of an observer and a state feed-back [27, pp. 148-150]. The observer is designed so that changes in the command signals do not generate errors in the observer. Although the command signal in milling process control is the reference force which is constant, a general case where the reference force may be varied is considered. This results in a factor which cancels in the right hand side of the Eq. 4.98 and can be interpreted as the observer polynomial Ao, which is selected to have its all zeros within the unit circle. It follows that Eq.4.98 can be written as BT B Ap ,, m AR+-BS AZA = ( 4 0 - i n n . 1 0 0 ) In the plant to be controlled, there is one zero which is well within the unit circle, therefore it can be safely canceled by one of the closed loop poles in order to obtain a desired response. The numerator of the plant can be factored as B = B B~ (4.101) + where B = z + 0.002046 B~ = 0.9518 K b + 0 Therefore B~ is a constant. In order to cancel B with one of the poles of the closed + loop transfer function, as A and B are coprime, following condition must be satisfied by the polynomial R. R = B + R' (4.102) Since B~ is retained, it is not a factor of the characteristic equation of the closed loop system, then it must be a factor of B m to satisfy the Eq. 4.100. Chapter 4. Controller Design and Application B = B~ B' m 70 (4.103) m Substituting equations 4.101, 4.102 and 4.103 into Eq. 4.100 gives, B~ T AR' + B-S B~B' Ao AA (4.104) m m 0 In order to satisfy Eq. 4.104, the following conditions must hold AR' + B~S = A A M (4.105) 0 (4.106) T = B' A M In Eq. 4.105, the polynomials A, A M 0 and AQ are known, and polynomials R' and S are to be solved. In order to have a unique solution for the Diophantine equation (Eq. 4.105), the following condition must be met [37, page 228] deg S < deg A (4.107) The degree of polynomial S is chosen to be deg S = deg A-l (4.108) Furthermore, the following conditions must be satisfied in order for the control law given in Eq. 4.99 to be casual [37, pp. 230-31] deg A 0 > 2deg A - deg A - deg B - 1 deg R = + M deg A + deg A + deg B - deg A + 0 M (4.109) (4.110) Chapter 4. Controller Design and Application 4.5.4 71 Application of Pole-Placement Design for Milling Process Control The Pole-Placement design method recapitulated in the previous section has been applied to control the milling process represented by the plant given in Eq. 4.90. It is desired that the milling process behave according to the model selected in Eq. 4.96. The conditions listed in equations 4.108 and 4.109 are applied to the plant and the model to find the order of the polynomials. deg AQ = 2 deg 5 = 2 deg R = 2 As a rule of thumb the observer dynamics should be faster than the desired closed loop response [41, pp. 502-503], therefore a deadbeat observer is selected as A Q = z (4.111) 2 Since a factor of the polynomial R is canceled by the plant zero B + (Eq.4.102), the polynomial R' can be expressed as a first order polynomial R' = z + r (4.112) x The feed-back regulator S is expressed as : S(z) = s z + *i z + s (4.113) 2 0 2 Substitution of polynomials into the Eq. 4.105 gives the Diophantine Equation z ( z - 0.0461992 ) (z - a ) (z + r ) + a (s z 0 2 + s z + s ) (K) = z (z 2 x 2 2 x + -1.162^ + 0.4132) (4.114) Chapter 4. Controller Design and Application 72 this results in n = -1.1158 + a 5 = 0.4132 + n oi + 0.0461992 ( n - o ) — r — - , . (4.116) = -0.0461992 (r ai) ~ J - (4-117) 0 * s 2 = (4.115) 1 x 1 a 1 0. (4.118) rx and So and S\ are calculated from the above equations at each sampling time and then polynomials S and R are calculated as follows S = z{ s z + Si) 0 (4.119) R = B R' = (z + 0.0020946) (z + n ) (4.120) and from Eq. 4.102 + Polynomial T is calculated from Eq.4.106 T-lt.A.-S'-gp. (4.121) The machining process parameters So and di are identified recursively at each control interval (i.e. tooth period) to adaptively determine the polynomial parameters given in equations 4.119,4.120 and 4.121. These polynomials satisfy the requirements of causality deg R < deg T deg R < deg S The control input signal is given as Riq-^uik) = Tiq-^u^k) - S(q- )y{k) X Table 4.3 presents a psuedo code for Pole-Placement control algorithm. (4.122) Chapter 4. Controller Design and Application 73 Table 4.2: Psuedo Code for PID Control Algorithm 1) Measure the peak resultant force and tacho signal x 2) Identify the parameters of the model based on procedure presented in Table 4.1. 3) From Eqs. 4.88, 4.71 and 4.72 find the gains K , Ki and K . p d 4) Calculate error signal by subtracting measured cutting force from reference input signal. 5) Calculate control input using Eq. 4.68 with known gains and error signal as input. 6) Wait until next sampling time, go to step one and repeat. Table 4.3: Psuedo Code for Pole-Placement Control Algorithm 1) Measure peak resultant force and tacho signal. 2) Identify the parameters of the model based on procedure described in Table 4.1. 3) Calculate polynomials R, S and T according to Eqs. 4.120 , 4.119 and 4.121. 4) Calculate control input signal from Eq. 4.122. 5) Wait until next sampling time, go to step one and repeat. Chapter 4. Controller Design and Application 4.5.5 74 Simulation and Experimental Results The simulation results for Pole-Placement controller is shown infigure4.27. The same cutting profile and reference force value was used as in case of PID controller. The algorithm was also simulated in the presence of run-out. The cutting force response and control input are shown in Fig. 4.28. As it is shown in simulations the pole-placement controller can follow the reference force even with sudden changes in axial depth of cut. The response is similar to that of the PID controller because the characteristic equations for both designs are almost the same. The Pole-Placement algorithm was run on the CNC machine under the same conditions as PID controller to set a base for comparison. Parameter Identification has the same procedure as the case of the PID to prevent drifting of parameters. During steady state cutting, if the predicted error was less than a minimum value (one percent of the reference force) then the previous control input value is sent to the servo. The measured cutting force is shown in Fig. 4.29. The output is tracking the reference signal well. Note that the height of the jumps in machining tests are generally lower than the simulations. The reason is that during cutting, the cutter gradually penetrates the flat face of the work-piece, but in simulations the changes are treated once. Control input signal, measured tacho signal and estimated parameters are shown in figures 4.30, 4.31 and 4.32 respectively. The parameters converge slowly to their true values. Change from axial depth of cut of 6 to 3 mm shows the same response in simulation and experiment. Note that after a 'burst-like' response the parameters converge fast to their final values and the controller works satisfactory. One drawback of the pole-placement technique is that the structure of the plant should be known before hand. If the model and the process does not match then it is possible for the controller to become unstable. Chapter 4. Controller Design and Application CD 0.0 40.0 0.0 40.0 80.0 SAMPLE 80.0 SAMPLE 120.0 (T0QTH 120.0 (TOOTH Figure 4.26: Pole-Placement Controller Simulation a) Cutting Force Response b) Control Input 75 160.0 200.0 240.0 160.0 200.0 240.0 PERIOD) PERIOD) Chapter 4. Controller Design and Application 80.0 SAMPLE 76 i r 120.0 160.0 (TQ6TH 0.0 40.0 80.0 SAMPLE 120.0 (TOOTH 240.0 200.0 240.0 PERIOD) i CD 200.0 r 160.0 PERIOD) Figure 4.27: Pole-Placement Simulation with Run out a) Cutting Force Response b) Control Input Chapter 4. Controller Design and Application (•puvinoqx) 77 L - Li i 0 - i 0.2 i t 0.4 V r i 0.6 Sample i i I 0.8 (Thousands) (Tooth Period) I 1 I I I 1.2 Figure 4.29: Adaptive Pole-Placement Machining Test, Control Input I 1.4 Chapter 4. Controller Design and Application 79 Chapter 4. Controller Design and Application Chapter 4. Controller Design and Application 81 Appendix B gives the source code for the pole-placement algorithm. 4.6 Model Reference Adaptive Control Design 4.6.1 Introduction The first attempt in the design of stable adaptive control systems was in the area of model reference adaptive control systems [6] and was proposed by Whitaker et al.[8] in the late 1950s. Meanwhile, there has been a fair amount of work in this area, especially regarding the stability of the controller. The original MRAC introduced two new ideas[41]. First, the performance of a system was specified by a model; second, the parameters of the controller were adjusted based on the error between the reference model and the system such that the output of the unknown system asymptotically approached that of a given reference model (Fig. 2.2). M R A C systems were originally derived for servo problems in deterministic continuoustime systems, but the theory has been extended to cover discrete-time systems and systems with stochastic disturbances. Earlier work in this area were based on the state space formulation, but from a practical point of view the adaptive control systems based on input-output signals are the main interest in the design of stable MRAC controllers. In the following section a basic summary of Landau's model reference adaptive control scheme, which is based on independent tracking and regulation, is presented. A more detailed analysis can be found in [21]. 4.6.2 Theory of M R A C for Machining Process Control Model following problem M R A C is based on model following problem. The model following problem is that for a time-invariant plant the controller parameters are adjusted in a manner that the closed Chapter 4. Controller Design and 82 Application loop transfer function is close to a specific model. consider a single input single output discrete linear time-invariant plant as A{q- )y{k) l = q- B(q-')u(k) (4.123) d where ^ ( g - ) = 1 + aq1 1 nA (4.124) + ... + b q- nB (4.125) nA B(q~ ) = b + hql + ... + a q~ 1 0 nB d is the plant time delay, q~ is the backward shift operator and u(k) and y(k) are l the plant input and output, respectively. It is assumed all zeros of the plant are inside the unit circle, which holds true for the milling process and servo. In machining, the required objectives for the controller are that the cutting forces as output follow a reference input and also the system should eliminate the disturbances and remain stable. These conditions could be considered as 1) In tracking the output should satisfy the equation Cx{q- )y{k) = q- D{q- )u (k) l d l where u (k) is the reference input. C\(q~ ) and D(q ) M (4.126) M l -1 axe polynomials which specify an explicit reference model as Ci(q~ )y {k) l M = q- D{q- )u (k) d l M (4.127) where y (k) is the model output. C i ( g ) should be a stable polynomial. - 1 M 2) In regulation , [u (k) = 0], an initial disturbance (y(0) ^ 0) is eliminated by the M dynamics defined by C2(q~ )y(k + d) = 1 where C2(q~ ) = 1 + C\q~ + ... + C q~ 1 l 2 c2 nc2 0k>0 is a stable polynomial. (4.128) Chapter 4. Controller Design and Application 83 The plant-model error is defined as e(k) = y{k) - y (k) (4.129) M The control objectives in Equations 4.126 and 4.128 are satisfied if the following equation holds C {q- )e(k + d) = 0 1 2 (4.130) The controller structure could be chosen in general form same as the Pole-Placement design 5VX*) = T\q-*)u (k) - R'iq-'Mk) M One way to choose polynomials S'iq' ) ,T (q' ) 1 S\ - ) and R'iq' ) 1 is 1 = B(q- )S(q-') l (4.132) i q T'(g- ) = C ) | ^ (4.133) B!(q- ) = R{q- ) (4.134) 1 2 ( 9 - (4.131) 1 x 1 where Siq- ) = 1 + Siq- + s q~ + ... + s q1 1 2 2 Riq-^^ro + nq- +r q~ + 1 nS nS 2 2 (4.135) ... + r q- (4.136) - Ry(k) (4.137) nR nR therefore the controller becomes BSu(k) = C £-u (k) C\ M 2 Note that for simplicity the arguments of the polynomials are omitted. With the help of equations 4.123 and 4.126 Eq. 4.137 can be rewritten as BS^y(k + d) = C ^~y{k 2 + d) - Ry(k) (4.138) Chapter 4. Controller Design and Application 84 or AS + Rq~ = C (4.139) d 2 This equation has a unique solution provided that ns = d — 1 TIR = max(riA — l,n 2 — 2) (4.140) C With the help of Eq. 4.139 it is straight forward to show that the required control objective, Eq.4.142 ,holds C e(k + d) = C y(k + d) - C y (k + d) (4.141) M 2 2 2 using Eqs. 4.141, 4.139 and 4.127 C e(k + d) = (AS + Rq- )y(k + d) - C £-u (k) (4.142) C e(k + d) = BSu(k) + Ry(k) - C ^-u (k) (4.143) d M 2 2 or M 2 2 Referring to Eq.4.137 the right hand side of the above equation is zero, therefore Eq. 4.130 is satisfied. Polynomials in the controller, Eq.4.137, could be expanded and rewritten as b u(k) + 8ZMk) = C y (k + d)- Ry(k) (4.144) M 0 2 where 4>l(k) = [u(k-l),...,u(k-d-n 6Q = [6 *i 0 +&i,6oS2 B + l), y(k),..., y(k - n )} R + M i + b ,... ,b s -i,r ,... 2 nB d 0 ,r ] nR (4.145) (4.146) Finally control input can be derived from Eq. 4.144 as u(k) = hc (q- )y (k 1 2 M + d)-6l<l>o(k)} (4-147) Figure 4.33 shows the block diagram of the linear model following control scheme. Chapter 4. Controller Design and Application 85 Chapter 4. Controller Design and Application 86 M R A C Design When the plant parameters are unknown, they are replaced by their estimates from the adaptation mechanism. Therefore the control law in the adaptive case is given by W = rrrA ^- )y (k b {k) U c l M + <*) - (4.i48) 0 or equivalently e (k)<f>(k) = C (q> )y (k + d) T M 2 where r(fc) = [6 0 (&)A (fc)] (4-150) T <f> (k) T = (4.151) Introducing Eqs. 4.149 and 4.139 into Eq. 4.142 gives C {q- )e{k + d) = l 2 [6- 9{k)}<f>{k) (4.152) The design objective is to find an adaptation mechanism which ensures that the plantmodel error converges to zero and the input and output of the plant remain bounded. lim e(k) = 0 fc—»oo || <fr(k) ||< M < oo,Vfc (4.153) Because the plant parameters are unknown Eq. 4.152 cannot be solved directly, however, it can be approached as follows. Define the filtered plant-model error as e /(Jb) = C (g- e(Jfc) 1 2 = [6 - §(k - d)] <f>{k - d) T (4.15 Define the auxiliary error as e(k) = [6{k -d)- 8(k)] <t>(k - d) T (4 Chapter 4. Controller Design and Application 87 The summation of the above errors gives the augmented error e'(Jfe) = e (k) + e{k) f (4.156) It can be proved [21] that if lim e"(fc) = 0 (4.157) k—i-oo then the objectives of equations 4.153 are satisfied. An adaptation mechanism which guarantees the conditions of Eq. 4.157 is given as 6(k) = 6{k P _J_r = _ P x (k) k+1 lk 1 P ^ k k ~ d ^ k 1) + P <f>(k k ~Vx p d)e*(k) 1 U 1 x (k)/x (k) + <f,T(k-d)p f>(k-dy 1 2 (4.158) k*\ ' ( k< where 0 < A^fc) < 1 , 0 < A (fc) < 2 and P > 0 2 0 To make the algorithm implementable , e*(k), augmented error , should be expressed in terms of parameters estimated up to k — 1. Using Eqs. 4.156, 4.155, 4.154 and 4.158 e-(fc) = e (k) = C (q- )e(k) + f + e(k) 0 (k-d)<f>{k-d)-d (k)<fi(k-d) T 1 2 T (4.160) or e*(k) = C {q-*)y{k)-6 {k)<f>(k-d) T 2 = C {q~ )y(k) - 6 (k - l)0(fc - d) - <j> {k - d)P 4>(k - d)e*{k) (4.161) l T T 2 k finally £ £ . _ W ( k ) C { -*)y{k)-9T(k-l)<l>(k-d) 1 + (f>T(k - d)P <j>(k - d) 2 q k Figure 4.34 shows the adaptive control scheme corresponding to this design. { A m l b 2 ) Chapter 4. Controller Design and Application 88 Chapter 4. Controller Design and Application 4.6.3 89 Application of M R A C Design for Milling Process Control The M R A C design method has been applied to control the milling process. The plant is the combination of the servo feeding velocity and cutting process transfer functions. y(k) _ ^(0.99578086)6 2 (l + 0.0020946z- ) u(k) (1 -0.0461992z- )(l-aaz- ) _2 1 O 1 1 (4.163) Comparing with the Eq. 4.123 one gets ri A — 2,n# = l,d = 2 (4.164) The choice of regulation dynamics, C , is by designer and through simulations a second 2 order polynomial is selected as C ( z ) = 1 + C\z~ + C z~ = 1 - 0 . 4 4 Z - + O . O I 6 2 - 1 x 2 1 2 2 (4.165) consequently the order of polynomials S(q ) and R(q ) are given by Eq.4.140 1 n s = l,n 1 R = 1 (4.166) The reference model has been chosen with the same structure as the plant. The parameters of the cutting process are calculated based on average depth of cut of 5 mm and the resulting transfer function is multiplied by the time-invariant transfer function of the servo. This model is multiplied by a gain of 2.235 to obtain a dc gain of one for the model. y (k) u (k) M M D d 2.235z- (0.3 + 0.00062838z- ) (1 - 0.0461992z~ )(l - 0.3*- ) 2 1 1 1 (4.167) The observation and parameter vectors are <f> (k) = [u(k),u(k ~ l),u(* - 2),y(k),y(k - 1)] T e (k) T = S (fc),S (fc)ii(fc) + 0 0 £ i , M i , f Table 4.4 shows a psuedo code for M R A C algorithm. 0 , f 1 (4.168) (4.169) Chapter 4. Controller Design and Application Table 4.4: Psuedo Code for MRAC Design 1) Choose the parameters of the regulation dynamics,C . 2 2) Choose the parameters of polynomials D,C\, model, as Eq. 4.163. 3) Calculate the order of polynomials R and S from Eq. 4.166. 4) Setup observation and parameter vectors as Eqs. 4.168, 4.169. 5) Give initial values to parameter vector and covariance matrix. 6) Measure peak resultant force. 7) Calculate augmented error from equation 4.162. 8) Calculate new parameter vector from Eq. 4.158. 9) Update covariance matrix from Eq. 4.159. 10) Calculate control input signal from Eq. 4.148. 11) Wait until next sampling time, go to 7 and repeat. Chapter 4. Controller Design and Application 4.6.4 91 Simulation and Experimental Results The M R A C algorithm was simulated under the same cutting conditions as PID and Pole-Placement algorithms. The results for peak cutting force and control input are shown in Fig.4.35. The same algorithm in the presence of run-out was simulated and the results are shown in Fig.4.36. The algorithm which has an overall satisfactory response, shows some instability when exposed to run-out. This is significant at the very beginning of the cutting. Note that in the MRAC algorithm five parameters are estimated. The same problem has been reported by Oh [40], who has used the same method[21], although his model was first order with two parameters. The MRAC controller was implemented on the CNC machine, using the same workpiece geometry and cutting conditions, as PID and Pole-Placement designs. The measured cutting force, control input, measured feed-rate from tacho and first estimated parameter 6 are shown in Figs. 4.37, 4.38, 4.39 and 4.40, respectively. The controller 0 is highly oscillatory at the beginning which affects the measured force. For the rest of the cut, although the force is tracking the reference input, the response is not ideal. Note that the control scheme developed above is suitable for varying reference input because in a fixed input environment, such as our work with constant reference force, the model output after a few iterations reaches the final value and remains constant. This approach which is described as " pure adaptive " [22] could be altered by introducing a feed-back controller around the MRAC controller. The reference input to the model is now the error between the measured force and reference force input. For this case since the model is in a closed loop block the compensating gain for the dc offset is removed and an integral controller with the gain of 0.1 is introduced. This integrator will eliminate the steady state error. The controller is implemented on the machine and the results are shown in Figs. 4.41, 4.42 and 4.43. Although the response for the Chapter 4. Controller Design and Application 0.0 40.0 80.0 120.0 160.0 200.0 240 120.0 160.0 200.0 240 SAMPLE 0.0 40.0 80.0 Figure 4.33: M R A C Simulation a) Cutting Force Response b) Control Input 92 SAMPLE 93 Chapter 4. Controller Design and Application 0.0 40.0 80.0 120.0 160.0 200.0 240.0 120.0 160.0 200.0 240.0 5RMPLE SAMPLE Figure 4.34: M R A C Simulation with Run-out a) Cutting Force Response b) Control Input 0 0.2 0.4 0.6 0.8 (Thousands) Sample (Tooth Period) 1 1.2 1.4 Figure 4.35: MRAC Machining Test, Measured Peak Force CO Chapter 4. Controller Design and Application 96 Chapter 4. Controller Design and Application o.i H i 1 0.4 1 1 0.6 Sample 1 1 r 0.8 (Thousands) (Tooth Period) Figure 4.40: MRAC Machining Test, Estimated Parameter 97 Chapter 4. Controller Design and Application 98 start of the cutting has improved but the controller is oscillatory for the rest of the cut. Note that decreasing the integral gain does not improve the response. The source code for the MRAC algorithm is given in Appendix C . 0 0.2 0.4 0.6 Sample 0.8 (Thousands) (Tooth Period) 1 1.2 1.4 Figure 4.38: MRAC with Integral Action, Measured Peak Force CO CO Chapter 5 Concluding Remarks Summary The purpose of the work presented in this thesis was to implement adaptive control algorithms on an end milling process. The work can be summarized as following. Modelling A first order model was developed for the milling process. This model, only in special cases, could be reduced to a simple gain. For the feeding velocity servo a second order model was derived which was accurate enough to be used in controller design Adaptive PID Design The performance of the PID controller was satisfactory. One drawback of this type of controller is that a thorough knowledge of the plant is necessary in order to adjust the gains for stability. Adaptive Pole-Placement Design Pole-Placement controller had a satisfactory response. Selection of the poles gives an advantage to this design. The performance of both PID and Pole-Placement is subject to correct modelling of the process and correct and fast convergence of the estimator. MRA C Design The response of the MRAC design was oscillatory and inferior compared to selftuning designs. 102 Chapter 5. Concluding Remarks 103 Recommendations for Future work The work presented in this thesis requires further research in several areas. The future work is outlined as follows: 1) The modelling of the milling process should be improved. More work needs to be done to include the effect of the edge forces. 2) The effect of the unmodelled dynamics (measurement noise and run-out) should be investigated and if necessary included in the model. 3) Identification method should be improved to guarantee correct and fast convergence. 4) Work is needed to study the effect of unmodelled dynamics on MRAC design. 5) Cutting force was used as the constraint to prevent tool breakage. More work is needed to find the best constraint(s) to optimize the quality and economic factors at the same time. 6) The algorithms can not be used to prevent tool breakage due to large force overshoots during transients and should be combined with other sensing mechanisms. 7) The algorithms should be tested for more complex geometries. The work could also be extended to other types of the machine tools. 8) Force sensor which was used in this work is not practical in real situations. More research, is needed to replace this by sensors on the spindle or the leadscrew, or use other signals such as current to measure the force. Bibliography [l] Koren,Y.,Computer Control of Manufacturing Systems, McGraw-Hill,New York, (1983). [2] Tomizuka,M. and Zhang,S.," Modelling and Conventional / Adaptive PI Control of a Lathe Cutting Process," ASME , Journal of Dynamic Systems, Measurement and Control, Vol.110, pp.350-354 (1988), [3] Groover,M.P., Automation, Production Systems, and Computer Integrated Manufacturing, Prentice-Hall,(1987). [4] Porter,B. and Summers R.D.M.J.," Adaptive Machine - Tool Control - The State of the Art," Journal of Mach. Prod. Eng. , pp.214-220 (1969). [5] Astrom,K.J.," Theory and Applications of Adaptive Control- A Survey," Automatica ,Vol.l9,pp. 471-486,(1983). [6] Seborg,D.E.,Edgar,T.F. and Shah,S.L.," Adaptive Control Strategies for Process control: A Survey," AIChE Journal,Vo\. 32, No.6, pp.881-913,(1986). [7] Astrom,K.J.," Adaptive Feedback controls," proceedings of the IEEE,Vo\.75, No.2, pp.l85-217,(1987). [8] Whitaker,H.P.,Yamron,J. and Kezer,A.,"Design of Model Reference Adaptive Control Systems for Aircraft," Report R-164, Instrumentation lab., MIT, Cambridge,MA(1958). 104 Bibliography [9] Kalman,R.E.,"Design of a Self-Optimizing 105 Control Systems," Transaction of ASME,80, Ser.D, (1958). [10] Centner,R.M. and Idelson,J.M.," Adaptive controller for a metal cutting process," Proc. of IEEE ASME joint Automatic Control Conference,pp.154-161,(1964). [11] Bedini,R. and pinotti,P.C.,"A hard-wired Logic for the Adaptive Control of a Milling Machine," International Journal of Machine Tool Design and Research, Vol.16, pp.l93-207,(1976). [12] Koren,Y.,"Flank Wear Model of Cutting Tools Using Control Theory,"ASME Journal of Engineering for Industry,Vol.100, pp.103-109,(1978). [13] Yen,D.W.and Wright,P.K.," Adaptive Control in Machining- A New Approach Based on the Physical Constraint of Tool Wear Mechanisms,"ASME Journal of Engineering for Industry, Vol.105, No.l,pp. 31-38,(1983). [14] Ulsoy,A.G.,Koren,Y. and Rasmussen,F.,"Principal developments in the Adaptive Control of Machine Tools," ASME Journal of Dynamic Systems, Measurement and Control, Vol.l05,pp.l07-112(1983). [15] Watanabe,T.,"A Model-Based Approach to Adaptive Control Optimization in Milling,"j45Af2? Journal of Dynamic Systems, Measurement and Control vol. 108, pp.56-64 (1986). [16] Beadle,B.R. and Bollinger,J.G.," Computer Adaptive Control of a Machine Tool," Annals of CIRP Vol. 16, pp.61-65 (1971). [17] Stute,G. and Goetz,F.R.,"Adaptive Control System for Variable Gain in A C C Systems,"Proceedings of the Sixteenth International Machine Tool Design and Research Conference,pp.117-121 (1975). Bibliography 106 [18] Tlusty,J. and Elbestawi,M.A.A./'Analysis of Transients in an Adaptive Control Servomechanism for Milling with Constant Force,".A5Mi? Journal of Engineering for Industry,Vol.99, No.3, pp.766-772 (1977). [19] Tomizuka,M., Oh,J.H. and Dornfeld,D.A.,"Model Reference Adaptive Control of the Milling Process," in Control of Manufacturing Processes and Robotics Systems, Edited by D.E.Hardt and W.J.Book,ASME, New York (1983). [20] Masory,0. and Koren,Y.," Stability Analysis of a constant Force Adaptive Control System for Turning," ASME Journal of Engineering for Industry, Vol.107, pp.295300 (1985). [21] Landau, I.D., and Lozano, R.,"Unification of Discrete Time Model Reference Adaptive Control Designs," Automatica, Vol.17, No. 4, pp.593-611 (1981). [22] Daneshmand,L.K. and Pak,H.A.,"Model Reference Adaptive Control of Feed Force in Turning,"ASME Journal of Dynamic Systems, Measurements, and Control, Vol.108, pp.215-222,(1986). [23] Lauderbaugh, L.K., and Ulsoy,A.G.,"Dynamic Modelling for Control of Milling Process,"Proceedings of the ASME Winter Annual Meeting, Sensors and Controls for Manufacturing, PED-Vol. 18, pp.149-158 (1985). [24] Elbestawi,M.A. and Sagherian,R.,"Parameter Adaptive Control in Peripheral MUling,"International Journal of Machine Tools and Manufacturing, Vol.27, No.3, pp.399-414 (1987). [25] Mohamed,Y.,Liu,L.and Elbestawi,M.A./'Stochastic Self-Tuning Control of Cutting Forces in a CNC Machine Tool,"Proceedings of IEEE Conference on Decision and Control, pp. 1178-1183 (1988). Bibliography 107 [26] Fussel,B.K. and Srinivasan,K.,"Model reference Adaptive Control of Force in End Milling Operations "Proceedings of IEEE Conference on Decision and Control, pp. 1189-1194 (1988). [27] Goodwin,G.C. and Sin, K.S.,Adaptive Filtering Prediction and Control, PrenticeHall Inc.,New Jersey (1984). [28] Koenigsberger,F. and Tlusty,J.,Machine Tool Structure Volume One,pp.77- 78,Pergamon Press(1970). [29] Altintas,Y. and Peng,J.,"Design and Analysis of a Modular CNC System for Machining Control and Monitoring," Submitted for Publication to ASME , Journal of Engineering for Industry, (1988). [30] DMC-230 Motion Control Unit Manual,Galil Motion Control Inc., Palo Alto, CA (1987). [31] Baldor DC Servo Motor Amplifier Manual,Baldor Servo Products, Fremont, CA (1987). [32] Altintas,Y., and Yellowley,I.," In-Process Detection of Tool Failure in Milling Using Cutting Force Models," ASME Journal of Engineering for Industry to be published,(1989). [33] Ogata,K., Discrete-Time Control iSystfem^Prentice-Hall Inc.,(1987). [34] Altintas, Y.," Instrumentation of a Research Machine Tool with a Modular Computer Numerical Controller (CNC)," submitted to Trans of the Institute of Measurement and Control,(1988). Bibliography 108 [35] Ljung,L. and Soderstrom,T., Theory and Practice of Recursive Identification MIT Press,(1987). [36] Wellsead,K.J.,Prager,D. and Zanker,P.,"Pole-Assignment Self-Tuning Regulator," Proc. 7^,126(1979). [37] Astrom,K.J. and Wittenmark,B.,Computer Controlled Systems, Theory and De- sign, Prentice-Hall,(1984). [38] Franklin G.F. and Powel,D.,Digital Control of Dynamic Systems,AddisonWesley,(1981). [39] Lauderbaugh,L.K.," Implementation of Model Reference Adaptive Force Control in Milling," P.hD. Thesis, University of Michigan,(1985). [40] Oh,J.," Model Reference Adaptive Control of the Mining Process," P.hD. Thesis,(1985). [41] Astrom K . J . and Wittenmark,B., Adaptive CorciroZ,Addison-Wesley,(1989). Appendix A P I D Control Algorithm '%%%%%%%%% ADAPTIVE PID ALGORITHM %%%%%%%%%%% '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DECLARE SUB SAVE.DATA (FILE.NAME$, COUNTER%) DECLARE SUB SETUP () DECLARE SUB ALGORITHM () DECLARE SUB DATA.ACQUISITION () DECLARE SUB SENDBACK (CHAR%(), NUM.OF.CHAR%) DECLARE SUB VT100 () DECLARE SUB INPUTINFO (GAIN%, FILE.NAME$) DIM FI(2), P(4), TETA(2) DIM CHAR%(50), FORCE.MAG!(1500), FEED.VEL!(1500) DIM CONTROL.CPS!(1500), TETA.ZERO 1(1500), TETA.ONE!(1500) CLS CALL VT100 CLS COUNTER% - 0 CALL SETUP TOTAL.FORCE! - 0 FEED! - 0 FI(0) - TOTAL.FORCE! FI(1) - FEED! P(0) - 1000! P(3) - 1000! P(l) - 0! P(2) - 0! IC% - 0 JC% - 0 HCPS! - 1000! TETA(O) - .5 TETA(l) - .5 L.ERRER - 0 LL.ERRER - 0 LAST.CPS! - 0 OUT &H307, &H80 'TURN PC LINK RESET ON OUT &H307, &H0 'TURN PC LINK RESET OFF OUT &H305, &HE0 'ENABLE SYSTEM,GET BUS,SELECT I/O START.TIME! - TIMER DO COUNTER% - COUNTER* + 1 CALL DATA.ACQUISITION CALL ALGORITHM CPS& - INT(CPS!) CPS$ - STR$(CPS&) LENGTH% - LEN(CPS$) CHAR%(1) - 83 'S CHAR%(2) - 80 'P FOR C0UNT% - 1 TO LENGTH% CHAR$ - MID$(CPS$, C0UNT%, 1) 109 Appendix A. PID Control Algorithm CHAR%(3 + LENGTH%) - 13 'CARRIAGE RETURN NUM.OF.CHAR% - 3 + LENGTH% CALL SENDBACK(CHAR%(), NUM.OF.CHAR%) LL.ERRER - L.ERRER L.ERRER - ERRER LAST.CPS! - CPS! FI(0) - TOTAL.FORCE! FI(1) - FEED! FIO - FI(0) FI1 - FI(1) LOOP UNTIL COUNTER% > 1499 FINISH.TIME! - TIMER CHAR%(1) - 83 'S CHAR%(2) - 84 'T CHAR%(3) - 13 '<CR> NUM.OF.CHAR% - 3 CALL SENDBACK(CHAR%(), NUM.OF.CHAR%) CLS PRINT "CNC MACHINE STOPPED" CALL VT100 PRINT (FINISH.TIME! - START.TIME!) / COUNTER* CALL INPUTINFO(GAIN%, FILE.NAME$) CALL SAVE.DATA(FILE.NAME$, COUNTER%) END SUB ALGORITHM SHARED CONTROL.CPS!(), TETA.ZERO!(), TETA.ONE!() SHARED TOTAL.FORCE!, FEED!, P(), F I ( ) , TETAQ SHARED COUNTER%, CPS!, LAST.CPS!, HCPS! SHARED ERRER, L.ERRER, LL.ERRER, IC%, JC% DIM S(2), K(2) FL - .995 Z% - 2 RPM% - 775 ST - .0387 KT - 60 / 20 * 25.4 / 1000 / RPM% / Z% VALU - 1000! REF - 1000! KV - .35 / ST IC% - IC% + 1 JC% - JC% + 1 ERRER - REF - TOTAL.FORCE! IF TOTAL.FORCE! > 150 THEN DEN - FI(0) * (FI(0) * P(0) + FI(1) * P ( l ) ) + FI(1) * (FI(0) * P(2) + FI(1) * P(3)) + FL S(0) - P(0) * FI(0) + P(l) * FI(1) S(l) - P(2) * FI(0) + P(3) * FI(1) K(0) - S(0) / DEN K(l) - S ( l ) / DEN ERRS - TOTAL.FORCE! - FI(0) * TETA(O) - FI(1) * TETA(1) P(0) - (P(0) - S(0) * S(0) / DEN) / FL P(2) - (P(2) - S ( l ) * S(0) / DEN) / FL P(D - P(2) P(3) - (P(3) - S ( l ) * S(l) / DEN) / FL TETA(O) - TETA(O) + K(0) * ERRS TETA(l) - TETA(l) + K(l) * ERRS IF ABS(ERRS) > REF / 20! AND JC% > 25 THEN JC% - 0 P(0) - VALU P(3) - VALU Appendix A. PID Control Algorithm 3 FL - .995 ELSE FL - 1 END IF r IF TETA(0) > 1 THEN TETA(O) - 1! END IF t IF TETA(1) < .001 THEN TETA(l) - .001 SUM - KV * ST / TETA(l) / KT / .9538 KD - SUM * TETA(O) * .0461992 KP - (TETA(O) + .0461992) * SUM - 2! * KD KI - SUM - KP - KD CPS! - LAST.CPS!.+ SUM * ERRER + (-KP - 2! * KD) * L.ERRER + KD * LL.ERRER ELSE CPS! - 4000 END IF t HCPS! - CPS! t 10 * CPS! - HCPS! IF CPS! < 10 THEN CPS! - 10 IF CPS! > 10000 THEN CPS! - 10000 CONTROL.CPS!(COUNTER*) - CPS! TETA.ZERO!(COUNTER%) - TETA(0) TETA.ONE!(COUNTER%) - TETA(l) END SUB Appendix B Pole-Placement Control Algorithm ' %%%%%% ADAPTIVE POLE PLACEMENT ALGORITHM VERSION 2 %%%%%% '%%%%%%%%%%%%%%%%%*%%%%*%%%%%%%%%%%%%%%%%%%%%%%%%%% DECLARE SUB SAVE.DATA (FILE.NAME$, COUNTER%) DECLARE SUB SETUP () DECLARE SUB ALGORITHM () DECLARE SUB DATA.ACQUISITION () DECLARE SUB SENDBACK (CHAR%(), NUM.OF.CHAR%) DECLARE SUB VT100 () DECLARE SUB INPUTINFO (GAIN%, FILE.NAME$) DIM FI(2), P(4), TETA(2) DIM CHAR%(50), FORCE.MAG!(1500), FEED.VEL!(1500) DIM CONTROL.CPS!(1500), TETA.ZERO!(1500), TETA.ONE!(1500) CLS CALL VT100 CLS COUNTER* - 0 IC% -- 0 JC% - 0 KC% - 0 CALL SETUP TOTAL.FORCE! - 0 L.FORCE - 0 FEED! - 0 FI(0) - TOTAL.FORCE! FI(1) - FEED! P(0) - 1000 P(3) - 1000 P(l) - 0 P(2) - 0 TETA(0) - .5 TETA(1) - .5 L.ERRER - 0 LL.ERRER - 0 LAST.CPS! - 0 LL.CPS! - 0 HCPS! - 1000! OUT &H307, &H80 'TURN PC LINK RESET ON OUT &H307, &H0 "TURN PC LINK RESET OFF OUT &H305, &HE0 'ENABLE SYSTEM,GET BUS,SELECT I/O START.TIME! - TIMER DO COUNTER* - COUNTER* + 1 CALL DATA.ACQUISITION CALL ALGORITHM CPS& - INT(CPS!) CPS$ - STR$(CPS&) LENGTH* - LEN(CPS$) 112 Appendix B. Pole-Placement Control Algorithm FOR COUNT% - 1 TO LENGTH* CHAR$ - MID$(CPS$, COUNT*, 1) CHAR*(2 + COUNT*) - ASC(CHAR$) NEXT COUNT* CHAR*(3 + LENGTH*) - 13 'CARRIAGE RETURN NUM.OF.CHAR* - 3 + LENGTH* CALL SENDBACK(CHAR%(), NUM.OF.CHAR*) LL.ERRER - L.ERRER L.ERRER - ERRER LL.CPS! - LAST.CPS! LAST.CPS! - CPS! L.FORCE! - TOTAL.FORCE! FI(0) - TOTAL.FORCE! FI(1) - FEED! LOOP UNTIL COUNTER* > 1499 FINISH.TIME! - TIMER CHAR%(1) - 83 'S CHAR%(2) - 84 'T CHAR%(3) - 13 '<CR> NUM.OF.CHAR* - 3 CALL S ENDBACK(CHAR*(), NUM.OF.CHAR*) CLS PRINT "CNC MACHINE STOPPED" CALL VT100 PRINT (FINISH.TIME! - START.TIME!) / COUNTER* CALL INPUTINFO(GAIN%, FILE.NAME$) CALL SAVE.DATA(FILE.NAME$, COUNTER*) END SUB ALGORITHM SHARED CONTROL.CPS!(), TETA.ZERO!(), TETA.ONE!() SHARED TOTAL.FORCE!, FEED!, P(), F I ( ) , TETAQ SHARED COUNTER*, CPS!, LAST.CPS!, LL.CPS!, HCPS!, IC* SHARED ERRER, L.ERRER, LL.ERRER, L.FORCE!, KC%, JC% DIM S(2) , K(2) FL - .995 Z% - 2 RPM* - 775 ST - .0387 KT - 60 / 20 * 25.4 / 1000 / RPM* / Z% VALU - 1000 IC* - IC* + 1 JC% - JC% + 1 IF TOTAL.FORCE! > 150 THEN KC% - KC% + 1 IF KC% < 25 THEN REF - 1000 * (1! - EXP(-COUNTER* / 5!)) REF - 1000! ELSE REF - 1000! END IF PI - -1.162 P2 - .4132 ERRER - REF - TOTAL.FORCE! DEN - FI(0) * (FI(0) * P(0) + FI(1) * P ( l ) ) + FI(1) * (FI(0) * P(2) + FI(1) * P(3)) + FL S(0) - P(0) * FI(0) + P ( l ) * FI(1) S(l) - P(2) * FI(0) + P(3) * FI(1) K(0) - S(0) / DEN K(l) - S(l) / DEN ERRS - TOTAL.FORCE! - FI(0) * TETA(O) 113 Appendix B. Pole-Placement Control Algorithm IC% - 0 GOTO 10 END IF IF ABS(ERRS) > REF / 20! AND JC% > 25 THEN P(0) - VALU P(3) - VALU P(2) - 0 P(D - 0 FL - .995 JC% - 0 ELSE FL - 1! END IF P(0) - (P(0) - S(0) * S(0) / DEN) / FL P(2) - (P(2) - S(l) * S(0) / DEN) / FL P(D - P(2) P(3) - (P(3) - S(l) * S(l) / DEN) / FL TETA(0) - TETA(O) + K(0) * ERRS TETA(l) - TETA(l) + K(l) * ERRS f IF TETA(1) < 0 THEN TETA(l) - .5 END IF f IF TETA(O) > 1 THEN TETA(O) - 1 END IF ELSE KI - TETA(1) * .9518086 * KT K2 - (1 + PI + P2) / KI RI - PI + TETA(O) + .0461992 SZ - (.0461992 * (RI - TETA(O)) + TETA(O) * RI + P2) / KI SI - (-.0461992 * TETA(0) * RI) / KI CPS! - -(.0020946 + RI) * LAST.CPS! .0020946 * RI * LL.CPS! + K2 * REF SZ * TOTAL.FORCE! - SI * L.FORCE! CPS! - 4000 END IF HCPS! - CPS! r 10 CPS! - HCPS! f IF CPS! < 10 THEN CPS! - 10 IF CPS! > 10000 THEN CPS! - 10000 f CONTROL.CPS!(COUNTER*) - CPS! TETA.ZERO!(COUNTER*) - TETA(O) TETA.ONE!(COUNTER*) - TETA(l) END SUB 114 Appendix C M R A C Algorithm ' %%%%%%% MRAC ALGORITHM %%%%%%% VERSION 4 (SHORT) ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DECLARE SUB SAVE.DATA (FILE.NAME$, COUNTER%) DECLARE SUB SETUP () DECLARE SUB ALGORITHM () DECLARE SUB DATA.ACQUISITION () DECLARE SUB SENDBACK (CHAR%(), NUM.OF.CHAR%) DECLARE SUB VT100 () DECLARE SUB INPUTINFO (GAIN%, FILE.NAME$) DECLARE SUB DOT (XX(), YY(), SS!, NN%) DIM P(5), PP(5), FI(5), FI1(5), FI2(5) DIM F(5), PZ(4), FIZ(4), H(5), T(5), G(5), GG(5) DIM CHAR%(50), FORCE.MAG!(1500), FEED.VEL!(1500) DIM CONTROL.CPS!(1500), TETA.ZERO!(1500), TETA.ONE!(1500) CLS CALL VT100 CLS COUNTER% - 0 IC% - 0 CALL SETUP 0 N% - 5 M% - N% - 1 D% - 2 VALU - 10! TOTAL.FORCE! - 0! LAST.FORCE! - 0! LL.FORCE! - 0! LAST.CPS! - 0! LL.CPS! - 0! FOR I - 1 TO N% P(D - -5 PP(I) - 0! FI(I) - 0! FI1(I) - 0! FI2(I) - 0! F(I) - VALU NEXT I OUT &H307, &H80 OUT &H307, &H0 OUT &H305, &HE0 START.TIME! - TIMER DO COUNTER% - COUNTER% + 1 CALL DATA.ACQUISITION 'TURN PC LINK RESET ON 'TURN PC LINK RESET OFF •ENABLE SYSTEM,GET BUS,SELECT I/O 115 Appendix C. MRAC Algorithm CPS$ - STR$(CPS&) LENGTH* - LEN(CPS$) CHAR%(1) - 83 CHAR%(2) - 80' CHAR%(3) - 4 4 'S 'P t FOR COUNT* - 1 TO LENGTH* CHAR$ - MID$(CPS$, COUNT*, 1) CHAR*(3 + COUNT*) - ASC(CHAR$) NEXT COUNT* CHAR*(4 + LENGTH*) - 13 'CARRIAGE RETURN NUM.OF.CHAR* - 4 + LENGTH* CALL SENDBACK(CHAR%(), NUM.OF.CHAR*) FOR I - 1 TO Ni PP(I) - P(I) FI2(I) - FI1(I) NEXT I FI(1) - CPS! FI(2) - LAST.CPS! FI(3) - LL.CPS! FI(4) - TOTAL.FORCE! FI(5) - LAST.FORCE! FI2(1) - LL.CPS! FI2(2) - LLL.CPS! FI2(3) - LLLL.CPS! FI2(4) - LL.FORCE! FI2(5) - LLL.FORCE! t LLL.FORCE! - LL.FORCE! LL.FORCE! - LAST.FORCE! LAST.FORCE! - TOTAL.FORCE! LLLL.CPS! - LLL.CPS! LLL.CPS! - LL.CPS! LL.CPS! --LAST.CPS! LAST.CPS! - CPS! YM - YM1 YM1 - YM2 ERK! - ERRER! UM1! - UM! LOOP UNTIL COUNTER* > 1499 FINISH.TIME! - TIMER CHAR%(1) - 83 'S CHAR%(2) - 84 'T CHAR%(3) - 13 '<CR> NUM.OF.CHAR* - 3 CALL SENDBACK(CHAR%(), NUM.OF.CHAR*) CLS PRINT "CNC MACHINE STOPPED" CALL VT100 PRINT (FINISH.TIME! - START.TIME!) / COUNTER* CALL INPUTINFO(GAIN%, FILE.NAME$) CALL SAVE.DATA(FILE.NAME$, COUNTER*) END SUB ALGORITHM SHARED CONTROL.CPS!(), TETA.ZERO!(). TETA.ONE!() SHARED TOTAL.FORCE!, LAST.FORCE!, LL.FORCE!, LLL.FORCE! SHARED COUNTER*, CPS!, LAST.CPS!, LL.CPS!, LLL.CPS!, LLLL.CPS! SHARED P(), PP(), F I ( ) , FI1(), FI2(), UM, UM1, ERRER!, ERK! Appendix C. MRAC Algorithm 117 ST - .0387 VALU! - 10! REF - 1000! C21 - .3 C22 - .001 LAM1 - .95 LAM2 - .95 t C l l - -.4 C12 - .04 Dl - .3 D2 - .00062838* t 'IC% - IC% + 1 i IF TOTAL.FORCE! > 150 THEN ERRER! - REF - TOTAL.FORCE! '########## Only For MRAC with Integral action ########## ' UM - UM1 + (.19) * (ERRER! + ERK!) ' // ii it it it ii n it ii it it n ii it ti u it ii ti a it it it it it ii ii ii ti ii n ii n ii ii ii ii it it a ii ti ii it ii it ii ii ii ii II n it ii it t UM - REF SI! - 0! FOR I - 1 TO N i SI! - SI! + PP(I) * FI2(I) NEXT I E - TOTAL.FORCE! + C21 * LAST.FORCE( + C22 * LL.FORCE! - SI! r FOR I — 1 TO N% G(I) - FI2(1) * F(I) NEXT I 9 S2! - 0! FOR I - 1 TO N% S2! - S2! + G(I) * FI2(I) NEXT I FOR I - 1 TO N% P(I) - PP(I) + G(I) / (1 + S2!) * E NEXT I # FOR I - 2 TO Nft PZ(I - 1) - P(I) NEXT I FIZ(l) FIZ(2) FIZ(3) FIZ(4) t - CPS! - LAST.CPS! - TOTAL.FORCE! - LAST.FORCE! YM2 - - C l l * YM1 - C12 * YM + (Dl * UM + D2 * UM1) / (Dl + D2) * (1 + C l l + C12) S3 - YM2 + C21 * YM1 + C22 * YM » S4! - 0! FOR I - 1 TO M S S4! - S4! + FIZ(I) * PZ(I) NEXT I r IF P ( l ) - 0 THEN P(l) - .01 CPS! - -<S4 - S3) / P ( l ) Appendix C. MRAC Algorithm FOR I - 1 TO N% F(I) - (F(I) - G(I) * G(I) / S6) / LAM1 NEXT I ELSE CPS! - 4000 END IF t IF CPS! < 10 THEN CPS! - 10 IF CPS! > 12000 THEN CPS! - 12000 t CONTROL.CPS!(COUNTER%) - CPS! TETA.ZERO!(COUNTER%) - P(l) TETA.ONE!(COUNTER%) - P(2) END SUB 118 Appendix D Data Acquisition Software ' %%%%%%% DATA ACQUISITION BOARD SOFTWARES %%%%%%%%% ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SUB DATA.ACQUISITION DIM VOLTAGE!(3) SHARED TOTAL.FORCE!, FIO, FI1, FEED!, COUNTER% SHARED FORCE.MAG!(), FEED.VEL!() LOOP This subprogram acquires feedrate and force feedback from the CNC machine Data i s sent v i a DMA to memory to be accessed by the program when required. Define a l l the constants used i n the subprogram DEFINT A-Z ' Define a l l variables to be integers RPM% - 775 Z% - 2 TOO.MUCH - 100 ' Number of times the loop w i l l be executed BASE.ADDRESS - &H2EC ' Base address of DT2801-A COMMAND.REGISTER - BASE.ADDRESS + 1 ' Address of DT2801-A command register STATUS.REGISTER - BASE.ADDRESS + 1 ' Address of DT2801-A status register DATA.REGISTER - BASE.ADDRESS ' Address of DT2801-A data register COMMAND.WAIT - &H4 Wait for command i n ready mask WRITE.WAIT - &H2 Wait for write data i n mask READ.WAIT - &H5 Wait for read data out mask CSTOP - &HF Stop DT2801-A board command CCLEAR - &H1 Clear DT2801-A board command CERROR - &H2 Get error from DT2801-A board command CCLOCK - &H3 Set DT2801-A board clock command CCONTINUOUS - 32 Continuous conversions command CSAD - &HD Set A/D parameters command CRAD - &HE Read A/D command EXT.CLOCK - &H40 Use external clock command EXT.TRIGGER - &H80 Use external trigger command CDMA - &H10 Start D/A conversions command DUMMY - 5 Dummy value Base frequency of the clock on the DT2801-A BASE.FREQUENCY* - 800000! This value indicates a quick scan. See manual. PERIOD* - 40 GAIN - 1 SEGMENT& - 32768 Define DMA constants f o r DMA channel 1. 119 Appendix D. Data Acquisition Software '' The memory to be used f o r DMA starts at memory address &HF000 '' on memory page 8. DMACHANNEL - 1 DMAMODE - &H45 BASEREG - 2 COUNTREG - 3 PAGEREG - &H83 DMABASEL - 0 DMABASEH - 0 DMAPAGE - 8 The channel to use for DMA Use DMA from a peripheral to memory Port address to send base info Port address to send count info Port address to send page info Low byte of base address High byte of base address Page to send data to SETUP DT2801-A BOARD FOR READ ON TRIGGER 5103 5106 5107 5109 5110 5113 5116 5119 5120 5123 5126 5129 5130 5133 5136 5200 5210 5220 5230 5240 5250 5300 6000 6010 6015 6110 6120 6300 6310 6320 Set-up DMA chip to transfer the required number of bytes. (1 sample x 2 channels x 2 bytes/sample ) - 1 byte DMACOUNT - ((1 * 2) * 2) - 1 DMACOUNTH - INT(DMACOUNT / 256) DMACOUNTL - DMACOUNT - DMACOUNTH * 256 OUT OUT OUT OUT OUT OUT OUT OUT 11, DMAMODE 12, 0 BASEREG, DMABASEL BASEREG, DMABASEH COUNTREG, DMACOUNTL COUNTREG, DMACOUNTH PAGEREG, DMAPAGE 10, DMACHANNEL set DMA mode clear byte f l i p - f l o p set DMA memory base address set DMA byte count set DMA memory page enable DMA channel mask Check f o r ERROR from board before continuing, (not essential) WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT WAIT STATUS.REGISTER, COMMAND.WAIT STATUS - INP(STATUS.REGISTER) IF (STATUS AND &H80) THEN PRINT "D.A.1-ERROR" Write READ A/D WITH DMA command. WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT WAIT STATUS.REGISTER, COMMAND.WAIT OUT COMMAND.REGISTER, CRAD + CDMA + EXT.TRIGGER Check f o r ERROR from board after conversions completed. The program w i l l pause here u n t i l the trigger has occured and the data has a l l been transferred. Ie: the board i s not interested i n getting another command from you u n t i l i t has finished the e a r l i e r one. WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT 6330 WAIT STATUS.REGISTER, COMMAND.WAIT 6340 STATUS - INP(STATUS.REGISTER) 6350 IF (STATUS AND &H80) THEN PRINT "D.A.2-ERROR" 6400 " DEF SEG - SEGMENTS FOR I - 1 TO 2 Appendix D. Data Acqmsition Software 121 DATA.VALUE - DATA.VALUE + PEEK(ADDRESS + 1) * 256 VOLTAGE!(I) - (DATA.VALUE - 2048) * (10 / GAIN) / 2048 NEXT I TOTAL.FORCE! - SQR(-VOLTAGE!(1) * 10 / 2) * 500 '500 N/mv FEED! - VOLTAGE!(2) * 531.32 / (RPM% * Z%) '[mm/rev*tooth] DEF SEG FORCE.MAG!(COUNTER%) - TOTAL.FORCE! FEED.VEL!(COUNTER%) - FEED! END SUB DEFSNG A-Z SUB INPUTINFO (GAIN%, FILE.NAME$) t ' Input the gain t DO LOCATE 5, 5 ' Locate cursor at input INPUT "Gain : ", RESPONSE$ ' Read i n the input value GAIN% - VAL(RESPONSE$) ' Convert input IF GAIN% - 1 OR GAIN% - 2 OR GAIN% - 4 OR GAIN% - 8 THEN EXIT DO LOCATE 5, 5 ' Locate cursor at input PRINT STRING$(60, 32) * Erase input LOCATE 23, 5 ' Locate cursor i n message window COLOR 0, 7 PRINT "Gain can only be 1,2,4 or 8" ' Print error message COLOR 7, 0 LOOP LOCATE 23, 5 ' Locate cursor i n message window PRINT STRING$(60, 32) ' Erase any message ' Input the f i l e name DO LOCATE 9,5 ' Locate cursor at input INPUT " F i l e Name : ", RESP0NSE$ ' Read i n input data HEAD$ - RESP0NSE$ ' Convert input data IF LEN(HEAD$) < 6 AND LEN(HEAD$) > 0 THEN EXIT DO ' I f within range then exit LOCATE 23, 5 ' Locate cursor i n message window' COLOR 0, 7 PRINT " F i l e name has to be from 1 to 5 characters long" COLOR 7, 0 LOCATE 9, 5 ' Locate cursor at input PRINT STRING$(60, 32) ' Erase input LOOP LOCATE 23, 5 PRINT STRING$(60, 32) ' Locate cursor i n message window ' Erase any message r ' Input the f i l e number DO LOCATE 11, 5 ' Locate cursor at input INPUT " F i l e Number : ", RESPONSE$ ' Read i n value NUMBER% - VAL(RESPONSE$) ' Convert value IF NUMBER% > 0 AND NUMBER% < 100 THEN EXIT DO ' I f value within range then exit LOCATE 23, 5 ' Locate cursor i n message window COLOR 0, 7 PRINT "Number has to be between 1 and 99" ' Print error message COLOR 7, 0 LOCATE 11, 5 ' Locate cursor at input PRINT STRING$(60, 32) ' Erase input Appendix D. Data Acquisition Software IF NUMBER% < 10 THEN NUMBER$ - RIGHT$(SEMI$, 1) ELSE NUMBER$ - RIGHT$(SEMI$, 2) LOCATE 23, 5 ' Locate cursor In message vindow PRINT STRING$(60, 32) ' Erase message ' Input the destination drive LOCATE 13, 5 ' Locate cursor at input INPUT "Destination Drive and Directory : ", RESP0NSE$ ' Read input DRIVE$ - RESP0NSE$ ' Convert input FILE.NAME$ - DRIVE$ + HEAD$ + NUMBER$ END SUB SUB SAVE.DATA (FILE.NAME$, C0UNTER%) SHARED FORCE.MAG!(), FEED.VEL!(), CONTROL.CPS!() SHARED TETA.ZERO!(), TETA.ONE!() FILE1$ - FILE.NAME$ + "A.DAT" FILE2$ - FILE.NAME$ + "B.DAT" OPEN FILE2$ FOR OUTPUT AS #1 FOR 1% — 1 TO COUNTERS WRITE #1, FORCE.MAG!(1%), FEED.VEL!(1%), CONTROL.CPS!(1%), TETA.ZERO!(1%), TETA.ONE!(1%) NEXT 1% CLOSE #1 END SUB SUB SENDBACK (CHARS(), NUM.OF.CHAR%) COUNTS - 1 DO UNTIL COUNTS > NUM.OF.CHARS ' WAIT UNTIL BUFFER CLEARED DO OUT &H302, &H3 STATUS.BYTES - INP(&H301) BIT3S - INT(STATUS.BYTES / 8) 'ERROR-1 BIT2S - INT((STATUS.BYTES - BIT3S * 8) / A) 'FULL-O BIT1S - INT((STATUS.BYTES - BIT3S * 8 - BIT2S * A) / 2)'WRITE-0 LOOP UNTIL BIT2S O 0 IF BIT3S - 1 THEN PRINT "S.B.-ERROR" IF BIT1S O 0 THEN OUT &H302, &H2 OUT &H301, CHARS(COUNTS) 'CHAR$ - CHR$(CHARS(COUNTS)) 'PRINT CHAR$; COUNTS - COUNTS + 1 ELSE DO OUT &H302, &H3 STATUS.BYTES - INP(&H301) FINISHS - INT(STATUS.BYTES / 2 INT(STATUS.BYTES / 2) + .5) IF FINISHS - 1 THEN EXIT DO OUT &H302, &H2 CHAR.BACKS - INP(&H301) LOOP END IF LOOP END SUB 122 Appendix D. Data Acquisition Software Define a l l the constants used i n the subprogram DEFINT A-Z ' Define a l l variables to be integers TOO.MUCH - 100 ' Number of times the loop w i l l be executed BASE.ADDRESS - &H2EC ' Base address of DT2801-A COMMAND.REGISTER - BASE.ADDRESS + 1 ' Address, of DT2801-A command register STATUS.REGISTER - BASE.ADDRESS + 1 ' Address of DT2801-A status register DATA.REGISTER - BASE.ADDRESS ' Address of DT2801-A data register COMMAND.WAIT - &H4 Wait for command i n ready mask WRITE.WAIT - &H2 Wait for write data i n mask READ.WAIT - &H5 Wait for read data out mask CSTOP - &HF Stop DT2801-A board command CCLEAR - &H1 Clear DT2801-A board command CERROR - &H2 Get error from DT2801-A board command CCLOCK - &H3 Set DT2801-A board clock command CCONTINUOUS - 32 Continuous conversions command CSAD - &HD Set A/D parameters command CRAD - &HE Read A/D command EXT.CLOCK - &H40 Use external clock command EXT.TRIGGER - &H80 Use external trigger command CDMA - &H10 Start D/A conversions command DUMMY - 5 Dummy value BASE.FREQUENCY* - 800000! Base frequency of the clock on the DT2801-A PERIOD* - 40 This value indicates a quick scan. See manual. Define DMA constants for DMA channel 1. The DMAMODE value i s set to program DMA channel 1 for single byte transfer memory write. The memory to be used f o r DMA starts at memory address &HF000 on memory page 8. The channel to use for DMA Use DMA from a peripheral to memory Port address to send base info Port address to send count info Port address to send page info Low byte of base address High byte of base address Page to send data to DMACHANNEL - 1 DMAMODE - &H45 BASEREG - 2 COUNTREG - 3 PAGEREG - &H83 DMABASEL - 0 DMABASEH - 0 DMAPAGE - 8 ' Check f o r legal Status Register. I f not then error! ( i e : no board) SET UP THE BOARD ' This routine sets up the basic parameters of the DT2801-A board ' p r i o r to actually doing any A/D conversions. ' CALL RESET.DT(I%) PRINT "reset completed" t STATUS - INP(STATUS.REGISTER) IF NOT ((STATUS AND &H70) - 0) THEN PRINT "S.E.2-ERROR": END t* ti " Stop and clear the DT2801. Appendix D. Data Acquisition Software WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT WAIT STATUS.REGISTER, COMMAND.WAIT OUT COMMAND.REGISTER, CCLEAR PRINT "stopped and cleared" " Set internal clock rate. '' Write SET CLOCK PERIOD command. 0 t WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT WAIT STATUS.REGISTER, COMMAND.WAIT OUT COMMAND.REGISTER, CCLOCK PRINT "clock period set" " Write high and low bytes of PERIOD#. PERIODH - INT(PERIOD# / 256) PERIODL - PERIOD* - PERIODH * 256 WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, PERIODL WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, PERIODH IF NOT ((STATUS AND &H70) - 0) THEN PRINT "S.E.2-ERROR": END PRINT "period* written" t0 Set the gain code for a gain of 1. 9 9 # 0 GAIN.CODE - 0 " \ " Set A/D channels. * t START.CHANNEL - 0 END.CHANNEL - 1 '' Set up the A/D converter. " Write SET A/D PARAMETERS command. 0 ( WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT WAIT STATUS.REGISTER, COMMAND.WAIT OUT COMMAND.REGISTER, CSAD Write A/D gain byte. WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, GAIN.CODE PRINT "gain code written" 0 0 9 9 r Write A/D s t a r t channel byte. 0 WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, START.CHANNEL 0 » 9 9 Write A/D end channel byte. 1 0 WAIT STATUS.REGISTER, WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, END.CHANNEL PRINT "channels written" '' Write two bytes, dummy number of conversions. WAIT STATUS.REGISTER. WRITE.WAIT, WRITE.WAIT OUT DATA.REGISTER, DUMMY 124 Appendix D. Data Acquisition Software PRINT "end of SETUP" END SUB DEFSNG A-Z SUB VT100 OUT &H307, OUT &H307, OUT &H305, LOCATE , PRINT ":"; DO DO &H80 &H0 &HE0 ,1 'TURN PC LINK RESET ON "TURN PC LINK RESET OFF 'ENABLE SYSTEM,GET BUS,SELECT I/O "TURN CURSOR ON CHAR$ - INKEY$ LOOP UNTIL CHAR$ O "" CHAR% - ASC(CHAR$) ' WAIT UNTIL BUFFER CLEARED DO OUT &H302, &H3 STATUS.BYTE% - INP(&H301) BIT3% - INT(STATUS.BYTE% / 8) BIT2% - INT((STATUS.BYTES - BIT3% 8) / 4) BIT1% - INT((STATUS.BYTES - BIT3S 8 • BIT2S A) / 2) LOOP UNTIL BIT2S O 0 IF BIT3S - 1 THEN PRINT "ERROR" IF BIT1S O 0 THEN OUT &H302, &H2 OUT &H301, CHARS IF CHARS - 8 THEN LOCATE , POS(O) - 1, 0 PRINT " "; LOCATE , POS(O) - 1, 0 ELSE PRINT CHAR$; END IF ELSE DO OUT &H302, &H3 STATUS.BYTES - INP(&H301) FINIS - INT(STATUS.BYTES / 2 •INT(STATUS.BYTES / 2) + .5) IF FINIS - 1 THEN EXIT DO OUT &H302, &H2 CHAR.BACKS - INP(&H301) CHAR.BACK$ - CHR$(CHAR.BACKS) PRINT CHAR.BACK$; LOOP END IF IF CHARS - 13 THEN DO OUT &H302, &H3 STATUS.BYTES - INP(&H301) NOWS - INT(STATUS.BYTES / 2 -INT(STATUS.BYTES / 2) + .5) LOOP WHILE NOWS DO OUT &H302, &H2 CHAR.BACKS - INP(&H301) CHAR.BACK$ - CHR$(CHAR.BACKS) PRINT CHAR.BACK$; OUT &H302, &H3 STATUS.BYTES - INP(&H301) FINISHS - INT(STATUS.BYTES / 2 - INT(STATUS.BYTES / 2) + .5) LOOP WHILE FINISHS - 0 CLS END SUB 125
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Adaptive control of the milling process
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
Adaptive control of the milling process Ordubadi, Fariborz Talebzade 1989
pdf
Page Metadata
Item Metadata
Title | Adaptive control of the milling process |
Creator |
Ordubadi, Fariborz Talebzade |
Publisher | University of British Columbia |
Date Issued | 1989 |
Description | Cutting forces in the milling process vary depending on the work-piece geometry and cutting parameters. When the cutting forces exceed a certain limit, the tool may break and cause damage to the work-piece and eventually to the machine tool. Adaptive cutting force control systems can be used to manipulate cutting operation parameters in order to keep the cutting forces at a safe level. Successful application of the method leads to increased metal removal rate and productivity in machining processes. In this thesis, a second order transfer function is used to represent the time invariant dynamics of a research milling machine's feed drive servo system. The command feed velocity is the input and the actual feed is the output of the servo system. The actual feed manipulates the cutting forces which are modelled by a first order time varying dynamic system. Three existing adaptive control methods have been designed to control the milling process. Adaptive Proportional Integral Derivative (PID), Pole-Placement and Model Reference Adaptive Control (MRAC) algorithms have been simulated and experimentally verified. It has been shown that when the dynamics of both the time invariant servo and the time variant cutting process are modelled correctly, the adaptive control algorithms can perform well. Simulations and experiments, which have been carried out with identical cutting conditions, show that PID and Pole-Placement controllers can be successfully applied to milling force control. |
Genre |
Thesis/Dissertation |
Type |
Text |
Language | eng |
Date Available | 2010-08-30 |
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.0080835 |
URI | http://hdl.handle.net/2429/27945 |
Degree |
Master of Applied Science - MASc |
Program |
Mechanical Engineering |
Affiliation |
Applied Science, Faculty of Mechanical Engineering, Department of |
Degree Grantor | University of British Columbia |
Campus |
UBCV |
Scholarly Level | Graduate |
Aggregated Source Repository | DSpace |
Download
- Media
- 831-UBC_1989_A7 O72.pdf [ 4.75MB ]
- Metadata
- JSON: 831-1.0080835.json
- JSON-LD: 831-1.0080835-ld.json
- RDF/XML (Pretty): 831-1.0080835-rdf.xml
- RDF/JSON: 831-1.0080835-rdf.json
- Turtle: 831-1.0080835-turtle.txt
- N-Triples: 831-1.0080835-rdf-ntriples.txt
- Original Record: 831-1.0080835-source.json
- Full Text
- 831-1.0080835-fulltext.txt
- Citation
- 831-1.0080835.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-0080835/manifest