Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Integration of manufacturing process control and optimization with a general purpose multi-processor… Ardekani, Ramin 1992

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata


831-ubc_1992_fall_ardekani_ramin.pdf [ 3.16MB ]
JSON: 831-1.0080852.json
JSON-LD: 831-1.0080852-ld.json
RDF/XML (Pretty): 831-1.0080852-rdf.xml
RDF/JSON: 831-1.0080852-rdf.json
Turtle: 831-1.0080852-turtle.txt
N-Triples: 831-1.0080852-rdf-ntriples.txt
Original Record: 831-1.0080852-source.json
Full Text

Full Text

INTEGRATION OF MANUFACTURING PROCESS CONTROL AND OPTIMIZATION WITH A GENERAL PURPOSE MULTI-PROCESSOR CONTROLLER By Ramin Ardekani B.A.Sc. (Mechanical Engineering) University of British Columbia  A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE  in THE FACULTY OF GRADUATE STUDIES MECHANICAL ENGINEERING We accept this thesis as conforming to the required standard  THE UNIVERSITY OF BRITISH COLUMBIA October 1992  © Ramin Ardekani, 1992  In  presenting  degree freely  at  this  the  available  copying  of  department publication  of  in  partial  fulfilment  of  University  of  British  Columbia,  I agree  for  this or  thesis  reference  thesis by  this  for  his thesis  and study. scholarly  or for  her  I further  purposes  gain  (Signature)  Department of  Mechanical Engineering  The University of British Vancouver, Canada  Date  DE-6 (2/88)  Columbia  October 15,1992  It  shall not  permission.  requirements that  agree  may  representatives.  financial  the  be is  that  the  permission  granted  allowed  an  advanced  Library shall  by  understood be  for  for  the that  without  make  it  extensive  head  of  my  copying  or  my  written  Abstract The objective of this thesis is to demonstrate the importance of control software and hardware design in economic optimization of a production process. It is proposed that the improvement in production economics depends on the system's ability to meet the needs of a process model formulated from a sound understanding of the process. To illustrate these concepts, an NC lathe machining language is created to exploit the UBC Controller's ability for reducing production cost, ensuring part quality and improving machining safety, all based on the guidelines from a practical process model. The language uses a feature based approach to part geometry definition which simplifies data entry and operation planning. The tool path is automatically generated for volume primitives and sent to the controller with process control information. Unlike other systems, which are restricted by the traditional NC code block format in communicating process information to the controller, the process data can be made to correspond with small motion increments and help the controller cope with the expected variations in cutting conditions due to the cut geometry. Experiments with a force monitoring scheme demonstrate how a simple algorithm can keep the force within the prescribed limits for machining safety and product quality. Implementation of a rudimentary process identification and optimization scheme shows the system's ability to reduce machining cost while observing the practical constraints. This low cost system is intended to allow smaller firms to benefit from the current level of process knowledge and production technology.  ii  Table of Contents Abstract  ii  Table of Contents  iii  List of Figures  vi  List of Tables  ix  Acknowledgments  x  INTRODUCTION  1  Chapter 2  The Mechanics and Economics of Turning  4  2.1  Introduction  4  2.2  Mechanics of Orthogonal Cutting  5  2.3  Mechanics of Turning  8  2.4  The Economics of Turning  11  2.4.1 Tool Life  13  2.4.2  14  2.5 Chapter 3  Optimization of the Process Parameters  Discussion and Conclusions  16  Machining Language  17  3.1  Introduction  17  3.2  Description of the UBC Lathe Language  18  3.3  Operation Planning  22  3.3.1  Tool Path Generation  24  3.3.2  Machining Technology  27  3.4  Software Design Considerations  iii  28  3.5 Chapter 4  Chapter 5  Discussion and Conclusions  33  Process Monitoring and Control  35  4.1  Introduction  35  4.2  Process Monitoring  35  4.2.1 Monitored Parameters  37  4.2.2 Choice of Sensor  38  4.2.3 The Significance of the Controller Design  49  4.2.4  Standard Controller Functions  50  4.2.5 Features of the UBC Controller Design  51  4.3  Laboratory Setup  56  4.4  Control Algorithm  58  4.5  Experimental Results  64  4.6  Discussion and Conclusion  70  Process Optimization  72  5.1  Introduction  72  5.2  Process Control and Optimization  72  5.2.1  Adaptive Control  73  5.2.2  Optimization Scheme  74  5.2.3  Control Algorithm  79  5.3  Experimental Results  81  5.4  Discussion and Future Work  85  Bibliography  87  Appendix A  Tool post and mounting plate design documentation  94  Appendix B  C routines for force simulation and process control  97  Appendix C  The machining language FORTH code  iv  114  List of Figures 2.1  The orthogonal cutting process  5  2.2  Merchant's cutting force relationship  6  2.3  The main and edge cutting forces  8  2.4  Bar turning tool geometry  9  2.5  Tool workpiece interface geometry in turning  9  3.1  The defined workpiece geometry  21  3.2  Common tool path strokes in turning  25  3.3  Generated tool path for a shoulder  25  3.4  Tool nose radius compensation  26  3.5  Tool path for roughing and finishing operations  27  4.1  Current sensor block diagram  40  4.2  Setup for motor current static calibration  41  4.3  Motor current variation with load  41  4.4  Motor current variation with load (filtered)  42  4.5  Motor current signal for incremental motions along the z-axis  43  4.6  Tool Post Assembly  45  4.7  Dynamometer x-axis static calibration  46  4.8  Dynamometer y-axis static calibration  46  4.9  Dynamometer z-axis static calibration  47  4.10  Dynamometer x-axis frequency characteristic (with tool post)  48  4.11  Dynamometer y-axis frequency characteristic (with tool post)  48  v  4.12  Dynamometer z-axis frequency characteristic (with tool post)  49  4.13  Point to point move  52  4.14  First stage incremental position commands  54  4.15  Second stage incremental position commands  54  4.16  Schematic of the control system architecture  55  4.17  Laboratory setup  56  4.18  Z-axis position loop block diagram  58  4.19  Velocity loop model  59  4.20  Effect of transients on the chip thickness  61  4.21  Tool path for simulated step change in depth  62  4.22  Cutting force simulation without force constraint  63  4.23  Force constrained cutting force simulation without derivative control  63  4.24  Force constrained cutting force simulation with derivative control  64  4.25  Tool path for feed experiment  65  4.26  Single pass at three feed rates without force constraint  66  4.27  Single pass at three feed rates with force constraint  67  4.28  Step change in depth experiment without constraints  69  4.29  Step change in depth experiment with constraints  69  4.30  Cutting force algorithm performance (after Chen and Chang [64])  71  5.1  Force ratio versus equivalent chip thickness relation (after Lai [18])  77  5.2  Force ratio versus the inverse of equivalent chip thickness  78  5.3  Tool-workpiece interface geometry during a taper cut  82  5.4  70 taper with no active constraints  83  5.5  70 taper with constraints  84  5.6  Overview of the thesis work  86  vi  A.1  Tool post  95  A.2  Mounting Plate  96  vii  List of Tables 3.1  Vocabulary for part geometry definition  20  3.2  The feature data structure  22  3.3  Lathe operation commands  33  3.4  Technological board vocabulary  33  4.1  Constants for the Z-axis position control loop  60  4.2  Constants for calculation of cutting pressures  60  viii  Acknowledgments The author wishes to express his sincere gratitude to Dr. Ian Yellowley whose knowledge and experience proved invaluable throughout the course of the research and whose encouragement proved a source of inspiration that made the work most enjoyable. The author would like to recognize and thank Mr. Philip Pottier for his extensive help with the laboratory equipment. The assistance and the friendship of the author's colleagues are also appreciated. Finally, the author would like to thank his parents for their unyielding support, and wishes to dedicate this work to the memory of his father.  ix  INTRODUCTION The advent of computers has had a significant impact on all phases of the production process, yet few affordable systems are available which allow the smaller firms to fully benefit from this technology. Typically, production processes consist of design, planning and manufacturing phases. Today, sophisticated Computer Aided Design (CAD) packages have revolutionized product design methods and have found their way into companies of all size. Computer Numerical Control (CNC) and Computer Aided Manufacturing (CAM) systems have similarly transformed the manufacturing function. However, high cost has hindered the diffusion of this technology into smaller firms. Computer Aided Process Planning systems have tried to bridge the gap between CAD and CAM, but only larger firms which can afford to invest in a Computer Integrated Manufacturing (CIM) environment have benefited from this development. This thesis describes a methodology for the development of a simple to use, affordable system which would allow the smaller companies to reap the economic benefits of the current state of process knowledge and computer technology. The increase in sophistication and price of production machines has created the need to extract the full economic advantage afforded by their improved capabilities. The flexibility offered by the computer control of manufacturing equipment, the computational capability of the computers, the state of sensor technology and the current understanding of the physics of common processes are some of the tools available for improvement of productivity and product quality. Effective use of these tools requires the removal of existing bottlenecks between design, planning and manufacturing, use of a design for manufacturing approach, improvements in operation planning and realization of real-time process control and  l  Chapter 1.  Introduction  2  optimization schemes. The challenge is to use the current state of technology and process knowledge and implement the above concepts in a commercially viable system. The turning process is very appropriate for demonstration of the ideas presented in this thesis. Turning is one of the simpler and better understood processes. There are proven process models for turning and the economics of it are well known. The knowledge of the turning process is used to implement a practical system for improving the process economics. Chapter 2 covers the pertinent metal cutting theory for turning. The normal Numerical Control (NC) language does not have the necessary provisions for communication of process control data, a new language has been formulated in this work to help generate process information and pass it to the controller. High level languages that do generate process data for operation planing are post-processed into the usual NC code and much useful process information is lost. The UBC Lathe Language sends process and motion data to the controller without generation of NC code. It also considers economic improvements at the operation planning level and facilitates data entry for part geometry definition. Chapter 3 presents the philosophy and a simple implementation of this machining language. Process control tasks require extension of the usual control functions and additional computational capability. These features are typically not built into commercial controllers and hardware modification is usually not easy. The inflexibility of commercial machine controllers lead to the use of an in-house controller. The UBC Controller's architecture is designed to accommodate additional process control boards and to perform process control tasks effectively. Chapter 4 shows the implementation of a force monitoring scheme with the UBC Controller. Force control is used to ensure process safety and product quality. Chapter 5 demonstrates how the machining language and the controller may be used to perform process control and optimization. This thesis covers a broad range of topics in manufacturing. Complete implementation of the proposed system still requires much work. However, the objective is to demonstrate  Chapter 1.  Introduction  3  the feasibility of an affordable system which would allow the smaller manufacturing firms to benefit from the result of manufacturing process research and advances in production technology. This would economically justify the investment of firms in newer technology and promote further research and development.  Chapter 2 The Mechanics and Economics of Turning 2.1  Introduction The economic incentive for optimization of metal cutting operations has motivated  research toward a better understanding of the mechanics of this complex process. As a result, numerous models for analysis of the cutting operation have emerged [1, 2, 3]. Turning, as one of the simpler processes, has received much attention. Even though the mechanics of turning is now fairly well understood, many process optimization techniques still do not take advantage of the current state of knowledge. Selection of the machining conditions based on an understanding of metal cutting mechanics leads to notable economic gains. Although the actual cutting time is typically less than 15 percent of the total cycle time [4], cost reduction through scientific selection of the cutting conditions and efficient process planning comes at little or no additional cost to the company. This prospect gains even more significance as the increase in sophistication of machine tools raises their price and incurs a greater overhead. A better understanding of the process also helps avoid scraping of parts due to chatter, tool breakage, poor surface finish or dimensional inaccuracy. The models currently available for common production processes such as turning are complete enough to help achieve many of the above objectives in industry.  4  Chapter 2.  The Mechanics and Economics of Turning  In this chapter a turning process force model is introduced which is based on the analysis of the simpler orthogonal cutting process. Then, the economics of turning are discussed and an optimization strategy is presented.  2.2  Mechanics of Orthogonal Cutting Orthogonal cutting, the simplest and most widely researched metal cutting process, is  commonly used to gain a better understanding of the cutting mechanics and help develop force models. These models are then extended to predict forces in practical processes like turning. The term orthogonal cutting, coined by Merchant [5] applies to a "case where the cutting tool generates a plane surface parallel to an original plane surface of the material being cut and is set with its cutting edge perpendicular to the direction of relative motion of tool and workpiece. This is to distinguish it from the more general cases where the cutting edge is oblique to the direction of relative motion, termed oblique cutting, or where the surface generated is not a plane"1. The orthogonal cutting geometry depicted in Figure 2.1, where metal is removed in the form of a chip that slides up the face of the tool as it moves along the workpiece.  Figure 2.1: The orthogonal cutting process  1  M. E. Merchant, 1945  5  Chapter 2.  The Mechanics and Economics of Turning  6  Researchers have used a number of approaches to determine the cutting forces in orthogonal cutting. Merchant's cutting force relation for this process [6] is well documented and is shown in Figure 2.2.  Figure 2.2: Merchant's cutting force relationship He estimated the cutting force values by studying the cutting mechanics and predicting the shear angle <I>. Later, analytical and empirical models for shear angle prediction were developed [7, 8]. Other researchers tried a simpler approach based on the method proposed by Sabberwal [9]. This approach, which is now commonly used, assumes that the main cutting forces are proportional to the chip cross-sectional area. Sabberwal suggested that the forces are in fact a function of the chip thickness. The two orthogonal force components were modeled as a power relationship:  The Mechanics amd Economics of Turning  7  Fv =.i»M*"*  (2.1)  F,~ •P2whmi  (2.2)  Where: Fv Ft h w "l>*2->mVm2  power consuming force [N] thrust force [N] undeformed chip thickness [mm] width of cut [mm] empirical constants  Researchers have also investigated the relationship of the shear angle and other practical parameters to the cutting forces. Figure 2.2 shows the geometric connection between the shear angle and cutting forces.  It is accepted that the shear angle is influenced by the  undeformed chip thickness h, the cutting speed V and the rake angle y. Tool forces, chip-tool contact length and temperature are some of the practical parameters that effect the cutting forces. Research has shown that the influence of cutting velocity, practical parameters and rake angle are relatively small for practical situations with realistic values of tool life (e.g. 5100 minutes) and rake angles of ±10° [10, 11]. However, the effect of the parasitic edge forces (see Figure 2.3) is significant [12, 13]. The cutting forces are then primarily influenced by: a)  the parasitic edge forces which are independent of chip thickness  b)  the chip thickness which influences the value of shear angle through its effect on cutting zone temperature and work material hardenability  Chapter 2.  The Mechanics and Economics of Turning  8  Figure 2.3: The main and edge cutting forces With these simplifications the above equations are written in a linearized form: ^- = P1h"h =kxh + k2 w  (2.3)  5- = P2hm2 =k3h + k4 w  (2.4)  where krk4 are constants. The first term in each equation accounts for the influence of chip thickness on the main cutting force and the second term accounts for the effect of the parasitic edge forces. 2.3  Mechanics of Turning The turning process has a more complex geometry as shown in Figure 2.4. Years ago  researchers began studying the implications of the tool workpiece interface geometry in turning [14 , 15]. Typically, angle of obliquity e has a negligible effect (see Figure 2.4). However, the force model must account for the new active cutting edge geometry which now includes a primary and a secondary cutting edge with a circular transition region as shown in Figure 2.5.a.  Chapter 2.  The Mechanics and Economics of Turning Work Piece  9 ^  Figure 2.4: Bar turning tool geometry  Figure 2.5: Tool workpiece interface geometry in turning In the above figures F a represents the axial component of force, F r the radial component, F t is the thrust force and F v is the power consuming force. Chip sections in turning may be accommodated in orthogonal cutting models through the concept of equivalent chip thickness [16, 17, 10]. It is the mean value of chip thickness averaged over the engaged cutting edge length (see Figure 2.5.b):  Chapter 2.  The Mechanics and Economics of Turning H.-f  10 (2.5)  e  where A is the undeformed area of cut: A = axS  (2.6)  and le is the engaged cutting edge length:  cosip R tp a  2 2 tool nose radius [mm] tool approach angle [rad] depth of cut [mm]  5  feed [mm/rev]  The equivalent chip thickness combines the effects of nose radius and approach angle on cutting temperature and cutting force [16]. Nakayama et. al. [11] have shown that at constant cutting velocity the cutting forces and temperature are linear functions of the equivalent chip thickness. Therefore, the orthogonal cutting equations 2.3 and 2.4 are written for turning as: ~^ = k,He+k2  (2.8)  e  f = k3He+k4  (2.9)  e  Lai's results show a strong linearity between the specific cutting pressure (force/undeformed area of cut) and the reciprocal of the equivalent chip thickness which supports this force model formulation [18] . Further simplifications enable estimation of the cutting force orientation in most turning operations. The line of action of the thrust force Ft which is obvious in orthogonal cutting due to the simple cutting edge geometry, is estimated in turning through the equivalent approach angle concept (ipe) introduced by Colwell [19] and is shown in Figure 2.5.c. Stabler [20] concluded through experimentation, that this assumption overestimates the contribution of the secondary cutting edge in cases where it forms an appreciable proportion of the total active edge length. However, strong experimental evidence is demonstrated by Nakayama et  Chapter 2.  The Mechanics and Economics of Turning  11  al. [11] in support of the ipe assumption in practical turning operations where feed and nose radius are small relative to the depth of cut. The three technological parameters introduced above, the equivalent chip thickness, the active cutting edge length and the effective approach angle, allow the use of orthogonal cutting force models for analysis of the more complex turning operation. It is then possible to study the economics of turning in light of the proven orthogonal cutting models.  2.4  The Economics of Turning Turning economics is improved by good process planning at numerous levels. At the  highest level, economic gains depend on recombination of the cut volumes to reduce process cost [21, 22, 23]. The cut volume geometry influences tool selection and efficiency of the generated tool paths [24] which in turn, determine the number of tool changes, the frequency of operator intervention and thereby the process cost. At the lowest level, in-cut time is reduced by optimal selection of the depth of cut, feeds and speeds [25, 10]. Conservative values of these parameters naturally increase cutting time and as a result the process cost. The objective is to show how CNC hardware and software could be used to consolidate process planning with cutting process control and optimization. Necessarily, the lowest level of process planning namely selection and maintenance of optimal cutting conditions is emphasized. However, provision for the higher level process planning functions mentioned above is also made and will be discussed in the next chapter. Economic optimization of the turning process, at the lowest level, involves selection of the optimal depth of cut, feeds and speeds. Optimization generally implies minimization of the process time or maximization of the production rate. In either case, an economic model of the process is needed for optimal selection of the cutting parameters. This model may be based on the time cost of the various machining activities. In a turning operation, time is expended to:  Chapter 2.  The Mechanics and Economics of Turning  12  1.  Manipulate the tool, set the feeds and speeds, load or unload the workpiece  2.  Perform the machining operation  3.  Change the tools that reach the end of their useful life  The time for the first set of operations is not directly related to the machining parameters (i.e. V, S and a). This time represents a fixed cost and is not included in the formulation. The remaining times depend on the choice of cutting parameters and effect both machining cost and time. The variable machining time is then expressed as [10]: ljL  tv  v  +  RPMxS  ^  (2.10)  RPMxSxT  and the variable machining cost is [10]:  cvv—h^_+M^l£L RPMxS  (2 . n)  RPMxSxT  where: RPM =  V  (2.12)  2TIR  RPM V R S ts T  K ct  X  cutting velocity [rev/min.] spindle velocity [mm/s] insert nose radius [mm] feed rate [mm/rev] time to replace a worn tool [min.] tool life [min.] length of cut [mm] tool cost [$] machine overhead rate [$/min.]  Others have used similar equations [25] or ones that account for the type of factors mentioned in point 1 above, such as machine idle time [26, 27]. Equation 2.10 emphasizes the actual machining time in selection of the optimum machining parameters whereas 2.11 emphasizes the machine overhead rate and the tool cost. Although both equations are valid approaches to optimization, the high overhead of modem machines renders a strategy based on Equation 2.11 more applicable. As both objective  Chapter 2.  The Mechanics and Economics of Turning  13  functions indicate, the tool life T plays a central role in selection of the optimum conditions since it relates the frequency of tool change and the total insert cost to the cutting parameters.  2.4.1 Tool Life Process conditions determine the wear rate of a tool insert and thereby the length of its useful life. Researchers have developed a number of empirical models to predict the relation between tool life and cutting parameters. Most models are an extension of F. W. Taylor's work who proposed in 1907 that tool life is primarily influenced by the cutting speed V [rev/min.]: VTa = Constant  (2.13)  The influence of feed S [mm/rev] and depth of cut a [mm] were eventually added to this model: Vr\S<V = Constant  (2.14)  where the empirical constants are typically: 0.5>a>0.1  l>P>v  These values imply that velocity has the greatest influence on tool life followed by feed and depth of cut. The extended Taylor equation like the original one is an approximation and is applicable only over the practical range of tool lives and velocities that avoid built up edge. However, most practical cutting situations do fall in this category. The constants p and Y in the extended Taylor equation are sensitive to geometric features of the tool such as the nose radius and approach angle. It is advantageous to reduce the number of experimental constants in Equation 2.13 and express it in a form that allows prediction of the influence of nose radius and approach angle on tool life: VTaHbe = Constant  (2.15)  Chapter 2. Now 6 - -  The Mechanics and Economics of Turning  14  is approximately constant with respect to changes in tool geometry mentioned  above. Hodgson and Trendler [28] have shown the validity of this form of the tool life equation.  2.4.2 Optimization of the Process Parameters Substitution of Equations 2.12 and 2.15 into Equation 2.11 gives:  c  _L2KR  VxS  VaHa 1+ '-rix.+C,) Constant" j  (2.16)  where He is given by Equation 2.5. In order to minimize this objective function the practical constraints on the metal cutting parameters are needed. The depth of cut a, feed S and spindle velocity V are the parameters to optimize.  The other variables that appear in the Equation 2.16 are experimental or  economic constants.  The depth of cut a is typically limited by chatter, an undesirable  vibration of the workpiece and the tool which degrades the surface finish. This phenomenon is influenced by the tool nose radius, tool approach angle and the stiffness of the machining setup. Other considerations for the depth of cut limit include chip breaking capability and the length of the cutting edge. The spindle velocity V is limited by the spindle motor power limitation and at times by the machine tool or the holding devices. The feed rate S for a roughing operation is primarily restricted by tool edge breakage although, the depth and feed combination used should allow chip breaking. The maximum allowable chip thickness is a better measure of the chip load on the tool than maximum feed or cutting force. Hence, chip thickness is a good parameter to use to guard against edge breakage. It is also possible to identify the equivalent chip thickness from the cutting forces [29] and chapter 5 will explore the implications of this capability for on-line process optimization.  Chapter 2.  The Mechanics and Economics of Turning  15  Selection of the optimal cutting parameters is now straight forward. The objective function constitutes a geometric programming problem of zero degrees of difficulty [30]. The solution dictates the following [29 ,31]: 1.  Maximize the depth of cut to the chatter limit  2.  Maximize the feed up to the edge breakage limit  3.  Set the velocity for the optimal tool life based on the desired optimization strategy: minimum cost or maximum production rate (see below).  Once feed and depth of cut are maximized to the limit, the optimal tool life is determined by the velocity only. Differentiation of the objective function 2.10 or 2.11 with respect to velocity gives the optimal tool life for the desired strategy. The tool life for maximum production rate is:  ^  =0  dV  (2-17)  T  =(-— - I V  max production  V  / s  a The optimal tool life for minimum cost is:  dc  -.o  dV  (2.18) T  a  )  mm cost  The optimal velocity is found by substitution of the tool life for the selected optimization strategy into the tool life equation. When the depth of cut exceeds the chatter limited depth or the available cutting edge length, a multi-pass turning operation results.  Researchers have studied the economic  implication of volume subdivision in two-pass and multi-pass turning operations [32, 30,]. A  Chapter 2.  The Mechanics and Economics of Turning  16  practical guideline for external rough turning is to take the largest depths first and the remainder on the last pass.  2.5  Discussion and Conclusions A set of practical guidelines was presented for the selection of machining parameters to  give good economic results. These guidelines can be used to calculate the optimal feeds and speeds at any point along the tool path from a knowledge of the tool-workpiece interface geometry. Future chapters will show how these optimal values can assisst the machine controller in performing process control and optimization.  Chapter 3 Machining Language 3.1  Introduction Better use of computers in production requires the development of new programming  methods. Initially, computers were only used for product design and motion control. The early manufacturing languages met motion planning needs while the design packages only considered the design task.  Today, computer applications cover the entire range of  production namely design, process planning, motion planning, process control, machine diagnostics and process optimization. The need to improve production efficiency requires integration of computer and machine with the process.  Therefore, the programming  environment used must be seamless and must provide the full range of manufacturing functions that are currently performed by computers. The approaches taken toward process integration have proceeded in two directions. The first involves the development of high level programming languages which allow easy editing at the high level, and are post-processed to produce low level machine code [41]. The other method involves development of work shop programming languages which are dialogue driven and are usually based on geometric features of the workpiece [42, 43]. Efforts to improve the economics of today's sophisticated and expensive CNC machines would benefit from an inexpensive programming method that pays particular attention to process economics.  17  Chapter 3.  Machinig Language  18  This language should facilitate the generation of an optimal operation plan and provide the capability to optimize machining parameters both off-line and on-line. Creation of a language that could fulfill these tasks would require both software and hardware design innovations.  In this chapter an interactive process oriented machining  language is presented which in conjunction with the UBC Controller creates an environment conducive to efficient part programming, automated operation planning and process optimization. First, the feature based technique for part definition is presented and its merits are discussed. Then, operation planning issues are addressed. Finally, some software design issues are mentioned. The controller hardware design which assists the language in its tasks is discussed in chapter 4.  3.2  Description of the UBC Lathe Language The UBC Language is envisioned as an interactive part definition and operation  planning language that combines geometry and technology to help implement process monitoring and optimization schemes more effectively. The language's implementation at the machine controller, its interactive nature, and the English phrases it uses are similar to the concepts used in robot programming languages [43, 44]. The incorporation of technological data, the generation of tool paths and the provisions made for operation planning resemble the features offered by technologically oriented processors such as EXAPT [38]. In addition, the UBC Language together with the UBC Controller described in chapter 4 facilitate real-time process control. The range of activities undertaken by the language includes: part geometry definition, operation planning and process optimization. The UBC Language's part definition scheme is intended to allow the following advantages: 1.  The inclusion of geometrical and technological data in the part representation  2.  The simplification of part program generation and faster tool path validation  3.  The facilitation of operation planning and process optimization  Chapter 3. 4  Machinig Language  19  The performance of the above tasks intuitively and interactively at the machine as well as off line  This thesis only demonstrates a methodology for implementation of these goals since complete realization of such a system is beyond the scope of the current work. Central to many of the above objectives is the use of features for product definition. The advantages of a feature based approach for integration of design and operation planning are well recognized by researchers in this field [33, 34, 35, 36]. Features are simply a data set which contain both geometrical and technological information. Some common machining features in turning are shoulders, tapers, grooves and holes. The higher level description of geometry afforded by features provides fundamental information for logical determination of processes, operation sequence and tool selection. For instance, when a groove is specified, the number of tools and tool motions are limited to only a few applicable combinations. Feature based design changes the usual design and manufacture approach, to one of design for manufacturing [37]. Limitation of the designer's choice of feature primitives to those which a machine is capable of producing ensures the part's manufacturability. Operation planning requires knowledge of surface finish and tolerances. This information is typically not an integral part of CAD part definitions but, it is easily included in a feature representation during the design phase. Features are also more intuitive since programmers tend to think in terms of features rather than low level geometrical objects such as circles and lines. A feature primitive is instantiated by specification of geometrical and technological data. The specification of this information requires the interaction of the user with the computer through some type of user interface: a graphical user interface, a menu driven interface, a statement oriented interface or a combination of these. Whatever the mode of data entry, it should facilitate part programming, minimize the amount of numerical information needed to define the geometry, and reduce the possibility of input error. In the UBC Language, data is entered with English like phrases. The feature geometry is defined by specification of the feature type namely: STOCK or Workpiece, the feature  Chapter 3.  Machinig Language  20  primitive name, a reference name, and a series of identifiers each followed by a set of numbers instantiating the feature primitive. The types, primitives and identifiers currently available are tabulated below:  Modifiers  Type  Feature  Identifier  EXT  STOCK  SHOULDER  CORN  INT  WP  BOUND  NECK  LFT  TAPER  RIGHT  FD  AXIAL  DIAM  RADIAL  LEN  Table 3.1: Vocabulary for part geometry definition  The keywords are used according to the following syntax: [Modifiers] [Type] [Featureprimitive] [name] [Id] [#] . . . [Id] [#]; The modifiers specify whether the feature is external or internal to the part, whether it is located at the right end, the left end or the centre of the part, and whether an axial or radial tool path orientation should be used. If no modifiers are specified, the system defaults to an external, right end feature generated by an axial tool path. The type indicates if the feature is part of the stock or part of the workpiece. When the stock is not cylindrical as in some forgings, a cylindrical stock is defined and it is reduced to the forging geometry by subtraction of features from the stock with the type specifier.  BOUND is used to define the initial  cylindrical stock dimensions. The length and outside diameter of the cylindrical stock are fixed by the two identifiers DIAM and LEN. For example, a cylindrical stock is defined as: STOCK BOUND boundary DIAM 150 LEN 200; where the dimensions are in millimeters. The feature primitive currently available is a SHOULDER. It is used to instantiate a straight or a tapered segment.  The CORN identifier followed by a coordinate pair  Chapter 3.  Machinig Language  21  representing the outside diameter and the length from the clamped end of the workpiece, determines the position of the feature corner. The dimensions following the identifiers FD, NECK and TAP indicate the finish diameter, the straight segment length and the tapered segment length respectively. It is acceptable to define either a NECK or a TAP or both. For example, a workpiece shoulder is defined as: WP SHOULDER shl CORN 150 200 FD 90 NECK 40 TAP 30; The two statements above would define the geometry shown in Figure 3.1. This form of data entry allows definition of entire volumes quickly and with minimal amount of data. 200 mm i30mmi 40 mm  \  30 mm  90 mm  /  Figure 3.1: The defined workpiece geometry  There are many possible ways to store and manipulate the feature information. Currently every feature uses 116 bytes of storage memory which is partitioned as shown in Table 3.2. The modifiers explicitly specify the feature orientation and the preferred tool path direction to help with operation planning. Tolerances and other technological data can be added in the future. Link fields may be added to allow combination of volumes. A linked list of features may also be created to represent the operation sequence.  Chapter 3.  Machinig Language Memory Offset (Bytes)  22 Data Type  Description  0  floating point  Comer 1 coordinate pair  12  floating point  Corner 2 coordinate pair  24  floating point  Corner 3 coordinate pair  36  floating point  Corner 4 coordinate pair  48  floating point  First finish path point  60  floating point  Second finish path point  72  floating point  Third finish path point  84  floating point  Slope of part surfaces  106  floating point  Finish depth allowances  108  Single  Type of feature  110  Single  Left\right handed feature  112  Single  Blank\Workpiece feature  114  Single  Radial\axial tool path  Table 3.2: The feature data structure  3.3  Operation Planning Researchers have spent much effort to integrate design, operation planning and  manufacturing. Operation planning mainly involves operation sequencing, tool specification, tool path generation, and feed and speed selection. Traditionally, the operation plan was prepared manually based on design and manufacturing information. The need to simplify and speed up this time consuming process lead to the development of software which usually used the output of a computer aided design packages to automatically generate the operation plan. Two typical systems are EXAPT [38] and TECHTURN [39]. In these systems, the operation plan and the part program are generated based on the assumed geometry and technological information. The motion and tooling commands are post-processed into the machine specific G-code and sent to the machine but, the technological data calculated during operation planning is left out. The lack of technological data during manufacturing has made process optimization with adaptive control schemes quite challenging. Some systems discussed in chapter 5, calculate global technological parameters (typically maximum force) and send them  Chapter 3.  Machinig Language  23  to the adaptive controller. However, these control algorithms do not optimize the process economics, they only attempt to improve it. Due to the complex and variable nature of the metal cutting operation, it is advantageous to generate technological data for small motion segments and use it with an online process control and optimization scheme. Such a scheme would begin with near-optimal machining parameters derived from the assumed cut geometry and a process model. Through real-time process feedback and an identification algorithm, the controller would then detect the actual cut geometry and alter the machining parameters to compensate for the difference between the assumed and the actual conditions. Since the actual conditions are usually close to those assumed, optimality is reached quickly. If a large discrepancy is observed, safety measure are taken to guard against damage or reduced quality. The traditional NC-code block format is a major barrier for implementation of this process optimization strategy. As mentioned above, to perform optimization effectively in real-time, the generated motion commands and corresponding technological information must both be passed to the control algorithm. This is difficult to do with G-code since there is no provision for specification of technological information.  Even if the code is extended to  include technological words, it would be difficult to combine motion and technology in a useful way. Each NC block defines a single tool stroke during which the process conditions often vary significantly. At best only one set of technological data can be defined per stroke. Typically, the machine dynamics and the computational capability of controllers limit the machine's ability to respond to process changes. This limitation together with the sparse use of technological data makes effective control a difficult task. The UBC Lathe Language in combination with the UBC controller would enable generation of technological information during operation planning and the use of this information for process control. Once the tool path is generated, the process model described in chapter 2 would determine the optimal cutting feeds and speeds along the tool path. The tool capability information would define maximum forces for monitoring purposes. With the  Chapter 3.  Machinig Language  24  technological data and the required motion commands sent to the controller, it would know the tool motions to execute as well as process conditions to expect each step of the way. An adaptive control algorithm would then validate the assumed process conditions and modify the cutting parameters if necessary. This would achieve a high level of integration between operation planning and manufacturing. To demonstrate some of these possibilities experimentally, rudimentary motion planning, process monitoring, process control and optimization schemes were implemented. This section describes the generation of tool paths for the SHOULDER described previously. Process monitoring is demonstrated in chapter 4 by measurement of the main component of cutting force and limitation of its value. Chapter 5, shows the system's ability to optimize the process through equivalent chip thickness control. Process control which is performed by feed rate manipulation is discussed in both chapters 4 and 5.  3.3.1 Tool Path Generation The objective in tool path generation is to determine the tool motions needed to remove a specific volume. The two types of cutting path typically used in turning are the four stroke and the two stroke loops (see Figure 3.2). The four stroke loop is the one most commonly encountered. The first stroke positions the tool; the second stroke is the cutting stroke; the third stroke retracts the tool from the machined surface; the fourth stroke returns the tool to a convenient position for the start of the next positioning command. As shown, the two stroke loop is used for drilling or plunging operations with form tools.  Chapter 3.  Machinig Language  2  25  Al  I  V2  A 1  n  > 4  (b)  (a)  Figure 3.2:  Common tool path strokes in turning  The tool path for the previously defined SHOULDER is shown in Figure 3.3.a. The orientation of the path is determined by the tool capability. The tool capability (right/left handed, maximum force, insert geometry, etc.) would be encoded so the operation planning algorithm can recognize the best tool with which to machine the feature geometry. In this case a right handed tool with a 0° approach angle was used (Figure 3.3.b). With this type of tool, the most efficient cutting direction is along the part axis. The cutting direction determines location of the drive and check surfaces on the feature. The tool moves along the drive surface and stops when it reaches the check surface. The tool then proceeds along a new drive surface to the next check surface. Segments {2, 3} and {3, 4} are the initial drive and check surfaces in Figure 3.3.a.  < >  Ia  (a)  Figure 3.3: Generated tool path for a shoulder  Chapter 3.  Machinig Language  26  Since tool inserts have a finite nose radius, nose radius compensation is necessary for dimensional accuracy of the generated surface. Figure 3.4.a demonstrates the dimensional error which results without tool nose radius compensation. Line {2, 3, 4} represents the required part surface and line {a, b, c, d} is the actual tool path. One way to eliminate this error is to set the datum at the centre of the nose radius and calculate a path that is a distance r equal to the nose radius away from the desired surface (see Figure 3.4.b).  These  calculations are performed automatically in the UBC Language's tool path generation routine.  Figure 3.4: Tool nose radius compensation  The depth of cut for the tool path is set according to the chatter limited depth and surface finish requirements. As discussed in chapter 2, for a multi-pass roughing operation it is more economical to take the full depth as long as possible. When a finishing pass and a corresponding depth is specified, the rough passes are taken at the maximum depth but, a final pass is left for the finish cut (see Figure 3.5). The keyword FP followed by two numbers specifies the depth of cut during each portion of the finish pass. In Figure 3.5, a 2 mm depth of cut was specified for both the straight and the tapered segments with the following statement: FP 2 2;  Chapter 3.  Machinig Language  27  Figure 3.5: Tool path for roughing and finishing operations  3.3.2 Machining Technology Once the tool path is determined, the controller can calculate the remaining technological data based on the process model developed in chapter 2. For example the feed is calculated from Equation 2.5 for a maximum value of equivalent chip thickness which represents the tool breakage criterion. The other parameters in this equation are found from the tool-workpiece interface geometry. The speed is found by substitution of the tool life value from Equations 2.17 or 2.18 into the tool life Equation 2.15. In this manner, the operational planning package could calculate optimal feeds and speeds for any point along the tool path. A convenient interval for generation of optimal feeds and speeds is the interpolation period. The UBC Controller uses a two stage interpolation algorithm which is discussed in chapter 4. This interpolation method is designed to take advantage of the multi-processor architecture of the controller.  The master processor performs a coarse interpolation to  calculate points along the path. These points are passed on to the slave axis boards which interpolate again to generate the fine motions increments used to drive the motors.  If  technological parameters are calculated at the first stage interpolation interval, each set of parameters would correspond to one coarse interpolation step. The axis boards would receive the first stage interpolation results while the monitoring board would receive technological parameters at the same frequency. The controller would then know the exact period for which a set of parameters is valid. To maintain dimensional accuracy for complex shapes such  Chapter 3.  Machinig Language  28  as curves, the size of the coarse interpolation steps is decreased. This would generate more technological parameters as well which would better prepare the control algorithm for the rapid variation in the tool workpiece interface geometry encountered during a complex path. As a first step toward implementation of the above strategy, a single set of technological parameters was sent to the monitoring board. These parameters included the feed, the speed, the equivalent chip thickness limit, the power consuming force limit, the cutting pressures, the depth of cut, the tool geometry and the tool motion direction. The first stage interpolation commands were sent to the axis control boards. Chapters 4 and 5 show the experimental results from the monitoring and optimization schemes that use the technological parameters. Extension of the current system to calculate and communicate these parameters at the interpolation interval is now fairly easy. The objective here was to illustrate the need for a machining language that would encourage a design for manufacture approach, incorporate technological information with geometrical data for part and tool definitions, simplify generation of operation plans and propose a methodology for calculation of technological parameters for use with process control schemes.  3.4  Software Design Considerations A number of software design consideration would help with the development and use of  the machining language conceptualized in the previous section: 1.  Modularization  2.  Layered code  3.  Software extendibility  4.  Ease of hardware access for both control and interrogation purposes  5.  On-line testing and debugging  These guidelines help generate efficient, easily maintainable, easily testable, extensible code. Software modularization has a number of well established advantages. Modularity is concerned with the break down of complex systems into a number of self-contained entities or  Chapter 3.  Machinig Language  29  modules. The programmer can test individual modules before combining them to form a more complex, harder to debug module. If the modular breakdown of the code is well planned, the programmer can reuse the modules many times and reduce the programming effort required. A library of well-defined, thoroughly tested, functionally distinct modules increases programming efficiency significantly. Generation of layered code is an extension of the modular programming technique. Layered software allows combination of simpler modules to form more complex ones. If carefully designed, each layer would form a different language characterized by a distinct degree of flexibility. This is an important consideration where various levels of users interact with the machining language. The unsophisticated user, such as a machine operator, would require the least flexibility and consequently a more user friendly interface. A more sophisticated user, such as the system programmer, would need as much flexibility as possible. Each class of users would only need to know the modules they intend to use. The recognition that the system will most likely require additions or modifications and that the final solution is most likely achieved incrementally is addressed by extendibility. It requires that the modules have a well defined and protected interface and that the effect of their execution is well known. A new module would then add additional functionality by safely interacting with the current modules and not interfering with their operation. Complete and easy hardware access is a great asset where real-time process interaction is involved. The ability to interrogate devices, sensors, and memory locations interactively from within the machining language environment is a tremendous advantage. It would allow the programmer to write and debug low level modules involving hardware access from a high level environment. In the case of the UBC controller, the machining language would run on a master processor while axis control and monitoring codes would run on slave boards. The ability to query the slave boards at any time for position, force, feed and speed data is helpful for development of language modules which depend on such information.  Chapter 3.  Machinig Language  30  Debugging consumes a large amount of program development time. Testing of modules containing real-time code and hardware access commands is particularly awkward and frustrating unless an expensive software development environment is used.  Interpreted  languages provide a great advantage by allowing interactive programming. However, very few interpreters have efficient hardware access capability. FORTH provides an inexpensive development environment which meets most of the above mentioned needs. FORTH is a threaded interpretive language. This means when a new word (subroutine) is defined, the addresses of the words it is comprised of ("the thread") is compiled into the ne word's definition.  Therefore, the interpreter does not have to  sequentially search through a long dictionary and execution time is reduced significantly compared to, for example BASIC. Although FORTH has not attracted as much attention as other programming languages, it has powerful features which come at a low price. FORTH provides the most direct, revealing and flexible way for controlling computer hardware. It encourages development of small (often 5-10 lines), reusable modules which can be easily tested independent of the other modules. This leads to a much reduced debugging time. The flexibility of FORTH allows the programmer to use it as a "construction set" rather than a rigid set of rules. FORTH subroutines are words, expressions which as in LISP are evaluated to give a value. This together with the extendibility of FORTH allows the extension of the language to create a motion control or machining vocabulary. As low level words are combined to form higher level words, a layered software user interface with various levels of flexibility evolves naturally. Sophisticated data structures containing both code and data can be created, a useful feature which only object oriented languages offer [40]. In short the advantages of FORTH stem from the unique combination of low cost, interactive environment, unrestricted low-level hardware access, and the unlimited flexibility to extend the language itself. FORTH has a powerful mechanism which allows elegant definition of machining features. In FORTH a data structure can contain code as well as data. When a feature is  Chapter 3.  Machinig Language  31  instantiated as described before, the feature code allocates the needed memory, calculates useful information such as slopes of workpiece surfaces or finish path points, compiles this data and adds the feature to a linked list of features to be machined. The feature code only behaves this way at compile time (instantiation time). When the feature is executed, (i.e. when the feature name is interpreted) the feature code makes the specified feature the reference one. The feature information is then accessed very intuitively by a set of words. For example the following line extracts the finish pass point coordinates from the SHOULDER feature created as SHI in the previous section: SHI 1 ©FPPOINT This phrase, read as shoulderl - fetch first finish pass point, places the first of two finish path coordinate pairs on the stack. The stack is what FORTH uses to pass data between words. @FPPOINT and other data access words provide a protected interface to the data structure and reduce the possibility of data corruption. The above FORTH phrase is an example of the layered approach alluded to before. @FPPOINT is a low level word used by the program developer. The machine operator would most likely use high level words; for example to generate axial tool paths for SHI the operator would type: AXIAL SHI GENPATH SHI and AXIAL are set globally and remain in effect until changed. Thus, there is in fact no need to include either in the above phrase if they were specified previously. GENPATH is a high level word which consists of many layers of low level words that performs tool path generation calculations. The operator can graphically display the workpiece geometry with or without the tool path with the words DRAW or DRAWP. If the depicted geometry and tool path is acceptable the operator can start a force monitored cut by typing the following phrase at the terminal: SHI MONITOR CUT SHI specifies the feature to machine, MONITOR sends technological data calculated based on the process model and process capability to the monitoring board and starts the  Chapter 3.  Machinig Language  32  routine described in chapter 4, and CUT sends the tool path motion increments to the axis slaves. A cutting operation that uses the monitoring, equivalent chip thickness identification and process optimization routines described in chapters 4 and 5 is performed by: SHI OPTIMIZE CUT Other words could be added in the future to combine two or more shoulders into one feature for operation planning: COMBINE SHI SH2 The key is that all the information needed to select tools or combine adjacent features is explicitly available in the feature data structure. So operation planning logic or new economic solutions can be added incrementally to improve the system. The unlimited, flexible and instantaneous hardware access possible in FORTH helps debug the code. Since FORTH is an interpreted language, a phrase such as: FORCE® typed at the terminal would give the three components of force sensed by the dynamometer at that instant. Similarly, other words would allow the programmer to query or set the tool position, feed, speed etc. interactively. Some of the words created to operate the lathe are tabulated below. The FORTH code writtern with LMI's version of the FORTH language is included in appendix c.  Chapter 3.  33  Machinig Language WORD  DESCRIPTION  SETDATUM  Clears position registers at current location  GODATUM  Move to the datum point set with SETDATUM  SOFF, SON  Tun spindle off or on  XPOS?, ZPOS?  Query x or z position [mm]  FEED <#>;  or  <#> FED  Set feed [mm/min] or set feed [mm/rev]  SPEED <#> ;  Set speed [rpmj  JOG or JOGS  Position tool with spindle off or on using the cursor keys  MOVE Z <#> X <#>;  Incremental move in millimetres  MOVEOUT  Rapid move out to clear the workpiece  Table 3.3: Lathe operation commands Other words were created to allow access to the technological board memory locations for both programming and debugging purposes (see Table 3.4)  WORD  DESCRIPTION  <float> <add> DFP!  Store floating point number at DSP1 board address  <add> DFP@  Fetch floating point number from DSP address  <double> <add> DY!, <add> DY@  Store or fetch double number at DSP board Y memory address  <double> <add> DX!, <add> DX@  Store or fetch double number at DSP board X memory address  FORCE®  Fetch three components of force from A/D module on the DSP  RESET  Reset code running on DSP board  Table 3.4: Technological vocabulary  3.5  Discussion and Conclusions In this chapter, a machining language for an NC Lathe was presented. The language  vocabulary consists of high and low level words. The high level words provide an easy and intuitive way for an inexperienced programmer to define the part geometry and generate the tool paths. The low level words give the system programmer direct access to the hardware and a protected interface to the feature data structure. The feature data structure explicitly Digital Signal Processor  Chapter 3.  Machinig Language  34  stores the necessary information for operation planning. This information helps with tool selection and generation of technological parameters for process control. After tool path generation, the motion commands are sent to the axis control boards and the technological information is sent to the technological board.  Chapters 4 and 5 will show how the  technological board uses the process information for control purposes.  The motion  vocabulary, the low level hardware access words, and the FORTH interpreter provide an interactive environment ideal for quick on-line code development, testing and debugging. The functionality of the language is easily extended to add further operation planning capability. The language provides an easy to use, low cost operator interface to a CNC lathe. The FORTH environment and the UBC Lathe Language run comfortably on a 80286 processor. The operation planning and optimization features presented here typically come packaged with expensive software and hardware which smaller firms cannot afford. The UBC Lathe Language approach would potentially allow smaller firms to benefit from the developments in metal cutting research and computer technology.  Chapter 4 Process Monitoring and Control 4.1  Introduction By monitoring the cutting process parameters, the machine control system is informed  of undesirable conditions, malfunctions and disturbances; it can then either try to correct the condition or halt the process gracefully. This ability not only improves machining safety, product quality and machine utilization but it is also a stepping stone toward the much sought after goal of unmanned machining. Chapter 3 showed how technological data for safety and quality requirements may be generated and sent to the controller; this chapter describes how the data are used in a monitoring scheme. First, an outline of the process monitoring tasks is given. Then, a control architecture is described that enables the controller to effectively perform monitoring and control tasks.  Finally, experimental results for cutting force control are presented to  demonstrate the proposed system's capability.  4.2  Process Monitoring Process monitoring involves the measurement and control of process and machine  parameters, to ensure that the process proceeds according to certain prescribed relationships. It should be a passive process up to the point when a parameter limit is exceeded. A control scheme should then either alter the machining conditions to limit the parameter value or the  35  Chapter 4.  Process Monitoring  36  system should issue a warning signal to indicate the presence of an abnormal condition and in the case of a critical situation the controller should stop the process to prevent damage. The usual approach to process monitoring involves active control of process parameters.  For  example in force control schemes, which are discussed in chapter 5, a force component is monitored and feed rate is constantly regulated to maintain the force at a prescribed limit. Process monitoring in metal cutting breaks down into a number of broad categories: 1.  Tool wear and breakage  2.  Machine tool monitoring  3.  Constraint avoidance  The importance of each of these areas to industry has lead to extensive research activity over the years and has resulted in notable advances in the state of sensor technology, control hardware, and software strategies. The objective here is to describe a system that takes advantage of the state of the art in these areas to enhance the monitoring capability of metal cutting machines.  The above categories, span a wide range of activities; after a brief  description of each, those that have a direct bearing on process economics will be discussed in depth. The ability to monitor tool wear and detect tool breakage improves the product quality and the production rate. Continuous knowledge about the state of the tool allows it to be changed before dimensional errors, poor surface-finish or fatal damage occurs. Tool wear tracking also enables the operator or the machine controller to schedule the tool change at a convenient time during production. The complexity of the tool wear process has challenged researchers in this field for years. As a result, the literature abounds with proposed solutions to tool wear tracking [46, 47]. Two approaches are generally taken; the direct approach involves measurement of the volumetric loss of cutting tool material by various means while the indirect approach involves correlation of cutting parameter values such as force with the degree of tool wear. Further discussion of the various methods is beyond the scope of this work. Suffice it to say that  Chapter 4.  Process Monitoring  37  although numerous promising indirect methods are reported [48, 49], the main challenge in this area lies in development of a rugged and reliable wear sensor [50]. It is note worthy that recently significant advances were reported in this area [51, 52]. Machine tool monitoring implies performance of machine diagnostics and identification of collision situations. These functions ensure safety and enhance productivity by recognition of the problem before it occurs or adversely affects the process. With advanced knowledge of impending problems, repairs or modifications are made with the least disruption to the production schedule [53]. By evaluating and imposing constraints on certain process variables, the controller would improve machining safety, product quality, and machine utilization, and reduce the need for operator intervention. For constraint avoidance, the controller may need to monitor any number of easily measured parameters such as force, power and torque and more complex parameters such as chip thickness, chip breaking, chatter and surface finish. The first set of parameters are directly measurable by force, torque or current sensors. However, multiple sensors, numerous measurements and a proven model is typically required for characterization of the latter parameters. A control strategy is also needed to enforce the prescribed limits. Since it is not possible to consider all the parameters here, the monitoring and control scheme is only implemented for force and chip thickness. This however, is not an arbitrary choice. A force limit is a typical constraint imposed by quality requirements, machine limitations or tool limitations; chip thickness control, as was explained in chapter 2, is closely linked to the process economics.  4.2.1 Monitored Parameters The machine controller can obtain process information by monitoring various parameters. Two such parameters that have a direct impact on metal cutting economics, machining safety, and product quality are cutting force and equivalent chip thickness. In this  Chapter 4.  Process Monitoring  38  chapter a control and monitoring scheme is proposed based on cutting force, and in the next chapter an optimization method based on equivalent chip thickness is presented. Cutting forces are the most commonly used parameters in metal cutting research. The reason for their dominance is threefold: cutting forces are easily and accurately measured, they are directly related to the process physics, and as such, many well developed process models are based on them. Forces are ideal for monitoring purposes since they give immediate and continuous information about the state of the process. Other sources of process data such as vibration, visual information, tool temperature, and acoustic emission cannot characterize the state of the process nearly as well. Although cutting force data characterizes the process well, a strategy to control and optimize it effectively necessitates that the controller captures the required information from the force data and control the cutting parameters efficiently. The force data is obtained from a force sensor signal.  The information content of the signal is dependent on the sensor  characteristics such as bandwidth, sensitivity, and accuracy.  Thus, the choice of sensor  determines the quality and the quantity of the information that is made available to the control algorithm. The ability of the control algorithm to use the sensor data and to control the process is primarily determined by the machine controller's hardware architecture. Sensor selection and control architecture are both discussed in depth in relation to effective process control.  4.2.2 Choice of Sensor Researchers have used a variety of sensors to measure force data. Typically, motor current sensors, tool holder dynamometers, table dynamometers, and torque sensors are used. Each type of sensor has advantages and disadvantages. Current sensors are less expensive and more durable than dynamometers. Furthermore, the current sensor's remoteness from the physically restrictive and harsh cutting environment means that minimal machine modification or sensor protection is needed.  Dynamometers, on the other hand, are generally more  Chapter 4.  Process Monitoring  39  expensive, harder to install on the machine and in close proximity of the harsh cutting environment. The potential advantages of current sensors has motivated researchers to study the feasibility of using them for monitoring and control purposes [54, 55, 56]. Stein evaluated the bandwidth of both the feed and the spindle drive on a Jones and Lamson 4-axis CNC lathe. The feed drives were predicted to have a bandwidth of 80 Hz. The larger spindle drive was reported to have a bandwidth of 2.0 to 0.11 Hz depending on the mode of field excitation. Generally, a load variation must be detected within one spindle revolution in order to allow reaction to a load disturbance within a few succeeding revolutions. The indicated range of spindle motor bandwidth implies that the motor must operate at 120 rpm to allow load variation detection over one spindle revolution. Although the surprisingly high feed drive bandwidth reported is sufficient, the spindle drive bandwidth is too low for effective response to higher frequency events. Therefore, a single load cell for measurement of the vertical force or an accelerometer for detection of the high frequency signals would be needed. Although a dynamometer's performance is superior to a current sensor's, the low cost and ease of installation on commercial machines makes the latter an attractive alternative. For this reason the feasibility of a current sensor on the laboratory 4-axis retrofitted Hitachi Seiki NC lathe was further investigated. The X and Z axis feed drives were permanent magnet FANUC model 5 and GETTYS-FANUC model 10 DC servo motors respectively.  The  voltage representation of the current signal was sampled from the servo amplifier channel and compared to the dynamometer force reading. The performance of the current sensor was judged on the basis of its ability to extract the needed process information from the current signal for control and monitoring purposes. The block diagram representation of the current sensor is shown in Figure 4.1 with disturbance torque as input and current as the output. The parameter values are listed in Table 4.1 in section 4.4. This diagram is similar to the one derived for the simulation of the  Chapter 4.  Process Monitoring  40  closed loop position control which is verified and used in a following section. The sensor's bandwidth calculated based on the transfer function of this block diagram was 5 Hz. Pul ref  H  j  i JgqS  0)  1 s  Pf ». i4*  D(z)  • He  V  O > D/A  -  >  &  •  *  Ka  .i  I >•  ii  V  K„V v  -  K,  ^  Figure 4.1: Current sensor block diagram A number of tests were conducted to determine the sensitivity and the accuracy of the sensor. The first test was designed to show the current sensor sensitivity. As shown in Figure 4.2, a spring scale was fixed at one end in the stationary W-axis and at the other end to the tool post-dynamometer assembly. A negative Z-position command was executed at constant feed; as a result the Z-axis motor and the dynamometer were both loaded to about 1600 N. Figure 4.3 shows the current and force as they increase with time in response to the increasing force. The motor current sensitivity is comparable to the dynamometer's. The flat part at the peak of the current trace is most likely due to the deceleration induced by the controller at the end of the position move. This may reduce the accuracy of the sensor at the start and at the end of the motion segments. Figure 4.4 shows the current signal after a 200 point running average digital filter was applied to reduce the signal noise. However, such a filter would also reduce the bandwidth of the current sensor.  Chapter 4.  Process Monitoring  41  Figure 4.2: Setup for motor current static calibration  Motor Current Variation With Load 1.8 1.6 1.4  g.8  Dynamometer Output  0.4 - 0.35  Motor Current  1.2  l-  0.3  -  + 0.25  g  - 0.15  o  "*tN***||fg' 0.2  0.8  - 0.1  0.6 en  0.05 0.4 0.2 0  _ .>•.  1  M«  0.45  T  /  rW^  »i——  - 0 -- -0.05  r  -+-  -H  10  15  20 Time [S]  Figure 4.3: Motor current variation with load  •0.1 25  30  35  40  CO  Chapter 4.  Process Monitoring  42  Motor Current Variation With Load 200 point running average filter 1.8 Dynamometer Output 1.6 Motor Current 1.4 1.2  IS 1 I-c 0.8 is  (3 >> C3  Servo Enable -  0.6 0.4 -0.2 - :  0 40  10  15  20  25  30  35  40  Time [S]  Figure 4.4: Motor current variation with load (filtered) Next a test was conducted to quantify the tare current produced by the feed drive inertia and friction. Short position commands at constant feed and no load were commanded first in the positive and then in the negative Z-direction. The current signal obtained is shown in Figure 4.5. The tare current is about 185 mV and 140 mV in the negative and positive Zdirections respectively. This difference is mainly due to the different friction coefficient values on each side of the slide and the off-centre position of the ball screw on this particular lathe which switches the saddle-slide contact point for the forward and reverse motion directions. For a similar reason a hystereses effect is observed as the direction is changed.  Chapter 4.  Process Monitoring  43  Incremental Motions along Z-axis Move Left  O SB  I Feed: 25 mm/min Incremental motion: 1.3 mm  Move Right Time [S]  Figure 4.5: Motor current signal for incremental motions along the z-axis A typical problem with accurate inference of cutting force from motor current is the determination of the contribution of the friction force. Stein has shown that the viscous and coulomb friction loads are speed and load dependent for both the spindle and the feed drive systems. He uses an empirical approach to predict the friction loads for selected operating conditions. Even in this highly controlled setup, an error in measurement of the Coulomb friction coefficient resulted in a 19% error in the predicted force value [54]. Thus, the accuracy of the force values inferred from the motor current is highly dependent on the ability to predict the friction loads. Normal cutting operations with CNC machines create a wide variety of cutting feeds, speeds, and directions which make accurate prediction of the friction load difficult.  Research systems that use motor current to infer cutting force typically  consider a chucking operation where only straight passes are taken [57]. The need to aggressively filter the current signal, the effect of acceleration and deceleration on accuracy, the variation of the friction load with motion direction and cutting  Chapter 4.  Process Monitoring  44  force, and the hystereses effect all detract from the previously mentioned advantages of a current sensor. Stein suggests a number of major design modifications such as increasing the ball screw pitch to increase the sensor's sensitivity or reduction of friction forces in the feed drive to lessen the influence of friction variation. However, such changes were not practical on the laboratory machine. For these reasons the inference of force from motor current was not pursued; instead a tool post dynamometer was used. The quality of force data provided by a dynamometer makes it the most suitable and commonly used sensor for process analysis. A well designed dynamometer provides high dynamic and static sensitivity, high precision and accuracy. One of two types of transducers is typically used in a dynamometer: piezo-electric or strain gauge.  A piezo-electric  dynamometer built by Lai [18] measures signals up to 400 Hz (with a tool post attached) to 1 N accuracy and maximum loads of 10,000 N in the z direction and 6,000 N in the other directions with no noticeable non-linearity and negligible cross-sensitivity.  Strain gauge  dynamometers are inferior to piezo-electric ones for a number of reasons: the mounting technique inevitably creates cross-sensitivity between the force components, the gauges are temperature sensitive, and the dynamometer sensitivity is related to the stiffness of the mount. The tool post dynamometer used throughout this thesis was designed and built by Lai [18]. Three piezo-electric force transducers each capable of measuring three components of force are used in the dynamometer. The sensor signals are added together, and amplified by three PCB Model 463A dual mode charge amplifiers. The dynamometer is fastened between the tool post and the saddle. The design documentation of the tool post and the mounting plate are included in appendix A. The entire assembly is shown in Figure 4.6.  Chapter 4.  Process Monitoring  45  Figure 4.6: Tool Post Assembly Static and dynamic tests were conducted to calibrate the dynamometer. In the static tests, the dynamometer was loaded along each one of its principal axes. The dynamometer static sensitivity and cross-sensitivity are shown in Figures 4.7, 4.8, and 4.9. In the dynamic test, the impact excitation method was used to determine the fundamental natural frequencies of the dynamometer- tool post assembly. The frequency characteristics of the three channels are shown in Figures 4.10, 4.11, and 4.12. For force measurements in turning operations, where low frequencies are involved, the 0-400 Hz range is more than adeq  uate.  Chapter 4.  Process Monitoring  Dynamometer Static Calibration Results Loading Direction - X-axis 10 Transducer Sensitivity Specification: 34.0177 [PC/lbf] Charge Amplifier Sensitivity Setting: 10.0 [Mu/V] Actual Charge Amp. Sensitivity: 10.3795 [Mu/V] Actual Transducer Sensitivity: 32.7741 [PC/lbf] Charge Amp. Setting for Experiments: 7.3683 [PC/N]  9 8 7  I  -- 0.8 •  6  • X-axis  5  •  Y-axis  4  A  Z-axis  1  - 0.4 - 0.2  3 2  - 0.6  "  * 4 6  0  H 5  0  6 4 *  A  A  A  A  A  A  A  A  A  A  A  &  A  -0.2 h H 1 1 1 1 1 1 1 1 H H h 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Force [lbs]  Figure 4.7: Dynamometer x-axis static calibration  Dynamometer Static Calibration Results Loading Direction - Y-axis  o Transducer Sensitivity Specification: 34.0177 [PC/lbf] Charge Amp. Sensitivity Setting: -10.0 [Mu/V] - 0.8 Actual Charge Amp. Sensitivity: -10.8275 [Mu/V] Actual Transducer Sensitivity: 31.4178 [PC/lbf] Charge Amp. Setting for Experiments: 7.0633 [PC/N] - 0.6  -l -2 -3  • Y-axis  -4  • X-axis  -5 o  0.4 A Z-axis  -6  > •  -- 0.2 -7 -8  •  •  I  I  I  I  I  I  I  I  S  S  I  ;  -9  -+-  -10  -+-  -+-  10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Force [lbs]  Figure 4.8: Dynamometer y-axis static calibration  -0.2  Chapter 4.  Process Monitoring  47  Dynamometer Static Calibration Results Loading Direction - Z-axis 12  T 1  T  Transducer Sensitivity Specification: 20.41062 [PC/lbfJ Charge Amp. Sensitivity Setting: 10 [Mu/V] Actual Charge Amp. Sensitivity: 11.7681 [Mu/V] Actual Transducer Sensitivity: 17.3440 [PC/lbf] Charge Amp. Setting for Experiment: 3.8993 [PC/N]  10  0.8 + 0.6  « S >-  • Y-axis  o-4  §  • X-axis  -3 0.2 =3  A  •ES 6 --S3  A  1  1  1  1  1  1  1  0  10  20  30  40  50  60  70  Z-axis  -0.2  1—  80  90  100  110  120  130  Force [lbs]  Figure 4.9: Dynamometer z-axis static calibration The dynamometer's capability to capture process information  through  force  measurement characterizes the process well, but effective force control is ultimately dependent on the machine controller's hardware architecture. Equation 2.8 shows that cutting forces are primarily a function of feed, and depth of cut over the practical range of cutting speeds. Since the simplest way to control the force is to vary the feed rate, the controller must have the capability to do this effectively.  Chapter 4.  Process Monitoring WIS f H E f l RESP HI Xa  W i  *  MAC  SOOHx LIN #Ai B  V 1 2 FHEO RESP H I PHASE Vi - 2 0 0 TO •ZOO DEC X> O H * * SOOHz LIN  •  #A<  Figure 4.10: Dynamometer x-axis frequency characteristic  f  p e PMEfi RE8P H I  • XJ  MAC  INPUT  2 7 . *tffl 40dS O H X * BOOHx LIN #AJ 8  -"•u  -BDO'T  too  aoo  m  W12 PREQ « W Hi PHASE Yi —200 TO •200 DEC XJ OHX • S0ONZ LIN #A>  e  Figure 4.11: Dynamometer y-axis frequency characteristic  Chapter 4.  Process Monitoring Hi 6 FREQ RESP HI MAC Ti 32. OdS 40dB X. OHx » BOOHz LIN #A. IS  49 INPUT  WIS FREQ RESP HI PHASE Yi -200 TO *200 DEO X. OHz * BOOH* LIN • A, 13  Figure 4.12: Dynamometer z-axis frequency characteristic  4.2.3 The Significance of the Controller Design The machine controller's ability to monitor the process and quickly alter the machining parameters greatly influences the performance of process control strategies. Even the best control algorithms cannot overcome the bottlenecks and inefficiencies arising from the machine controller's design. This realization has led researchers to examine the required controller functionality for process control.  A number of studies have resulted in the  development of new controllers that facilitate process monitoring and control tasks [58, 59]. Commercial controllers are characterized by a number of shortcomings which make process control difficult. They typically lack monitoring capability and are slow in controlling process parameters. modification.  Furthermore, their closed architecture1 bars any kind of functional  Up to now, controllers were only required to do geometric tasks such as  1. Engineering information that would allow users to expand the capability and functionality of the controller is withheld by the manufacturer.  Chapter 4.  Process Monitoring  50  contouring or read logic data such as switch states. They were not designed to perform process oriented functions. However, with the maturity of process models, the development of control strategies, and the need for their experimental verification and industrial implementation additional capabilities were required from the controller.  The provision to  extend the controller's functionality was not a design feature in most controllers. Furthermore, the controller manufacturers were usually reluctant to release propriety technical information to allow the customers to customize a controller to suite their needs. In response to these problems, an open architecture controller was built at UBC to accommodate process needs as well as perform the traditional machine control functions [60]. In particular, provisions were made to effectively control technological parameters such as forces. This is discussed after a brief introduction to the standard control functions.  4.2.4 Standard Controller Functions NC controllers must process geometric data and logic control data. The tool path is defined by the geometric data, and is executed by the contouring system, comprised of the interpolator and the axis feed-drives. The interpolator approximates the exact path defined by the geometric data by converting the required displacement and the tool feed rate into a series of small incremental axial displacements. These increments are sent to the feed-drives to generate the required motion. The interpolation calculations and the axis control functions, which are discussed further in a future section, consume significant processing time. Typical logic control data includes spindle and direction commands, tool feed rates, coolant flow control, over travel limit switch detection, and operator panel interface. These functions, broadly described as switching functions, are usually implemented by a programmable logic controller (PLC). The PLC is a computer that cycles through a software loop consisting of Boolean logic statements. It communicates with the NC controller through its input/output port.  Chapter 4.  Process Monitoring  51  4.2.5 Features of the UBC Controller Design A number of design features allow the UBC controller to perform process control along with the standard controller functions.  The controllers interpolation scheme reduces the  computational load of the master processor and decreases the amount of inter processor information flow. Thus, the master processor has the capacity to service more axis boards and accommodate additional monitoring boards for process control purposes.  A direct  communication channel linking the axis boards facilitates feed rate control and improves the performance of process control strategies. These design features are discussed in depth in this section. To understand interpolation better, a simple two axis linear interpolation example without acceleration control is cited. The equations listed below are described in Bollinger and Duffie [61]. Figure 4.13 shows a point to point move fromXs, Ys to Xe, Ye. In this case the interpolator calculates the incremental position for the x and y axes from the parametric position equations: Px=Vxt  Py=Vyt  where: Px=Xe-Xs  Py=Ye-Ys  and Vx, V are components of the vector velocity V which is equal to the command feed rate. The vector position is calculated as:  Pxy-yjpJ^pJ  (4.1)  The axis velocities are proportional to the ratio of the axis position and the vector position: K=y^~  (4.2)  Chapter 4.  Process Monitoring  52  The interpolator period T is the interval at which the interpolator algorithm is executed. The total interpolation time t and the number of interpolator periods n are calculated as: t=  ^xy  (4.4)  xy  -1-_5L T  V  (4.5)  T  Xe,Ye  mm  Figure 4.13: Point to point move  The interpolator outputs incremental positions to the feed-drives at each period T. For the X axis, the kfa incremental position APX is calculated as:  PXk -  VJk  = VxT(k-(k-l)) = VT  (4.6)  Since the feed-drive only accepts integer pulses, the integer portion of the incremental position command is sent and the remainder is carried forward to the next calculation:  Chapter 4.  Process Monitoring AP X i =Kr + Frac(APXti)  A f ^ - ^ r + FtacCAPyJ  53  (4.7)  To ensure that the full displacement is executed, and to accommodate the possibility of a fractional n, the total incremental position command is calculated and subtracted from the required displacement to find the incremental position for the last interpolator period: Total = Total  + Int(AP )  Totalyt=Totalyki+lnt(M>yk)  (4.8) V J  Although linear interpolation is not very computationally intensive, circular interpolation and velocity profiling do require significant computational power. Linear interpolation, either with or without acceleration control, requires floating point operations during the initial stage and integer arithmetic during the calculation of the next incremental displacement. Circular interpolation involves floating point as well as trigonometric calculations. This, together with the trigonometric calculations involved in acceleration control over circular path segments, significantly increases the processor's computational load. With a large part of the processor resources dedicated to interpolation, the number of axes controlled by a single processor is limited. The UBC controller uses an interpolation scheme which frees the master processor of a major part of the interpolation burden. On the UBC controller, the time consuming interpolation task is distributed between multiple processors by a two stage interpolation algorithm [62]. Each incremental position APk calculated during the first stage is broken down into m second stage position increments —*-. Figures 4.14 and 4.15 show three incremental position commands at different command velocities for the case of m=4 second stage steps. The size of the first stage increments determines the feed rate. The first stage or coarse interpolation is performed in the master processor while the second stage or fine interpolation and acceleration control is delegated to the slave axis processors.  Chapter 4.  Process Monitoring  AP, AP, AP,  0  T  2T  3T  Figure 4.14: First stage incremental position commands  AP 3  m AP 2 m  m  o  T  2T  3T  Figure 4.15: Second stage incremental position commands  The requirement to perform trapezoidal velocity profiles and process control functions necessitates that the controller vary the feed rate during a motion command. Implementation of coordinated feed rate control for all axes leads to a significant increase in processing time at the master and restricts the number of axes accommodated.  In order to circumvent this  limitation, one axis processor is designated as the coordinator and performs velocity profiling for all axes by using a front plane communication system consisting of two logical signals connected to all the slave boards. The first signal is a periodic pulse generated at the loop closing frequency by the coordinator axis board. The pulses synchronize the update frequency of all slave boards; all boards read this line and begin processing at the rising edge of the  Chapter 4.  Process Monitoring  55  pulse. The second signal is used to communicate the current state of the system to all the processors. Every processor writes to this line at the end of its processing activity and reads from it at the beginning of its processing activity.  The logic state of the "state line"  determines if the interpolation should continue. This scheme is used to modulate the feed rate at the loop closing frequency of 1 KHz for both velocity profiling and process control purposes without involvement of the master processor [60]. The reduced load at the master processor and the decreased information transfer over the bus, in conjunction with an open architecture design allows the extension of the controller's functionality by addition of commercial peripheral boards. For example in this project, a Digital Signal Processor (DSP) was added to perform data acquisition and force control. A schematic of the controller is shown in Figure 4.16. Pottier has described the basic axis control card in detail [60] and the control system's design philosophy is under publication [63]. In reference to Figure 4.16, the master processor handles the operator interface needs, and does the first stage interpolation; the axes processors perform the second stage interpolation and axis control functions; the monitoring processor does data acquisition and process control; the front plane bus provides a direct communication channel between the slave boards. STD BUS  Master CPU 80x86 Coordinating Line  Slave CPU Axis 1  I  Slave CPU Axis 2  I  \  Slave CPU Axis 3  I  State Line Front Plane Bus Figure 4.16: Schematic of the control system architecture  Monitoring / A i / Sensors c And \ Control V  I  Chapter 4.  4.3  Process Monitoring  56  Laboratory Setup The laboratory setup used to for the cutting force monitoring and control scheme is  shown schematically in Figure 4.17. The Hitachi Seiki NC Lathe is retrofitted with the UBC controller and modified to accomodate the tool post dynamometer (see appendix A). The dynamometer characteristics were mentioned in section 4.2.2. Pottier [60] has documented in detail the implementation of the standard motion control functions with the UBC Controller. Work piece  Charge Amplifiers  Nicolet Scope  Computer  (PCB Model 463A dual mode)  Figure 4.17: Laboratory setup Installation of a MOTOROLA 89CT30 Integer Digital Signal Processor board (DSP) in the controller added process control capability. The DSP performed data acquisition, data processing, and feed rate control. The dynamometer force signals, conditioned by the charge  Chapter 4.  Process Monitoring  57  amplifiers and the digital filter, digitized by the DSP board's analog to digital (A/D) module, were compared to the set limits communicated to the DSP by the master CPU as described in chapter 3. Upon detection of a force limit2 violation, the DSP continuously wrote a low logic value to the state line until the force fell below the limit. The low state line stopped the interpolation activity on all axis boards which stopped the feed motors once the error buffers were emptied. This scheme can only reduce the feed rate which is sufficient for passive force control; the implication for process optimization is discussed in chapter 5.  2. Presently only the power consumming force is constrained.  Chapter 4.  4.4  Process Monitoring  58  Control Algorithm Although the controller was able to reduce the force value by simple switching of the  state line, derivative control was added to help decrease the force oscillations. A model of the closed loop position control was used to simulate the effect of the derivative action and the controller gain was fine-tuned before tests were conducted on the lathe. The Z-axis position loop block diagram is shown in Figure 4.18. Put  <>k  D(z)  ok —>  I ->  D/A  T 1 — > Jeep  U)  1 s  ->  Ke  Pul  V  V ^  Figure 4.18: Z-axis position loop block diagram Values of the control loop constants are listed in Table 4.1. The system bandwidth calculated from the closed loop transfer function was 13 Hz. The digital filter used had the following form:  {l + Bz-1) (4.9)  0 =G e  k i k-G2ek-l-GPk-l  where: Gj=G,  G2=GA,  G3=B  The equivalent inertia Je was based on the sum of the motor inertia and an estimate of the ball screw and saddle inertia. The 8 bit D/A had a range of ±10 V which gave the indicated gain. The encoder gain Ke, the tachometer gain H , and the motor torque constant Kt were found from the manufacturer specifications.  Chapter 4.  Process Monitoring  59  The velocity loop was approximated by a first order system. The gain K and the time constant x in Figure 4.19 were determined experimentally. K was found by correlation of the command voltage with the tachometer voltage output for 10 feed rates. To find the time constant, a position move was executed, the state line was brought low in the middle of the move to stop the motion and the motor velocity trace was recorded. This was done to bypass the influence of the acceleration and deceleration routines on the motor response at the beginning and at the end of a motion command. \  K  0)  TS+1  Figure 4.19: Velocity loop model The tachometer voltage gain Kv and the current gain Ka were found using the values of Hg, K, x, J^, and Kt found above and the relationship below:  K - — 1 Kc TS + 1  KvHg eq  (4.10) \S + l  Ka was used to calculate the current which was then limited according to the setting on the lathe's servo amplifier.  Chapter 4.  Process Monitoring  60  Z-axis Control Loop Constants  Symbol  Value  Equivalent inertia of the feed drive  J ea  0.04 fN.m-s2J  Encoder Gain  *e  636.6 [Pulselrad]  Digital Filter parameters  Gj  0.24966  G2  0.22583  G3  0.9  ald  0.07813 [Vllevel]  K  15.447 [radlslV]  A/D converter gain  K  Velocity loop gain Velocity loop time constant  X  Tachometer gain  Hg  0.02865 [V/radls]  Current gain  Ka  65.07 fA/VJ  Tachometer voltage gain  Kv  2.2568 [V/VJ  Motor torque constant  *t  0.543 A]  17.5 [mS]  Table 4.1: Constants for the z-axis position control loop Once the feed drive dynamics and the tool motion are modeled, the simulation must calculate the cutting force. Equation 2.8 was used to find the main cutting force Fv. The constants representing the cutting pressures Kj and K2 in the equation were determined experimentally. Three straight passes were taken with the same tool at constant depth, and speed, but at three different feed rates. The power consuming force was sampled during each pass. To solve for the cutting pressures, the only unknowns in Equation 2.8, this equation was evaluated for two different passes and solved simultaneously. The constants used and the cutting pressures are listed in Table 4.2.  Symbol  Value  Tool nose radius  R  1.2 [mm]  Tool approach angle  8  0°  Depth of cut  a  2.0 [mm]  Feed rates  S  0.1, 0.2, 0.3 [mm/rev]  *7  836 [Nlmm2]  K?  55 [Nlmm2]  Cutting pressures  Table 4.2: Constants for calculation of cutting pressures  Chapter 4.  Process Monitoring  61  There is an inherent dynamic relation between feed and chip thickness in turning. Since cutting force is related to chip thickness, the simulation must include this effect when calculating force values. During transients such as a step change in depth of cut or entry into the workpiece, the chip thickness approaches a constant value after approximately one spindle revolution. Figure 4.20 explains the reason for this relationship graphically. The simulation models this effect through a one spindle revolution delay term. The C program is included in appendix B. B  ^  I*  r8  1  tu  1  1  1  ft  K ^  al  /">  1->  2 3 Revolutions  11// 11 / /  nd  > Feed  /a1*  2 3 Revolutions h  ni  I  -+> 5  4  I  I  1  \  4 ltd  /  ^ 1  1  Feed (•>)  Figure 4.20: Effect of transients on the chip thickness  \'  Chapter 4.  Process Monitoring  62  The force control criterion used in the simulation was based on the instantaneous value of force and its rate of change: (4.11)  F, + ^ ^ s F dt  The simulation results for the scenario depicted in Figure 4.21 for a step change in depth of cut from 2 to 4 mm at 0.25 mm/rev is shown in Figures 4.22, 4.23, and 4.24. These figures indicate instances of no force constraint, a 400 N force constraint and a 400 N force constraint and derivative control respectively. Although the controller limits the force with no derivative control, the force level oscillates about the limit. The derivative action reduces the oscillation. After a few simulations, fast response and low oscillatory behavior was achieved with a derivative gain of 30 ms. The steady state error which results after the step change in depth is related to the second stage interpolation increments and is explained in detail in the discussion following the experimental results. The spike at the transition from 2 to 4 mm depth of cut is due to the assumption that the tool has an infinite stiffness. The forces are calculated based on: Fv=k,A  + k2le  (4.12)  The program assumes that the entire active cutting edge length le engages the workpiece immediately, whereas in reality the tool deflection makes this a gradual process. The low amplitude oscillation of the cutting force results from the variation in force induced by a feed rate change.  <N  JL.  _^_.  Figure 4.21: Tool path for simulated step change in depth  Chapter 4.  Process Monitoring  63  Simulation of Step Change in Depth of Cut-A No Force Constraint 1  1100 1000 900 800  Straight pass with step change in depth Depth of Cut: 2 to 4 mm Feed: 0.25 mm/rev Speed: 600 rpm Work piece: Aluminum  0.9 0.8 0.7  700  400  J 0.5 1 0.4 1  300  0.3  200  0.2  100  0.1  0.6  600 500  0  0 Time [S]  Figure 4.22: Cutting force simulation without force constraint  Simulation of Step Change in Depth of Cut-B Force Constraint: 400 [N] 900 800 700 600  Straight pass with step change in depth Depth of Cut; 2 to 4 mm Feed: 0.25 mm/rev Speed: 600 rpm Work piece: Aluminum No Derivative Action  g500 £  400 300 200 100 0  Figure 4.23: Force constrained cutting force simulation without derivative control  Chapter 4.  Process Monitoring  64  Simulation of Step Change in Depth of Cut-C Force Constraint: 400 [N]  Figure 4.24: Force constrained cutting force simulation with derivative control After the model formulated in this chapter and the control algorithm were both experimentally verified a number of experiments were designed to determine the performance of the system under various cutting conditions. These experiments and their results are discussed next.  4.5  Experimental Results Two experiments were designed to examine the performance of the proposed force  control scheme under different conditions.  In the first experiment, the feed rate was  incrementally increased while the depth of cut was held constant. In the second experiment, a step change in depth of cut was introduced while the feed was kept constant.  Both  experiments raised the power consuming force Fv beyond its set limit and the controller had to decrease the force value by reducing the feed. The experiments were done with an aluminum 6061 workpiece, Sandvik MTGNR-164D T-MAX M tool holder and TNMG 433, K20 insert.  Chapter 4.  Process Monitoring  65  In the first experiment, the feed rate was incrementally increased and Fv and feed rate traces were recorded. Two 15 mm long straight passes were taken. During each pass, the feed rate was increased from 0.15 to 0.25 to 0.35 mm/rev with each feed rate active over a 5 mm segment. This scenario is depicted in Figure 4.25. The negative sign of the feed rate in the graphs indicates that the motion is in the negative z direction (i.e. toward the chuck). No force constraint was imposed during the first pass. The feed rate and Fv traces obtained are shown in Figure 4.26. The dynamometer force signal was low pass filtered at 300 Hz to remove the high frequency noise for display purposes. Both traces were sampled at 200 Hz with the Nicolet oscilloscope, but for convenience only every third point is plotted. The feed rate signal from the tachometer was post processed by a 10 point running average digital filter to reduce the noise content. As expected, Fv increases with an increase in feed and reaches 800 N at 0.35 mm/rev. Note that the forces encountered at 0.25 mm/rev correspond to those obtained by the simulation (Figure 4.22). The effect of noise in the force signal on the performance of the control algorithm is discussed shortly. Feeds [mm/rev]:  H"  0 25  0.15 5 mm >|< . i. 35mmm 5 mm m >^ 0 35  (N  JL  work piece Figure 4.25: Tool path for feed experiment  tool  Chapter 4.  Process Monitoring  66  Single Pass At Three Feed Rates-A No Constraint  900 800 700 600  Straight pass at three feed rales Depth of Cut: 2 mm Feeds: 0.15, 0.25,0.35 mm/rev Speed: 600 rpm Work piece: Aluminum 6061 Insert: TNMG 433, K20 Holder: MTGNR-164D  500 400 300 200 100 0 -100 4.5  5.5  6.5  7.5  8.5  9.5  10.5  11.5  12.5  13.5  14.5  15.5  Time [S]  Figure 4.26: Single pass at three feed rates without force constraint A second pass was performed with the same conditions, except a 400 N force limit was imposed. Comparison of Figure 4.26 with 4.27 shows that the controller effectively enforced the force limit. The algorithm maintained the force well below the set limit at 325 JV during the first segment. The force level moved closer to the limit during the second and third segments. The feed was reduced by half to maintain the force within the limit during the last segment. These results apart from demonstrating the ability of the controller to limit the force imply a relationship between the final force level, the force limit value, and the command feed rate.  Chapter 4.  Process Monitoring  67  Single Pass At Three Feed Rates-B Force Constraint: 400 [N]  900 800 700 600 500  Straight pass at three feed rates Depth of CUt: 2 mm Feeds: 0.15, 0.25,0.35 mm/rev Speed: 600 rpm Work piece: Aluminum 6061 Insert: TNMG 433, K20 Holder: MTGNR-164D  9  10  11  12  13  14  15  16  Time [S]  Figure 4.27: Single pass at three feed rates with force constraint The connection between feed rate and the final force level is explained in relation to the interpolation scheme and the feed drive dynamics. As mentioned before when the state line logic is set to low, interpolation stops. However, the system does not stop instantaneously because of the feed drive dynamics (17.5 ms time constant) and the remaining error in the register (following error). At a low feed rate, the size of second stage incremental position command is small which means both the following error and the feed drive momentum are also relatively small. When the ready line goes low, the feed rate is reduced rapidly and the force drops quickly. At this point the ready line is pulled high, but the small position increments do not accelerate the system quickly. Again the control algorithm detects a rising trend in the force and pulls the ready line low. This behavior keeps the force well below the limit at lower feed rates. Higher feed rates create a different scenario. At high feed the position increment size is larger and one interpolation increment adds a significant error to the register. This may raise  Chapter 4.  Process Monitoring  68  the force close to or even over the limit before the next low state line comes into effect. The deceleration is also more rapid at higher feeds; thus, a force drop is quickly detected by the control algorithm and the interpolation is restarted. Another large increment is added to the error register which increases the force until the error is fully diminished. The net result is that the force gets closer to the limit or overshoots it at higher feeds. This situation is further aggravated by the force signal noise. Although noise is random and causes an even number of untimely state line switches, the effect of an erroneous high state line is greater than an erroneous low state line. The low state line stops interpolation for one clock cycle whereas a high state line adds an increment to the register which may take longer than a clock cycle to execute. This effect is especially noticeable at higher feeds. As mentioned above, the second stage position increments are larger at higher feeds, so the addition of an increment to the error register due to an erroneous high state line would have a more pronounced effect. In the second experiment, a step change in depth of cut was introduced at about the 9 second mark and Fv and feed rate traces were recorded. Two passes were taken, each at 0.25 mm/rev feed rate with a step change from 2 to 4 mm in depth of cut half way through the pass. No force constraint was imposed during the first pass. Figure 4.28 shows the force and feed rate traces which were acquired as in the previous experiments. This figure may be compared to Figure 4.22 which shows the simulation results for the same operation. A 400 N force limit was set for the second pass. As shown in Figure 4.29, the force level was kept at the limit during the segment with 2 mm depth of cut. When the depth of cut increased to 4 mm, the actual force which reached nearly 3 times the limit when no constraint was applied resulted in a 20% overshoot. The reason for the overshoot is related to the interpolation effect described above. Although in this case a constant feed was used, the increased depth of cut amplified the effect of the interpolation related effects. Nevertheless, the controller's performance is stable and improvements are possible by addition of an integral action to reduce the steady state error.  Chapter 4.  Process Monitoring  Step Change in Depth Experiment A No Constraint  10  12  11  Time [S]  Figure 4.28: Step change in depth experiment without constraints  Step Change in Depth Experiment B Force Constraint: 400 [N]  1300 1200 1100 1000 900 800 , 700 ' 600 500 400 300 200 100 0 -100  Single pass with a step change in depth of cut Depth of Cut: 2 to 4 mm Feed: 0.25 mm/rev Speed: 600 tpm Work piece: Aluminum 6061 Insert: TNMG 433, K20 Holder: MTGNR-164D  8  10  11  Time [S]  Figure 4.29: Step change in depth experiment with constraints  12  13  Chapter 4.  4.6  Process Monitoring  70  Discussion and Conclusion In this chapter a force control scheme was presented which used the force limits  dictated by the machining language and the feed rate control capability of the UBC Controller to monitor the cutting force.  The simulation and experimental results demonstrated the  performance of the system. This control scheme is inherently different from the usual adaptive force control algorithms (AC). Adaptive force control systems usually keep the force at a constant value by active control of the process parameters. The present system, on the other hand, remains passive until the force exceeds the prescribed limit. These two approaches have different objectives. AC systems use force control as a means to increase metal removal rate, whereas the present scheme uses force control to ensure safety and product quality. Nevertheless, a comparison of the two systems is justified on the basis of their performance during an entry transient when a sudden increase in force causes the limit to be exceeded. A recent publication shows the performance of a robust PI turning force control system designed by Chen and Chang [64]. Their results for machining steel with a 2 mm step change in depth of cut at 600 rpm and 0.45 mm/rev with a 900 N force limit is shown in Figure 4.30. At the step change the force limit is exceeded by 100%. Figure 4.32 shows the results obtained by the scheme implemented on the UBC controller for a similar force control scenario. Although the workpiece used in the current experiments was aluminum, whereas Chen used steel, the lower force limit in the present experiments makes the two results comparable. The present system is capable of controlling the large rise in force during transients. This is mainly due to the faster sampling time of 1 ms compared to 20 ms used by Chen and the more effective feed rate control scheme used.  Chapter 4.  Process Monitoring  71 g-0.4x10 h-1.6xt(f n«600pp«  l«o)  fln«/r«v] 0.50 T  ,-2 g«0.4x10 h-I.BxIO ' n"600rp«  l«b)  Figure 4.30: Cutting force algorithm performance (after Chen and Chang [64]) Chapter 5 will discuss how a process optimization scheme could be implemented in conjunction with the force monitoring technique described above.  Chapter 5 Process Optimization  5.1  Introduction Real-time process control plays an important role in the economic optimization of the  metal cutting process. The calculation of the optimal feeds and speeds prior to machining based on the predicted cut geometry with a process model does not necessarily guarantee the optimality of the process. Unforeseen conditions, variable workpiece hardness and geometry, deviations from the process model, and variations in the machining setup necessitate the monitoring and modification of the cutting process parameters in real-time. As explained in chapter 4, the ability to monitor and control the process parameters enhances machining safety, product quality, and machine utilization. However, a real-time process optimization strategy is still needed to fine tune the machining parameters so that optimality is maintained in the face of process requirements or unmodeled variations. Chapter 3 showed how to calculate technological parameters during operation planning and pass them to the controller for real-time optimization. This chapter first explains the optimization scheme and then shows its implementation within a novel control architecture.  72  Chapter 5.  5.2  Process Optimization  73  Process Control and Optimization Optimization during machining implies real-time identification and control of  technological parameters to improve the process economics within product quality and machining safety limits. The effectiveness of an optimization strategy is dependent on the accuracy of the process model, the choice of controlled parameters), the capability of the sensor(s), the effectiveness of the control algorithm and the architecture of the control hardware. Research systems often excel in some of these areas, yet fall short in others. The objective here is to demonstrate a system that takes advantage of the latest developments in these areas. The process mechanics, the sensors used and the control architecture were described in previous chapters. This chapter will explain how a control algorithm can use this setup for process optimization.  A review of other approaches would serve well as an  introduction.  5.2.1 Adaptive Control Systems for real-time control and optimization of process parameters are categorized as adaptive control (AC). The term adaptive control in machining literature refers to a control system which alters the machining conditions based on process feedback.  In the control  literature, on the other hand, adaptive control implies a system that adapts the controller parameters as well as the machining parameters to changes in process conditions. Such systems are called parameter adaptive for clarity [65]. Adaptive control schemes are further classified into adaptive control constraint (ACC) and adaptive control optimization (ACO). ACC systems generally seek to maximize the metal removal rate while observing one of the practical constraints of cutting force, spindle torque or power. ACO systems on the other hand, attempt to optimize a performance index based on an economic model relating the material removal rate to the cost of machining. The approach  Chapter 5.  Process Optimization  74  used in this thesis falls under adaptive control optimization (ACO) as defined in the machining literature. Since the majority of AC systems are of the ACC type, these systems are discussed first. Researchers have developed numerous ACC systems over the years. One of the main challenges in the design of an ACC controller based on classical control theory is stability over a wide range of cutting conditions [66]. Since the conual system parameters vary with changes in process parameters such as depth of cut, the controller's performance is degraded, often to the point of instability. Parameter adaptive systems were developed to address this issue [67, 68]. These systems adjust the controller parameters, typically the gains, according to the information received from the process and try to maintain the desired closed loop controller performance in the presence of process variations. ACC systems typically maximize the metal removal rate by increasing the feed until a controlled parameter reaches its specified limit. Most often cutting force is the regulated parameter [69, 70, 67, 64]. Although a 30-50% productivity improvement is reported with ACC systems [71], they do not ensure optimization of the process economics since the choice of parameters and their limits are not based on a fundamental economic analysis of the process. Adaptive control optimization systems optimize an economic performance index to within the practical constraints of the process. ACO is a more ambitious approach since the economic models used require information about a number of process parameters, some of which are not easily measured. Although ACO is potentially more effective as an optimization strategy, it has encountered limited success primarily due to the need to track tool wear [72]. The fact that tool wear monitoring is not required in ACC systems is one of the main reasons for their popularity.  Chapter 5.  Process Optimization  75  5.2.2 Optimization Scheme The control scheme used in this thesis attempts to procure the benefits of ACO in a practical system. The equivalent chip thickness, a parameter chosen based on the analysis of the process mechanics, is the key to this approach. An equivalent chip thickness limit would prevent tool breakage while a constant value of chip thickness would result in uniform tool wear rate. The relevant theory appears in the works published by Yellowley and Adey [73, 31] and was covered in chapter 2; however, the key points are reiterated here in the light of real-time process optimization. A major distinction between other adaptive control algorithms and the scheme used in this work is the controlled parameter. ACC systems commonly control a single component of cutting force because it is easily measured and it is directly related to the chip load. Developers of force constrained AC systems maintain that a constant force level ensures tool integrity and part accuracy during the cutting operation. A force limit is indeed needed to ensure part accuracy and machining safety; however, tool integrity is a function of the force distribution rather than the force level. For example, a tool performing a deep cut can often safely withstand a large cutting force because the force is distributed over a longer active cutting edge. As explained in chapter 2, the maximum value of equivalent chip thickness H e , which is related to the maximum force per unit length of the active cutting edge [16], is a more suitable parameter to use for an edge breakage criterion. ACC systems which maintain the force at a specific value may in fact dictate sub-optimal machining conditions since a constant force limit does not account for changes in depth of cut which allow the tool to bear a larger force and higher feeds. An He limit in conjunction with force constraints, would allow the controller to achieve higher feed rates while maintaining product quality and safety requirements.  Chapter 5.  Process Optimization  76  Maintenance of the product of equivalent chip thickness and velocity at a constant value (Equation 2.15) would ensure a uniform tool wear rate. This would allow prediction of the useful life of the tool which circumvents the wear tracking problem attributed to ACO schemes. Current techniques cannot detect small changes in tool wear rate over short time intervals under variable cutting conditions [74, 75]. Since the performance indices used by ACO strategies depend on accurate wear rate data, such approaches are typically rendered ineffective. A strong correlation between equivalent chip thickness and the tool wear rate at constant cutting velocity [10] presents an opportunity to bypass this problem. Provided that the average tool life is known for a tool operated at a set value of equivalent chip thickness (Hemax\,  a reliable value of tool life is obtained without on line wear measurement. Even  when other constraints reduce the feed such that the chip thickness value drops below the specified value, the controller could alter the velocity to maintain a constant value of tool life. Implementation of a control scheme based on constant equivalent chip thickness would require real-time calculation of its value. Adey has described an identification algorithm which uses the cutting force and the tool geometry data to identify the feed, the depth of cut, the engaged cutting edge length and thereby the equivalent chip thickness [29]. The feed is then adjusted to maintain a value of equivalent chip thickness which optimizes the process economics. This algorithm extracts process information from force ratios to minimize the effect of tool wear on the calculations. In this thesis, the equivalent chip thickness was not obtained through the above algorithm; a simple relation between the forces and the equivalent chip thickness was used instead. Adey has already shown the practicality of his algorithm. The author's objective was to demonstrate the feasibility of the equivalent chip thickness control scheme with the UBC controller. To simplify this task Lai's conclusion was used instead of a full implementation of Adey's method. Lai showed that for a sharp tool, there is a fairly linear relationship between the ratio of the thrust force to the power consumming force and the reciprocal of the  Chapter 5.  Process Optimization  11  equivalent chip thickness value [18]. Figure 5.1 depicts the relation for a sharp tool (wear land = 0 mm) and also shows the influence of wear (wear land = 0.3 mm).  MATERIAL' A1SI 4 3 4 0 (HB 320) 1MSERT. TPG432. K45 HOLDER. KTAR 854C, * * 0 , a * 5 SPEED' 100 M/MIM DEPTH OF CUT. 2.54 nn N  0.88  r  0.80  -  0.72  -  0.64  -  0.56  -  0.48  -  0.40  -  0.32  16  1/he  20  24  1  (nn- )  Figure 5.1: Force ratio versus equivalent chip thickness relation (after Lai [18]) The force ratio-chip thickness relation was found for the present setup experimentally. Four passes were taken at 2 mm depth each at a different feed rate ranging from 0.1 to 0.3 mm/rev. With prior knowledge of the tool geometry, the tool path and the cutting parameters, the equivalent chip thickness was calculated for each pass with Equations 2.5 to  Chapter 5.  Process Optimization  78  2.7. During each pass the DSP sampled the three cutting forces Fa, Fr and Fv. The average value of the forces for each pass was used to calculate the ratio of the thrust force Ft to the power consuming force Fv: EL  \F;+F;  (5.1)  F,  A linear regression analysis gave the following relationship between the force ratio and the chip thickness: F  0.008652  R2 =0.995  + 0.5671  (5.2)  The experimental data and the best fit line are shown in Figure 5.2. The use of the thrust force, which is the resultant of the axial and the radial components of the cutting force, maintains the above relationship's validity for variable depths of cut and different tool motion directions.  The Force Ratio (Ft/Fv) - Equivalent Chip Thickness Relationship For sharp tool only 0.69 Material: Aluminum 6061 Insert: TNMG 433, K 420 Holder: MTGNR-164D 0.67 Speed: 600 rpm Depth of Cut: 2 mm 0.66 + Feeds: 0.1, 0.15,0.2,0.25 mm/rev 0.68  £  0.65 0.64 0.63 0.62 0.61  •+0  6  8  10  1/He [1/mm]  Figure 5.2: Force ratio versus the inverse of equivalent chip thickness  12  14  Chapter 5.  Process Optimization  79  Equation 5.2 is only applicable for a sharp tool. According to Lai, the relation between the reciprocal of chip thickness and force ratio relation becomes non linear with tool wear. In this thesis the chip thickness control experiments were conducted with an Aluminum workpiece and a carbide insert. Since Aluminum is relatively soft, there is negligible tool wear during the experiments. The range of experimental feeds used gives chip thickness reciprocal values of 0 to 12 mm"1 which falls within the linear part of Lai's sharp tool relation shown above. Equation 5.2 was used in place of Adey's identification algorithm on the DSP to identify the equivalent chip thickness value from the cutting forces. A control scheme was needed to maintain a specified value of equivalent chip thickness by adjusting the cutting parameters .  5.2.3 Control Algorithm The parameters which control the value of the equivalent chip thickness during the cutting operation appear in Equations 2.5 through 2.7. Control of the chip thickness by variation of the depth of cut or parameters related to the tool geometry is awkward. The most practical way to control chip thickness is through control of the cutting speed and feed. Since effective spindle speed control was not yet implemented on the laboratory lathe, only feed control was used for the experiments. Although the proposed ACO scheme requires spindle speed control, once feed rate control is realized, speed control is fairly easy to implement. Speed control is needed when constraints such as force reduce the feed and cause the chip thickness value to drop below the specified level. Speed control would attempt to maintain a uniform tool wear rate without violation of the activated constraint. Nevertheless, the first step toward the proposed ACO method is to control the chip thickness with the feed rate. Once this is achieved, addition of speed control would implement the optimization strategy.  Chapter 5.  Process Optimization  80  To control the chip thickness, the master processor sent the chip thickness limit to the monitoring board which campared the value to the measured one and adjusted the feed accordingly.  To reduce the computational load and speed up execution time, the chip  thickness limit was first converted to the corresponding force ratio with Equation 5.2. The actual force ratio was calculated once every millisecond. The three components of force sensed by the dynamometer were sampled by the DSP. It calculated the thrust force from its radial and axial components and evaluated the ratio of the thrust to the power consuming force. The actual and the set force ratios were compared to determine the required control action. The equivalent chip thickness value was controlled by regulation of the feed rate with the state line, similar to the case of force control. However, the requirement to maintain a constant value of equivalent chip thickness required the ability to increase as well as to decrease the feed rate. Since the controller is only capable of reducing the feed rate, the scheduled feed sent to the axis boards was always set to exceed the equivalent chip thickness limit. In this manner the controller could reduce the feed with the state line or let the feed increase by simply remaining passive. The derivative action used in force control, was also applied here to improve the controllers performance. The control action was based on the last calculated value of the equivalent chip thickness and the rate of change of chip thickness. In the computer code, the force ratio corresponding to the chip thickness value was used for computational efficiency. Thus, the control criterion for equivalent chip thickness was: dF . *'ratio + ^d  ~~7  S  ^ratiomsa.  lp•A)  with A^=30 mS as the gain for the derivative term. The derivative action allowed the controller to anticipate quick changes in chip thickness value and reduce the overshoot and the oscillations. The C routine for this algorithm is in appendix A.  Chapter 5.  Process Optimization  81  It is important to emphasize the distinction between equivalent chip thickness regulation and force control in this thesis. A force limit is imposed to guard against machine damage and to ensure product quality requirements. As such, a force limit is enforced only when the specified limit is exceeded. In the case of equivalent chip thickness, the cutting parameters (in this case the feed) are continuously adjusted to maintain a constant value of He that would maximize the metal removal rate without tool damage and allow prediction of the tool wear rate for economic optimization of the process. The force limit is then a passive constraint while equivalent chip thickness is an actively regulated one. As alluded to before, a practical adaptive control system needs to simultaneously control chip thickness as well as other physical constraints such as force.  A number of  experiments were designed to demonstrate the capability of the controller to handle multiple constraints. Even though speed control was not implemented during these experiments, the regulation of feed to control force and equivalent chip thickness illustrates the capability of the system and its potential to perform speed control as well. The force control scheme developed in chapter 4 was combined with the chip thickness control described above. In this multiple constraint situation, an arbitration scheme is needed. To ensure machining safety, the controller's response to the force constraint should override the equivalent chip thickness constraint. Ideally when a force constraint reduces the feed, speed control should be used to maintain a uniform wear rate. However, in the absence of speed control, only the feed rate was reduced in response to the activated force constraint.  5.3  Experimental Results The proposed ACO scheme would in practice require the controller to maintain the  maximum value of equivalent chip thickness while observing the force limits that ensure rriachining safety and product quality. Therefore, a series of experiments were designed to demonstrate the capability of the controller to regulate both force and equivalent chip  Chapter 5.  Process Optimization  thickness simultaneously through feed control.  82 The tool-workpiece interface geometry  encountered while machining a 70° taper creates the necessary cutting conditions to activate both constraints (see Figure 5.3).  work piece  Figure 5.3: Tool-workpiece interface geometry during a taper cut Figure 5.3 shows that when a taper is machined at constant depth of cut, the workpiecetool interface geometry varies during the transition from the straight portion to the tapered portion.  The master processor scheduled a feed at the axis boards that exceeded the  equivalent chip thickness limit set for the tool path. During the straight portion, the control algorithm was expected to reduce the feed rate to give the required He value. Since the chip load is distributed over a longer edge length during the tapered portion, a drop in the equivalent chip thickness and an increase in the feed rate to compensate for the drop was expected. Usually, the force constraint would then limit the feed rate to observe safety and quality standards and adjustment of the spindle speed would ensure a uniform wear rate. In the absence of a spindle control system, the feed was simply reduced to observe the force constraint. The other feature of a 70° taper is the 6 mm depth of cut encountered by the tool at the transition between the straight and the tapered segments. The high cutting forces in this region test the controllers capability to limit large forces.  Chapter 5.  Process Optimization  83  The 70 degree taper was first machined with no constraints active and then with combined force and equivalent chip thickness constraints. The machining conditions for the first case and the experimental results are shown in Figure 5.4. The data was obtained and processed in the same way as in chapter 4. The main features to note are the force levels during the straight segment and the tapered segment and the peak force during the transition between the two segments.  70 Degree Taper Experiment No Force Constraint 1300 j 1200 - - Single pass with 70 degree taper Depth of Cut: 2 mm 1100 Feed: 0.25 mm/rev 1000 - - Speed: 600 rpm onn Work piece: Aluminum 6061 " Insert: TNMG 433, K20 800 - Holder. MTGNR-164D , 700 ' 600 500 400 300 200 100 -0 -100 13  14  15  16  17  18  19  20  21  22  23  Time [S]  Figure 5.4: 70° taper with no active constraints Figure 5.5 shows the results for the case where a 0.1 mm equivalent chip thickness and a 500 N Fv force limit were imposed. The expected value of Fv during the straight portion of the cut based on the cutting parameters, a 0.1 mm equivalent chip thickness and Equation 2.8 was 370 N. The experimental results show a value of 350 N which is within the expected range. The chip thickness constraint was inactive along the taper, but the 500 N force constraint limited the feed during this portion. During the straight to taper transition, where  Chapter 5.  Process Optimization  84  the depth of cut reaches 6 mm, the controller reduced the 1200 N force to about 600 N. The results show that the equivalent chip thickness constraint strategy allows higher forces during the tapered segment due to the different tool-workpiece interface geometry. However, often the force must be controlled to observe practical or quality constraints. This experiment demonstrates the system's capability to accommodate both economic and safety/quality considerations.  70 Degree Taper Experiment Constraints: He = 0.1 [mm], Fv = 500 [N] 1300 1200 1100 1000 900 800 , 700 600 500 400 300 200 100 0 -100  Single pass with 70 degree taper Depth of Cut; 2 mm Feed: 0.25 mm/rev Speed: 600 rpm Work piece: Aluminum 6061 Insert: TNMG 433, K20 Holder MTGNR-164D  -0.2 ->...AV.,. •- : - ^ v ^ v H . ^ r - ^ ' - • •  -+11  13  =f*  -+-  15  17  -0.1 0  -I-  19  21  23  25  27  Time [S]  Figure 5.5: 70° taper with constraints Other noteworthy features are the controller's performance during the transients. The initial rise to the equivalent chip thickness limit was quick and no significant overshoot occurred. During the corner transient, the tool encountered a gradual increase in depth of cut due to the taper angle; thus the force did not rise instantaneously as it did for the entry transient. During the exit transient which occurred at the end of the tapered segment, the feed rate first increased until the equivalent chip thickness constraint became active. As the force  Chapter 5.  Process Optimization  85  dropped further the feed approached its commanded value in an attempt to maintain the chip thickness level.  5.4  Discussion and Future Work This chapter showed the implementation of a rudimentary process monitoring and  optimization scheme. Force control was used to demonstrate the ability of the system to ensure process safety and product quality while chip thickness identification and control was used to improve the process economics. The advantage of the system lies in its ability to blend process control parameters with motion commands at small increments along the tool path to help the controller cope with the expected cutting condition variations. The force monitoring scheme guards against unexpected conditions which may damage the machine or degrade the workpiece finish. The process control parameters are generated based on the expected tool-workpiece interface geometry and the practical process model described in chapter 2. The feed rate control capability of the UBC Controller showed how inexpensive hardware and a simple algorithm can excel at controlling process conditions. Figure 5.6 summarizes the approach presented in this thesis. The machining language would use geometrical and technological information to generate motion planning and process control parameters. The axis control boards perform the motion control functions.  The  process control and optimization scheme on the technological board would initially use the guidelines sent by the master processor and then optimize the cutting conditions based on process feedback.  Chapter 5.  Process Optimization Part Geometry  86 Tool Geometry  Technology  Machining language on master processor Slave level process control and optimization  >  Axis Motion Control  Process Control  Cutting Process Figure 5.6: Overview of the thesis work In future, the machining language operation planning functions must be extended and the process parameters must be generated at the motion interpolation interval. Currently only a limited set of feature primitives are available and automatic tool selection is not implemented. The process control parameters which are now generated for a single motion stroke need to be calculated at the first stage interpolation frequency. These developments would make better use of the machining language and controller capabilities in performing operation planning and economic optimization.  Bibliography  [I]  Zorev, N. N., "Metal Cutting Mechanics", Pergamon Press, Oxford, 1966  [2]  Armarego, E. J. A., Brown, R.H., "The Machining of Metals", Prentice Hall, Inc., Englewood Cliffs, New Jersey, 1969.  [3]  Kronenberg M., "Machining Science and Applications", Pergamon Press, Oxford, 1966.  [4]  Mayer, J. E., "Estimated Requirements for Machine Tools During the 1980-1990 Period", Proceedings of the Machine Tool Task Force conference, Vol. 2, pp. 31-41, Oct. 1980.  [5]  Merchant, E., Journal ofApplied Mechanics, Vol. 11,1944, pp. A168-A175.  [6]  Merchant E.M., "Mechanics of the Metal Cutting Process. I. Orthogonal Cutting and a Type 2 Chip," Journal ofApplied Physics, Vol. 16, No. 5,1945, pp. 267-275.  [7]  Lee, E. H., and Shaffer, B. W., "The Theory of Plasticity Applied to a Problem of Machining," Journal of Applied Mechanics, Vol. 8,1951, pp. 405-413.  [8]  Usui, E., Hirota, A., "Analytical Prediction of Three-Dimensional Cutting Process, Part l~Basic Cutting Model and Energy Approach," ASME JOURNAL OF ENGINEERING FOR INDUSTRY, Vol. 100,1978, pp. 222-228.  [9]  Sabberwal, A. J. P., "Chip Section and Cutting Force During the Milling Operation," Annals of the CIRP, 1960, pp. 197-203.  [10]  Yellowley, I., "The Utilization of Numerically Controlled Machine Tools", Technical Innovation Studies Program Research Report, Canadian Office of Industrial Innovation, Ministry of Regional Industrial Expansion, June 1985.  [II]  Nakayama, K., Arai, M., Takei, K., "Semi-Empirical Equations for Three Components of Resultant Cutting Force", Annals of the CIRP, Vol. 32, No. 1, 1983, pp. 33-35.  87  Bibliography  88  [12]  Albrecht, P., "New Development in Theory of the Metal Cutting Process - Parti: The Ploughing Process in metal Cutting", Transactions oftheASME, 1960, pp. 348-358.  [13]  Spanns, C , "An Exact Method to Determine Forces on The Clearance Plane", Annals of the CIRP, Vol. 15, 1967, pp. 463-469.  [14]  Armarego, E. J. A., "Metal Cutting Analysis For Turning Operation", Int. Journal of Machine Tool Design and Research, Vol. 10,1970, pp. 361-379, Pergmon Press.  [15]  Luk, W. K., "Mechanics of the Turning Operation", Int. Journal of Machine Tool Design and Research, Vol. 10, 1970, pp. 351-360.  [16]  Bus, C , Touwen, N. A. L., Veenstra, P. C , Van Der Wolf, A. C. H., "On the Significance of Equivalent Chip Thickness", Annals of the CIRP, Vol. XVIV, 1971, pp. 121-124.  [17]  Woxen, R., "A Theory and an Equation for the Life of Lathe Tools", Ingeniors Vetenskaps Akadamien, Handliger 119, Stockholm, Sweden, 1932.  [18]  Lai, T. C , "The Influence of Tool Wear and Breakage on Forces in Bar Turning", Master of Engineering Thesis, McMaster University, 1986.  [19]  Colwell, L., "Predicting the Angle of Chip Flow for Single Point Cutting Tools", Transactions oftheASME, Vol. 76, 1954, pp. 199-203.  [20]  Stabler, G. V., "The Chip Flow Law and Its Consequences", Advances in Machine Tool Design and Research, Proceedings of the Fifth International MTDR Conf., Pergamon Press, 1964, pp. 243-248.  [21]  Hinduja, S., Huang, H., "OP-PLAN: an automated operation planning system for turned components", Institution of Mechanical Engineers, Part B: Journal of Engineering Manufacture, Vol. 203, 1989, pp. 145-158.  [22]  Yellowley, I., Kusiak, A., "Observations on the Use of Computers in the Process Planning of Machined Components", Transactions of the Canadian Society of Mechanical Engineers, Vol. 9, No. 2,1985, pp. 70-74.  [23]  Yellowley, I., Fisher, A. D., "The Planning of Multi-Volume Rough Machining Operations", submitted for publication  [24]  Maropoulos, P. G., Hinduja, S., "Automatic Tool Selection for Finish Turning", Institution of Mechanical Engineers, Part B: Journal of Engineering Manufacture, Vol. 204, 1990, pp. 43-51.  [25]  Hinduja, S., Petty, D. J., Tester, M., Barrow, G., "Calculation of Optimum Cutting Conditions for Turning Operations", Institution of Mechanical Engineers, Part B: Journal of Engineering Manufacture, Vol. 199, 1985, pp. 81-92.  Bibliography  89  [26]  Ermer, D., S., Kromodihardjo, S., "Optimization of Multipass Turning with Constraints", TRANSACTIONS OF THE ASME, Vol. 103,1981, pp. 462-468.  [27]  Lambert, B., K., Walvekar, A., G., "Optimization of Multi-Pass Machining Operations", International Journal of Production Research, Vol. 16, No. 4, 1978, pp. 259-265.  [28]  Hodgson, T., and Trendler, P., H. H., "Cubic Boron Nitride Machining; With Particular Reference to Cutting Tool Geometry and Cutting Forces When Machining Tool Steel", Mechanical Engineering Transactions, institute of Engineers Australia, 1981, p. 66.  [29]  Adey, D., "An Alternate Strategy to the On-Line Optimization of Turning Operations", Master of Engineering Thesis, McMaster University, Hamilton , Ontario, Canada, 1990.  [30]  Yellowley, I., Gunn, E., A., "The Optimal Subdivision of Cut in Multi-pass machining Operations", International Journal of Production Research, Vol. 27, No. 9, 1989, pp. 1573-1588.  [31]  Yellowley, I., Adey, D., "Force Models for Practical Multiedge Cutting Tools and Real Time Process Optimization", ASM: Proceedings of the International Conference on Factors Influencing Machining and their Control, 1989, pp. 179-187.  [32]  Yellowley, I., "A Fundamental Examination of the Economics of the Two Pass Turning Operation", International Journal of Production Research, Vol. 21, No. 5, 1983, p. 617.  [33]  Eversheim, W., Marczinski, G., Cremer, R., "Structured Modeling of Manufacturing Processes as NC-Data Preparation", Annals of the CIRP, Vol. 40, No. 1, 1991, pp. 429-432.  [34]  Shah, J., Rogers, M. T., "Functional Requirements and Conceptual Design of the Feature-Based Modeling System", Computer Aided Engineering Journal, February, 1988, pp. 9-15.  [35]  Shpitalni, M., Fischer, A., "CSG Representation as a Basis for Extraction of Machining Features", Annals of the CIRP, Vol. 40, No. 1,1991, pp. 157-160.  [36]  Shah, J., Sreevalsan, P., Mathew, A., "Survey of CAD/Feature-Based Process Planning and NC Programming Techniques", Computer Aided Engineering Journal, February, 1991, pp. 25-33.  [37]  Plummer, C. S., Hannam, R. G., "Design for Manufacture Using a CAD/CAM System - A Methodology for Turned Parts", Proceedings of the Institution of Mechanical Engineers, Vol. 197B, 1983, pp. 187-195.  Bibliography  90  [38]  Opitz, H., Berger, H., Budde, W., Engelskirchen, H., "Calculation of Technological Data for the Computer Assisted Programming of NC Machine Tools", Proceedings of the 1st International IFIP/IFAC PROLAMAT Conference, Rome 1965, Numerical Control Programming Languages, Amsterdam, London, North-Holland Publishing Company, 1970, pp. 243-259.  [39]  Hinduja, S., Barrow, G., "TECHTURN: A Technologically Oriented System for Turned Components", First International Conference on Computer Aided Production Engineering, Edinburgh, 1986.  [40]  Pountain, D., "Object Oriented Forth - Implementation of Data Structure", Academic Press Inc., Orlando, Florida, 1987.  [41]  Cho, K. K., Lee, S. H., Ahn, J. H., "Development of Integrated Programming and Monitoring System", Annals of the CIRP, Vol. 40, No. 1,1991, pp. 423-427.  [42]  Satine, L., Hinduja, S., Vale, G., Boon, J., "A Process-Oriented System For NC Lathes", International Journal of Machine Tool Design and Research, Vol. 23, No. 4, 1983, pp. 263-278.  [43]  Hinduja, S., Rao, P. N., Chan, W., Greenhalgh, C , Vale, G. H., "An OperatorDirected Control System For NC Drilling Machines", International Journal of Machine Tool Design and Research, Vol. 20, 1980, pp. 111-121.  [44]  Nackman, L. R., Lavin, M. A., Taylor, R. H., Dietrich, W. C , Grossman, D. D., "AML/X: A Programming Language for Design and Manufacturing", IEEE Proceedings, Vol. 7, 1986, pp. 145-59.  [45]  Taylor, R. H., Summers, P. D., Meyer, J. M., "AML: A Manufacturing Language", The International Journal of Robotics Research, Vol. 1, No. 3,1982, pp. 19-41.  [46]  Lister, P., M., Barrow, G., "Tool Condition Monitoring Systems", 26th International Machine Tool Design and Research Conference, 1986, pp. 271-288.  [47]  Dan, L., Mathew, J., "Tool Wear and Failure Monitoring Techniques for Turning - A Revies", International Journal of Machine Tools and Manufacture, Vol. 30, No. 4, 1990, pp. 579-598.  [48]  Yellowely, I., Lai, C , T., Altintas, Y., "Strategies and Sensors for the Real Time Identification of Cutting conditions in Turning and Milling Operations", Proceedings of the International Conference on Strategies for the Automation of Machining Processes, ASM, 1987, pp. 181-189.  [49]  Altintas, Y., Yellowley, I., "In-Process Detection of Tool Failure in Milling Using Cutting Force Model", Transactions of the ASME: Journal of Engineering for Industry, Vol. Ill, 1989, pp. 149-157.  Bibliography  91  [50]  Tlusty, J., Andrews, G., C , "A Critical Review of Sensors for Unmanned Machining", Annals of the CIRP, Vol. 28, No. 8, 1983, pp. 1-10.  [51]  Yellowley, I., Hosepyan, Y., Oyawoye, O. "The Identification of Machining Condition and Tracking of Tool Wear in Milling Using Machining Forces", The Winter Annual Meeting of the American Society of Mechanical Engineers, ASME, 1992.  [52]  Hosepyan, Y., "Tool Wear Monitoring", Master of Applied Science Thesis, University of British Columbia, Vancouver, B.C., Canada, 1991.  [53]  Week, M., Vorsteher, D., "Monitoring and Diagnosis Systems for Numerically Controlled Machine Tools", Proceedings of the 24th International Machine Tool Design and Research Conference, 1983, pp. 229-237.  [54]  Stein, J. L., Colvin, D., Clever, G., Wang, C. H., "Evaluation of DC Servo Machine Tool Feed Drives as Force Sensors", Transactions of the ASME: Journal of Dynamic Systems, Measurement, and Control, Vol. 108, 1986, pp. 279-288.  [55]  Stein, J. L., Shin, K. C , "Current Monitoring of Field Controlled DC Spindle Drives", Transactions of the ASME: Journal of Dynamic Systems, Measurement, and Control, Vol. 108, 1986., pp. 289-295.  [56]  Hadeby, H., "Increasing Availability and Efficiency by Monitoring the Cutting Process in a Lathe During Production with Limited Manpower", Annals of the CIRP, Vol. 38, No. 1, 1989, pp. 393-397.  [57]  Arsecularante, J. A., Hinduja, S., Barrow, G., "Force Data Acquisition Using Computer Process Monitoring", Proceedings of the Institution of Mechanical Engineers, Part B: Journal of Engineering Manufacture, Vol. 204, 1990, pp. 275286.  [58]  Yellowley, I., Pottier, P. R., "The Development of an Integrated Open Architecture machine Controller", First Atlantic Congress And Exhibition On Advanced Manufacturing And Engineering, Halifax, Nova Scotia, Canada, Sept. 10-12,1991.  [59] Greenfeld, I., "Open-System Machine Controllers - The MOSAIC Concept and Implementation", Proceedings of the Winter Annual Meeting of the ASME: Control Issues in Manufacturing Processes, San Francisco, CA, Dec. 10-15, 1989. [60]  Pottier, P. R., "Advanced Controller for Machine Tools", Master of Engineering Thesis, McMaster University, Hamilton, Ontario, Canada, 1991.  [61]  Bollinger, J. G., Duffie, N. A., "Computer Control of Machines and Processes", Addison-Wesley, 1988.  Bibliography  92  [62]  Yellowley, I., Pottier, P. R., "A Note On a Simple Method for the Improvement of Interpolation Accuracy in a General Purpose, Multiprocessor Based Motion Controller", International Journal of Machine Tools and Manufacture, Vol. 29, No. 2, 1989, pp. 287-292.  [63]  Yellowey, I., Pottier, P. R., "The Integration of Process and Geometry Within an Open Architecture Machine Tool Control System", submitted for publication 1992.  [64]  Chen, B., Chang, Y., "Robust PI Controller Design for a Constant Turning Force System", International Journal of Machine Tools and Manufacture, Vol. 31, No. 3, 1991, pp. 257-272.  [65]  Ulsoy, A. G., Koren, Y., Rasmussen, F., "Principal Developments in the Adaptive Control of Machine Tools", Journal of Dynamic Systems, Measurement, and Control, Vol. 105, 1983, pp. 107-112.  [66]  Masory, O., Koren, Y., "Stability Analysis of a Constant Force Adaptive Control System for Turning," Journal of Engineering for Industry, Vol. 107, 1985, pp. 295300.  [67]  Masory, O., Lin, B. S., "Optimal, Variable Gain Adaptive Control System for Turning", Transactions of SME: Proceedings of the 15th NAMRC, Vol. 2, 1987, p. 578.  [68]  Elbestawi, M. A., Sagherian, R., "Parameter Adaptive Control in Peripheral Milling", International Journal of Machine Tools and Manufacture, Vol. 27, No. 3, 1987, pp. 399-414.  [69]  Daneshmand, K. L., Pak, H. A., "Model Reference Adaptive Control of Feed Force in Turning", Transactions of the ASME: Journal of Dynamic Systems, Measurement, and Control, Vol. 108, 1986, pp. 215-222.  [70]  Tomizuka, M., Zhang, S., "Modeling and Conventional/Adaptive PI Control of a Lathe Cutting Process", Proceedings of the American Control Conference, Boston, Massachusetts, June, 1985, pp. 745-750.  [71]  Lewis, A., Nagpal, B. K., "Economic Considerations in Adaptive Control", Proceeding of the 22nd International Conference on Machine Tool Design and Research Conference, 1981, pp. 187-195.  [72]  Koren, Y., "Computer Control of Manufacturing Systems", McGraw Hill, New York, 1983.  [73]  Yellowley, I., Adey, D., "A New Approach to the Real-Time Optimization of Turning Operations", International Journal of Machine Tools and Manufacture, Vol. 32, No. 3, 1992, pp. 453-466.  Bibliography  93  [74]  Giusti, F., Santochi, M., Tantussi, "On-line Sensing of Flank and Crater Wear of Cutting Tools", Annals of the CIRP, Vol. 36, No. 1, 1987, pp. 41-44.  [75]  Jiang, C. Y., Zhang, Y. Z., Xu, N. J., "In-Process Detection of Tool Wear Stage by Frequency Band-Energy Method", Annals of the CIRP, Vol 36, No. 1, 1987, pp. 4548.  Appendix A  Tool post and mounting plate design documentation  94  Appendix A.  Tool post and mounting plate design documentation  2 /3/16  95  15/16  0  1/2 Diam. 3 holes, clear  ©^  1/2 Diam. 6 holes, threaded 3 7/8  1 1/4  0  1  © © ©  0  1 1/2  \ ^ \  19/16  1/2  V3  •si -a '"  O  S .2  1 1/2  "K ,—4  3/4  E2£5 ->K-  2 3/8 4 3/8  Figure A.l: Tool post  Appendix A.  Tool post and mounting plate design documentation  96  7 &  5/8"  d>  2 1/16 17 2 1/16 4 holes, clear 3/4 Diam. Counter sunk 17/32 deep  CM CO  in  0.5 Diam. 4 holes, clear  <D cd I H  G>-  ^  •*-'  OH  1/5  00 G  <u  3/8 ^ > <-  •4—*  G c (—1 G on Q T3 G  H  •i—t  s  T3  a  3 1/8  3/8  G O  C/3  G  g o G  (/>  <—  <-  T3  ^ o Q O  a Q  3  Figure A.2: Mounting Plate  *l  3  Appendix B  C routines for force simulation and process control  97  Appendix  B.  C routines for force simulation  and process  control  98  Program for simulation of closed loop position control and evaluation of the main cutting force #include "stdio.h" #include "string.h" #include "math.h" /• • • a : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / /* Force Monitor Simulation program. /* /**************************************************************/  #define gl 0.24966 #define g2 0.22583 #define g3 0.9 #define Tow 17.5e-3 #define Kv 2.2568 #define Ke 2506.377 #define Kda 0.078125 #define Ka 65.0666 #define Jeq 0.04 #define Kt 0.543 #define Hg 0.0286478 #define Tmax Imax*Kt #define Vcmax 10  /* G Digital filter constants: */ /• G*A 0(k)=gl*e(k)-g2*e(k-l)-g3*0(k-l) */ /*B */ /* time constant of the velocity loop [s] */ /* velocity loop gain [V/V] */ /* Encoder gain [pulse/rad] */ /* D/A gain [V/level] */ /* Servo Amp Current gain [A/V] */ /* equivalent inertia of system [N.m.sA2] */ /* Motor Torque constant [N.m/A] */ /* Tachometer gain [V/rad/s] */ /* Current limit [A] (Imax*Kt/Jeq) */ /* D/A voltage output limit */  #define 1 0.01 #defineMub 0.01 #definedm 0.033  /* ball screw pitch [m] */ /* ball screw guide coeff of friction */ /* mean diameter of the ball screw [m] */  #define #define #define #define #define #define #define  /* rake angle */ /* approach angle */ /* effective coeff of friction */ /* tool nose radius [mm] */ /* force ration Ft/Fv */ /* Cutting Pressures [N/mmA2] */ /* [N/mm] */  lambda -6 psi 0.0 Mu 0.6+0.005 *(lambda) R 1.2 r (Mu-tan(lambda))/(l+Mu*tan(lambda)) Kl 836 K2 55  #define Pul 1574.803 #define i_lrev floor(60./(RPM*dt)) #define i_prev floor(60000./RPM) #defineSize 8000 #definePI 3.141592654  /* [Pulses/mm] */ /* i/rev */ /* i - for previous spindle revolution */ /* Array size required */  float float float float float  /* /* /* /* /*  Tf,T; Fmax; Imax; dPv; Step = 2.0;  Friction and total torque [N.m] */ Force constraint [N] */ Current limit [A] */ Position ramp [mm/ij */ step change in DOC [mm] */  Appendix float float float float float  B.  C routines for  force simulation  DOC = 2.0; I; Vc[2]; Vo[2], dVo[2]; Pc[3], Po[Size];  float F[2]; float dF; float Pstep; int Tstp; float Kd_pos, Kd neg; float RPM; float s; float dt; float Fa; int output; int Out; FILE *outfile;  and process  control  I* depth of cut [mm] */ /* Current output */ /* Command velocity [V] */ /* Output velocity arrays [rad/s] */ /* Command, output and Position error /* [BLU] */ /* Force array [N] */ /* rate of change of force */ /* location of step change in DOC */ /* Time of step change in DOC [S] */ /* gain of derivative control [S] */ /* spindle speed [RPM] */ /* feed [mm/rev] */ /* sampling time [S] */ /* axial force [N] */ /* data output interval pts/sec */ /* data output interval ms/pt */  Print (i) int i; { fprintf(outfile,"%e %e %e ",i*dt, Pc[2], Po[i]); fprintf(outfile,"%e %e", F[l],Vc[l]*(Ke/Pul)/(RPM/60)); fprintf(outfile,"%e %e\n", Vo[l]*(Ke/Pul)/(RPM/60),I); }  * Initialize arrays with initial conditions * - no motion for the first revolution of the spindle * eg 75 ms for 800 RPM InitO { int i; int count=0; for (i=0; i<2; i++) { F[i]=Vc[i]=Vo[i]=dVo[i]=Pcli]=I=0.0; } Pc[3] = 0; for(i=0; i<i_lrev; i++) { Po[i]= 0.0; if (count == Out) { Print(i); count = 0; } count += 1; } ***************************************************************** * Finds the torque ****************************************************************/  Appendix B.  C routines for force simulation and process control  float Torque () { float T; T = Ka*Kt*(Vc[l]-Vo[l]*Kv*Hg); if (abs(T) > Tmax) { i f ( T < 0 ) T = -Tmax; else T = Tmax; } return T; }  /* current limit */  * Routine to implement current limit Chk_Curr () { float I; I = Ka*(Vc[l] - Vo[l]*Kv*Hg); if (abs(I)>Imax) { if (I<0) Vo[l] = ((-Imax/Ka)-Vc[l])/(-Kv*Hg); else Vo[l] = ((Imax/Ka)-Vc[l])/(-Kv*Hg); } } * Routine to calculate the main cutting force at current * depth of cut and feed. float Force (depth,feed) float depth, feed; { float Fv; float Le; Le = depth-R+R*PI/2+feed/2; Fv = Kl*depth*feed+K2*Le; return Fv; }  /* main cutting force [N] */ /* active cutting edge length [mm] */  * Routine to simulate i-th interval in a turning process * with force constraint Simulate (i) int i; { float Fcl, Fc2, Fie; /* forces encountered during a transient */ float Perri, P e r r i l ; /* position error in BLU */ float Kd; /* derivative control gain */ if (i == Tstp) Pstep = Po[i-lJ; /* start of the step change in DOC */ if ((i >= Tstp) && (i <= (Tstp+ijrev))) { Fcl = Kl*DOC*(Po[i-l]-Po[i-i_lrev]); Fc2 = Kl *Step*(Po[i-l]-Pstep); Fie = K2*((DOC+Step)-R+R*PI/2+(Po[i-l]-Po[i-i_lrev])/2); F[lj = Fcl+Fc2+Fle; /* -Fvarl; */  100  Appendix B.  C routines for force simulation and process control  if (i == Tstp+i_lrev) DOC += Step; /* adjust DOC after 1 rev. */ } else { F[l] = Force(DOC,Po[i-l]-Po[i-i_lrev]); } Fa = r*F[l]*cos(psi); /* axial force fN] */ Tf = Fa*(dm/2)*((l+PI*Mub*dm)/(PI*dm-Mub*l)); /* Friction torque [N.m] */ dF = (F[l] - F[0])/dt; if (dF < 0) Kd = Kd_neg; else Kd = Kd_pos; F[0] = F[1]; if ((Kd*dF) <= (Fmax-F[l])) Pc[2] = Pc[l]+dPv; else Pc[2] = Pc[l];  /* check sign of slope */ /* adjust gain based on sign */  /* Command Position [mm] */  /* Pc[i] = Pc[i-1] */ /* digital filter */ Perri = (Pc[l] - Po[i-l])*Pul; /* Position error in pulses (BLU's) */ Perri_l = (Pc[0] - Po[i-2])*Pul; /* Position error in pulses (BLU's) */ Vc[l] = (gl*Perri-g2*Perri_l-g3*Vc[0])*Kda; /* IV] */ /* extrapolated acceleration */ if(abs(Vc[l])>Vcmax){ /* D/A output limit */ if (Vc[l] < 0) Vc[l] = -Vcmax; else Vc[l] = Vcmax; } dVo[0] = Torque()/Jeq; Vo[l] = Vo[0] + dVo[0]*dt; Chk_Curr(); dVo[l] = Torque()/Jeq; dVo[0] = (dVo[0J + dVo[l])/2; Vo[l] = Vo[0] + dVo[0]*dt; Chk_Curr(); Vo[0] =(Vo[0] + Vo[l])/2; Po[i] = Po[i-l] + Vo[0]*dt*Ke/Pul; I = Ka*(Vcll] - Vo[l]*Kv*Hg); Vc[0] = Vc[l]/Kda; Vo[0]=Vo[l]; dVo[0] = dVo[l]; Pc[0] = Pc[l]; Pc[l] = Pc[2];  /* predicted velocity */ /* check current limit */ /* /* /* /* /* /*  actual accel. */ mean value */ actual value */ check current limit */ mean value */ actual value */  /* check simulations with this change */ /* otherwise Vc[0] = Vc[l] ! */  } main(argc,argv) /* outfile, RPM, Tstp, Gain */ int argc; char *argv[]; { int i; int count = 0; char name[20]; if(argc!=ll){ printf ("input: outfile, RPM, Tstp, GaindAn");  Appendix B.  C routines for force simulation and process control  exit(O); } RPM = atof(argv[3]); s = atof(argv[2]); t = atof(argv[6]); Kd_pos = atof(argv[7]); Kd_neg = atof(argv[8]); Tstp = floor(atof(argv[9])/dt); Out = atoi(argv[10]); Fmax = atof(argv|4]); Imax = atof(argv[5]); dPv = (s*RPM*dt)/60.;  /* Spindle speed [RPM] */ /* feed [mm/rev] */ /* sampling time [S] */ /* derivative gains [S] */  /* i corresponding to start time of step */ /* data loging interval */ /* current limit [A] */ /* Position ramp [mm/i] */  strcpy (name, "c:\\qpro\\folder\\"); strcat (name,argv[l]);  if ((outfile=fopen(name,"w")) == NULL) { printf ("cannot open output file\n"); exit(l); } fprintf(outfile,"%s"," T Pc fprintf(outfile,"%s\n"," Force Vc  Po Vo  "); I");  output = (RPM/60)*3; output = floor(output/(dt*1000)); Init ();  /* 3 times highest observed frequency */ /* adjust for sampling rate */  for (i=i_lrev; i<Size; i++) { Simulate(i); if (count == Out) { Print(i); count = 0; } count += 1; }  /* start simulation at */  fclose(outfile); exit(0);  102  Appendix B.  C routines for force simulation and process control  103  Program for Motorola 89CT30 Integer DSP Conrol Processor Includes host interface routines, data acquisition chip thickness identification and process control routines 1% page 132,66,3,3 %/ #include <values.h> #include <math.h> /* X memory #defineXhcr #defineXpbc #defineXhsr #defineXhtx #defineXhrx  */ 0xffe8 OxffeO 0xffe9 Oxffeb Oxffeb  /* x.Xhcr => host control register */ /* x:Xpbc => port control register */ /* x:Xhsr => host status register */ /* x:Xhtx => host transmit register (when written) */ /* x:Xhrx => host receive register (when read) */  /* Y memory */ #define Yled Oxffeb #define Ysbxjo OxffeO #define Ysbx_hi Oxffcl #define Yrdy Oxffea #defineYstrt 0xffe8  /* y:Yled => 4 led bank */ /* y:Ysbx_lo => SBX analog input chan low byte */ /* y:Ysbx_hi => SBX analog input chan high byte */ /* y:Yrdy => front plane ready line */ /* y:Ystrt => front plane start line */  #define Vmax  /* voltage range of the analog input card [V] */  #define #define #define #define #define  5  Low 0 High 1 Samples 10 Xcoeff 0.008652 Const 0.5671  float Fa[Samples], Fr[Samples], FvfSamples]; float k l , k2, k3, k4; float Hemax; float s,scom; float R; float theta; float Threshold = 50; float Fv_max = 100; float Fv_Scale = 200; float LowTime = 5E-3; float fpdata; float Fmin, Fmax; int hidata, lo_data; int k; int flag; int kk; float Kdf=30e-3; float Kdh = 30e-3; float dt= le-3;  /* number of force samples during calib cut */ /* 1/He vs Force ratio relation parameters */  /* material constants [N/mm] */ /* max equivalent chipthickness [mm] */ /* scheduled feed [mm/rev] */ /* tool nose radius [mm] */ /* current direction of motion [deg] */ /* force threshold in [N] (default = 50) */ /* Fv force constraint [N] */ /* charge amp scale factor [Mu/V] */ /* time ready line is pulled low [s] */  A/D data segments */ counter variable */ indicates interruption of current routine */ general integer variable */ Force con. derivative gain [S] */ He con. derivative gain [S] */ /* sampling period */  Appendix B,  C routines for force simulation and process control  float sratio; float Kdf_pos = 0; float Kdf_neg = 0; float Kdh_pos = 0; float Kdhneg = 0; float Fratmax; float Frat[2]; float dFv; float xl, x2, dFrat;  I* I* I* I* I* I* I*  1%  section Pxvar org x:$0 JXhcmd dc $0  ]Xdl6bO_wr ]Xdl6bl_wr ]Xdl6b2_wr ]Xdl6b3_wr ]Xdl6b4_wr ]Xdl6b5_wr ]Xdl6b6_wr ]Xdl6b7_wr  dc dc dc dc dc dc dc dc  $0 $0 $0 $0 $0 $0 $0 $0  ]Xd24bO_wr ]Xd24bl_wr ]Xd24b2_wr ]Xd24b3_wr ]Xd24b4_wr ]Xd24b5_wr ]Xd24b6_wr ]Xd24b7_wr  dc dc dc dc dc dc dc dc  $0 $0 $0 $0 $0 $0 $0 $0  ]Xa0_bak ]Xal_bak ]Xa2_bak ]Xx0_bak ]Xxl_bak  dc dc dc dc dc  $0 $0 $0 $0 $0  global Xhcmd global Xdl6b0_wr global Xdl6bl_wr global Xdl6b2_wr global Xdl6b3_wr global Xdl6b4_wr global Xdl6b5_wr global Xdl6b6_wr global Xdl6b7 wr global global global global global  Xd24b0_wr Xd24bl_wr Xd24b2_wr Xd24b3_wr Xd24b4_wr  charge amp radial/axial scale ratio */ F con. derivative gain for +ve slope [ms] */ F con. derivative gain for -ve slope [ms] */ He con. derivative gain for +ve slope [ms] */ He con. derivative gain for -ve slope [ms] */ Force ratio for maximum He constraint */ Force ratio for He constraint */  104  Appendix B.  C routines for force simulation and process control  global Xd24b5_wr global Xd24b6_wr global Xd24b7_wr global global global global global  XaO_bak Xalbak Xa2_bak XxO_bak Xxlbak  endsec orgp: %/  I* Routine to read an analog voltage from the analog input card. /* The channel number to be read is passed to the routine /* (range 0-7). readchan (ch,i) int ch, i; { 1% move +ch,x0 movep x0,Y:$ffc0 ]* jset #0,Y:$ffc0, [ movep Y:$ffcO,Y:Ylo_data movep Y:$ffcl,Y:Yhi_data %l lo_data = (lo_data » 4) & Oxf; hidata = (hi_data & Oxff) « 4; fpdata = lodata | hidata; fp_data = (fp_data/0xfff)*2*Vmax-Vmax; switch (ch) { case 0 : Fa[i] = fpdata; case 1 : Fr[i] = fpdata; case 2 : Fv[i] = fpdata; default:; }  ; start conversion at channel ; read input when conversion is complete  /* acquire low data portion */ /* acquire high data portion */ /* construct force fp value */ /* calculate output voltage */  } Readforces 0 { readchan (0,0) readchan (1,0) read_chan (2,0) } /•••a***************** j m p i e m e n t Multiple constraints ********************/ He_F_Con () { /* float dFrat; */ /* float x l , x 2 ; * /  105  Appendix B.  C routines for force simulation and process control  float dummy; flag = l; Fmax = Fvmax/FvScale; dummy = (1/Hemax) * Xcoeff + Const; Fratmax = dummy * dummy;  /* Maximum allowable force in V */ /* He vs Force ratio */  /* Readforces (); */ read_chan(0,0); read_chan(l,0); read_chan(2,0); Frat[0] =((Fa[0] * Fa[0J+Fr[0] * Fr[0]) * s_ratio * s_ratio)/(Fv[0] * Fv[0]);  LED(O); while (flag) { /* for (k=0; k<=l; k++) { /* create a ms delay */ /* read_chan (2,1); /* and read a/d channel */ /* } * / read_chan(0,l); read_chan(l,l); read_chan(2,l); dFv = Fv[l]-Fv[0]; Frat[l]=((Fa[l] * Fa[l]+Fr[l] * Fr[l]) * s_ratio * s_ratio)/(Fv[ 1 ] * Fv[l]); dFrat = Frat[l]-Frat[0|; if(Fv[l]<0.5)dFrat = 0.0; if (dFv < 0.0) Kdf = Kdfneg; else Kdf = Kdf_pos; if (dFrat < 0.0) Kdh = Kdhneg; else Kdh = Kdh_pos;  /* adjust gain of derivative action for slope */ /* force constraint */ /* adjust gain of derivative action for slope */ /* chip thickness constraint */  /* check force and equivalent chipthickness constraints */ xl = (Fv[l]+((Kdf*dFv)/dt)-Fmax); x2 = (Frat[l]+((Kdh*dFrat)/dt)-Fratmax); if ((xl > 0.0) || (x2 < 0)) { /% movep #l,Y:Yrdy ; pull ready line low %/ } else { 1% movep #0,Y:Yrdy ; pull ready line high %/ } Fv[0] = Fv[l]; Fa[0] = Fall]; Fr[0] = Fr[l]; Frat[0] = Frat[l]; } /* end while loop */ LED (8); } /* end ID */ /********************* create a delav of t seconds ********************/ Delay (t) float t; {  106  Appendix B.  C routines for force simulation and process control  int i,n; n = (int)(t/0.000111); for (i=0;i<n;i++) { t = tan (25); }  /* .000111 is the time for one trig calculation */  }  y* ****** ************ iwrjte n to LED address on DSP *****************/ LED (n) int n; { 1% movep +n,Y:$ffeb %/ } /********************** pyij Readv line low **************/ ReadyLow (period) float period; { 1% movep #l,Y:Yrdy ; pull ready line low %/ Delay (period); 1% movep #0,Y:Yrdy ; pull ready line high %/ } main () { 1% movec #$82,omr  1%  movep #4,x:Xhcr movep #l,x:Xpbc movep #0,y:Yled  ; fix assembler bug %/  ;allow HC interrupt ;to show something happenned!  %/ /**** return to debugger ********/ /% jmp $a002 %/  /***** Set up Interrupt Table ****** 1% section Pvectors org p:$24 jsr flushhi jsr exec jsr Calibration jsr Monitor jsr LED_ON jsr ReadAD jsr MultiCon  endsec %/  ;vector 24 = empty receiver (92) ;vector 26 = execute HI command from host (93) ;vector 28 = read x,y,z forces and store (94) ;vector 30 = monitor force const. & mod. feed (95) jvector 32 = turn on all LEDs (96) ;vector 34 = read 3 a/d channels (97) jvector 36 = read forces, modify feed (98) ;vector 38 => (99) ; vector40 => (100) ; vector42 => (101)  107  Appendix B. /***** /%  C routines for force simulation and process control  Host Interface Service Routines *******/  section Proutine org p:$40  ]LED_ON %/LED(15);/% rti global LED_ON  ; LED write interrupt service routine  JMonitor ANDI #$00,MR %/ flag=l; LED (0); Fmax = Fv_max/Fv_Scale; while (flag) { for (k=0; k<=8; k++) { read_chan (2,k); } dFv = Fv[8]-Fv[0]; if (dFv < 0) Kdf = Kdf_neg; else Kdf=Kdf_pos; if ((Kdf *dFv/dt) >= (Fmax-Fv[8])) { /%movep#l,Y:Yrdy } else { 1% movep #0,Y:Yrdy } } LED (8); /% OR] #$02,MR NOP rti global Monitor  ; force monitor interrupt service routine ; enable interrupts (IPL = 0)  JCalibration ANDI #$00,MR %/ LED (0); flag=l; Fmin = Threshold/FvScale; for (k=l; k<Samples; k++) { Fa[k]=Frlk]=Fvlk|=0; } do{ readchan (2,0); } while ((Fv[0] < Fmin) & flag); Delay(0.5); LED (15); for (k=0; k<Samples; k++) { if (flag) { readchan (0,k); readchan (l,k); read_chan (2,k);  /* signal start of monitor routine */  /* create a ms delay */ /* and read a/d channel */  /* adjust gain for slope */ /* check force constraint */ ; pull ready line low %/  ; pull ready line high %/  ; update IPL of current task (IPL=2)  ; calibration interrupt service routine ; enable interrupt (IPL = 0 ) /* clear LED set on DSP */  /* wait until Threshold is reached */  /* wait until tool is fully engaged in cut */ /* signal begining of data acquisition */  108  Appendix B.  C routines for force simulation and process control  Delay(LowTime); LED(k);  /* delay LowTime sec. */ /* signal stage of data acquisition */  } if(Fv[0]<Fmin){ k = Samples; } }  1% ORI #$02,MR NOP rti global Calibration ]Read_AD %//*LED(15) ; */ read_chan(0,0); read_chan(l,0); read_chan(2,0);  ; update IPL of current task (IPL=2)  ; read 3 channels of A/D interrupt service routine  LED (0); 1% rti global ReadAD ]Multi_Con ANDI #$00,MR %/ He_F_Con ();  ; call Multiple constraint routine ; enable interrupt (IPL = 0 )  1% ORI #$02,MR NOP rti global MultiCon jflushhi movep x:Xhrx,x:Xhcmd jset #0,x:Xhsr,flush_hi movep #8,y:Yled rti global flushhi  ; update IPL of current task (IPL=2)  ;this empties dsp side buffers ;flag only  ;Start Processing Host Interface Commands here ]exec movep x:Xhrx,x:Xhcmd move x:Xhcmd,r3 global exec jset #18,x:Xhcmd,cbuffers Jmemcmd jset #16,x:Xhcmd,xmem jset #17,x:Xhcmd,write_ymem ]read_ymem  ;start processing hostifcmds ;stores the address for hostif  ;D2  109  Appendix B.  C routines for force simulation and process control  movep y:(r3),x:Xhtx rti ]write_ymem movep x:Xhrx,y:(r3) rti Jxmem jset #17,x:Xhcmd,write_xmem Jreadxmem movep x:(r3),x:Xhtx rti ]write_xmem movep x:Xhtx,x:(r3) rti .************************************************************** »  ;* This is the section that writes to the circular buffers .************************************************************** Jcbuffers ]save  move aO,x:XaO_bak move al,x:Xal_bak move a2,x:Xa2_bak move xO,x:XxO_bak move xl,x:Xxl_bak  ;preserve registers used here  move #>$ff,m7 ;move #>$f,m7  jcircular buffer size is 256 words ;circular buffer size is 16 words  move x:Xhcmd,a rep #20 lsr a  ;extract buffer ptr  jset #19,x:Xhcmd,data24  ;hostif cmd byte D3  ;result in D23-D47 only  page ;This is a jump table for determining which circular buffer will be written to ]datal6 move #>0,x0 cmp x0,a jeq datal6b0 move#>l,x0 cmp x0,a jeq datal6bl move #>2,x0 cmp x0,a jeq data!6b2 move #>3,x0 cmp x0,a  ;16 bit buffers here  110  Appendix B.  C routines for force simulation and process control  jeq datal6b3 move #>4,x0 cmp xO,a jeq datal6b4 move #>5,xO cmp xO,a jeq datal6b5 move #>6,xO cmp xO,a jeq datal6b6 move #>7,xO cmp xO,a jeq datal6b7 ;insert up to 8 more 16 bit buffers here jmp restore  ]data24 move #>0,x0 cmp xO,a jeq data24b0 move #>l,xO cmp xO,a jeq data24bl move #>2,x0 cmp xO,a jeq data24b2 move #>3,x0 cmp xO,a jeq data24b3 move #>4,x0 cmp xO,a jeq data24b4 move #>5,x0 cmp xO,a jeq data24b5 move #>6,x0 cmp xO,a jeq data24b6 move #>7,x0 cmp xO,a jeq data24b7  ;24 bit buffers here  HI  Appendix B.  C routines for force simulation and process control ;insert up to 8 more 24 bit buffers here  ] restore move x:Xaf)_bak,aO move x:Xal_bak,al move x:Xa2_bak,a2 move x:XxO_bak,xO move x:Xxl_bak,xl rti  ;preserve registers used here  page . * * * * * * * * * * * * * * * * *  ;*  * * * * * * * * * * * * * * * * * * *  * * * * * * * * *  * * * * * * * * * * 4 : * * 4 : * 4 : * 4 :  16 bit buffers here  .**************4i***********4;********4;4i***«*H:********************  ]datal6b0 move x:Xdl6bO_wr,r7 nop move r3,x:(r7)+ nop move r7,x:XdI6bO_wr jmp restore  ;r3 contains the 16 bit data  ]datal6bl ]datal6b2 ]datal6b3 jdatal6b4 ]datal6b5 ]datal6b6 ]datal6b7 jmp restore  ;*  24 bit buffers  .t^^^^^^^^t-**^*************************************  »  ]data24b0 move x:Xd24bO_wr,r7 JbOwl jclr#0,x:Xhsr,bOwl movep x:Xhrx,x:(r7)+ ]b0w2 jclr#0,x:Xhsr,b0w2 movep x:Xhrx,x:(r7)+ nop move r7,x:Xd24bO_wr jmp restore ]data24bl ]data24b2 ]data24b3 ]data24b4 ]data24b5 ]data24b6 ]data24b7 jmp restore  * * * * * * * * * * * * * *  ;wait for data available (reqd?) ;store 24 bits in the buffer ;wait for data available (reqd?) ;store 24 bits in the buffer ;update the pointer  Appendix B.  C routines for force simulation and process control  endsec %l }  113  Appendix C  The machining language FORTH code  Appendix C. The machining language FORTH code  Initialization screen (init.scr) Screen # 0 14:22 09/06/91 / program load order INIT -> ENV -> FPUTIL -> CFG -> LANG -> DSP -> COM  Screen # 1 \ LOAD SCREEN 40001 MALLOC PTR DATBUFF SHELL" C:\RAMIN\EGAGRAPH " :L1 USING CNC 2 LOAD USING IO 1 LOAD USING GCMD 1 LOAD USING LINEAR 1 LOAD USING CIRCULAR 1 LOAD USING CONFIG 1 LOAD ;  18:12 09/14/92 \ pointer to memory block for BUFF \ ega graphics setup  :L2 USING ENV 1 LOAD ; : LL ( - ) LI L2 ; L2  Screen # 2 \ LOAD SCREEN 2  11:0310/07/92  SFP DOSINT .(-DOS INTERFACE ) 40001 MALLOC PTR DATBUFF :LD(~) USING USING \ USING \ USING \ USING  LD  C:\URF\LANG.SCR C:\URF\TOOL.SCR C:\URF\DATA1.SCR C:\URF\COM.SCR C:\URF\LANG.SCR  \ load software floating point overlay \ load level two file interface overlay \ pointer to memory block for BUFF  1LOAD 1LOAD 1 LOAD 1LOAD  \ language vocabulary \ tool data file \ feature data file \ controller com. word \ make lang.scr current  Appendix C. The machining language FORTH code  Setup for programming environment (env.scr) Screen # 0 \  15:11 03/26/92  SET UP ENVIRONMENT  Screen # 1 \ ENV LOAD SCREEN  15:23 03/26/92  2 50 THRU CR.( ENV ) USING FPUTIL 1LOAD  Screen # 2 \ SFP, DOSINT, EGAGRAPH, DATBUFF SFP DOSINT .( DOSINT) \ SHELL" EGAGRAPH "  18:22 09/14/92 \ load software floating point overla \ load level two file interface overlay \ ega graphics setup  Screen # 3 \ Q, DOS, AXIS  15:11 03/26/92  :ENV(~);  \ mark spot in dictionary  :Q(")  \ Q Editor access word \ -- add len ) \ -- add len add len)  "Q.EXE "COUNT BL WORD COUNT STRCATSTRPCK -SHELL CR :DOS(-) SHELL" \COMMAND.COM" CR;  \ shell out to DOS  : AXIS (-- ) \ axis board monitor program SHELL" \COMMAND /C \RAMIN\T.COM" CR ;  Screen # 4 \ DSP( - )  12:53 03/19/92  : DSP ( - ) \ shell to dos and enter DSP debug SHELL" \RAMIN\S.BAT" CR ;  116  Appendix C. The machining language FORTH code  Floating point utility (fputil.scr) Screen # 0 \ FP UTILITIES  15:50 03/26/92  Screen # 1 \ FP UTIL LOAD SCREEN  15:50 03/26/92  2 50 THRU .( FPUTIL) USING CFG 1LOAD  Screen # 2 \ F2/, F2DROP, F2DUP, 2F>2S, F2., F2@, FNIP, 09:26 09/13/91 : FPUTIL ( - ) ; \ mark place in dictionary : F2/ ( fp - fp) 2E0 F / ; \ fp division by 2 : F2* ( fp -- fp ) 2E0 F* ; \ fp mult, by 2 : F2DROP ( fp fp - ) FDROP FDROP ; : F2DUP (fpl fp2 - fpl fp2 fpl fp2) FOVER FOVER ; : 2F>2S ( fzp fxp - z x ) \ convert 2 fp to 2 single F>S >R F>S R> ; : 2F>2D ( fp fp -- d d ) \ convert 2 fp to 2 double F>D >R >R F>D R> R> ; : F2. ( - ) F. F . ; : -FROT ( - ) 2 FROLL 2 FROLL ; \ inverse of FROLL : F N I P ( - ) FSWAP FDROP; \ same as NIP but for fp : F2@ ( add - fp fp ) DUP >R F@ R> [ FPSIZE ] LITERAL + F@ ;  Screen # 3 \ F>$(f--*str), F2! (zfp xfp add --), F2- ( )  16:52 09/06/91  \ formats f in string in exponent form. \ #places are generated to the right of the decimal point. \F>$ ( f - a d d l e n ) \ (F.R) ; \ fp -- add len ) \ Subtract two floating point pairs from each other : F2- ( fpl fp2 fp3 fp4 -- fp5 fp6 ) 3 FROLL 2 FROLL F-FROT F- ; : F2! ( zfp xfp add --) >R FSWAP R@F! R> [ FPSIZE ] LITERAL + F! ;  \ -- fp2 fp4 fp5 ) \ -- fP5 fp6) \ \  -xfpzfp) -xfp)  Appendix C.  The machining language FORTH code  Screen # 4 \ F2@L (ptr--fp fp) :F@L(ptr-fp) 2DUP 2@L 2SWAP 4 + @L ; :F!L(fpptr--) 2DUP >R >R ROT >R 2 ! L R > R > R > 4 + !L;  18:51 09/06/91  \ - ptr d ) \ - fp) \ - d ptr)  : F2@L (ptr - fp fp) 2DUP >R >R F@L R> R> [ FPSIZE ] LITERAL + F@L ; : F2!L ( fp fp ptr --) >R >R FSWAP R> R@ OVER >R F!L R> R> [ FPSIZE ] LITERAL + F!L ;  \ -- fp)  118  Appendix C.  The machining language FORTH code  Program Parameters (cfg.scr) Screen # 0 \  15:13 03/26/92  LANGUAGE CONFIGURATION SCREEN  Screen # 1 \ LCONFIG LOAD SCREEN  15:31 03/26/92  2 50 THRU .( CFG) USING LANG.SCR 1LOAD  Screen # 2 \ CONSTANTS  15:43 03/27/92  : L ( - );  \ mark spot in dictionary  HEX \ FFEB CONSTANT LED FFEA CONSTANT *RDY FFCO CONSTANT CH_LO FFC1 CONSTANT CH HI Screen # 3 \ DSP VARIABLE ADDRESSES 10:18 05/08/92 HEX ( DSP addresses for variables of identification routine) 3C CONSTANT *K1 3E CONSTANT *K2 40 CONSTANT *K3 42 CONSTANT *K4 44 CONSTANT *HEMAX 46 CONSTANT *S 4A CONSTANT *NRAD 48 CONSTANT *SCOM 4C CONSTANT *THETA 4E CONSTANT "THRESHOLD 50 CONSTANT *FZMAX 52 CONSTANT *FZSCALE 54 CONSTANT *LOW_TIME 61 CONSTANT *KDF 63 CONSTANT *KDH 67 CONSTANT *S_RATIO 65 CONSTANT *DT 69 CONSTANT *KDF_POS 6B CONSTANT *KDF_NEG 6D CONSTANT *KDH_POS 6F CONSTANT *KDH_NEG 0 CONSTANT *FA 14 CONSTANT *FR 28 CONSTANT *FV 71 CONSTANT *FRATMAX  Screen # 4 \ FEED DATA  11:05 10/07/92  119  Appendix C. The machining language FORTH code DECIMAL \ -  FEED DATA \ FEED IN [mm/rev] FVARIABLE RCUT 0.3E0 RCUT F! FVARIABLE FCUT 0.15E0FCUT F! FVARIABLE OUTCUT 900E0 OUTCUTF! 0.15E0 FCONSTANT RCUT1 0.25E0 FCONSTANT RCUT2 0.35E0 FCONSTANT RCUT3 0.45E0 FCONSTANT RCUT4  \ 150 MM/MIN = .1 IN/SEC \ 100 MM/MIN = .07 IN/SEC \ 900 MM/MIN = .6 IN/SEC \ 100 MM/MIN = 1.047 RAD/ \ 175 MM/MIN = 0.219 MM/RE  Screen # 5 \ TIME DATA \ — TIME DATA  08:48 03/30/92  0E0 FCONSTANT SAMPLE_PRD 5E-3 FCONSTANT LOW TIME  \ force sampling period (calib) [S] \ period to pull ready line low for  CONTROL DATA  \-  FVARIABLE KDF_POS 30E-3 KDF_POS F! FVARIABLE KDF_NEG 30E-3 KDFNEG F! FVARIABLE KDH_POS 30E-3 KDH_POS F! FVARIABLE KDH_NEG 30E-3 KDH_NEG F! FVARIABLE DT 1E-3 DT F!  \ derivative gain [mS] \ derivative gain [mS] \ derivative gain [mS] \ derivative gain [mS] \ sampling period [mS]  Screen # 6 \ FORCE, TOOL  08:45 03/30/92  \-  FORCE RELATED DATA  200E0 FCONSTANT FASCALE 200E0 FCONSTANT FRSCALE 200E0 FCONSTANT FZSCALE FVARIABLE FZMAX 400E0 FZMAX F!  \-  \ chargeamp Mech. Units per Volt \ for each axis \ force constraint  TOOL INSERT DATA  FVARIABLE DOC 2E0 DOC F! FVARIABLE NRAD 1.2E0NRADF!  Screen # 7 \ IDENTIFICATION ROUTINE CONSTANTS \\ \ STEEL 1960E0 FCONSTANT KK1 85E0 FCONSTANT KK2  \ depth of cut for rough cut [mm] \ tool nose radius [mm]  08:15 03/30/92  \ material constants [N/mmA2]  120  Appendix C.  The machining language FORTH code  OEO 0E0  FCONSTANT KK3 \ FCONSTANT KK4 FVARIABLE HEMAX0.25E0 HEMAX F! \[mm] OEO FCONSTANT THETA \ direction of motion 600E0 FCONSTANT V \ spindle speed [RPM] 100E0 FCONSTANT THRESHOLD \ force threshold  Screen # 8 \ IDENTIFICATION ROUTINE CONSTANTS \-  08:15 03/30/92  ALUMINUMM  836E0 FCONSTANT KK1 \ material constants |N/mm"2] 56E0 FCONSTANT KK2 \ [N/mm] OEO FCONSTANT KK3 \ OEO FCONSTANT KK4 FVARIABLE HEMAX 0.25E0 HEMAX F! \[mm] OEO FCONSTANT THETA \ direction of motion 600E0 FCONSTANT V \ spindle speed [RPM] 100E0 FCONSTANT THRESHOLD \ force threshold  Screen # 9 \ S, CALIB_FEEDS  10:48 03/30/92  FVARIABLE S RCUTF@ V F / S F !  \ feed s in mm/rev  2VARIABLE STEP 1000. STEP 2! \ DEFAULT MOTION INCREM VARIABLE CALIBPASS 0 CALIB_PASS ! \ calibration pass count VARIABLE FORCECOUNTER 0 FORCECOUNTER ! \ # forces read (dsp) CREATE CALIB_FEEDS FPSIZE 2* ALLOT CALIB FEEDS FPSIZE 2* ERASE  \ fp pair of feed rates \ used in calibration  Screen # 10 \ CONSTANTS  11:56 03/19/92  HEX  1E0 CONSTANT ICR 1 El CONSTANT CVR 1E2 CONSTANT ISR 1E5 CONSTANT RXH 1E6 CONSTANT RXM 1E7 CONSTANT RXL 1E5 CONSTANT TXH 1E6 CONSTANT TXM 1E7 CONSTANT TXL (writing/reading to TXL/RXL sets the flags)  Screen #11 \ ORIGIN, W/V COORDS, MAG, OFFSET, ZPIX, CURSOR 08:22 09/23/91 DECIMAL 40 CONSTANT OFFSET \ Axis offset on view port OFFSET OFFSET 2CONSTANT ORIGIN \ YX coord's of the axis origin 20 5 2CONSTANT POS \ x y: input area location 500 CONSTANT WRLDZ \ World right coord limit  121  Appendix C. The machining language FORTH code  122  250 CONSTANT WRLDX \600 CONSTANT ZPIX \440 CONSTANT XPIX  \ World left coord limit \ VGA MODE number of z pixies \ VGA MODE number of x pixies  \680 \308 600 310  \ HERCULESE MODE \ HERCULESE MODE \ EGA MODE \ EGA MODE  CONSTANT CONSTANT CONSTANT CONSTANT  ZPIX XPIX ZPIX XPIX  Screen # 12 \ INTVL, CURSOR, MAG, VIEWZ, VIEWX  08:31 09/11/91  2VARIABLE CURSOR  \ Cursor position  VARIABLE MAG 1 MAG! VARIABLE VIEWZ ZPIX VIEWZ ! VARIABLE VIEWX XPIX VIEWX !  \ magnification factor for graduat. \ V Port right coord limit 640-X \ V Port left coord limit 480-X  FVARIABLE INTVL 40E0 INTVL F!  \ graduation interval in mm  Screen # 1 3 \ L-TYPES, BUFFSIZE \ Check surface line type  08:58 03/20/92  0 1 2 3 4 5 6 7 8 9  \ horizontal surface \ ramp surface \ back ramp surface \ concave surface \ back concave surface \ convex line segment \ back convex surface \ form line segment \ vertical surface \ back vertical surface  CONSTANT HORIZ CONSTANT RAMP CONSTANT BRAMP CONSTANT CONC CONSTANT BCONC CONSTANT CONV CONSTANT BCONV CONSTANT FORM CONSTANT VERT CONSTANT BVERT  10 CONSTANT ASCII_LF 13 CONSTANT ASCII CR  Screen #14 \ BUFFSIZE, TOOREC, REC#, TOOL#, PASS, FILE, FP# 09:06 03/20/92 40000 CONSTANT BUFFSIZE 20 CONSTANT OPREC 60 CONSTANT TOOLREC 10 CONSTANT REC# 18 CONSTANT FP# 5 CONSTANTS* \ 4 CONSTANT C#  \ memory for buffer which keeps \ record size in bytes for op array \ record size in bytes for tool array \ total records = no. features \ number of fp's in the feature defn \ number of single data in feature array \ number of char, data in feature array  VARIABLE TOOL# 0TOOL#! VARIABLE PASS 0PASS ! VARIABLE OP# 0 OP#!  \ current tool number \ pass number in current volume \ Operation number  Appendix C. The machining language FORTH code HCB HCB  FILE DFILE  \ handle control block for input/output file \ handle control block for DATA file  Screen #15 \ MAXF#, MAXBF#, SIDE  11:15 09/23/91  VARIABLE VARIABLE VARIABLE VARIABLE  \ feature for which path is being generated \ temporary storage location for feature # \ max work piece feature count \ Internal/External side  CURFEAT TEMPFEAT MAXF# 0 MAXF# ! SIDE 1 SIDE!  0 CONSTANT STOCK -1 CONSTANT WP 1 CONSTANT EXTERNAL 0 CONSTANT INTERNAL 1 CONSTANT RIGHT 0 CONSTANT LEFT 1 CONSTANT AXIAL 0 CONSTANT RADIAL  \ feature mode ... Blank/Work Piece \ feature type \ tool direction (handedness) \ tool path direction  Screen # 1 6 \ TXTBUF, CPAIR, LINELEN, FPNUM, CSSLOPE 12:15 03/19/92 FVARIABLE FPNUM 0E0 FPNUM F! FVARIABLE CSSLOPE  \ fp number storage \ slope of chk surface  180 CONSTANT LINELEN 15 CONSTANT FLDWIDTH  \ lenght of text line \ number field width on text line  CREATE TXTBUF LINELEN ALLOT TXTBUF LINELEN BLANK  \ text line buffer for file output  CREATE CPAIR FPSIZE 2* ALLOT CPAIR FPSIZE 2* ERASE  \ fp coord pair  Screen # 17 \ ARRAY ( - )  11:50 09/23/91  : ARRAY ( - ) CREATE REC# 2* ALLOT DOES> SWAP 2* + ;  \++++ ) \n-~)  ARRAY FEATLIST  Screen # 18 \ TOOLMEM(-), OPRECMEM(-), FEATMEM(-) 09:13 09/23/91 : FEATMEM ( - ) [ FP# FPSIZE * S# 2* + ] LITERAL ;  \ record size in bytes for feature array  Appendix C. The machining language FORTH code  124  : OPRECMEM ( - ) [ OPREC REC# * ] LITERAL ;  \ memory alloted for op array (bytes)  : TOOLMEM ( -- ) [ TOOLREC 3 * ] LITERAL ;  memory alloted for 3 tool records (bytes)  Screen # 19 \ BUFF (n-th-add)  17:59 09/06/91  VARIABLE ADDRESS BUFF ( n-th -- ptr ) [ FPSIZE 10 * ] LITERAL * DATBUFF ROT + ;  \ array to store cycle coords  Screen # 20 \ TOOL (n-th - add), TOOLPAR, TOOLCAP, TOOLCOD HERE ADDRESS! TOOLMEM ALLOT ADDRESS @ TOOLMEM ERASE : TOOL ( n-th - add) [ TOOLREC ] LITERAL * [ A D D R E S S ® ] LITERAL+;  14:19 09/17/91  \ allocate space for tool array \ initialize the array \ array to store tool information  : TOOLPAR ( n - ) FPSIZE * TOOL# @ TOOL + ;\ tool parameters : TOOLCOD ( n - ) \ tool\insert codes 10 * [ FPSIZE 6 * ] LITERAL + TOOL# @ TOOL + ; : TOOLCAP ( n - ) \ tool capability 2 * [ FPSIZE 6 * 20 + ] LITERAL + TOOL# @ TOOL + ;  Screen # 21 \ OP (op#-add) -> array of 20 operations \ \ \ \ \  0. si l.fpl 2. fp2 3. fp3  15:54 09/06/91  - feature info start address in feature array. - slope of feature surface - or center coord's and - radius of arc. > Total 20 bytes  HERE ADDRESS! OPRECMEM ALLOT ADDRESS (a) OPRECMEM ERASE OP ( op# - st-add) [OPREC ] LITERAL* [ ADDRESS @ ] LITERAL + ;  \ allocate space for op's array \ initialize the array \ array to index 20 op's  Appendix C.  The machining language FORTH code  The machining language code (lang.scr) Screen # 0 \ INPUT LANGUAGE FOR UBC LATHE 10:18 03/30/92 FEATURE INFO DATA STRUCTURE BLANK INFO DATA STRUCTURE 0. fp0,fpl | 0. fpO.fpl (6 bytes each) 1. fp2, fp3 COORD'S 1. fp2, fp3 2. fp4, fp5 | 2. fp4, fp5 3. fp6, fp7 | 3. fp6, fp7 4. £p8, fp9 FP point 1 4. fp8, fp9 5. fplO.fpll FP point 2 5. fplO.fpll 6. fpl2,f P 13 FP point 3 6. fpl2,fpl3 7. fpl4,fpl5 Slopel & 2 7. fpl4,fpl5 8. fpl6,fpl7 Finish Allow.8. fpl6, fpl7 0. si Int\Ext 0. si (2 bytes) 1. s2 L-type 1. s2 2. s3 Mode (B\Wp) 2. s3 3. s4 Tool Path 3. s4 116 bytes/feature 116 bytes/feature  Screen # 1 \ LOAD SCREEN  11:07 10/07/92  2 150 THRU .( LANGUAGE ) USING DSP 1LOAD  Screen # 2 \ TOOL DATA STRUCTURE \\ TOOL INFO DATA STRUCTURE 0. fpO 1. fpl 2. fp2 3. fp3 4. fp4 5. fp5 6. $1 7. $2 8. si 9. s2  13:57 09/17/91  Approach angle Clearance angle Rake angle Nose Radius Primary Cutting edge width Secondary Cutting edge width Tool code ISO/ANSI Insert code ISO/ANSI Feed Direction Right/Left Cutting capability  60 Bytes total memory/record Screen # 3 \ LANGUAGE VOCABULARY  RA 15:07 03/19/92  Appendix C.  The machining language FORTH code  DECIMAL : LANG ( - ) ;  \ mark place in dictionary  Screen # 4 \ 1+! (add-), 1-! (add-)  16:35 09/06/91  : 1+! (add - ) 1SWAP+!; : 1-! ( add - ) -1 SWAP +! ; : GOLINE ( lin - ) POS ROT + GOTOXY;  Screen # 5 \ LERASE (ptr bytes-), STR>ASCIIZ ("str-n len) 14:15 09/17/91 : LERASE ( ptr bytes ~ ) 0?DO 2DUP 0 -ROT !L 1+ LOOP 2DROP;  \ clear mem block by inputting zeros \ - ptr ptr) \-ptr)  \ convert counted string to null terminated string and a length : STR>ASCIIZ ( Astr - asciiz len ) DUP COUNT NIP >R \ ~ A str) ASCIIZ R > 1 + ; \ - a s c i i z len)  Screen # 6 \ PASS+(-), !BUFF, @BUFF  18:00 09/06/91  :DR+ ( f p - f p ' ) NRADF@F+; : P A S S + ( - ) PASS1+!;  \ nose radius offset \ increment pass  : !BUFF ( zfp xfp n - ) [ FPSIZE 2* ] LITERAL * PASS @ BUFF ROT + F2!L;  \ store the coord in buffer \ - zfp xfp offset) \ - zfp xfp ptr)  : @BUFF ( n - zfp xfp ) [ FPSIZE 2* ] LITERAL * PASS @ BUFF ROT + F2@L;  \ get coord from buffer \ - zfp xfp offset) \-ptr) \ - zfp xfp )  Screen # 7 \ W>V(fpWz fpWx-fpVz fpVX 23:45 09/22/91 DECIMAL  11:15 09/23/91  126  Appendix C.  The machining language FORTH code  : W>V ( fpWz fpWx - fpVz fpVx ) \ window to view port xform FSWAP \ -WxWz) VIEWZ @ S>F F* WRLDZ S>F F/OFFSET S>F F+ \ - W x V z ) FSWAP \ -VzWx) VIEWX@S>FF* WRLDXS>FF/OFFSET S>FF+; \ - V z V x )  Screen # 8 \ @MAXF(--max#)  00:09 09/23/91  : @MAXF ( - max# ) MAXF# @ ;  \ Reset feature number  Screen # 9 \ INIT ( - - )  1 18:48 09/23/91  :INIT(~) L DEFINITIONS FORGET BND 0MAXF#! 0 PASS ! DATBUFF BUFFSIZE LERASE ;  Screen # 10 \ INDX (offset-add), BLIP, CLRSTK(~)  17:33 09/20/91  : INDX (offset -- add ) CURFEAT @ + ; : CLRSTK ( ? - ) DEPTH 0?DO DROP LOOP CR;  \ - n)  .BLIP 44020BEEP;  Screen #11 \ .ERRMSG ("add--), WAIT (n~) VARIABLE PERIOD : WAIT ( n - ) PERIOD ! PERIOD TICKER DROP BEGIN PERIOD @ IF FALSE ELSE TRUE THEN UNTIL; : .ERRMSG ( "add - )  13:02 03/16/92 \ 20 = 1 sec wait period  \  -n)  \ -flag)  127  Appendix C.  The machining language FORTH code  CURSOR 2@ 2DUP GOTOXY \ -"add r e ) ROT COUNT TYPE CLREOL 15 WAIT \ -re) 2DUP GOTOXY CLREOL 2DUP CURSOR 2! GOTOXY; Screen # 12 \$>TXTBUFN, .TXTBUF  11:2104/08/92  : CLRTXTBUF ( - ) [ TXTBUF ] LITERAL LINELEN BLANK;  \ clear buffer  : $>TXTBUFN ( Astr n - ) [ TXTBUF ] LITERAL + SWAP COUNT >R SWAP R> CMOVE;  \ put counted string onto buffer i \ - add) \ - addl add2 len )  : .TXTBUF ( - ) TXTBUF LINELEN TYPE;  \ print the text buffer  Screen # 1 3 \ $>TXTBUF ( add len n  ), CLRTXTBUF(-)  1 20:22 09/09/91  : TXTOFFSET ( n - add ) FLDWIDTH * [ TXTBUF ] LITERAL +  \ create offset into buffer \ - add )  : $>TXTBUF ( Astr n - ) TXTOFFSET SWAP COUNT >R SWAP R> CMOVE;  \ put counted string onto buffer \ - Astr add ) \ - addl add2 len )  : TXTBUF>$ ( - A str) \ get counted string from buffer TXTBUF LINELEN BL SKIP -TRAILING STRPCK; \ -- Astr )  Screen #14 \ ISTRING (~T|F=Esc) -> input string frm con ( — T | F=Escape ; input string from console) : ISTRING 80 +STRBUF STRBUF 80 BLANK STRBUF 80 0 BEGIN KEY DUP 27 = IF 4DROP FALSE EXIT THEN DUP 13 = 20VER = OR IF DROP NIP 1+2DUP + BL C! STRPCK DROP TRUE EXIT THEN DUP 8 = IF OVER IF EMIT BL EMIT 8 EMIT 1ELSE DROP BEEP THEN ELSE DUP EMIT OVER 4 PICK + C! THEN AGAIN; Screen # 15  00:39 07/29/91  \ ~ addr max counter) \ Escape? \ F: Escape hit \ Return or full? \ append bl \ done input \ backspace \ at start of line?  1+  Appendix C.  The machining language FORTH code  \ 7STRING (--), CONFIRM (--), STRBUF>TXTBUF 20:18 09/09/91 : STRBUF>TXTBUF (--) STRBUF COUNT TXTBUF SWAP CMOVE ; : 7STRING ( -- ) BEGIN ! STRING UNTIL STRBUF>TXTBUF; : CONFIRM 10 GOLINE ." Feature Added! " 20 WAIT CLS ;  \ Get string from console \ try until a valid string is found  Appendix C.  The machining language FORTH code  Screen # 16 \ @WORDN (Astr n-th -add len T;F=No words) : @WORDN ( Astr n - add len T ; F) COUNT 2DUP 4 ROLL 0 DO I0> IF 2SWAP 2DROP 2DUP THEN BL SCAN SWAP 1+ SWAP LOOP 2DUP STRPCK DROP DUP0> IF NIP-TRUE ELSE 4DROP FALSE EXIT THEN;  17:18 09/09/91 \ get n-th word in +STRBUF \ note: deletes previous words \ - n adl lenl adl lenl) \ - adl lenl adl lenl n) \ if n > 1 then record add. ad2 len2 ad2 len2 ) - adnlenn adn+l lenn+1 ) - addn lenn addn+1 len ) - addn lenn addn+1 len ) - addn lenx flag) -flag) \ F: No more words found  Screen # 17 \ @WORD ( A str- add len T;F=No words) -> +STRBUF 21:22 09/09/91 @WORD ( Astr - add len T ; F) COUNT 2DUP BL SCAN DUP0> IF NIP- TRUE ELSE DROP NIP OVER - DUP0= IF 2DROP FALSE ELSE TRUE THEN THEN;  Screen # 18 \ ?WORD (-"add) : ?WORD ( ~ "add ) ?XY CURSOR 2! BEGIN 7STRING STRBUF @WORD DUP >R NOT IF " Error: No words found! " .ERRMSG ELSE STRPCK THENR> UNTIL;  \ Get next word in +STRBUF \ - add len add len ) \ - addl lenl add2 len2 | addl lenl add2 0 ) \-addllen4T) \ - addl len ) \-F) \-addlenT) \ F: No more words found  17:36 09/09/91 \ obtain a valid word form +STRBUF \ ! cursor position \ -add len flag flag) \ - "add) \ - "add flag) \ - "add)  Screen # 1 9 \ @DIGIT (count n-th char - count' n-th1)  00:50 07/17/91  ( count n char — count' n') : @DIGIT DUP 8 = IF 2 PICK IF EMIT BL EMIT 8 EMIT  \ backspace \ count <>0? \ backspace display  130  Appendix C.  The machining language FORTH code  10 / SWAP 1- SWAP ELSE DROP BLIP THEN ELSE DUP 10 DIGIT> IF -ROT EMIT 10* + SWAP 1+ SWAP ELSE DROP BLIP THEN THEN;  Screen # 20 \ ©SINGLE (~s# T;F=Esc|Bad#) : ©SINGLE ( - s# T | F=Esc or Bad # ) 0 0 BEGIN KEY DUP 27 = IF 3DROP FALSE EXIT THEN DUP 13 = IF ROT IF DROP TRUE ELSE 2DROP FALSE THEN EXIT THEN @DIGIT AGAIN;  Screen # 21 \ ?SINGLE ( -- s#)  \ discard digit \ count=0, complain \ digit valid? \ add to forming answer \ count valid digits \ bad digit, complain  06:16 07/30/91  \ Escape? \ yes bail out \ Return \ was count <>0? \ yes ok number \ no bad number \ process digit  05:38 07/24/91  ?SINGLE ( — s#) \ obtain a valid sing, precision # BEGIN ?XY ©SINGLE DUP NOT IF 2DUP GOTOXY CLREOL GOTOXY THEN UNTIL;  Screen # 22 \ @SDATA (n-th - s#), ISDATA (s# n-th --) : @SDATA ( n-th - s#) 2* [ FP# FPSIZE * ] LITERAL + INDX  17 02:31 09/23/91  \ - offset ) \ - add) \-s#)  : ISDATA ( s# add n-th - ) 2* [ FP# FPSIZE * ] LITERAL + INDX * >  \ single data offset \ - s# off) -> find offset \ - add) \~)  : $DATA ( add - ) [ S# 2* FP# FPSIZE * + ] LITERAL INDX;  \ string data offset \-off) \ - add)  Screen # 23  131  Appendix C. The machining language FORTH code \ FPFORMAT ( add len - fp T|F )  20:06 09/09/91  : FPFORMAT ( add len - fp T|F ) " EO" COUNT STRCAT STRPCK FNUMBER? NOT IF FDROP FALSE ELSE TRUE THEN;  \ format string to fp number \ -fp) \ -- flag ) F: bad #  Screen # 24 \ @FLOAT ( A str-fp T;F=Bad fp#) : @FLOAT ( Astr - fp T ; F ) @WORD IF FPFORMAT ELSE FALSE THEN;  Screen # 25 \ 7FLOAT (--fp) : 7FLOAT ( - fp ) ?XY CURSOR 2! BEGIN CLRTXTBUF 7STRING TXTBUF>$ ©FLOAT DUP NOT IF " Error: try again. " .ERRMSG THEN UNTIL;  Screen # 26 @2FLOAT ( A str-zfp xfp T|F=Bad fp#)  \ -- flag) \-fpflag)  20:06 09/09/91 \ F: err. in fp # formation \ --add len T|F ) F: No word \-fpT|F) \-flag)  21:49 09/09/91  \ ! pos.  \ - - f p & | flag flag) \ --flag)  22:01 09/09/91  @2FLOAT ( Astr - zfp xfp T | F ) \ F: err. in fp # formation \ ~ add len T | F ) DUP >R @WORD IF DUP>R \ - add len ) FPFORMAT \--fpT|F) IF R> R> COUNT 2 PICK \ - len add len ) -ROT + SWAP BL SKIP STRPCK @WORD \ -- add len T|F) IF FPFORMAT \-fpfpT|F) IF TRUE EXIT \-fpfpT) \-F) THEN FDROP FALSE EXIT ELSE FDROP FALSE EXIT \- ) THEN THEN R>R>2DROP \ - F) ELSE R> DROP \-F) THEN FALSE ;  Screen # 27  132  Appendix C.  The machining language FORTH code  \ 72FLOAT (-- fp) :?2FL0AT(-zfpxfp) ?XY CURSOR 2! BEGIN CLRTXTBUF 7STRING TXTBUF>$ @2FLOAT DUP NOT IF " Error: try input again. " .ERRMSG THEN UNTIL;  21:49 09/09/91  \ ! cursor position  \ -- zfp xfp T | F )  Screen # 28 \ IFPDATA (fp n-th--), @FPDATA  17:34 09/20/91  : IFPDATA ( fp add n t h - ) FPSIZE * INDX F!;  \ - fp off) -> find offset \ - add ) \~)  : @FPDATA ( add n-th - fp ) FPSIZE * INDX F@;  \ - offset) \ - add) \-fp)  Screen # 29 \ @2FDATA(n-zfp xfp), I2FDATA (zfp xfp n-th-) 17:34 09/20/91 @2FDATA ( add n-th - zfp xfp) [ FPSIZE 2* ] LITERAL * INDX F2@;  \ --offset) \ ~ add ) \ ~ zfp xfp )  I2FDATA ( zfp xfp add n-th - ) [ FPSIZE 2* ] LITERAL * INDX F2!;  \ - zfp xfp offset) \ - add) \~)  Screen # 30 \ SLOPE ( zf1 xfl zf2 xf2 - slope) \ fp —> slope of line \ 0.0 —> horizontal line \ 1.0 - > vertical line \ Find slope of a line given two points on the line : SLOPE ( zfp2 xfp2 zfpl xfpl - slope ) 2 FROLL FSWAP  11:15 09/06/91  \ - zfp2 zfpl xfp2 xfpl)  Appendix C. The machining language FORTH code F- FDUP FABS 0.01E0 F< IF F2DROPFDROP 0E0 EXIT THEN 2 FROLL 2 FROLL F- FDUP FABS 0.01E0 F< IF F2DROP 999E0 ELSE F/ THEN:  Screen #31 \ 7SLOPE (--fslope) @SLOPE (-fp) \ fp ~> slope of line \ 0.0 —> horizontal line \ 1.0 —> vertical line  \ - zfp2 zfpl dxfp flag ) \ horiz line \ -- dxfp zfp2 zfpl) \ -- dxfp dzfp flag) \ vertical line \ -- dxfp/dzfp )  11:15 09/06/91  \ 0 - 2nd line segment \ 1 - 3rd line segment : 7SLOPE ( n -- fslope ) 0= IF 1 @2FDATA 2 @2FDATA ELSE 2 @2FDATA 3 @2FDATA THEN SLOPE;  \ find slope of various check surface  : ©SLOPE ( n - fp ) 14 + @FPDATA;  \ extract slope info, from memory.  Screen # 32 \ POFFSETL ( zfp xfp dfp m n-zfp xfp)  \ - zfp2 xfp2 zfpl xfpl ) \ ~ fslope )  11:15 09/06/91  \ Find the perpendicular offset to a general line \ zfp xfp is a point on the original line \ the output is the coordinate of the tool nose center : POFFSETL (zfp xfp dist m dir - zfp xfp ) >R FNEGATE FATAN F2DUP FCOS F* -FROT FSIN F* 3 FROLL R> IF F+ -FROT F+ ELSEFSWAP F- -FROT FTHEN;  \ — zfp xfp dist m ) \ - zfp xfp dist theta dx) \ - zfp xfp dx dz ) \ - xfp dx dz zfp ) \ ~ zfp' xfp') \ ~ zfp' xfp')  Screen # 33 \ POFFSETV(zfp xfp dis dir-zfp xfp), POFFSETH 11:15 09/06/91 \ Find the perpendicular offset in vert. & horiz. directions : POFFSETV ( zfp xfp dist dir - zfp xfp ) IF F+ ELSE FTHEN;  \ - zfp xfp')  134  Appendix C.  The machining language FORTH code  : POFFSETH (zfp xfp dist dir - zfp xfp ) IF 2FROLLF+ ELSE 2 FROLL FSWAP FTHEN FSWAP ;  \ -- xfp zfp') \ - zfp' xfp )  Screen # 34 \ POFFSET ( zfp xfp dfp m n-zfp xfp)  11:15 09/06/91  \ Finds the perpendicular offset to the line with slope m \ and point z x at a distance of dist in direction dir. : POFFSET ( zfp xfp dist m dir - zfp xfp ) >R FDUP F0= IF FDROP R> POFFSETV EXIT THEN FDUP 999E0 F= IF FDROP R> POFFSETH EXIT THEN R> POFFSETL;  Screen # 35 \ FPALLOW- (fp-fp'), FPALLOW+, FPPOINT \ FPALLOW- ( fp -- fp') \ FINALLF@F-; \ \ FPALLOW+ ( fp - fp') \ FINALLF@F+;  11:37 09/11/91 \ offset point for finish pass  \ Find point on the finish pass given the slope,point & z coord : FPPOINT ( zfp z x m -- zfp xfp) 3 FPICK 3 FROLL F-F*F+;  \ - zfp x m z zfp) \--zfp xfp)  Screen # 36 \ @STYPE, @FSIDE, IFINAL (fp fp-), @FINAL  12:02 09/23/91  : IFINAL (fp fp - ) 17 IFPDATA 16 IFPDATA ;  store finish allowance \ 2nd chk surf, finish allowance \ 1st chk surf, finish allowance  : @FINAL ( n — fp ) 16 + @FPDATA ;  \ get finish allowance \ fp)  ©LOCATION (-- n ) 0 @SDATA ; ©SURFACE ( - n ) 1 @SDATA ; ©FEATURE ( - n ) 2 @SDATA ;  \ INTERN\EXTERN feature type \ Surface type \ WP\STOCK feature type  135  Appendix C. The machining language FORTH code : @FEATURE# ( - n )  4 @SDATA ;  Screen # 37 \ @FPPOINT, IFPPOINT, @TOOLPATH  \ Get the feature number  00:15 09/23/91  : @TOOLPATH (-- n ) 3 @SDATA; : @FPPOINT ( n-th - zfp xfp ) 4+ @2FDATA;  \ fetch fin. pass point from \ the feature array  : IFPPOINT ( zfp xfp n t h - ) 4+ I2FDATA;  \ store fin. pass point in the \ feature array  Screen # 38 \ GRAPHICS MODES ( set the graphics mode) : GMODE ( - - ) \ 640X480 16COLORVMODE \ 640X350-COLOR VMODE 720X348 VMODE CLS; :AMODE( - ) MONOCHROME CLS; GLRMODE( - ) 640X200 -COLOR VMODE CLS;  Screen # 39 \ DZGRAD(n-) : DZGRAD ( n t h - ) DUP >R S>F INTVL F@ F* 0E0 W>V 2F>2S OVER ZPIX > IF R>3DROPEXIT THEN 2 D U P 3 0 - > R 10->R 2DUP 5 LINE "CL" COUNT ZPIX 10 + 30 GTYPE " z [mm]" COUNT ZPIX 10 - 47 GTYPE R>R> R> S>F INTVL F@ F* F>D <# #S #> 2SWAP GTYPE;  Screen # 40  18:23 09/14/92  \ VGA GRAPHICS VEGA GRAPHICS UNCOMMENT \ HERCULESE COMMENT  \ 80X25 ALPHANUMERIC MODE  \ VGA GRAPHICS MODE (LOW RES)  12:56 09/09/91 \ graduate the axis \ - zl xl flag) \ clip if beyond screen limit \ text coordinate \ — zl xl z2 x2 )  \ - tz tx ) \ - add count z x )  136  Appendix C. The machining language FORTH code \ DXGRAD(n-)  11:04 09/06/91  : DXGRAD ( n t h - ) >R OEOINTVL F@ R@ S>F F* W>V 2F>2S DUP XPIX > IF R>3DROPEXIT THEN 2 D U P 8 - >R 4 0 - >R 2DUPSWAP7- SWAP LINE " x [mm]" COUNT 0 XPIX GTYPE R>R> INTVL F@ R> S>F F* F>D <# #S #> 2SWAP GTYPE;  \ graduate the axis  Screen # 41 \ DAXIS (-) : DAXIS (-- ) ORIGIN DUP VIEWZ @ DUP ZPIX > IF DROP ZPIX THEN SWAP LINE ORIGIN OVER VIEWX @ DUP XPIX > IF DROP XPIX THEN LINE ZPIX S>F INTVL F@ F/ F>S 0?DO I DZGRAD LOOP XPIX S>F INTVL F@ F/ F>S 0?DO I DXGRAD LOOP;  Screen # 42 \ DRAWPATH ( - ) : DRAWPATH (-- ) PASS @ 0 ?DO I PASS ! 0 @BUFF W>V 2F>2S 2DUP 1 @BUFF W>V 2F>2S 2DUP >R >R LINE 2 @BUFF W>V 2F>2S 2DUP R> R> LINE 3 @BUFF W>V 2F>2S 2DUP >R >R LINE 4 @BUFF FDUP F0= NOT IF W>V 2F>2S 2DUP >R >R LINE R> R> R> R> LINE ELSE F2DROP R> R> LINE THEN LOOP PASS+ ;  \ - zl xl flag ) \ clip if beyond screen limi \ text coordinates \ - zl xl z2 x2 ) \ - tz tx ) \ - tzfp txfp) \ ~ add count z x )  11:04 09/06/91 \ draw axis and graduate  \ draw z axis graduation  \ draw x axis graduation  02:15 09/23/91  \0 \ 0 IR \02 \ 0 3R \3R4R  Appendix C.  The machining language FORTH code  Screen # 43 \ DFEAT ( - ) : DFEAT ( - ) 0 @2FDATA W>V 2F>2S 2DUP 4 1 DO I @2FDATA W>V 2F>2S 2DUP 2ROT LINE LOOP LINE;  Screen # 44 \ DFEATS (-), DRAW (--) : DFEATS ( - ) XOR-ON @MAXF 0 ?DO I FEATLIST @ CURFEAT ! DFEAT LOOP XOR-OFF; : DRAW ( - ) GMODE CLS DFEATS DAXIS KEY DROP AMODE CLS ;  Screen # 45 \ DRAWP (-- ) :DRAWP ( - ) GMODE CLS CURFEAT @ TEMPFEAT! DFEATS DAXIS @MAXF 0 ?DO I FEATLIST @ CURFEAT ! ©FEATURE IF DRAWPATH LEAVE THEN LOOP TEMPFEAT @ CURFEAT! KEY DROP AMODE CLS ;  Screen # 46 \ DRAWFP ( --)  138  11:04 09/06/91  \-- WzfpWxfp) \ - VzfpVxfp) \ -- Vz Vx ) \ -- Vz Vx Wzfp Wxfp) \ - Vz Vx Vzfp Vxfp) \ - Vz Vx Vz Vx ) \ -- Vz Vx )  11:31 09/23/91 \ Draw features of 0=blank or -l=workpiece  \ Graphics xor function off for overlaying  \ Switch to graphics mode \ Draw the work piece features \ Draw the axis  18:41 09/23/91 \ Draw the path \ Switch to graphics mode \ Draw the work piece features \ Draw the axis  00:12 09/23/91  Appendix C.  The machining language FORTH code  DRAWFP ( - ) GMODE CLS DAXIS @MAXF 0 ?DO 0 @FPPOINT W>V 2F>2S 1 @FPPOINT W>V 2F>2S LINE LOOP KEY DROP AMODE CLS ;  Screen # 47 \ XMAG (n--), FULLSCALE(-)  \ Draw the finish pass \ Switch to graphics mode \ Draw the axis  11:04 09/06/91  :XMAG(n-) MAG! ZPIX MAG @ * VIEWZ ! XPIX MAG @ * VIEWX ! INTVL F@ MAG @ S>F F/ INTVL F! DRAWP; : FULLSCALE ( - ) ZPIX VIEWZ ! XPIX VIEWX ! 30E0 INTVL F! 1MAG! DRAW:  Screen # 48 \ Screen to text file conversion using DOSIN : 7FILENAME ( - ) CLS 0 GOLINE ." Enter file name:" 7WORD FILE NAME>HCB;  15:49 08/26/91  \ - "filename "add)  : OPEN_DFILE ( - ) FILEOFMAKE \--flag) IF 2 GOLINE ." Can't make destination file" EXIT THEN; : OPEN_SFILE ( - ) FILE 0_RD FOPEN IF 2 GOLINE ." Source file not found." EXIT THEN;  Screen # 49 \ CLOSE_FILE (--), SAVELINE ( hcb add len --) : CLOSE_FILE ( - ) FILE FCLOSE DROP ;  \--flag)  13:02 08/30/91  139  Appendix C.  The machining language FORTH code  SAVELINE ( hcb add len --) DUP2+>R STRPCK FWRITELN R> <> IF CR ." Destination media is full" CR CLOSE_FILE EXIT THEN CLRTXTBUF;  Screen # 50 \ INTERVXL (vzfp lmfp lzfp lxfp--zfp xfp)  \ -- hcb A str) \~flag)  15:07 09/05/91  \ Find intersection of a vert, line with a general line INTERVXL ( vzfp lmfp lzfp lxfp - zfp xfp ) 2FPICK F0= IF FNIP FNIP EXIT THEN 2 FPICK 999E0 F= IF F2DROP F2DROP 0E0 0E0 EXIT THEN FSWAP 3 FPICK F2FROLLF* F - ;  Screen #51 \ INTERHXL(hx lm lz lx--zfp xfp)  \ Horiz. X Vert. \ -- zfp xfp ) Wert. X Vertical \ - zfp xfp ) \ No intersedtion \ ~ vzfp lmfp lxfp lzfp) \ ~ vzfp lmfp lxfp dzfp ) \ -- zfp xfp)  09:03 08/26/91  \ Find intersection of a horiz. line with a general line INTERHXL (hxfp lmfp lzfp lxfp -- zfp xfp) 2 FPICK F0= IF F2DROPF2DROP 0E0 0E0 EXIT THEN 2 FPICK 999E0 F= IF FDROP FNIP FSWAP ELSE 3 FPICK F2 FROLL F/ F- FSWAP THEN;  Screen # 52 \ CHKSURF? ( - )  \ Horiz. X Horiz.  \ No intersection \ Horiz. X Vertical \ -- zfp xfp ) \ -- hxfp lmfp lzfp dxfp) \--lzfpfp) \ -- zfp xfp )  02:41 09/23/91  \ Determines check surface and returns its slope. : CHKSURF? ( ~ ) @TOOLPATH (©SURFACE CASE HORIZ OF IF 1 @SLOPE \ if hoiz.  \ -nn)  140  Appendix C. The machining language FORTH code ELSE 0 ©SLOPE THEN ENDOF RAMP OF 1 ©SLOPE ENDOF ENDCASE CSSLOPE F! ;  Screen # 53 \ MM>COUNT (fp-d), MM>$(fp--add len) : MM>COUNT (fp - d ) 25.4E0 F/ 1E3 F* F>D;  \-m)  14:49 09/09/91 \ convert mm (fp) to counts (double) \ ~ fp ) mm -> inch conversion \ - fp ) inch -> count conversion \ fp (mm) to d (counts) & to ASCII string  : MM>$ ( fp -- add len ) MM>COUNT DUP >R 2DUP D0< IF DNEGATE THEN <# R> SIGN #S #> STRPCK;  \ -- Astr) double -> ASCII  Screen # 54 \ RADCLD( - )  01:54 09/23/91  :RADCLD(- )  \ 4 stroke radial cutting cycle generation  \-d)  1 @BUFF NRAD F@ 1 POFFSETV F2DUP CPAIR F2! \ -- zfp2 xfp2 ) 0 @BUFF NRAD F@ 1 POFFSETV F2\ - dz dx ) MM>$ 1 $>TXTBUF MM>$ 0 $>TXTBUF CPAIR F2@ FDROP CSSLOPE F@ 2 @BUFF NRAD F@ CSSLOPE F@ 1 POFFSET INTERVXL F2DUP CPAIR F2@ F2MM>$ 3 $>TXTBUF MM>$ 2 $>TXTBUF -->  Screen # 55 \ RADCLD( - ) CPAIR F2! 0 @BUFF FDROP CSSLOPE F@ CPAIR F2@ INTERVXL F2DUP CPAIR F2@ F2MM>$ 5 $>TXTBUF MM>$ 4 $>TXTBUF  \ - - vzfp \ - - vzfp \ - - vzfp \ - - zfp3 \ - - zfp3  m) m zpf xfp dist dir) m zfp xfp ) xfp3 dz2 dx2 ) xfp3 )  01:54 09/23/91 \ - - vzfp m zfp3 xfp3 ) \ - - zfp4 xfp4 dz3 dx3 ) \ - - zfp4 xfp4 )  CPAIR F2! 0 @BUFF NRAD F@ 1 POFFSETV CPAIR F2@ F2- \ - dz5 dx5 ) MM>$ 7 $>TXTBUF MM>$ 6 $>TXTBUF 1 @BUFF NRAD F@ 1 POFFSETV 0 @BUFF NRAD F@ 1 POFFSETV F2MM>$ 9 $>TXTBUF MM>$ 8 $>TXTBUF  \ -- zfp2 xfp2 ) \ -- dz dx )  141  Appendix C. The machining language FORTH code  142  CPAIR 12 ERASE FILE TXTBUF LINELEN SAVELINE ;  Screen # 56 \ AXCLD( --)  01:55 09/23/91  : AXCLD ( - )  \ 4 stroke cutting cycle generation  1 @BUFF NRAD F@ 1 POFFSETV F2DUP CPAIR F2! \ - zfp2 xfp2 ) 0 @BUFF NRAD F@ 1 POFFSETV F2\ -- dz dx ) MM>$ 1 $>TXTBUF MM>$ 0 $>TXTBUF CPAIR F2@ FNIP CSSLOPE F@ 2 @BUFF CSSLOPE F@ NRAD F@ FSWAP 1 POFFSET INTERHXL F2DUP CPAIR F2@ F2MM>$ 3 $>TXTBUF MM>$ 2 $>TXTBUF  \ -- hxfp m ) \--hxfp m zpf xfp m ) \--hxfp m zfp xfp ) \ -- zfp3 xfp3 dz2 dx2) \ -- zfp3 xfp3 )  Screen # 57 \ AXCLD( - ) 01:55 09/23/91 CPAIR F2! 0 @BUFF NRAD F@ 1 POFFSETV \ - zfpl xfpl) FNIP CSSLOPE F@ CPAIR F2@ \ - hxfp m zfp3 xfp3 ) INTERHXL F2DUP CPAIR F2@ F2\ -- zfp4 xfp4 dz3 dx3 ) MM>$ 5 $>TXTBUF MM>$ 4 $>TXTBUF CPAIR F2! 0 @BUFF NRAD F@ 1 POFFSETV CPAIR F2@ F2MM>$ 7 $>TXTBUF MM>$ 6 $>TXTBUF 1 @BUFF NRAD F@ 1 POFFSETV 0 @BUFF NRAD F@ 1 POFFSETV F2MM>$ 9 $>TXTBUF MM>$ 8 $>TXTBUF  \ -- dz5 dx5 )  \ -- zfp2 xfp2 ) \ - dz dx )  CPAIR 12 ERASE FILE TXTBUF LINELEN SAVELINE ;  Screen # 58 \ ENDAXIAL (zfp xfp - F|T) : ENDAXIAL? ( zfp xfp-- F | T ) FNIP 0 @FPPOINT FNIP F<= IF 2 @FPDATA 0 @FPPOINT FNIP 1 !BUFF TRUE ELSE FALSE THEN; : ENDRADIAL? (zfp xfp - F | T ) FDROP 2 @FPPOINT FDROP F<= IF 2 @FPPOINT 1 !BUFF  13:08 09/23/91 \ T = end of cut reached  Appendix C.  The machining language FORTH code  TRUE ELSE FALSE THEN:  Screen # 59 \ 4SRADIAL (doc zfp xfp - doc zfp xfp F|T)  01:56 09/23/91 \ 4 str. right handed axial cycle : 4SRADIAL ( doc zfp xfp - doc zfp xfp F | T ) \ T= end of cut F2DUP 0 !BUFF \ - doc zfpl xfpl) FSWAP FROT F- FSWAP F2DUP 1 !BUFF \- - zfp2 xfp2 ) ENDRADIAL? >R 1 @BUFF FDROP CSSLOPE F@ 0 @FPPOINT - vzfp ml zl xl) INTERVXL 2 !BUFF 0 @BUFF FDROP CSSLOPE F@ 0 @FPPOINT - vzfp m z x ) INTERVXL 3 !BUFF R@NOT IF D O C F @ l @ B U F F doc zfp xfp) THEN R> PASS+ ; doc zfp xfp F | T )  Screen # 60 \ 4SAXIAL (doc zfp xfp -- doc zfp xfp F|T) : 4SAXIAL (doc zfp xfp -- doc zfp xfp F|T ) F2DUP 0 !BUFF FROT F- F2DUP 1 !BUFF ENDAXIAL? >R 1 @BUFF FNIP CSSLOPE F@ 1 @FPPOINT INTERHXL 2 !BUFF 0 @BUFF FNIP CSSLOPE F@ 1 @FPPOINT INTERHXL 3 !BUFF R@NOT IF D O C F @ l @ B U F F THEN R> PASS+ ;  Screen # 61 \ DOFINPASS (-- ) . DOFINPASS ( - ) 0 @FPPOINT 0 !BUFF 1 @2FDATA 1 !BUFF 2 @2FDATA 2 !BUFF 3 @2FDATA 3 !BUFF  01:57 09/23/91 \ 4 str. right handed axial cycle \ T = Endofcut - doc zfpl xfpl) - zfp2 xfp2 ) -flag) - hxfp ml zl xl) \ -- hxfp ml zl x l )  doc zfp xfp ) doc zfp xfp F | T )  10:55 05/29/92  1 @BUFF NRAD F@ 1 POFFSETV F2DUP CPAIR F2! \ - zfp2 xfp2 ) 0 @BUFF NRAD F@ 1 POFFSETV F2\ -- dz dx ) MM>$ 1 $>TXTBUF MM>$ 0 $>TXTBUF CPAIR F2@ FNIP CSSLOPE F@ 2 @BUFF CSSLOPE F@ NRAD F@ FSWAP 1 POFFSET INTERHXL F2DUP CPAIR F2@ F2MM>$ 3 $>TXTBUF MM>$ 2 $>TXTBUF  \ \ \ \->\ -  hxfp hxfp hxfp zfp3 zfp3  m) m zpf xfp m ) m zfp xfp) xfp3 dz2 dx2) xfp3)  Appendix C.  The machining language FORTH code  Screen # 62 \ 12:23 05/29/92 CPAIR F2! 3 @BUFF NRAD F@ 1 POFFSETV \ -- zfpl xfpl ) FNIP CSSLOPE F@ CPAIR F2@ \ - hxfp m zfp3 xfp3 ) INTERHXL F2DUP CPAIR F2@ F2\ - zfp4 xfp4 dz3 dx3 ) MM>$ 5 $>TXTBUF MM>$ 4 $>TXTBUF CPAIR F2! 0 @2FDATA NRAD F@ 1 POFFSETV CPAIR F2@ F2- \ -- dz5 dx5 ) MM>$ 7 $>TXTBUF MM>$ 6 $>TXTBUF 0E0 0E0 MM>$ 9 $>TXTBUF MM>$ 8 $>TXTBUF  \ - dz6 dx6 )  CPAIR 12 ERASE FILE TXTBUF LINELEN SAVELINE ;  Screen # 63 \ GENAPATH (--) : GENAPATH ( --) 0 PASS ! DATBUFF BUFFSIZE LERASE DOC F@ 0 @2FDATA BEGIN 4SAXIAL UNTIL DRAWP;  Screen # 64 \ GENRPATH (--), GENPATH (--) : GENRPATH ( -- ) 0 PASS ! DATBUFF BUFFSIZE LERASE DOC F@ 0 @2FDATA BEGIN 4SRADIAL UNTIL DRAWP:  GENPATH ( -) CHKSURF? @TOOLPATH AXIAL = IF GENAPATH ELSE GENRPATH THEN: Screen # 65 \ CORNOFFSET ( - ) CORNOFFSET ( - )  00:16 09/23/91 \ Generate the axial passes \ initialize data buffer \ ~ doc zfpl xfpl ) \ -- doc zfp xfp flag )  02:40 09/23/91 \ Generate the radial passe \ initialize data buffer \ - doc zfpl xfpl ) \ — doc zfp xfp flag)  \ Generate tool paths \ get chic surface slope  17:45 01/07/92  Appendix C. The machining language FORTH code 0 @2FDATA CURFEAT @ TEMPFEAT ! 0 FEATLIST @ CURFEAT ! 0 @2FDATA TEMPFEAT @ CURFEAT! F2MM>$ 1 $>TXTBUF MM>$ 0 $>TXTBUF FILE TXTBUF LINELEN SAVELINE ;  Screen # 66 \GENCLD( - )  23:53 09/22/91  : GENCLD( - ) 7FILENAME OPENDFILE PASS © 0 PASS ! \--n) TXTBUF LINELEN BLANK CORNOFFSET \ motion for corner offset ©TOOLPATH \ PATH = 1 radial, = 0 axial IF 0?DO TXTBUF LINELEN BLANK AXCLD PASS+ LOOP ELSE 0 ?DO TXTBUF LINELEN BLANK RADCLDPASS+ LOOP THEN CLOSEFILE;  Screen # 67 \ FINPASS ( -- )  1 15:18 09/20/91  FINPASS ( - - ) \ calc. finish pass points for a taper surf, 1 @2FDATA \ 1 @FINAL 0 POFFSETH \ - zfp xfp ) FDROP 0 ©SLOPE \ - vzfp ml) 1 @2FDATA 0 @FINAL 0 ©SLOPE 1 POFFSET \ — vzfp ml zl xl) INTERVXL F2DUP 0 IFPPOINT \ - zfp xfp ) FNIP 1 ©SLOPE \ - hxfpml) 2 @2FDATA 1 ©FINAL 1 ©SLOPE 1 POFFSET \ -- hxfp ml zl xl) INTERHXL 1 IFPPOINT \ - zfp xfp) 0 ©2FDATA FNIP 1 ©SLOPE \ - vxfp ml) 1 ©FPPOINT \ - vxfp ml zl xl) INTERHXL 2 IFPPOINT;  Screen # 68 \ .CORNER (n-), RDIAM, .LDIAM, .WIDTH  18:55 09/23/91  .RDIAM ( n --) GOLINE ." Right Inside Diameter: . L D I A M ( n - ) GOLINE ." Left Inside Diameter: " .WIDTH ( n --) GOLINE ." Width: "; .SLOPE ( n - ) GOLINE ." Slope of feature surface: " .FINAL ( n - ) GOLINE ." Finish allowances: "; .CORNER ( n - ) GOLINE ." Corner Len. & Diam. [Z,X]: " ; : .FEAT# ( n - ) GOLINE ." Feature Number" @FEATURE#. . " o n "  145  Appendix C.  The machining language FORTH code  ©FEATURE IF ."WORKPIECE." ELSE." STOCK." THEN; Screen # 69 \ .STOCKLEN (n--), .STOCKDIA (n~), .SIDE(n-) 12:46 09/23/91 : .STOCKLEN ( n --) GOLINE ." Effective Length: : .STOCKDIA ( n - ) GOLINE ." Outside Diameter:  "; ";  : .SIDE ( n -- ) GOLINE ." Type Of Operation: ©LOCATION 0 = IF ."INTERNAL" ELSE." EXTERNAL" THEN;  Screen # 70 \SHOW_INF (-) SHOW_INF ( ) CLS 0 .FEAT# 2 .CORNER 0 @2FDATA F2* FSWAP F2. 3 .RDIAM 1 @2FDATA F2* FSWAP F2. 4 .LDIAM 2 @2FDATA F2* FSWAP F2. 6 .SIDE 8 .SLOPE 1 ©SLOPE 0 ©SLOPE F2. 9 .FINAL 1 ©FINAL 0 ©FINAL F2. KEY DROP CLS ;  12:21 03/19/92 \ Show information on feature \ set feature number variable  : TEST ['] SHOWJNF >NAME COUNT TYPE ;  Screen #71 \ NCOMP (add- T;F) \\ : NCOMP ( add -- T; F) COUNT ©NAME COUNT -TRAILING STRCMP IF FALSE ELSE TRUE THEN;  00:16 09/23/91 \ find a match on the feature name \ ~ add len ) \ - add len add len ) \-flag) \ - flag) match not found \ -- flag ) match found  146  Appendix C. The machining language FORTH code Screen # 72 \ FSEARCH(-), .INFO ( - ) \\ : FSEARCH (--) @MAXF 0 ?DO DUP NCOMP IF .FEAT LEAVE THEN LOOP;  Screen # 73 \ .DIRECT(n--), .CAPAB(n-)  12:27 09/23/91  \ check the blank features \ - add flag) \ - add ) \ - add)  11:27 09/17/91  : .DIRECT ( n - ) IF ." Right handed" ELSE." Left handed" THEN; : .CAPAB ( n --) CASE 7 < - l OF ."Contouring Tool." ENDOF ." Forming Tool. " ENDCASE;  Screen # 74 \ TINFO ( - )  14:34 09/17/91  : .TINFO ( --) \ Show tool and insert data CLS 0 GOLINE ." Tool Number: " TOOL# @ . 1 GOLINE ." Tool Code : " 0 TOOLCOD-ASCIIZ COUNT TYPE 2 GOLINE ." Insert Code: " 1 TOOLCOD -ASCIIZ COUNT TYPE 4 GOLINE ." Approach Angle: " 0 TOOLPAR F@F. 5 GOLINE ." Holder End Angle: " 1 TOOLPAR F@ F. 6 GOLINE ." Rake Angle: " 2 TOOLPAR F@ F. 8 GOLINE ." Nose Radius [mm]:" 3 TOOLPAR F@ F. 10 GOLINE ." Prim. Cutting Edge Length [mm]:" 4 TOOLPAR F@ F. 11 GOUNE ." Sec. Cutting Edge Length [mm]:" 5 TOOLPAR F@ F. 13 GOLINE ." Cutting Direction:" 0 TOOLCAP @ .DIRECT 14 GOLINE ." Tool Capability: " 1 TOOLCAP @ .CAPAB KEY DROP CLS; Screen # 75 \ ISTKLEN (fp-), ISTKDIAM (fp~) !FEATURE# ( - - ) @MAXF 4 ISDATA; LOCATION ( n - ) 0 ISDATA ; SURFACE(n - ) 1 ISDATA ; FEATURE(n - ) 2 ISDATA ; TOOLPATH ( n - ) 3 ISDATA ; ISLOPE ( fp n ~ ) 14 + IFPDATA ; : ISTKLEN ( fp - )  09:12:1109/23/91  \ main feature surface  147  Appendix C.  The machining language FORTH code  2 IFPDATA HORIZ SURFACE;  \ - flen )  ISTKDIAM (fp --) F2/ FDUP 7 IFPDATA 2 @FPDATA FSWAP 0 I2FDATA;  \ -- flen fr)  Screen # 76 \ !CORNER(zfp xfp--), !FDIAM(dfp~),  00:18 09/23/91  :!CORNER(zfpxfp F2/0I2FDATA;  \-  -)  : IFDIAM ( dfp - ) 0 @2FDATA FROT F2/ FOVER F- F+ 1 I2FDATA;  Screen # 77 \ !NECK(lfp-), !TAPER(lfp-), !NAME<add-) :!NECK(lfp--) FPNUM F! 1 @2FDATA FSWAP FPNUM F@ F- FSWAP F2DUP 212FDATA FDROP 0 @2FDATA FNIP 3 I2FDATA HORIZ SURFACE; : ITAPER (lfp - ) FPNUM F@ FDUP F0= IF 1 @2FDATA 2 I2FDATA THEN F+ 0 @2FDATA -FROT FSWAP F- FSWAP 3 I2FDATA RAMP SURFACE; Screen # 78 \ MATCH (Astr Apat~Astr T|F)  )  \ ~ dfp zfp xfp) \ - zfp xfp rfp) \ ~ zfp x2fp )  14:3 02:24 09/23/91  \ - zfp xfp ) \-zfp'xfp) \-zfp'xfp)  \ a neck was not defined \-fp) \ - zfp xfp)  11:13 09/13/91  \ find matching pattern and xtract remaining text MATCH ( Astr "pattern - Astr T | F ) 2DUP SWAP COUNT ROT COUNT \ - Astr Apat add len add len) STRNDX DUP0< \ - Astr Apat offset) IF 3DROP FALSE EXIT \-F) THEN SWAP COUNT NIP + \ - Astr offset) SWAP COUNT 2 PICK - -ROT + SWAP STRPCK \ - A str) TRUE ; - Astr T )  148  Appendix C.  The machining language FORTH code  Screen # 79 \ DEL ( - - ) 15:08 09/23/91 \\ : DEL (-- ) CLRTXTBUF BL WORD 0 $>TXTBUF ['] FORGET TXTBUF>$ ; \\ CURFEAT ( 'BODY> >NAME  Screen # 80 \ ADDFEAT ( - - )  12:01 09/23/91  : ADDFEAT (-- ) 0E0 0E0 ! FINAL AXIAL TOOLPATH EXTERNAL LOCATION 0 ?SLOPE 0 ISLOPE 1 7SLOPE 1 ISLOPE FINPASS !FEATURE# CURFEAT @ @MAXF FEATLIST ! MAXF# 1+!;  \ add the new feature to feat, array \ Default finish allowance \ Default tool path orientation \ Default is external feature \ Slope of feat, surface \ Slope of check surface \ find finish pass points for surface \ store the feature number \ put feature pfa on feature list \ Increment the feature number  Screen # 81 \ FINAL ( --)  12:56 09/23/91  : FINAL ( — ) \ extract fin. allowances from input line CLRTXTBUF ASCII; WORD 0 $>TXTBUF TXTBUF>$ @2FLOAT IF IFINAL FINPASS ELSE CR ." Error: Finish allowance specification." CR THEN;  Screen # 82 \ XSDIAM ( -- T|F )  09:09 09/23/91  : XSDIAM ( -- T|F) \ extract width from input line TXTBUF>$ " DIAM " MATCH IF @FLOAT IF 1STKDIAM TRUE EXIT ELSE CR ." Enor: Blank diameter specification." CR THEN ELSE CR ." Error: DIAM key word not found in input line." CR THEN FALSE;  Screen # 83 \ XSLEN ( - T|F ) : XSLEN ( ~ T|F ) TXTBUF>$ " LEN " MATCH  09:09 09/23/91 \ extract left diameter from input line  149  Appendix C.  The machining language FORTH code  IF @FLOAT IF ISTKLEN TRUE EXIT ELSE CR ." Error: Blank length specification." CR THEN ELSE CR ." Error: LEN key word not found in input line." CR THEN FALSE;  Screen # 84 \ XTAPER ( - T|F )  14:09 09/19/91  : XTAPER ( - T|F ) \ extract left diameter from input line TXTBUF>$ " TAPER " MATCH IF ©FLOAT IF ITAPER TRUE EXIT ELSE CR ." Error: Taper lenght specification." CR THEN THEN FALSE;  Screen # 85 \XNECK(-T|F)  14:09 09/19/91  : XNECK (-- T|F ) \ extract left diameter from input line TXTBUF>$ " NECK" MATCH IF @FLOAT IF !NECK TRUE EXIT ELSE CR ." Error: Neck lenght specification." CR THEN THEN FALSE;  Screen # 86 \ XRD ( - T|F )  14:08 09/19/91  : XFD ( — T|F ) \ extract right diameter from input line TXTBUF>$ " FD " MATCH IF ©FLOAT IF IFDIAM TRUE EXIT ELSE CR ." Error: Right diameter specification." CR THEN ELSE CR ." Error: RD key word not found in input line." CR THEN FALSE ;  Screen # 87 \ XCORNER (--T|F ) : XCORNER (-- T|F) TXTBUF>$ " CORN " MATCH IF @2FLOAT IF ICORNER TRUE EXIT  10:43 09/11/91 \ extract corner point from input line  150  Appendix C. The machining language FORTH code ELSE CR ." Error: Corner point specification." CR THEN ELSE CR ." Error: CORN key word not found in input line." CR THEN FALSE;  Screen # 88 \ Features  *  17:36 09/20/91  \ BOUND LEN 400 DIAM 400; \ EXTERN WP NECK SHI CORN 400 400 RD 200 WID 200 FA 3 2; \ EXTERN WP FEAT TAPl CORN 400 350 FD 200 NECK 100 TAPER 100; \ EXTERN WP FEAT SHI CORN 400 400 FD 350 NECK 100;  Screen # 89 \ BOUND ( n -- )  18:39 09/23/91  : BOUND ( n ~ ) \ - WP\STOCKMODE) CREATE HERE CURFEAT ! FEATMEM ALLOT \ allocate memory CURFEAT @ FEATMEM ERASE \ initialize space ( 0 ) FEATURE \ WPVSTOCK class EXTERNAL LOCATION \ feature location CLRTXTBUF ASCII; WORD 0 $>TXTBUF XSLEN XSDIAM AND IF ADDFEAT CR." Feature added successfuly." CR ELSE CR ." Error in feature specification. Try agin." CR THEN DOES> CURFEAT !; \- )  Screen # 90 \ SHOULDER ( n --)  18:39 09/23/91  :SHOULDER(n - ) \++) CREATE HERE CURFEAT ! FEATMEM ALLOT \ allocate memory CURFEAT @ FEATMEM ERASE \ initialize space ( 0 ) FEATURE 0E0 FPNUM F! CLRTXTBUF ASCII; WORD 0 $>TXTBUF XCORNER XFD AND XNECK XTAPER OR AND IF ADDFEAT CR ." Feature added successfuly." CR ELSE CR ." Error in feature specification. Try agin." CR THEN DOES> CURFEAT ! ; \- )  Screen # 91 \ ALUMINUM WORKPIECE  11:09 10/07/92  151  Appendix C.  The machining language FORTH code  152  \\  STOCK BOUND BND LEN 50 DIAM 102; WP SHOULDER SHI CORN 50 102 FD 98 NECK 20; WP SHOULDER SH2 CORN 50 98 FD 94 NECK 20;  Screen # 92 \ CALIBRATION PASSES FOR ALUMINUM WORKPIECE  11:09 10/07/92  \ STOCK BOUND BND LEN 110 DIAM 127; \ WP SHOULDER SHI CORN 110127 FD 110 NECK 10 TAPER 10; \ FINAL 2 2; \ STOCK SHOULDER SH2 CORN 95 127 FD 100 NECK 10;  Appendix C.  The machining language FORTH code  Code for communication with DSP (dsp.scr)  Screen # 0 \ 13:55 02/27/92 dsp hostif command format: DO = 0 => Y memory 1 => X memory Dl = 0 => read: read dsp memory & send to HI port 1 => write: read HI port & write to dsp memory  Screen # 1 \  16:07 03/19/92  2 50 THRU .( DSP ) USING COM 1LOAD  Screen # 2 \ HEX  08:53 02/27/92  : INITHI ( - ) 0 CVR PC! 80ICRPC! BEGIN RXL PC@ DROP ISR PC@ 1 AND 0= UNTIL ; : DSPJNIT ( - ) (host vector 24) ( dsp to read RTX 2 times to empty) 92 CVR PC! ; : DSP_EXEC 93 CVR PC! ( execute hostif cmd, vector 26 ) ; ( read adr & cmd as one 24 bit word,) ( decode cmd, read another 24 bit word [data] if reqd )  Screen # 3 \ d here only 24 bits : DR ( - d ) BEGIN ISR PC@ 1 AND 0> UNTIL RXHPC@ RXM PC@ 8 SHIFT RXL PC@ + SWAP: : DW ( d --) BEGIN ISR PC@ 2 AND 0> UNTIL TXHPC! D U P x T X M P C ! TXLPC!  13:37 02/27/92  (byte) (n)  153  Appendix C. The machining language FORTH code \ n byte = 16 bit number D0-D15 & byte D16-D23  Screen # 4 13:53 02/27/92 \ :DX!(dadr - ) ( write 24 bit data to X memory ) 3(dsphostifcmd)DW DW DSP^EXEC; : DX@ ( adr - d ) ( read X memory, 24 bit data ) 1 DW DSP_EXEC DR; : D Y ! ( d a d r --) 2 DW DW DSP_EXEC; : D Y @ ( a d r --) 0 DW DSP EXEC DR;  Screen # 5 \ : DRB ( - byte) ( dsp byte memory read) BEGIN ISR PC@ 1 AND 0> UNTIL RXLPC@ ;  14:12 02/27/92  : DWB ( byte — ) ( dsp byte memory write ) BEGIN ISR PC@ 2 AND 0> UNTIL TXLPC!;  Screen # 6 \ :DXC!(nadr - ) 3 DW DWB DSP EXEC; :DXC@(adr 1 DW  13:53 02/27/92  --) DSP_EXEC DRB;  : D Y C ! ( n a d r --) 2 DW DWB DSP_EXEC; :DYC@(adr - ) 0 DW DSP EXEC DRB ;  Screen # 7 \ HEX \ 8 LED DYC! (writes 8 to leds ) \ LED DYC@ . ( reads leds ) : D16B0 40000. DW DSP EXEC ;  08:51 02/29/92  Appendix C. The machining language FORTH code D16B1 140000. DW DSP_EXEC; BOJNIT 4000. ( base adr for bufferO) 1 (b0_wr adr) DX!; RDBOWR 1 DX@ D . ; : D24B0 COOOO. DW DSP_EXEC ; D24B11C0000. DW DSP_EXEC ;  Screen # 8 \ Test 16 bit buffer 0  11:50 03/19/92  INITHI DSPJNIT (sets up host interface) : WRITE16B0 ( n - ) 4 DW DSP_EXEC ; : 16B0JNIT 4000. ( base adr for bufferO) l(16bO_wradr)DX! ; : 16B0? 1 DX@ D . ; : TEST16 16B0JNIT 12 0 DO I WRITE16B0 CR 16B0? 1 DX@ DROP DX@ D. LOOP ;  Screen # 9 \ Test 24 bit buffer 0  08:51 02/29/92  : WRITE24B0 ( dl d2 -- ) COOOO. DW DSP_EXEC DW ( write d2 ) DW ( write d l ) ; : 24B0JNIT 5000. (base adr for bufferO) 9 ( 24b0_wr adr ) DX! ; : 24B0? 9 DX@ D . ; : TEST24 24B0JNIT 12 0 DO I 0 1 0 WRITE24B0 CR 24B0? 9 DX@ DROP DUP DX@ D. 1+ DX@D. LOOP;  Screen # 10 \ DFP@ ( adr -- fp) : DFP@ ( adr - fp ) DUP >R 1+ DY@ DUP 80 AND IF NOT SWAP NOT SWAP 80 OR THEN 8 SHIFT OVER -8 SHIFT OR SWAP 8 SHIFT SWAP R> DY@ DROP 1FFF-;  17:50 03/26/92  \ check sign bit on mantissa \ 2's compl conversion \ shift high word \ shift low word \ OR and shift low word \ get exponent  155  Appendix C. The machining language FORTH code  Screen # 11 \ DFP! ( fp add -- ) : DFP! ( fp add --) DUP 1+ >R >R 1FFF + 0 R>DY! SWAP -8 SHIFT OVER 8 SHIFT OR SWAP -8 SHIFT DUP 80 AND IF NOT SWAP NOT SWAP 80 OR THEN R> DY!; \ store mantissa  Screen # 12 \ DRP, DWP : DRP ( - byte) BEGIN ISR PC@ 1 AND 0> UNTIL RXLPC@ ;  16:56 03/26/92  address of fp mantissa & exponent in DSP \ add bias - d ) \ store exponent  \ check sign bit on mantissa \ 2's compl conversion  14:12 02/27/92  : DWP ( byte --) BEGIN ISR PC@ 2 AND 0> UNTIL TXL PC! ;  Screen # 1 3 \ DWPX, DRPX, DWPY, DRPY : DWPX ( byte_data n a d r --) ( write 8 bit data to X peripheral memory ) 7 DW DWP DSP EXEC;  13:53 02/27/92  :DRPX(n_adr --) ( read 8 bit data from X peripheral memory ) 3 DW DSP_EXEC DRP;  DWPY(byte_data n a d r --) 6 DW DWP DSP EXEC; DRPY(n_adr --) 2 DW DSP_EXEC DRP;  Screen # 1 4 \ Screen to text file conversion using DOSIN DECIMAL : OPENDATAFILE ( - ) " c:\RAMIN\data" DFILE NAME>HCB DFILE 0 FMAKE DROP;  11:54 03/19/92  \~) \-flag)  : CLOSE_DATAFILE ( - - ) DFILE FCLOSE DROP ;  156  Appendix C. The machining language FORTH code  Screen # 1 5 \ TIMER ( n -- )  10:05 03/17/92  VARIABLE COUNTER VARIABLE TIME VARIABLE DURATION : TIMER ( n --) \ 20 = 1 sec wait period DUP TIME ! DUP DURATION ! COUNTER ! COUNTER TICKER DROP \ setup timer variable BEGIN COUNTER @ \ check timer variable status IF FALSE DURATION @ COUNTER @ TIME ! \ decrement time ELSE TRUE \ timer ran out! THEN \ -flag) UNTIL;  Screen # 1 6 \ FP>$, 3FP>LINE, 3FP>FILE  16:04 03/19/9  : FP>$ ( fp - Astr ) (F.R) STRPCK; : 3FP>LINE ( fp fp fp - Astr2 ) CLRTXTBUF FZSCALE F* FP>$ 2 $>TXTBUF FRSCALE F* FP>$ 1 $>TXTBUF FASCALE F* FP>$ 0 $>TXTBUF;  \ Fz \ Fy \ Fx  : 3FP>FILE ( fp fp fp - ) 3FP>LINE DFILE TXTBUF LINELEN SAVELINE ;  Screen #17 \ KEY? ( -- n ) : KEY? (-- n ) \ 1 = ESC, 0 = ignore ?TERMINAL 1 = IF KEY 27 = IF 1 ELSE 0 THEN ELSE 0 THEN;  16:07 03/18/92  \ get key - flag )  Screen # 18 \ FORCE@ ( - )  09:45 03/23/92  : FORCE! ( fp fp fp - ) 3FP>FILE ;  \~)  157  Appendix C.  The machining language FORTH code  : FORCE® ( - fp fp fp ) 10 0 DO *FA I 2* + DFP@ *FR I 2* + DFP@ *FV I 2* + DFP@ FORCE! LOOP CLRTXTBUF DFILE TXTBUF LINELEN SAVELINE ;  \ clear buffer & insert blank line at end of \ calibration pass  Screen # 19 \ INIT_MON  16:50 04/01/92  : INIT_MON ( - ) KK1 *K1DFP! KK2 *K2DFP! HEMAX F@ *HEMAX DFP! THETA *THETADFP! NRAD F@ *NRAD DFP! THRESHOLD *THRESHOLD DFP! FZSCALE *FZSCALE DFP! FZMAX F@ *FZMAX DFP! RCUT F@ *S DFP! 1.5E-3*DTDFP! KDF_POS F@ *KDF_POS DFP! KDF_NEG F@ *KDF_NEG DFP!;  Screen # 20 \ INIT_OPT :INIT_OPT(-) KK1 *K1DFP! KK2 *K2DFP! KK3 *K3 DFP! KK4 *K4 DFP! HEMAX F@ *HEMAX DFP! \ THETA *THETADFP! NRAD F@ *NRAD DFP! THRESHOLD *THRESHOLD DFP! FZSCALE *FZSCALE DFP! FRSCALE FZSCALE F/ *S_RATIO DFP! FZMAX F@ *FZMAX DFP! RCUT F@ *S DFP! 2E-3*DTDFP!  Screen # 2 1 \ INIT_OPT cnfd  KDF_POS F@ *KDF_POS DFP! KDF_NEG F@ *KDF_NEG DFP! KDH_POS F@ *KDH_POS DFP! KDH_NEG F@ *KDH_NEG DFP! ;  \ get forces from DSP and store in \~fp) -fpfp) \-fpfpfp)  \ initialize ID algorithm variables on DSP \ material constants \ max. equiv. chip thickness \ motion direction (current) \ nose radius \ force threshold value [N] \ charge amp scale setting in Z \ force constraint in Z \ current feed [mm/rev] \ sampling period \ gain of derivative control \ gain of derivative control  13:43 05/28/92 \ initialize ID algorithm variables on DSP \ material constants  \ max. equiv. chip thickness \ motion direction (current) \ nose radius \ force threshold value [N] \ charge amp scale setting in Z \ charge amp scale ratio \ force constraint in Z \ current feed [mm/rev] \ sampling period  13:37 05/28/92 \ gain of deriv force control \ gain of deriv force control \ gain of deriv he control \ gain of deriv he control  Appendix C. The machining language FORTH code  Screen # 22 \S>$  12:32 04/08/92  : S>$ ( s -- A str) 0 < # # S # > STRPCK;  \ convert single to string  : D>$ ( d -- "str) <##S#> STRPCK;  \ conver double to string  : TXTBUF>DFILE ( -- ) DFILE TXTBUF LINELEN SAVELINE;  \ write buffer to data file  Screen # 23 \ $DATE, $TIME  11:08 04/08/92  : $DATE ( — ) \ put date string in text buffer @DATE 256 /MOD 0 <# ASCII / HOLD #S #> STRPCK 35 $>TXTBUFN 0 <# ASCII / HOLD #S #> STRPCK 38 $>TXTBUFN S>$ 41 $>TXTBUFN; : $TIME ( — ) \ put time string in text buffer @TIME DROP 256 /MOD 0 <# ASCII: HOLD #S #> STRPCK 35 $>TXTBUFN S>$ 38 $>TXTBUFN;  Screen # 24 \ CALIB_INFO 08:46 04/08/92 : CALIBJNFO ( - ) \ store calibration parameters in " Date:" 0 $>TXTBUFN $DATE TXTBUF>DFILE " Time: " 0 $>TXTBUFN $TIME TXTBUF>DFILE "Material: Aluminum " 0 $>TXTBUFN TXTBUF>DFILE " Tool: TPU 433.H13A K20" 0 $>TXTBUFN TXTBUF>DFILE " Description: Calibration" 0 $>TXTBUFN TXTBUF>DFILE " Feeds (1,2),3 [mm/rev]:" 0 $>TXTBUFN RCUTF@ FP>$ 35 $>TXTBUFN FCUTF@ FP>$ 45 $>TXTBUFN TXTBUF>DFILE " Depth of Cut [mm]: " 0 $>TXTBUFN DOC F@ FP>$ 35 $>TXTBUFN TXTBUF>DFILE " Spindle Speed [RPMJ:" 0 $>TXTBUFN VFP>$ 35 $>TXTBUFN TXTBUF>DFILE --> Screen # 25 \ CALIBJNFO Cnt'd 08:46 04/08/92 " Specific Cutting Pressures k 1, k2 [N/mmJ:" 0 $>TXTBUFN KK1 FP>$ 35 $>TXTBUFN  Appendix C. The machining language FORTH code KK2 FP>$ 45 $>TXTBUFN TXTBUF>DFILE Tool Nose Radius [mm]:" 0 $>TXTBUFN NRAD F@ FP>$ 35 $>TXTBUFN TXTBUF>DFILE Charge Amp setting V,R,A [Mu/V]:" 0 $>TXTBUFN FZSCALE FP>$ 35 $>TXTBUFN FRSCALE FP>$ 45 $>TXTBUFN FASCALE FP>$ 55 $>TXTBUFN TXTBUF>DFILE " Force Sampling Period [s]: 0 $>TXTBUFN SAMPLE_PRD FP>$ 35 $>TXTBUFN TXTBUF>DFILE " Force Threshold Z-axis [N] " 0 $>TXTBUFN THRESHOLD FP>$ 35 $>TXTBUFN TXTBUF>DFILE " Pause Period Before Sampling [s]: 0.5 " TXTBUF>DFILE TXTBUF>DFILE; \ blank lines Screen # 26 UNIT CALIB : INIT_CALIB (-- ) FZSCALE *FZSCALE DFP! FZMAX F@*FZMAXDFP! SAMPLE_PRD *LOW_TIME DFP! RCUT F@ FCUT F@ CALIB_FEEDS F2! THRESHOLD THRESHOLD DFP!;  Screen # 27 \EXP INFO  08:54 04/08/92 \ initialize parameters for calibration \ charge amp scale setting in Z \ force constraint in Z \ force sampling period \ store calib feeds  0 14:24 04/08/92  \ store experimental parameters in file : EXPJNFO (-- ) TXTBUF>DFILE " Date: " 0 $>TXTBUFN $DATE TXTBUF>DFILE " Time:" 0 $>TXTBUFN $TIME 0 $>TXTBUFN TXTBUF>DFILE " Material: Aluminum" 0 $>TXTBUFN TXTBUF>DFILE " Description: Experiment 1" 0 $>TXTBUFN " Force Sampling Period [ms]: " DT 2@ 10 2/ D>$ 35 $>TXTBUFN TXTBUF>DFILE 0 $>TXTBUFN " Force Threshold Z-axis [N]: " THRESHOLD FP>$ 35 $>TXTBUFN TXTBUF>DFILE " Pause Period Before Sampling [s]: 0.5 " 0 $>TXTBUFN TXTBUF>DFILE  Screen # 28 \EXP INFOct'd  0 14:24 04/08/92  " Feed [mm/rev]: " 0 $>TXTBUF RCUT F@ FP>$ 35 $>TXTBUFN TXTBUF>DFILE " Charge Amp setting V,R,A [Mu/V]:" 0 $>TXTBUFN FZSCALE FP>$ 35 $>TXTBUFN FRSCALE FP>$ 45 $>TXTBUFN FASCALE FP>$ 55 $>TXTBUFN TXTBUF>DFILE " Depth of Cut [mm]:" 0 $>TXTBUFN DOC F@ FP>$ 35 $>TXTBUFN TXTBUF>DFILE TXTBUF>DFILE TXTBUF>DFILE; \ blank lines  160  Appendix C. The machining language FORTH code  Screen # 29 \ CALIBRATE MONITOR ID LED HEX : CALIBRATE ( -- ) INIT_CALIB 94 CVR PC! ; : MONITOR ( - ) INIT_MON 95 CVR PC! ;  13:00 03/24/92 \ execute calibration routin on DSP  \ execute monitor routine on DSP  : OPT (-- ) INITOPT 98 CVR PC! ; :LED ( - ) 96 CVR PC! ;  \ turn on all LEDs on DSP (use for reset)  Screen # 30 \ CH@, RESET (-- ) HEX  09:12 04/06/92  :CH@(-fpfpfp) 97 CVR PC! 10 WAIT 0 DFP@ ." AXIAL " F. CR 14 DFP@ ." RADIAL " F. CR 28 DFP@ ." VERTICAL " F . ;  \ execute hi cmd, vector to read a/d \ read 3 forces (dynamometer) \ axial force comp. \ radial force comp. \ power consuming force comp.  :RESET( - ) 0. 5 F D Y ! ;  \ Stop the routine running on DSP  RDYL ( - ) 1. FFEA DY! ; : RDYH ( --) 0. FFEA DY! ;  161  Appendix C.  The machining language FORTH code  Lathe operation commands (com.scr) Screen # 0 \  07:58 03/20/92  CONTROLLER INTERFACE WITH UBC LATHE LANGUAGE EXTRACTS COORDS FROM CLD FILE AND SENDS THEM TO THE CONTROLLER ALONG WIHT MOTION COMMANDS TO CONTROL FEED AND SPEED.  Screen # 1 \ COM LOAD SCREEN  15:26 03/26/92  2 50 THRU CR .( COMMANDS) CR  Screen # 2 \ DOCUMENTATION \\ Emperical words: xxxx Z xxxx X MOV [10E3 counts/inch ] xxxx FED [10E-3 inch/min ] Metric words: MOVE Z sss X sss; FEED sss; [mm/rev] fp FED [mm/min] fp FEDREV [mm/rev]  11:1210/07/92  \ move xxx [mm]  Screen # 3 \ Z, X, MOV, FEED, ZPOS?, XPOS?, CLRZ, CLRX 14:02 08/30/91 DECIMAL : COM ( -- ) ; \ mark spot in dictionary Z (d- )X; X ( d - ) DNEGATE Y ; MOV ( - - ) XYL; ZPOS? ( - f ) XPOS? ; XPOS? ( ~ f ) YPOS? FNEGATE ; CLRZ ( -- ) CLRX ; CLRX ( - - ) CLRY;  Screen # 4 \ 2ROLL(n-), 2REV(count-)  \ store z coordinate \ store x coordinate \ initiate motion \ get z-axis position \ get x-axis position \ clear the z register \ clear the x register  12:55 08/28/91  162  Appendix C.  The machining language FORTH code  2ROLL ( n --) 2* 1+ DUP ROLL SWAP ROLL SWAP ;  \ roll n-th double to top of the stack  2REV ( count - count) DUP>R 1DO I2ROLL LOOP R> ;  \ reverse the order of doubles on stack  Screen # 5 \ GETX ( -- T|F )  13:55 10/08/91  : GETX ( » T|F ) \ extract X from input line TXTBUF>$ " X " MATCH IF ©FLOAT IF MM>COUNT X TRUE EXIT ELSE CR ." Error: X input." CR THEN ELSE CR ." Error: X key word not found in input line." CR THEN FALSE;  Screen # 6 \ GETZ ( -- T|F )  13:55 10/08/91  GETZ ( - T|F ) \ extract Z from input line TXTBUF>$ " Z " MATCH IF ©FLOAT IF MM>COUNTZ TRUE EXIT ELSE CR ." Error: Z input." CR THEN ELSE CR ." Error: Z key word not found in input line." CR THEN FALSE;  Screen # 7 \ MOVE(-), FEED (--), SPEED (-)  111:30 09/13/91  \ input z,x [mm] in floating point : MOVE ( --) CLRTXTBUF ASCII; WORD 0 $>TXTBUF GETZ GETX AND IF MOV ELSE CR ." Error in coord specification. Try agin." CR THEN; : FEED ( --) \ input feed rate [mm/rev] CLRTXTBUF ASCII; WORD 0 $>TXTBUF TXTBUF>$ ©FLOAT \ - fp) V F* 1.524E0 F/ F>D VEL ; \ -- 60*25.4/1000 ) in/min :SPEED ( - )  \ input spindle speed [rpmj  163  Appendix C. The machining language FORTH code CLRTXTBUF ASCII; WORD 0 $>TXTBUF TXTBUF>$ @FLOAT \ - fp ) F>D RPM;  Screen # 8 \ FED ( fp - ) : FED ( fp — ) 1.524E0 F/ F>D VEL;  13:38 09/03/91 \ feed rate command [ mm/min ] \ - 60*25.4/1000 = fp) IN/min  \ mm/min = min/60s mm/25.4in 1000/1 FEDREV ( fp - ) V F* 1.524E0 F/ F>D VEL;  Screen # 9 \ GODATUM(-), MOVOUT(-) : GODATUM ( - ) OUTCUT F@ FED XPOS? FNEGATE 1E3 F* F>D X 0. Z MOV ZPOS? FNEGATE 1E3 F* F>D Z 0. X MOV RCUT F@ FEDREV;  \ feed rate command [ mm/rev ] \ -- fp) mm/min \ - 60*25.4/1000 = fp) IN/min  13:28 09/03/91 \ rapid move to the datum (comer of wpiece) \ move along x axis \ move along z axis  : MOVOUT ( — ) OUTCUT F@ FED 3000. Z 3000. X MOV;  \ rapid move to clear workpiece \ move out 5" in z & x  Screen # 10 \ RPMW (s~)  16:01 08/30/91  : RPMW ( s - ) \ set rpm and wait to reach speed DUP RPM RPM? \ - rpm) 100 / 100 * 200 + \ - w) 5 seconds delay/100 rpm CLS 0 GOLINE ." Stand by for spindle to reach speed ...." WAIT \ -) CLS 0 GOLINE ." Spindle speed reached:" RPM? .  Screen #11 \ SOFF@DATUM (-- ) DECIMAL  18:21 08/30/91 \ wait until datum is reached & turn spindle off  : SOFF@DATUM (--) GODATUM BEGIN 20 WAIT  \ wait 1 seconds  164  Appendix C.  The machining language FORTH code  XPOS71E-3 F< ZPOS? 1E-3 F< AND UNTIL SOFF STOP;  Screen # 1 2 \ NXTWRD ( add- newadd F|T) : NXTWRD ( add - newadd F|T ) BEGIN DUP >R R@ C@ BL = R> TXTBUF - LINELEN < AND WHILE 1+ REPEAT DUP TXTBUF - LINELEN < IF FALSE ELSE DROP TRUE THEN;  17:58 10/08/91 \ skip over blanks to next word \~ \~ \\-  newadd flag ) newadd flag) add ) newadd )  \ - newadd F ) \ --T)  Screen #13 \ PARSEWORD (add- newadd add len )  18:22 10/08/91  CREATE SBUFF 20 ALLOT  \ text line buffer for file output  PARSEWORD ( add - newadd add len) SBUFF 20 BLANK \ - add ) SBUFF >R \ - add ) BEGIN \ store characters in SBUFF until BL encountered DUPC@DUPBL<> \ - add char flag) WHILE R@C!R>1+>R1+ \-add) REPEAT DROP \ - add ) SBUFF R> SBUFF - ; \ - newadd add len )  Screen #14 \ PARSELINE (add-d ... n)  7:44 10/08/91  : PARSELINE ( add - d ... d n ) 0 >R BEGIN R>1+>R PARSEWORD STRPCK NUMBER? NOT IF DNEGATE THEN ROT NXTWRD UNTIL R > ;  \ - newadd d) \ - d newadd) \ — d .. newadd flag ) \ - d count)  Screen # 1 5 \ CALIB_PTS>BUFF ( d .. d cnt fp --)  11:14 04/05/92  \ - add ) \ count # coords of cycle ) \ - newadd add len) \ - newadd d flag )  165  Appendix C.  The machining language FORTH code  : CALIB_PTS>BUFF (d .. d count fp --) FEDREV 2/ 2- DUP 0< IF DROP OUTCUT F@ FED 2DUP D0= >R 20VER D0= R> AND IF 2DROP2DROP ELSE Z X MOV THEN ELSE CALIBRATE ODO Z X MOV LOOP OUTCUT F@ FED Z X MOV FORCE® Z X MOV THEN;  Screen # 16 \ PTS>BUFF (d..d cnt-) : PTS>BUFF(d..d count - ) RCUT2 FEDREV 2/ 2- DUP 0< IF DROP OUTCUT F@ FED 2DUP D0= >R 20VER D0= R> AND IF 2DROP2DROP ELSE Z X MOV THEN ELSE 0 DO Z X MOV LOOP OUTCUT F@ FED Z X MOV Z X MOV THEN;  Screen # 1 7 \CLD( - ) : CLD ( ~ ) GENPATH " CL" FILE NAME>HCB OPENJDFILE PASS @ 0 PASS ! CLRTXTBUF CORNOFFSET @TOOLPATH IF 0?DO CLRTXTBUF AXCLD PASS+ LOOP ELSE 0 ?DO CLRTXTBUF RADCLD PASS+ LOOP THEN -->  \ schedule desired cutting feed \ - for this 4-stroke cycle \ plan motion for inital offset \ if no motion req. then skip \ plan feed for 4-stroke motion \ in-cut motions at incut feed  \ retract motion at outcut feed  13:28 09/03/91  \ plan motion for inital offset \ if no motion req. then skip \ plan feed for 4-stroke motion  \ RCUT2 FEDREV  08:18 10/09/91  \ generate the tool path  \-n) \ motion for corner offset \ PATH = 1 radial, = 0 axial  166  Appendix C. The machining language FORTH code  Screen # 18 \ CLD cnfd  11:35 05/29/92  16 @FPDATA F0> 17 @FPDATA F0> AND IF CLRTXTBUF DOFINPASS THEN CLOSE FILE ;  Screen # 19 \ STARTUP ( - ), SHUTDOWN ( - ) :STARTUP( - ) MOVOUT CLS SON V F>S RPMW  SHUTDOWN (--) SOFF@DATUM  Screen # 20 \ SCH_FEED ( - fp) : SCH_FEED ( - fp) CALIB_FEEDS F2@ CALIB_PASS @ DUP 1 = >R 0 = R> OR IF FDROP ELSE FNIP THEN 1 CALIB PASS +!  Screen # 21 \ CALIB ( - )  \ move out of spindle range \ turn spindle on and bring upto speed  \ clear tool from workpiece  10:32 03/19/92 \ scheduled feed rate for calibration \-fpfp) \~fpfpflag) \ rcut feed for first 2 passes \ fcut feed for third pass \ increment calibration pass counter  13:46 03/19/92  \ calibration cut macro : CALIB ( --) CLD CLS0GOLINE ." CL file created. Hit ENTER to start calibration cut!" KEY CRCR DROP OPEN_SFILE OPEN_DATAFILE CALIBJNFO INIT_CALIB GODATUM 0 CALIBPASS ! \ zero pass counter BEGIN FILE FREADLN 0> WHILE STRBUF COUNT TXTBUF SWAP CMOVE \ - d .. d count) TXTBUF PARSELINE \ -- d ... d count) 2REV SCH_FEED CALIB_PTS>BUFF REPEAT CLOSE_FILE CLOSEDATAFILE CLS 0 GOLINE ." Done! ";  Screen # 22  167  Appendix C.  The machining language FORTH code  \ CUT ( - )  17:54 09/09/91  : CUT ( - - ) CLD CLS 0 GOLINE ." CL file created. Hit ENTER to cut!" KEY CR CR DROP OPEN_SFILE GODATUM BEGIN FILE FREADLN 0> WHILE STRBUF COUNT TXTBUF SWAP CMOVE TXTBUF PARSELINE \ -- d .. d count) 2REV \ -- d ... d count) PTS>BUFF REPEAT CLOSE_FILE CLS 0 GOLINE ." Done! " \ SHUTDOWN ; \ turn spindle off after datum reached  Screen # 23 \ DO_KEYl ( n  ), DO_KEY2  : DOJCEY1 ( n - ) CASE 75 OF STEP 2@ DNEGATE Z MOV ENDOF 77 OF STEP 2@ Z MOV ENDOF 72 OF STEP 2@ DNEGATE X MOV ENDOF 80 OF STEP 2@ X MOV ENDOF ENDCASE;  Screen # 24 \ DO_KEY2 ( n  )  : DO_KEY2 ( n - ) CASE 43 OF STEP 2@ D2* STEP 2! ENDOF 45 OF STEP 2@ D2/ STEP 2! ENDOF ENDCASE;  Screen # 25 UOG(-) : JOG ( - ) GO OUTCUTF@FED BEGIN KEY DUP0 = IF KEY DO_KEYl DROP ELSE DUP 27 = IF DROP STOP EXIT ELSE DO_KEY2 THEN THEN AGAIN;  12:07 03/19/92 \ arrow key functions left \ right \up \ down a  12:07 03/19/92 \ +/- key functions \ + key \-key  13:19 12/15/91 \ get arrow key for lathe motion commads \ enable controller \ get key - n flag) \ - n n') \--n) \ -- n flag) \~)  168  Appendix C. The machining language FORTH code  Screen # 26 WOGS(-) : JOGS (-- ) CLS OUTCUTF@FED GO SON 100 RPMW BEGIN KEY DUP 0 = IF KEY DO_KEYl DROP ELSE DUP 27 = IF DROP STOP EXIT ELSE DO_KEY2 THEN THEN AGAIN SOFF STOP;  Screen # 27 \ INFEED (zfp,xfp,fp) OUTFEED : FEEDIN ( zfp xfp fp - ) FEDREV MM>COUNTX MM>COUNT Z XYL; : FEEDOUT ( zfp xfp fp - ) FED MM>COUNT X MM>COUNTZXYL;  13:19 12/15/91 \ get arrow key for lathe motion commads \ turn spindle on and bring upto spee \ enable controller \ get key ~ n flag) \ - n n') \--n) \ -- n flag ) \~) \~)  09:18 04/29/  169  


Citation Scheme:


Citations by CSL (citeproc-js)

Usage Statistics



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"
                            async >
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:


Related Items