- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Automated identification of cutting force coefficients...
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
Automated identification of cutting force coefficients and tool dynamics on CNC machines 2010
pdf
Page Metadata
Item Metadata
Title | Automated identification of cutting force coefficients and tool dynamics on CNC machines |
Creator |
Dunwoody, Keith |
Publisher | University of British Columbia |
Date Created | 2010-04-01T14:27:32Z |
Date Issued | 2010-04-01T14:27:32Z |
Date | 2010 |
Description | The complexity and variation of parts are continuously increasing due to technologically oriented consumers. The objective of present manufacturing industry is to increase the quality while decreasing the machining costs. This thesis presents a smart machining strategy which allows the automated prediction of chatter-free cutting conditions using sensors integrated to Computer Numerical Controlled (CNC) machine tools. The prediction of vibration free spindle speeds and depth of cuts require to have material's cutting force coefficient and frequency response function (FRF) of the machine at its tool tip. The cutting force coefficients are estimated from the cutting force measurements collected through dynamometers in laboratory environment. The thesis presents an alternative identification of tangential cutting force coefficient from average spindle power signals which are readily available on machine tools. When tangential, radial and axial cutting force coefficients are needed, the forces need to be collected by piezoelectric sensors embedded to mechanical structures. The structural dynamics of sensor housings distort the force measurements at high spindle speeds. A Kalman filter is designed to compensate the structural modes of the sensor assembly when the spindle speed and its harmonics resonate one of the modes the measuring system. The FRF of the system is measured by a computer controlled impact modal test unit which is integrated to CNC. The impact head is instrumented with a piezo force sensor, and the vibrations are measured with a capacitive displacement sensor. The spring loaded impact head is released by a DC solenoid controlled by the computer. The impact force and resulting tool vibrations are recorded in real time, and the FRF is estimated automatically. The measured FRF and cutting force coefficient estimated from the spindle power are later used to predict the chatter free depth of cuts and spindle speeds. The machine integrated, smart machining system allows the operator to automatically select the chatter-free cutting conditions, leading to improved quality and productivity. |
Genre |
Thesis/Dissertation |
Type |
Text |
Language | Eng |
Collection |
Electronic Theses and Dissertations (ETDs) 2008+ |
Date Available | 2010-04-01T14:27:32Z |
DOI | 10.14288/1.0070939 |
Degree |
Master of Applied Science - MASc |
Program |
Mechanical Engineering |
Affiliation |
Applied Science, Faculty of |
Degree Grantor | University of British Columbia |
Graduation Date | 2010-05 |
Campus |
UBCV |
Scholarly Level | Graduate |
URI | http://hdl.handle.net/2429/23240 |
Aggregated Source Repository | DSpace |
Digital Resource Original Record | https://open.library.ubc.ca/collections/24/items/1.0070939/source |
Download
- Media
- ubc_2010_spring_dunwoody_keith.pdf [ 1.16MB ]
- Metadata
- JSON: 1.0070939.json
- JSON-LD: 1.0070939+ld.json
- RDF/XML (Pretty): 1.0070939.xml
- RDF/JSON: 1.0070939+rdf.json
- Turtle: 1.0070939+rdf-turtle.txt
- N-Triples: 1.0070939+rdf-ntriples.txt
- Citation
- 1.0070939.ris
Full Text
Automated Identification of Cutting Force Coefficients and Tool Dynamics on CNC Machines by Keith Dunwoody B.A.Sc., The University of British Columbia, 2005 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) THE UNIVERSITY OF BRITISH COLUMBIA (Vancouver) March 2010 c© Keith Dunwoody 2010 Abstract The complexity and variation of parts are continuously increasing due to technologically ori- ented consumers. The objective of present manufacturing industry is to increase the quality while decreasing the machining costs. This thesis presents a smart machining strategy which allows the automated prediction of chatter-free cutting conditions using sensors integrated to Computer Numerical Controlled (CNC) machine tools. The prediction of vibration free spindle speeds and depth of cuts require to have mate- rial’s cutting force coefficient and frequency response function (FRF) of the machine at its tool tip. The cutting force coefficients are estimated from the cutting force measurements collected through dynamometers in laboratory environment. The thesis presents an alterna- tive identification of tangential cutting force coefficient from average spindle power signals which are readily available on machine tools. When tangential, radial and axial cutting force coefficients are needed, the forces need to be collected by piezoelectric sensors embedded to mechanical structures. The structural dynamics of sensor housings distort the force mea- surements at high spindle speeds. A Kalman filter is designed to compensate the structural modes of the sensor assembly when the spindle speed and its harmonics resonate one of the modes the measuring system. The FRF of the system is measured by a computer controlled impact modal test unit which is integrated to CNC. The impact head is instrumented with a piezo force sensor, and the vibrations are measured with a capacitive displacement sensor. The spring loaded impact head is released by a DC solenoid controlled by the computer. The impact force and resulting tool vibrations are recorded in real time, and the FRF is estimated automatically. The measured FRF and cutting force coefficient estimated from the spindle power are later used to predict the chatter free depth of cuts and spindle speeds. The machine integrated, smart machining system allows the operator to automatically select the chatter-free cutting conditions, leading to improved quality and productivity. ii Table of Contents Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Background and Literature Review . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 Identification of Cutting Force Coefficients . . . . . . . . . . . . . . . . . . . 3 2.2 Automatic Transfer Function Measurement . . . . . . . . . . . . . . . . . . 6 2.3 Effective Dynamometer Bandwidth Improvement . . . . . . . . . . . . . . . 8 3 Identification of Cutting Force Coefficients from Spindle Power . . . . . 10 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 Extraction of Cutting Torque from Spindle Load Sensor . . . . . . . . . . . 11 3.2.1 Limitation of Torque Estimation using Load Meter . . . . . . . . . . 14 3.3 Identification of Tangential Cutting Force Coefficient . . . . . . . . . . . . . 16 4 Automatic Impact Modal Testing of Milling Cutters . . . . . . . . . . . . 19 4.1 Automatic Spindle Orientation . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.2 Automatic Capacitive Sensor Calibration . . . . . . . . . . . . . . . . . . . 24 4.3 Signal Processing of Automatic Hammer Signal . . . . . . . . . . . . . . . . 25 4.3.1 Force Measurement Windowing . . . . . . . . . . . . . . . . . . . . . 25 4.3.2 Spectral Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.4 Hammer-Displacement Sensor Offset Compensation . . . . . . . . . . . . . . 31 iii Table of Contents 4.5 Comparison of Automatic Hammer with Traditional Impact Test . . . . . . 33 4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5 Effective Dynamometer Bandwidth Improvement . . . . . . . . . . . . . . 37 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.2 Dynamic Model of Cutting Force Measurement System . . . . . . . . . . . . 38 5.3 Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6 Integrated Smart Machining System . . . . . . . . . . . . . . . . . . . . . . 55 6.1 Integration with Cutting Coefficient Prediction . . . . . . . . . . . . . . . . 55 6.2 Integration with Automated Transfer Function Measurement Unit . . . . . . 57 6.3 Chatter Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.3.1 Chatter Stability Law . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.4 Prediction of Stability Charts . . . . . . . . . . . . . . . . . . . . . . . . . . 61 7 Summary and Future Research . . . . . . . . . . . . . . . . . . . . . . . . . 64 7.1 Limitations and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Appendices Automatic Hammer CNC Integration Source Code . . . . . . . . . . . . . . 69 iv List of Figures 2.1 Automatic Hammer[17] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1 Load Meter Voltage in Air Cutting . . . . . . . . . . . . . . . . . . . . . . . 11 3.2 Load Meter Sensitivity by Spindle Speed . . . . . . . . . . . . . . . . . . . . 13 3.3 Load Meter Torque Estimate vs. Measured Torque . . . . . . . . . . . . . . 14 3.4 Torque in Air Cutting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.5 Load Meter Sensitivity by Spindle Speed . . . . . . . . . . . . . . . . . . . . 17 4.1 Automatic Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.2 Measurement Heights for Finding Flutes . . . . . . . . . . . . . . . . . . . . 21 4.3 Cosine-Taper Window for Force Signal Windowing . . . . . . . . . . . . . . . 26 4.4 Automatic Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5 Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs. Cross) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6 Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs. Direct) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.7 Comparison of Automatic Hammer vs Traditional Tap Testing (Compensated vs. Direct) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.8 Predicted Stability of Slot Machining . . . . . . . . . . . . . . . . . . . . . . 35 5.1 Kalman Filter Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.2 Dynamometer Force-Force Transfer Function . . . . . . . . . . . . . . . . . . 49 5.3 Dynamometer Force-Force Transfer Function . . . . . . . . . . . . . . . . . . 49 5.4 Kalman Filter for X-Axis at Tooth-Passing Frequency of 930 Hz . . . . . . . 50 5.5 Kalman Filter for Y-Axis at Tooth-Passing Frequency of 930 Hz . . . . . . . 50 v List of Figures 5.6 X-Axis Cutting Test at 13950 RPM . . . . . . . . . . . . . . . . . . . . . . . 51 5.7 Y-Axis Cutting Test at 13950 RPM . . . . . . . . . . . . . . . . . . . . . . . 52 5.8 X-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90th Percentile) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.9 Y-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90th Percentile) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.1 CNC and Automatic Hammer Connection to Laptop Computer . . . . . . . 56 6.2 Comparison of Stability Chart with Different Kr . . . . . . . . . . . . . . . . 62 6.3 Comparison of Stability Chart with State of the Art Approach . . . . . . . . 63 vi Chapter 1 Introduction Present computer numerical controlled (CNC) machine tools have integrated tool setting, in-situ inspection, positioning error compensation, vision and communication with remotely located maintenance computers for on-line troubleshooting. However, machining process control and monitoring tasks have not been widely implemented in industry, despite intensive research efforts since 1980s, due to poor reliability of algorithms and sensors. Industry removed most tool condition monitoring systems since they frequently failed to detect the tool wear and breakage, and stopped the machines which led to poor productivity. The recent advances in electronics, sensors and computer technology created new opportunities to add intelligence to CNC machine tools. However, any new on-line process monitoring and control task must be reliable and should not hinder the production flow. This thesis proposes an automated approach to one problem commonly encountered in industry: chatter prediction. A common problem in industry is the chatter vibrations during milling and wear of the spindles. If the selected depth of cut and spindle speeds in the NC program are incorrect, the machine tool becomes unstable and experiences severe vibrations, which lead to tool failure, damage to the machine tool spindle and workpiece. The machine tool vibrations can be avoided by predicting the critical depth of cut and speeds, and choosing a spindle speed and depth of cut in the stable region. This stable region depends on the frequency response of the machine at the tool tip and cutting force coefficients of work material to be machined. Each frequency response function and cutting force coefficient are strongly dependent on the particular tool geometry and work material, and their preparation in the data base prior to production is rather a costly process, and require scientific expertise. This thesis presents robust sensors and on-line algorithms to measure the material cut- ting coefficients and dynamic stiffness changes of the spindle. From this data, the chatter 1 Chapter 1. Introduction free, stable depth of cuts and speeds are identified automatically. The Frequency Response Function is measured with a computer controlled impact testing unit, and cutting force coefficients of materials are identified automatically from the spindle power sensor when ac- tivated by the operator on demand. A communication protocol between the CNC and an external PC is designed, which allows command and data exchange between the machine tool control (CNC) and measurement (PC) units. An automated impact hammer is inte- grated to CNC machine tool to measure FRF at the tool tip. The operator can activate the FRF measurement from the panel through computer commands. The tool is positioned automatically at the impact testing station placed at the corner of the machine tool table. The measurement unit is activated and FRF of the tool is measured automatically. The operator is allowed to conduct trial test cuts with the same tool and specific work material. The spindle power is collected and sent to measurement computer. The power data, which is calibrated against cutting forces and torque, is used to identify cutting force coefficients automatically. The measured FRF and cutting force coefficients are used to predict chatter stability charts, which enable the operator to select optimal depth of cut and spindle speeds without violating the maximum torque and power limit of the machine tool. Henceforth, the thesis is organized as follows. Chapter 2 presents related literature about on-line machine tool monitoring, control and chatter prevention methods. The estimation of cutting forces and cutting force coefficients from the machine spindle load meter is presented in Chapter 3. The integration of automated impact hammer to CNC machine tool and its reliability are explained in Chapter 4. The cutting force measurement technique developed in Chapter 3 are sufficient for measuring the average torque on the spindle, but cannot be used to reliably measure the instantaneous torque, or the cutting forces in the other two directions. If these forces are required, a dynamometer must be used. However, dynamometers distort the cutting forces if the spindle speed or tooth passing frequency is close to a mode of the dynamometer. This can occur during high-speed machining. Chapter 5 presents a method for compensating the dynamics of a dynamometer to make them more useful during high speed machining. The impact test and cutting force coefficients are integrated to a previously developed chatter stability and machine tool diagnostic system in Chapter 6. The thesis is concluded with a summary and future research issues in Chapter 7. 2 Chapter 2 Background and Literature Review As machined parts become more complicated and the time given to develop them shortens, it becomes more important to decrease the length of the the machining process time of a part. Smart machining systems aim to improve productivity and part machining quality by integrating sensors to the machine tool, combined with physics based predictive models to provide actionable information to the machine tool operator. This allows a smart machining system to provide the first and every part correct; improve the response of the production system; realize rapid manufacturing; and provide data on an as-needed basis[8]. The objective of this thesis is to develop a system which can be integrated to machining centers to automatically determine chatter free, stable cutting conditions for a machining operation. The cutting coefficients, which relate feed per toot to the cutting force need to be determined. The frequency response function at the tip of the cutting tool must be measured, and this information is used with a model of the chatter process to determine the chatter-free cutting conditions. A method of extending the effective bandwidth of dynamometers is also examined. Al- though dynamometers are not practical in the average machine shop, this technique allows less costly dynamometers to be used in laboratories to measure cutting forces at high spindle speed. 2.1 Identification of Cutting Force Coefficients In order to predict the chatter-free pockets in a machining operation it is necessary to identify the cutting forces which will be generated for a given depth of cut (a). The tangential (Ft) and radial (Fr) cutting forces in milling are expressed as Ft = Ktcah(φ) +KteaFr = Krcah(φ) +Krea (2.1) 3 Chapter 2. Background and Literature Review where (Ktc, Krc) are the cutting force coefficients, and (Kte, Kre) are the edge force coeffi- cients in tangential and radial directions, respectively. The chip thickness change periodically as h = c sinφ where c is the feed per tooth, and φ is the immersion angle of the cutter which changes with the spindle speed (Ω) φ = Ωt (2.2) Note that the chip is zero when the cutter is outside the material, h = 0 if φ < φst or φ > φex). The cutting force coefficients are ideally identified from direct cutting force measurements carried out with dynamometers. Tool wear can be correlated to the cutting force since as the cutting tool wear, the cutting force increases due to a larger friction load. There are different approaches used in force measurement for TCM: Direct measurement using a dynamometer, force plates and rings, force-measuring bearings, force and torque at spindles, pins and extension sensors, displacement sensors, and motor current and effective power. Direct measurement using a piezoelectric dynamometer is the simplest method of force measurement and has a high bandwidth. However dynamometers are unsuitable for use in production due to high cost and a lack of overload-protection in case of a collision. Force plates and rings use piezoelectric sensors mounted between elements of the turret (in the case of turning machines), or behind the spindle flange (in the case of milling machines). So far results have been poor due to a high-degree of cross-talk, and force distortion due to the dynamics of the machine which may change over time. Some work has been done to compensate the machine dynamics in such systems using a Kalman filter[19]. Park et al. later extended the Kalman Filter compensation strategy to micro milling systems[6]. Spindle bearings are instrumented with strain gauges to measure the force. The output of these sensors must be low-pass filtered to eliminate the ball contact frequency. The torque can also be measured through a sensor placed directly in the machine tool spindle or tool holder. However, a complex system is required to measure the torque through the entire power range of the tool, and the measurement must be transmitted from the rotating spindle[5]. Pins and extension sensors measure the cutting force indirectly through the extension of 4 Chapter 2. Background and Literature Review machine elements. These have low sensitivity, so are not suitable for the task of measuring cutting coefficients. Similarly cutting force can also be measured indirectly by measuring the bending of the tool through non-contact displacement sensors. Such sensors have a high risk of interference in the form of chips, dirt and cooling fluid. In a similar vein, strain gauges have been mounted into a turning tool to measure the cutting forces[22]. This system had good sensitivity, but the measured force was a combination of the tangential force, feed force and radial force. This makes it suitable for tool condition monitoring, where the change in force is important, but unsuitable for measuring cutting coefficients, where the magnitude of each component is important. The final method is to estimate the force from the current or power applied to the spindle or axis motors. This will be discussed in more depth below, however all such systems share some common disadvantages. Forces measured in this way include bearing and guideway friction components, which are often much higher than the cutting forces and may vary substantially based on the lubrication state and motor speed. Also, due to the large masses the output signal has a limited frequency bandwidth. The cutting forces can be measured from the motor current[1], [16]. The feed and spindle drive servos have low frequency bandwidth and may not accurately capture cutting forces which are periodic at the spindle speeds times number of teeth on the cutter. However, the cutting force coefficients can be extracted from average cutting forces, which can be correlated to average current drawn by the spindle or motor current sensors. The prediction accuracy would improve if the friction force and inertial forces can be accurately modeled, and separated from the current consumed by cutting process when the machine has time varying velocities. Furthermore, this method is poor at determining the force in a direction if that axis is not moving due to the uncertainty in the static friction force, although empirical models have been developed for this case[14]. Spindle motor power[7] and spindle motor current[18] have been used to estimate the cutting torque. The bandwidth of the spindle motor is lower than the bandwidth of the axis feed drives. However, the friction which must be compensated is also lower. Since the measurement will be averaged to determine the cutting coefficient, the bandwidth of the sensor is less important than an accurate average measurement. This thesis will use spindle 5 Chapter 2. Background and Literature Review motor power to estimate the tangential cutting force coefficient. The total torque drawn from the spindle motor is Tc = ∑ n D 2 Ft,n, (2.3) where D is the cutter diameter and Ft,n is the cutting force of the nth tooth. The total power drawn by the spindle motor is Pc = TcpiDΩ (2.4) By measuring the average motor power (P̄c), the tangential cutting force coefficients (Ktc, Kte) can be identified during cutting with know depth of cut, speed and radial engagement condition. The radial cutting force coefficient (Krc, Kre) cannot be predicted from the spindle power since the spindle power is related only to tangential force (i.e. torque). However, the radial and axial cutting force coefficients do not affect the absolute stability limits but mainly the width of the stability pockets. Determining the instantaneous cutting forces from power measurements is almost im- possible at practical spindle speeds due to low bandwidth of the drives. Instead, this thesis proposes to use average power to predict the fundamental parameter, the tangential cutting force coefficients, from the average motor power, which is available in CNC machines. The instantaneous cutting force can be reconstructed from the tangential cutting coefficient, feed per tooth and depth of cut. 2.2 Automatic Transfer Function Measurement The principal methods of measuring the force to displacement frequency response function (FRF) measurement use instrumented hammers and shakers to apply a force and measure the response with an accelerometer or displacement sensor[9]. These techniques require lengthy manual setup and cannot be used directly in a smart machining system. Several techniques of performing automatic frequency response or impact testing have been investigated. Piezoelectric sensors have been embedded into a structure to measure its frequency response function[12]. This technique cannot be used to directly measure the 6 Chapter 2. Background and Literature Review Figure 2.1: Automatic Hammer[17] frequency response function to a force applied at a free surface like the tool tip. It could be used to find the natural frequencies of the spindle. DC solenoid[20] and piezoelectric[23] powered impact hammers have been used in wave- velocity measurement of testing. For concrete velocity wave testing it is not necessary to measure the impact force; the DC solenoid did not have a force sensor. The piezoelectric sensor had a force sensor to measure the time of impact accurately. In this case filtering and windowing was needed to eliminate extraneous peaks which were observed to either side of the primary impact. Bilne and Tse developed an solenoid-driven hammer[17] to measure the transfer function near the tip of a cutting tool (see figure 4.4). The hammer is activated by a pulse from an analog output on a computer. When the hammer is activated, the solenoid is energized, and the hammer strikes the tool. Once the hammer strikes the tool, the control electronics immediately de-energize the solenoid and the hammer is returned to the rest position by a spring. The force applied to the tool is measured by a piezoelectric force sensor mounted on the hammer, and the response is measured by the capacitive displacement sensor mounted below the hammer. The advantages of this system over a traditional manual hammer are that it can deliver 7 Chapter 2. Background and Literature Review quick, repeatable strikes to the tool. The integrated displacement sensor allows the system to be run without requiring an external response sensor, such as an accelerometer. This hammer is used as the basis for the automatic frequency response measurement system described in Chapter 4. 2.3 Effective Dynamometer Bandwidth Improvement The cutting forces are either measured by using table dynamometers or spindle integrated sensing systems, where both use piezoelectric sensors. Piezoelectric sensors detect the strain between the two mechanical interface surfaces, and naturally reflect the mass, springs and damping element chains in the embedded mechanical structure. As a result, the bandwidth of the force sensing systems is limited by the natural modes of the structure which can be well below the tooth passing frequencies used in milling operations. The aim of the smart measurement system is to remove the dynamic distortions from the measured force signals, so that the cutting forces and force coefficients are more accurately identified. Park[19] developed a spindle integrated force sensor system for measuring the cutting forces at the tool tip by measuring the force sensors embedded in the spindle housing. He then used a Kalman filter to compensate for the dynamics of the spindle and spindle housing.He was able to expand the bandwidth of the spindle integrated sensing system to 1000 Hz by compensating the first three bending modes of the spindle structure. He later expanded the algorithms to compensate high frequency dynamics of micro end mills operating over 50,000 rev/min[6]. This thesis presents a robust Kalman filter method which is able to compensate the most dominant mode of the structure which is carrying the sensor. The method is illustrated on a table dynamometer which is used to measure cutting forces during high spindle speeds (i.e. 15,000 rev/min). Although, the tool condition monitoring is quite a wide field, this thesis focuses only on automated FRF measurement, cutting force measurements at high speeds, and identification of cutting force coefficients from power signals available in CNC system. These methods are robust, practical and do not hinder the operation of the machine during production, hence 8 Chapter 2. Background and Literature Review they contribute to smart machining technology. 9 Chapter 3 Identification of Cutting Force Coefficients from Spindle Power 3.1 Introduction The cutting force coefficients are used to predict cutting forces, torque, power and chat- ter stability to identify optimal machining operations on the machine tools. The cutting force coefficients are dependent on the material properties such as yield strength and hard- ness, and have traditionally been identified in laboratories by measuring cutting forces using dynamometers. The cutting forces in X, Y, and Z directions are measured with a dynamome- ter, and from the workpice material-tool geometry specific cutting coefficients in the radial, tangential and axial directions are calculated. This thesis presents a method of predicting one of the cutting force coefficients from average power measurement sensors available on standard machine tools. Several test cuts are performed by the machine tool operator, and the power drawn by the spindle motor is measured using a computer connected to the CNC (the details of this connection are further explained in Chapter 6). The cutting torque is calculated from the spindle power. By combining the cutting torques calculated during several test cuts at different feed rates, the mechanistic cutting coefficients can be calculated, and entered into a cutting coefficient database. This eliminates the need for costly tests in a laboratory with a dynamometer. 10 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power Figure 3.1: Load Meter Voltage in Air Cutting 3.2 Extraction of Cutting Torque from Spindle Load Sensor The first step in cutting coefficient identification is to measure the cutting forces during a test cut. Most machines include load meters which display the power being drawn by the machine spindle, so the operator can know if the machine is approaching an overload condition. This voltage output of this sensor can be read by a computer connected to the CNC and used to estimate the torque on the machine tool, which provides enough information to estimate one of the three mechanistic cutting coefficients. The load meter on the machine tool returns a voltage V which is proportional to the average power being drawn by the spindle drive motor V = KP, = KTω (3.1) where T is the total torque applied to the spindle by the motor, ω is the angular speed of 11 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power the spindle, and K is a constant. The applied torque consists of the torque Tc applied to cutting, and the torque lost to friction Tf T = Tc + Tf . (3.2) The friction is assumed to consist of viscous and Coulomb components Tf = bω + Tcf , (3.3) where b is the viscous friction constant and Tcf is the Coulomb friction torque. Substituting equation 3.3 into 3.1 gives V = Kω (Tc + bω + Tcf ) . (3.4) Rearranging this equation gives the cutting torque in terms of load meter voltage and spindle speed Tc(V, ω) = V Kω − bω − Tcf . (3.5) There are three machine-tool specific coefficients which must be identified: the viscous fric- tion b, the Coulomb friction Tcf and the load meter constant K. To identify these coefficients, air cutting tests were performed on the target machine, a Mori-Seiki NMV-5000 machine tool. For an air-cutting test, the cutting torque Tc = 0, so V = Kbω2 +KTcfω. (3.6) Air cutting tests were performed from 1000 to 20000 Hz, and the voltage measured by the spindle load meter was plotted (figure 3.1). From this data the voltage equivalent of the viscous and Coulomb friction Vb = Kb (3.7) VTf = KTcf (3.8) can be determined through least-squares fitting. For the Mori-Seiki machine tool tested, these parameters were found to be Kb = 1.43×10−7 V/rad/s2, and KTcf = −2.51×10−5 V/rad/s. Although the Coulomb friction is negative, this is not a problem for cutting torque prediction 12 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power Figure 3.2: Load Meter Sensitivity by Spindle Speed in practice (see section 3.2.1). To avoid the unphysical result of negative friction, the friction force is assumed to be zero below 2000rpm (209 rad/s). To measure the load meter coefficient K, slot milling tests were conducted with spindle speeds starting at 1000 rpm in 1000 rpm increments up to the maximum spindle speed of the machine tool, 20, 000 rpm. The true average cutting torque (Tc) was measured using Kistler rotating dynamometer, while the average power was obtained from the spindle load meter of the machine. The spindle load caused by friction, Vf = Kbω 2 + Tcfω, (3.9) was subtracted from the measured load, and the ratio of the cutting load to cutting torque torque Kω = V − Vf Tc (3.10) was plotted in figure 3.2. The coefficient K was estimated by fitting a straight line to the data using least squares. For the Mori-Seiki NMV-5000 machine tool tested, K was found to be 3.88 × 10−4 V/W. By substituting K into KTcf and Kb, the Coulomb and viscous 13 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power Figure 3.3: Load Meter Torque Estimate vs. Measured Torque friction constants are found to be Tcf = −0.0647 Nm b = 3.70× 10−4 Nm/(rad/s) ω > 209 rad/s, or 2000 rpm (3.11) 3.2.1 Limitation of Torque Estimation using Load Meter This method of estimating cutting torque has a couple of limitations stemming from the nature of the load meter sensor, which must be considered when planning cutting force coefficient identification tests. First, the data from the load meter is low-pass filtered, so this technique can only be used to obtain the average cutting torque, not the instantaneous cutting torque. Second, since the load meter measures power, the cutting force estimate is inaccurate at low speeds. Third, the friction estimate is inaccurate at low speeds. The primary purpose of the machine tool load meter is to provide an indication to the operator when the machine is operating within safe limits. For this purpose, the important measure is the average power being applied to the spindle motor. In addition, the spindle has a large moment of inertia, and the bandwidth of the spindle velocity control loop is low, 14 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power which means that the power reported by the load meter is a low-pass filtered version of the instantaneous cutting power. This can be seen in figure 3.3. This shows the torque and load-meter readings as the cutting tool leaves the workpiece. The torque measured by the dynamometer falls to zero immediately, while the load meter reading falls off exponentially. From this graph it appears the load-meter has approximately a first order response. To discover the approximate bandwidth of the load meter, the step response of a first order system was fitted to the load meter data. This gives a bandwidth of approximately 7 Hz for the load meter. To have a tooth-passing frequency less of less than 7 Hz, a two fluted tool must be rotating at less than 210 rpm. This is much lower than the practical spindle speeds on modern milling machines, making this method impractical for measuring the instantaneous cutting torques. It can still be used for measuring average cutting forces. Another limitation arises because the torque is being estimated from the measured power. At low speeds, the power will be low, even if the torque is high, leading to inaccurate measurements. Consider two load meter measurements, one at V , and one at V + ∆V , where ∆V is the quantization error of the load meter, which for the Mori-Seiki NMV-5000 is approximately 3× 10−4 V. The difference in estimated torque for these two measurements, ∆Tc = 1 Kω ∆V, (3.12) is the minimum cutting torque error. For the cutters used in this thesis, the average cutting torque was between 2− 3 Nm, so to get the quantization error below 10%, the spindle speed must be above 35 rpm, and to get the quantization error below 1% the spindle speed must be above 350 rpm. The apparent negative Coulomb friction is the linear approximation used in the model. The real friction follows the Stribek curve, with viscous friction dominating over the majority of the spindle speeds except under 2000 rpm as can be seen from the torque measurements against the spindle speed shown in figure 3.4. To avoid the unphysical negative friction, friction is assumed to be zero below 2000 rpm. Since the spindle load method is less accurate at low spindle speed, so the error in the friction model at low spindle speed is unimportant in practice. 15 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power Figure 3.4: Torque in Air Cutting 3.3 Identification of Tangential Cutting Force Coefficient The estimated average cutting torque from the spindle load meter needs to be correlated to cutting torque model based on metal cutting mechanics. The tangential cutting force per unit depth of cut along the cutting edge j of a milling cutter is given by dFt,j(φ) = Ktch(φ) +Kte, (3.13) where h(φ) is the chip thickness at the cutting edge angle φ[2]. The corresponding instanta- neous cutting torque is dTc,j(φ) = R(Ktch(φ) +Kte)g(φ), (3.14) where R is the radius of the milling tool, and g(φ) is a function which is unity if the tooth is in cut, and zero if it is out of cut. The chip thickness changes as cutter rotates, h(φ) = st sin(φ). (3.15) 16 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power Figure 3.5: Load Meter Sensitivity by Spindle Speed The average torque per unit depth of cut is thus dT̄c,j = R 2pi ∫ 2pi 0 g(φ) [Ktcst sin(φ) +Ktedφ] . (3.16) If the cutting tests are performed in slotting mode for simplicity, g(φ) = 1 if 0 ≤ φ < pi0 if pi ≤ φ < 2pi . (3.17) the average torque per unit length for a single tooth reduces to dT̄c,j = RKtc pi st + RKte 2 , (3.18) or a total average torque of T̄c = RNaKtc pi st + RNaKte 2 . (3.19) where a is the axial depth of cut. Cutting tests were performed with varying feeds per tooth st, and the measured and estimated cutting torque was shown in figure 3.5. Straight lines were fit to both the measured 17 Chapter 3. Identification of Cutting Force Coefficients from Spindle Power torque from dynamometer and estimated torque from the load, and the slope and intercepts were matched to the coefficients in equation 3.19. The cutting coefficients were estimated to be Ktc = 1040N/mm 2 (3.20) Kte = 9.81N/mm (3.21) from the load meter measurements. The cutting coefficients obtained from the rotating dynamometer measurements were Ktc = 936N/mm 2 (3.22) Kte = 13.9N/mm, (3.23) which gives a value of Ktc which agrees within 11% with the estimation from the load meter model. The prediction accuracy is sufficient to use the model for on-line identification of tangential cutting force coefficients from cutting tests using the available load meters on the production machines. The cutting force identification model can be integrated to CNC system for smart, au- tomated, on line design of material machining data base in production floors. 18 Chapter 4 Automatic Impact Modal Testing of Milling Cutters To predict the occurrence of unwanted unstable vibrations in machining (known as chatter), the dynamics, or frequency response function (FRF) of the machine tool must be measured. In practice this can be a time consuming and difficult operation, which requires a trained technician or engineer with specialized test equipment. This test must be repeated for every cutting tool used in manufacturing a part as each cutting tool will have a different FRF. If the machine tool could measure its own FRF, the process of calculating the stable cutting regions of a machine tool would be greatly reduced. In order to automate this process an automatic hammer was developed which can be integrated to the controller of a machine tool. The automatic hammer can be activated from the front panel of the CNC by the operators. The chatter stability charts can be automatically calculated from the FRF measurements, and the operators can be advised to select chatter free conditions and the current health of the spindle can be reported to avoid damages to bearings. The automatic hammer is a device invented by Matthew Tse and Ryan Bilne for their Master of Engineering project (2003)[17], with the goal of automating the process of ob- taining the frequency response function of a tool/tool-holder combination. Although their device simplifies the measurement of the frequency response, the device itself is not enough to achieve the goal of one touch FRF measurement. This chapter expands their work to integrate the hammer with a CNC to produce a system which can perform high quality transfer function measurement completely automatically. The automatic hammer (shown in figure 4.1) consists of a solenoid actuated plunger with a force sensor on the end to hit the tool, and a capacitive displacement sensor to measure 19 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.1: Automatic Hammer the response. The force sensor and the solenoid are connected to a solenoid control circuitry which activates the solenoid in response to a signal transmitted from a connected PC. The circuitry energizes the solenoid until the hammer head on the solenoid hits the tool. The force and displacement are recorded by a computer, and the FRF between force and displacement is calculated. Several difficulties have been identified with the use of automatic hammer on CNC ma- chine tool: • the tool must be oriented at the correct position and orientation, • the capacitive displacement sensor must re-calibrated with each measurement, • multiple impacts which destroy the measurement accuracy need to be minimized, and • the offset between the impact force and measurement of vibration points must be considered. This work proposes a series of algorithms which can be implemented on a personal computer (PC) connected to a CNC machine tool to automatically position the cutting tool and calibrate the displacement sensor. The accuracy of the developed system is then tested using a normal laptop computer connected to a Mori-Seiki NMV-5000 5-axis milling machine. 20 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.2: Measurement Heights for Finding Flutes 4.1 Automatic Spindle Orientation In order to get an acceptable impact on the tool, it must be aligned so that the hammer strikes a surface of the tool which is approximately perpendicular to the direction of travel of the hammer, and the path of the hammer is free of interference from other parts of the tool. On an inserted cutter, this is not difficult since there is typically a large flat surface located behind the inserts. On a traditional endmill however the only acceptable location is behind the flute edge. To position the tool correctly, the location of a flute at the height of hammer the must be found (marked A on figure 4.2). However, the displacement sensor cannot be moved to this location, since the tool would impact against the table. Instead, the flute is located at the bottom of the tool (C), and midway between A and C (B). Assuming the helix angle is constant, the location of the flute at point θA is θA = 2θB − θC , (4.1) where θB and θc are the locations of the flute at points B and C, respectively. Locating the flute is a minimization problem; the flute is at the angle where the distance between the displacement sensor and the tool is minimized. To find the location of a flute, 21 Chapter 4. Automatic Impact Modal Testing of Milling Cutters three points are found: a central point, where the sensor is close to the flute, and a point to the left and a point to the right of the central point, where the tool is further away from the sensor. Using the golden section search algorithm described below, the left, center and right points are moved towards each other, making sure that tool is always closer to the sensor at the central point than either the left or right points. This ensures that the tool is closest to the sensor at some point between the left and right points. Once the left and right points are within 1.5◦ of each other, the algorithm is terminated. This bound offers sufficient accuracy so the hammer will hit the flute. Additional accuracy is not required, and a smaller bound would require more measurements, increasing the length of time required to run the algorithm. The technique used to locate the flute is the Golden Section Search[15]. This algorithm keeps track of three points: the left bound A, right bound B, and a point C between the two. A test point X is chosen in the larger of the regions between A and C, and between C and B. Suppose the point X is chosen between A and C. Then if d(X) ≤ d(C), the new bracketing triplet will be A, X, and C. Alternatively, if d(C) < d(X), then the new bracket will be X, C, B. The test point X is chosen to be a fraction of the distance between A and B as follows. Suppose C is a fraction of the distance between A and B C − A B − A = W. (4.2) Furthermore, suppose that the test point X is a fraction beyond A of X − A B − A = Z. (4.3) The next bracket will either be of length W , or of length 1−Z. To maximize the worst-case performance, these two must be equal, or W = 1− Z. (4.4) Now assume the initial points A, B, and C were selected by the same strategy. Then W must be the same proportion of the whole interval, as Z is of the smaller interval AB W = Z W . (4.5) 22 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Substituting in equation 4.4 and solving gives W = 1 φ = √ 5− 1 2 , (4.6) where the negative solution is ignored as physically impossible. Here φ is the golden ratio. In order to apply this algorithm, the initial three bracket points must be found. The algorithm given in Numerical Recipes in C[21] is adopted here. First, the distance to the tool at two points θa, θb = θa + 5.6 ◦. The largest of these two points becomes θ1, the other θ2. These two points are measured, and the distance to the tool at some number of other points θn = θn−1 + φ (θn−1 − θn−2)if φ (θn−1 − θn−2) < 22.5 ◦ 22.5◦otherwise , (4.7) are also measured, for n = 2, 3, . . . . This continues until the distance to the tool at the final point θN is greater than the distance at θN−1. Then, the three bracketing points will be θN−2, θN−1, and θN . If the bracketing interval is chosen before the maximum step size of 22.5◦ is reached, the central point will be located so that the golden section algorithm is optimal. If the maximum step size of 22.5◦ is reached, the interval found will no longer be optimal for the golden section search; however a maximum step size is required because the golden section search algorithm assumes there is only one local maximum inside the bracketed region. If there are more than one local maximum, the algorithm could converge to a local maximum which is not necessarily the global maximum. In order to ensure there will be only one local maximum in the bracket, it is necessary to find the maximum bracket size such that there is only one local maximum in any such bracket. The maximum step size must be carefully chosen. On one hand, if the maximum step size is too small, the bracketing algorithm will often achieve the maximum step size, which will slow down both the bracketing and the minimization algorithms. On the other hand, if the maximum step size is too large, the chosen bracket may include multiple local maxima, causing the algorithm to fail to correctly locate the flute edge. 23 Chapter 4. Automatic Impact Modal Testing of Milling Cutters 4.2 Automatic Capacitive Sensor Calibration The calibration for the capacitive sensor is only valid when the target is a thick metal sheet that is flat within an area roughly 30% larger than the target of the capacitive sensor. Due to the flutes and the curvature of the tool, a milling tool does not satisfy these requirements, so a custom calibration method must be done before measuring each tool. In addition, the calibration is designed such that at the end of the calibration the tool is positioned such that the voltage output from the capacitive sensor is approximately zero. The capacitive sensor has a non-linear sensitivity, and is more sensitive the closer the tool is to the sensor, so positioning the tool such that the voltage output of the displacement sensor is zero ensures maximum sensitivity while ensuring the tool does not impact against the sensor. In order to calibrate and zero the sensor, the voltage at the initial distance is first mea- sured. The machine is then jogged 50 µm, and the voltage is measured again. This is used to obtain an estimate of the sensitivity S = ∆V ∆x . (4.8) Then an estimate of the distance required to zero the voltage of the sensor ∆xremaining = V S . (4.9) If the distance remaining is less than 200 µm, then the CNC is jogged half the estimated remaining distance; otherwise it is jogged 100 µm. This slow approach ensures that the tool does not impact against the displacement sensor. This is repeated until the voltage is more than −0.1 V. The last sensitivity measurement is taken as the sensitivity of the sensor for the FRF measurement. There are two major potential sources of error in this measurement. First, the CNC may have low positioning accuracy, so it may move a different amount than what is instructed. Secondly, there may be noise in the displacement sensor measurement. This noise was found to be negligible in the flute finding algorithm; however, the sensitivity is the derivative of the data, which will tend to magnify the effect of noise. In order to measure the error of the CNC axis, a laser interferometer was set up to measure the displacement along the same axis as the automatic hammer was measuring. The CNC was then programmed to move between 24 Chapter 4. Automatic Impact Modal Testing of Milling Cutters 10µm and 100µm, and the distance actually traveled was measured by the interferometer. In all cases, it was found that the distance actually traveled by the CNC agreed with the instructed distance to within ±100nm, which is the display precision of the interferometer. 4.3 Signal Processing of Automatic Hammer Signal The goal of signal processing for the automatic hammer setup is to reduce the effect of noise and systematic errors on the measured FRFs. There are two sources of noise in the automatic hammer system which are eliminated using digital signal processing. First, it is known that the force is zero except during the impact. The force data is multiplied by a window function which sets the force to zero away from the impact. Second, random noise is a significant problem, especially in the displacement sensor readings. So several measurements are taken and averaged as described by Ewins[9]. 4.3.1 Force Measurement Windowing The purpose of windowing is usually to reduce signal distortion (leakage) which occurs when the discrete Fourier transform of a non-periodic function is taken. In the automatic hammer system, this is not a problem. The measurement time is sufficiently long that the system has a chance to settle back to its steady state value after each impact, so it can be treated as a periodic system. Instead, the goal is to reduce the noise in the measured signal. For an impact test, the applied force f(t) is large for a small time; however the noise will occur over the entire measurement. Therefore, the overall noise in the signal can be significantly reduced by setting the force signal to zero outside the small region where the actual force signal exists. This is especially important for the automatic hammer. Since some of the measurement circuitry is run from the same circuitry as the solenoid actuator, the current drawn by the solenoid causes noise to appear in the force signal when the solenoid is activated. There is a similar problem with the displacement measurement. Although there is no cross-talk between the solenoid driver circuit and the displacement circuit, since the response has an exponential falloff, it is mostly limited to within the first 0.2 s after the impact. 25 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.3: Cosine-Taper Window for Force Signal Windowing The noise reduction algorithm is presented as follows. The discrete Fourier transform (DFT) of the measured signal fn is Uk = N−1∑ n=0 fne 2pii N kn. (4.10) where N is the total number of samples, and k is the number of the harmonic. Assuming that the measurement error is a Gaussian process with zero mean, the error at each point is 2Uk = N−1∑ m=0 ∣∣∣∣∣ ∂∂fm N−1∑ n=0 fne 2pii N kn ∣∣∣∣∣ 2 2fm = N2f , (4.11) where epsilonfm is the measurement error at point m. Since the noise is assumed to be a stationary process, the error fm at each measurement point is identical. This error is called f . The measured signal is windowed as wn = unwn, (4.12) 26 Chapter 4. Automatic Impact Modal Testing of Milling Cutters where wn is the window function. For the windowed signal, Wk = N−1∑ n=0 wnfne 2pii N kn. (4.13) The error in the windowed signal is 2Wk = N−1∑ m=0 ∣∣∣∣∣ ∂∂fm N−1∑ n=0 wnfne 2pii N kn ∣∣∣∣∣ 2 2fm (4.14) = 2f N−1∑ n=0 w2n. (4.15) As a result, the error is decreased by Wk Uk = √√√√ 1 N N−1∑ n=0 w2n (4.16) when the window is used. For the force signal windowing, a cosine taper window was chosen. Such a window is shown with a typical force signal in figure 4.3. A cosine-taper window is defined as W (t) = 1 2 [ cos ( pi t−tps tps−tts ) + 1 ] if t >= tts and t < tps 1 if t >= tps and t < tpe 1 2 [ cos ( pi t−tpe tte−tpe ) + 1 ] if t >= tpe and t < tte 0 otherwise (4.17) There are four important points: the start of the initial cosine taper tts, the start of the plateau tps, the end of the plateau tpe, and the end of the final cosine taper tte. These points are automatically selected by finding the maximum force, and then finding the next point where the force falls to 10% of its peak value. The distance to this point is called tshoulder. The end of the plateau is selected to be tpe = tmax + 3 2 tshoulder, (4.18) and the end of the window is tte = tpe + tshoulder. (4.19) 27 Chapter 4. Automatic Impact Modal Testing of Milling Cutters The last point before the force peak where the force rises above 10% of the peak value is also found, and the same procedure is followed to find tps and tts. This method of determining the force window size was chosen to ensure that the force window was unity wherever the force sensor was in contact with the machine tool, it hugged the force signal as tightly as possible so as much of the noise as possible is eliminated, and it had a smooth drop off between 1 and 0. A typical force signal produced by the automatic hammer has a width of 0.4 ms, with a 50 000 Hz sampling rate, and sample length of 0.2 s, which gives an error 6 % of the error of the unwindowed signal. 4.3.2 Spectral Averaging In order to reduce the effect of noise on the calculated transfer function, several force and displacement measurements have been made. The Fourier transforms of the force Fn(jω) and displacement Xn(jω) of each measurement are calculated, and the auto- and cross-spectra of each measurement are calculated: Sff,n = |Fn|2 , (4.20) Sxx,n = |Xn|2 , (4.21) Sfx,n = F ∗ nXn. (4.22) The average spectrum over all M measurements is then calculated S̄ff = 1 M M∑ n=1 Sff,n (4.23) S̄fx = 1 M M∑ n=1 Sfx,n (4.24) S̄xx = 1 M M∑ n=1 Sxx,n. (4.25) These spectra are then used to calculate the measured transfer function one of two ways. Either Hm1 = S̄fx S̄ff , (4.26) 28 Chapter 4. Automatic Impact Modal Testing of Milling Cutters or Hm2 = S̄xx S̄∗fx (4.27) In the noise free case these equations both simplify to the normal equation for calculating the transfer function Hm = X̄ F̄ . (4.28) If the transfer function is calculated using equation 4.28, the error at each point will be 2Hm = M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂∂xmn X̄F̄ ∣∣∣∣2 2xn + M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂∂fmn X̄F̄ ∣∣∣∣2 2fn = N M 1∣∣F̄ ∣∣2 [2x + |Hm|2 2f] (4.29) If the transfer function is calculated using equation 4.26, the error in the transfer function measurement is 2Hm = M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂∂xmn S̄fxS̄ff ∣∣∣∣2 2xn + M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂∂fmn S̄fxS̄ff ∣∣∣∣2 2fn = 1 S̄2ff [ M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂S̄fx∂xmn ∣∣∣∣2 2xn + M∑ m=1 N−1∑ n=0 ∣∣∣∣ ∂S̄fx∂fmn −Hm1 ∂S̄ff∂fmn ∣∣∣∣2 2fn ] (4.30) but ∂S̄fx ∂xmn = ∂ ∂xmn 1 M M∑ p=1 F ∗p N−1∑ q=0 xpqe − 2piik N q = F ∗m M e− 2piik N n. (4.31) Similarly, ∂S̄fx ∂fmn = Xm M e 2piik N n. (4.32) 29 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Finally, ∂S̄ff ∂fmn = ∂ ∂fmn 1 M M∑ p=1 ( N−1∑ q=0 fpqe − 2piik N q )∗(N−1∑ r=0 fpre − 2piik N r ) = ∂ ∂fmn 1 M M∑ p=1 N−1∑ q=0 N−1∑ r=0 fpqfpre − 2piik N (r−q) = 1 M [ N−1∑ q=0 fmqe − 2piik N (n−q) + N−1∑ r=0 fmre − 2piik N (r−n) ] = 2 M N−1∑ q=0 fmq cos ( 2pik N (n− q) ) = 2 M [ cos ( 2pin N k )N−1∑ q=0 fmq cos ( 2piq N k ) + sin ( 2pin N k )N−1∑ q=0 fmq sin ( 2piq N k )] = 2 M [ cos ( 2pin N k ) < [Fm] + sin ( 2pin N k ) = [Fm] ] . (4.33) Substituting equations 4.31 through 4.33 into equation 4.30 gives 2Hm1 = 1 M2S̄2ff ( M∑ m=1 N−1∑ n=0 Sff,m 2 x + M∑ m=1 N−1∑ n=0 [ Sxx,m − 4< [ X∗mHm1e − 2pik N n ] · ( cos ( 2pin N k ) < [Fm] + sin ( 2pin N k ) = [Fm] ) +4 |Hm1|2 ( cos ( 2pin N k ) < [Fm] + sin ( 2pin N k ) = [Fm] )2] 2f ) . (4.34) In order to simplify this equation, approximate N−1∑ n=0 f ( n N ) ≈ ∫ N 0 f ( n N ) dn (4.35) for large N. Since ∫ T 0 cos ( 2pik x T ) sin ( 2pik x T ) dx = 0 (4.36)∫ T 0 cos2 ( 2pik x T ) dx = T 2 (4.37)∫ T 0 sin2 ( 2pik x T ) dx = T 2 (4.38) 30 Chapter 4. Automatic Impact Modal Testing of Milling Cutters for any integer k, equation 4.34 reduces to 2Hm1 ≈ N M |Hm1|2 S̄ff [ 1 |Hm1|2 2x + 2f Cfx ] , (4.39) where Cfx is the coherence, defined as Cfx = ∣∣S̄fx∣∣2 S̄xxS̄ff , (4.40) which is roughly an indication of the error in the signal, and varies between 0 and 1. Similarly, the error in Hm2 is 2Hm2 = 1∣∣S̄fx∣∣2 M∑ m=1 N−1∑ n=0 ∣∣∣∣∣ ∂S̄xx∂xmn −Hm2 ∂S̄ ∗ fx ∂xmn ∣∣∣∣∣ 2 2xn + M∑ m=1 N−1∑ n=0 ∣∣∣∣∣Hm2 ∂S̄∗fx∂fmn ∣∣∣∣∣ 2 ≈ N M |Hm2|2 S̄xx [ 2x Cfx + |Hm2|2 2f ] . (4.41) By comparing equations 4.29, 4.39 and 4.41 a couple of observations can be made. First, in all cases the error increases with the square root of the number of the frequency range, and decreases with the square root of the number of measurements. Although increasing the number of measurements will always increase the accuracy of the measurement, as more measurements are made the improvements will decrease. When using the automatic hammer, an increased number of measurements can be used since each measurement takes less time. Equation 4.26 is preferred over 4.27 because for the automatic hammer the force mea- surement has lower error than the displacement measurement, and in equation 4.26 the error in the force measurement f contributes more to the overall error than the error in the displacement x. 4.4 Hammer-Displacement Sensor Offset Compensation To predict the chatter-free cutting conditions, it is necessary to obtain the frequency response function (FRF) from a force applied at the tool tip to the displacement at the tool tip. However, the automatic hammer does not apply the force at the tool tip, it applies the force approximately 15 mm above the tool tip (see figure 4.4. This will increase the apparent 31 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.4: Automatic Hammer stiffness of the cutting tool. As a result, the predicted chatter stability obtained using this FRF will be higher than the real chatter stability. This apparent increase in stiffness can be compensated under the assumptions that 1. the most flexible part of the spindle/tool holder/tool structure is the tool, 2. the tool can be approximated as a beam, and 3. the bending of the tool is quasi-static. Under these assumptions, the stiffness of the tool at the tool tip is Xa Fa = L3 3EI , (4.42) where L is the stick-out of the tool from the toolholder, E is Young’s modulus, and I is the area moment of inertia of the tool. The stiffness of the tool for a force applied higher on the tool and the displacement measured at the tool tip is Xa Fb = l 2b 6EI (3L− lb) (4.43) where lb = L − where is the offset between the displacement sensor and force sensor in the automatic hammer. Solving equation 4.43 for EI and substituting into equation 4.42 32 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.5: Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs. Cross) gives Xa Fa = 2L3 l 2b (3L− lb) Xa Fb . (4.44) This equation is used to obtain an approximation of the direct transfer function by sub- stituting the measured cross transfer function into Xa/Fb. The effect of this compensation can be seen by comparing figure 4.6 with figure 4.7. The FRF with the correction applied matches more closely with the FRF measured manually. 4.5 Comparison of Automatic Hammer with Traditional Impact Test A test of the full automatic hammer system was performed, including edge detection and automatic calibration. This was compared with a FRF measurment performed with a manual hammer striking the tool at the same height as the automatic hammer, and measuring the response with a capacitive sensor positioned at the tool tip (see figure 4.5). In this case the 33 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.6: Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs. Di- rect) automatic hammer and traditional methods give very similar results. The FRF measured using the automatic hammer was then compared with the FRF of the machine was then measured with a traditional tap testing method: an instrumented hammer to apply and measure the impulse, and an laser sensor to measure the response. In this case, both the instrumented hammer and laser sensor were positioned at the tool tip. Tests were done using a typical setup for each method, and a comparison without hammer- displacement sensor offset compensation is shown in figure 4.6. Since the automatic hammer is much quicker than the manual hammer, the transfer function obtained by the automatic hammer was averaged over 20 measurements, while the FRF obtained by the traditional method was only averaged over 5 measurements. The increased stiffness due to the offset between the hammer and the displacement sensor can easily be observed near the mode at 2400 Hz. By contrast, the stiffness of this mode is much closer in the corrected FRF (figure 4.7). The effect of this correction can be seen in the stability chart (figure 4.8). In all three cases (corrected automatic hammer FRF, uncorrected automatic hammer FRF and traditional 34 Chapter 4. Automatic Impact Modal Testing of Milling Cutters Figure 4.7: Comparison of Automatic Hammer vs Traditional Tap Testing (Compensated vs. Direct) Figure 4.8: Predicted Stability of Slot Machining 35 Chapter 4. Automatic Impact Modal Testing of Milling Cutters method FRF) the stable cutting pockets occur at the same spindle speeds. However, due to the apparent increased stiffness, the uncorrected automatic hammer measurements have a much higher absolute stability limit compared with both the corrected and traditional FRF measurements. The stability limit inside the more stable pockets matches more closely with the uncorrected measurement than the corrected measurement. This is because the maximum stable depth of cut in these regions is determined principally by the spindle modes. This is unsurprising as these modes were not targetted by the correction algorithm, and the assumptions used when developing the correction algorithm do not apply in this region. 4.6 Conclusion Since the automatic hammer is completely automated, it can measure the frequency response function of the machine tool much quicker than the traditional method. It can also be used by a machine tool operator with minimal training. However, the traditional method measures the direct FRF at the tool-tip, while the automatic method measures a cross-FRF, with the impact located approximately 15 mm above the response measurement point. When this cross-FRF is used to approximate the direct transfer FRF, it is similar to the direct FRF at low frequencies. At high frequencies the two FRF differ substantially, with the FRF measured by the automatic hammer not detecting modes above 3000 Hz. The FRF measured by the automatic hammer can be used as a starting point for locating the stable cutting regions. 36 Chapter 5 Effective Dynamometer Bandwidth Improvement 5.1 Introduction The instantaneous cutting force measurements are used to identify material cutting con- stants, to trace the cutting load history on the machine tool during machining a workpiece, and to monitor the condition and cutting performance of the tools used. Spindle load meters have only limited bandwidth (less than 10Hz), and can not measure instantaneous cutting forces at spindle speeds above a few hundred revolutions per minute. It is necessary to use cutting force dynamometers mounted on the table or integrated to the spindle. Integrating a dynamometer to the machine tool adds flexibility to the structure. If the periodic cutting force frequency is near a resonance frequency of the sensing system, the measured cutting forces are distorted and incorrectly recorded. The lowest natural frequency of the sensing system can be as low as 200 Hz depending on the mass of the workpiece mounted on the dynamometer, or spindle which houses the force cells. If a force is applied at this frequency, the workpiece and dynamometer will vibrate, and the measured force will be distorted compared to the applied force. In order to recover the real applied force from the distorted measured force, a state space model of the dynamometer is developed, and a Kalman filter is derived to recover the applied force, similar to the technique proposed by Park for his spindle integrated force sensor system[19]. In this technique, the dynamics of the mechanical system are first identified by applying a known force impact to the dynamometer using an instrumented hammer and measuring the response to get a frequency response function (FRF). The FRF is then used to construct a state space system which captures the dynamics of the dynamometer. This system is then 37 Chapter 5. Effective Dynamometer Bandwidth Improvement modified as described below such that the applied force on the dynamometer is treated as another state. A Kalman filter is then designed to estimate the state of this model, and from that state an estimate of the applied force can be extracted. 5.2 Dynamic Model of Cutting Force Measurement System The dynamometer is modeled as a linear time invariant (LTI) system which has an applied force Fa as the input and produces a measured force Fm. The dynamometer dynamics can be modeled as a transfer function of the form Fm Fa = H(s) = ∞∑ k=1 Kk s2 + 2ζkωn,ks+ ω2n,k . (5.1) For simplicity, assume that the modes are ordered by natural frequency, ωn,1 ≤ ωn,2 ≤ . . . . In general any structure will have an infinite number of modes. Here the dynamics of the dynamometer are approximated by a model with a finite number of modes, M , which is valid for frequencies 0 < ω < ωn,M . For any mode Hk(jω) = Kk −ω2 + j2ζkωn,kω + ω2n,k ≈ Kk ω2n,k when ω ωn,k, (5.2) since if ω ωn,k, ∣∣ω2 + j2ζkωn,kω∣∣ ω2n,k (5.3) Therefore, in the domain of the reduced model, the contributions from higher modes can be approximated by a constant K0 = ∞∑ k=M+1 Kk ω2n,k . (5.4) This gives an approximate transfer function of the dynamometer, H(s) ≈ K0 + M∑ k=1 Kk s2 + 2ζkωn,ks+ ω2n,k for 0 < ω < ωn,M (5.5) 38 Chapter 5. Effective Dynamometer Bandwidth Improvement To determine the transfer function of the dynamometer, the frequency response function (FRF) of the dynamometer is measured by striking it with an instrumented hammer. The input force from the hammer and output force from the dynamometer are measured. The measured FRF is fit to the above model using a non-linear least-squares method, with the additional constraint that the static gain of the system is known to be 1 since the both the hammer and dynamometer are calibrated to produce a force in Newtons, so K0 = 1− M∑ k=1 Kk. (5.6) To design a Kalman filter to compensate these dynamics, a state space system with these input-output characteristics must be designed. There is no unique state space system with certain system. Indeed, there are infinitely many state space systems with the same dynamics. The two standard forms are the controllable canonical form and the observable canonical form. Since the extended system must be observable, the observable canonical form is most appropriate. To write the state space model of the system in observable canonical form, the transfer function of the system must first be written as a system with a common denominator H(s) = b0 + b1s+ · · ·+ bnsn a0 + a1s+ · · ·+ sm . (5.7) This can be written in observable canonical form as ẋ = =A︷ ︸︸ ︷ −am−1 1 0 · · · 0 −am−2 0 1 ... . . . ... −a0 0 0 · · · 0 x+ =B︷ ︸︸ ︷ bn bn−1 ... b0 Fa (5.8) y = [ 1 0 · · · 0 ] ︸ ︷︷ ︸ =C x. (5.9) For a typical mechanical system however, this process will have poor numerical properties. A useful measure of the numerical stability of any matrix U is the conditioning number, κ(U) = ‖U‖∥∥U−1∥∥ , (5.10) 39 Chapter 5. Effective Dynamometer Bandwidth Improvement where any norm can be used. In this thesis infinity norm is used for simplicity. For the observable canonical form, ‖A‖∞ = max {a0, a1 + 1, . . . am−1 + 1} . (5.11) Since for the modes of interest of the dynamometer ωi ζj ∀i, j, ‖A‖∞ = a0 = M∏ k ω2k. (5.12) Similarly, ∥∥A−1∥∥∞ = ∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥ 0 0 · · · 1 a0 0 −am−1 0 a0 −am−2 ... . . . ... 0 0 · · · −a1 ∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥ |a0| using Cramer’s rule (5.13) = max k>0 { 1 a0 , 1− ak a0 } ≈ 1. (5.14) This gives a conditioning of the state transition matrix A of κ(A) ≈ a0. (5.15) A system is said to be ill-conditioned if the reciprocal of the condition number approaches the machine precision, which is 10−12 for double precision[21]. The natural frequencies of a dynamometer are ωn ≈ 103, so the observable canonical form will be ill-conditioned with more than two modeled modes. Instead, the state-space model is constructed by composing the state space models of several mode individually. Split the transfer function into the sum of transfer functions for each mode H(s) = M∑ k=1 Hk(s), (5.16) where Hk(s) = Kk s2 + 2ζkωn,ks+ ω2n,k . (5.17) 40 Chapter 5. Effective Dynamometer Bandwidth Improvement Each individual mode has a corresponding canonical observable form ẋk = =An︷ ︸︸ ︷−2ζkωn,k 1 −ω2n,k 0 xk + =Bn︷ ︸︸ ︷ 0 Kk Fa (5.18) yk = [ 1 0 ] ︸ ︷︷ ︸ =Cn xk (5.19) The total response of the system y is given as: y = M∑ k=1 yk +K0Fa. (5.20) Let x be the total state of the system x′ = x1 x2 ... xn , (5.21) then a state space model of the system can be written as ẋ′ = =A′︷ ︸︸ ︷ −2ζ1ωn,1 1 0 0 · · · 0 0 −ω2n,1 0 0 0 0 0 0 0 −2ζkωn,k 1 0 0 0 0 −ω2n,k 0 0 0 ... . . . ... 0 0 −2ζkωn,k 1 0 0 · · · −ω2n,k 0 x + =B′︷ ︸︸ ︷ 0 K1 0 K2 ... 0 KM Fa (5.22) y = [ 1 0 1 0 · · · 1 0 ] ︸ ︷︷ ︸ =C′ x′ + K0︸︷︷︸ =D′ Fa. (5.23) For this new state space model, ‖A′‖∞ = maxω2n,k, (5.24) 41 Chapter 5. Effective Dynamometer Bandwidth Improvement and ∥∥∥A′−1∥∥∥ = ∥∥∥∥∥∥∥∥∥∥∥∥ A1 −1 0 · · · 0 0 A2 −1 ... . . . ... 0 · · · AM−1 ∥∥∥∥∥∥∥∥∥∥∥∥ = max k { ωn,k ζk } . (5.25) This gives a condition number approximately κ(A′) ≈ max k { ω2n,k } . (5.26) This form is well conditioned for any number of modes as long as the natural frequency of all modeled modes ωn,k < 10 6 rad/s. In order to construct a Kalman filter, it is necessary to write the system in state space form with known inputs and outputs, and unknown process and measurement noise. For the Kalman filter to be optimal, the process and measurement noise must both be uncorrelated zero mean white noise processes with a known variance. However, in the case of milling, the force applied to the dynamometer is not a white-noise. A model must be developed which models the applied force as white-noise passed through some filter[13]. To obtain this filter, the applied force is written as a periodic function Fp(t) multiplied by some slowly varying envelope A(t) Fa(t) = A(t)Fp(t). (5.27) Expanding Fp as a Fourier series gives Fa = ∞∑ n=−∞ an(t)e 2piin T t, (5.28) where A(t) is considered approximately constant. Defining Fp,n = an(t)e 2piin T t, (5.29) and Gp,n = iFp,n, (5.30) 42 Chapter 5. Effective Dynamometer Bandwidth Improvement gives Ḟp,n = 2pin T Gp,n + ȧne 2piin T t (5.31) Ġp,n = −2pin T Fp,n + iȧne 2piin T t, (5.32) for n 6= 0 and Ḟp,0 = ȧ0 (5.33) Since ȧn is not known a priori, ȧne 2piin T t can be treated as a white-noise source with variance Qn = ȧ 2 n = constant. (5.34) This has the form of a state-space model with an infinite number of states. For the purpose of the dynamometer compensation, this model is approximated as a model with 2N+1 states, the DC component and the firstN harmonics. The tests done in this thesis have been performed with a 4-fluted tool, so N = 12 was chosen, with the fundamental frequency being the spindle frequency. The spindle frequency was chosen as the fundamental frequency instead of the tooth passing frequency to account for any runout in the measurement. By using 12 harmonics, the third harmonic of the tooth passing frequency is included, which is required to properly capture the cutting forces[19]. ẋf = =Af︷ ︸︸ ︷ 2pi T 0 0 0 0 0 · · · 0 0 0 0 1 0 0 0 0 0 −1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 −2 0 0 0 ... . . . ... 0 0 0 0 0 0 N 0 0 0 0 0 · · · −N 0 xf + =Bf︷︸︸︷ I w Fa = [ 1 1 0 1 0 · · · 1 0 ] ︸ ︷︷ ︸ =Cf xf . (5.35) The dynamometer model is expanded to a composite model which includes the force model. The state vector of the composite model contains the states of both the dynamometer 43 Chapter 5. Effective Dynamometer Bandwidth Improvement model and the applied force model z = x′ xf . (5.36) The expanded system is then ż(t) = A′ B′Cf 0 Af z(t) + 0 Bf w(t) (5.37) Fm = [ C′ D′Cf ] z(t) + v(t). (5.38) This gives a new state space system with state space matrices Â = A′ B′Cf 0 Af B̂ = 0 0 Ĉ = [ C′ D′Cf ] D̂ = 0, (5.39) which is disturbed by some white noise [ 0 Bf ]T w(t) and v(t), each with impulsive corre- lation E 0 Bf w(t)w(ζ)T [0 Bf] = Qδ(t− ζ) (5.40) E {v(t)v(ζ)} = Rδ(t− ζ). (5.41) v(t) and w(t) are also assumed to be mutually uncorrelated. To estimate the applied force it is necessary to find a linear filter which is driven by the measured force Fm and produces a state estimate ẑ. An estimate of the applied force F̂a can be extracted from the estimated state. The filter will be optimized by minimizing the function Jt = E { z̃(t)z̃(t)T } (5.42) where z̃(t) = ẑ(t)− z(t) (5.43) is the estimation error. This is the Kalman filter problem. To derive the solution to this problem, the derivation of the Kalman filter given in Goodwin[13] is followed. Begin by considering a time-varying state-space model ẋt(t) = At(t)xt(t) + wt(t)yt(t) = Ct(t)xt(t) + vt(t) (5.44) 44 Chapter 5. Effective Dynamometer Bandwidth Improvement where wt(t) and vt(t) have zero mean and are uncorrelated, and E { wt(t)wt(ζ) T } = Qtδ(t− ζ) (5.45) E {v(t)v(ζ)} = Rtδ(t− ζ). (5.46) For this model, compute the covariance P̄(t) = E { xt(t)xt(ζ) T } given the initial covariance P̄0 = E { xt(0)xt(0) T } . The solution to equation 5.44 is xt(t) = φt(t, 0)x0t + ∫ t 0 φt(t, τ)wt(τ)dτ (5.47) where the state transition matrix φt(t, τ) is the matrix such that xt(t) = φt(t, τ)xt(τ). (5.48) Squaring the solution given in equation 5.48 and taking the expectation gives P̄(t) = φt(t, 0)P̄0φt(t, 0) T + ∫ t 0 φt(t, τ)Qt(τ)φt(t, τ) Tdτ. (5.49) Differentiating this equation gives dP̄(t) dt = At(t)P̄(t) + P̄(t)At(t) T + Qt(t). (5.50) Returning to the original problem of obtaining an estimate, ẑ(t), of the state z(t). Assume the filter has the form: dẑ(t) dt = Âẑ(t) + K(t) [ Fm(t)− Ĉẑ(t) ] , (5.51) where K(t) is a gain matrix yet to be determined. Subtracting equation 5.37 from equation 5.51 gives dz̃(t) dt = ( Â−K(t)Ĉ ) z̃(t) + K(t)v(t)−w(t). (5.52) Comparing equation 5.52 with 5.44 gives xt(t) = z̃(t); At(t) = ( Â−K(t)Ĉ ) ; wt(t) = K(t)v(t)−w(t). (5.53) Therefore dP(t) dt = ( Â−K(t)Ĉ ) P(t) + P(t) ( Â−K(t)Ĉ )T + K(t)RK(t)T + Q. (5.54) 45 Chapter 5. Effective Dynamometer Bandwidth Improvement To determine the gain K(t) which minimizes equation 5.54, let K(t) = K̂(t) + K̃(t), (5.55) where K̂(t) = P(t)ĈTR−1. (5.56) Substituting equation 5.55 into equation 5.54 gives dP(t) dt = ( Â− K̂(t)Ĉ ) P(t) + P(t) ( Â− K̂(t)Ĉ )T + K̂(t)RK̂(t)T + K̃(t)RK̃(t)T + Q. (5.57) It can clearly be seen that Ṗ(t) is minimized if K̃(t) = 0. Thus, K̂(t) is the optimal time varying filter gain. At a steady state condition, 0 = ( Â− K̂(t)Ĉ ) P(t) + P∞ ( Â− K̂(t)Ĉ )T + K̂(t)RK̂(t)T + K̃(t)RK̃(t)T + Q (5.58) K̂∞ = P∞ĈTR−1. (5.59) The steady state Kalman gain K̂∞ is used instead of the time varying gain K̂(t) to avoid recomputing the Kalman gain at every time. To summarize, the estimated applied force is ˙̂z = Âẑ(t) + K̂ ( Fm − Ĉẑ(t) ) (5.60) F̂a = [ 01×2M Cf ] ẑ (5.61) where the optimal gain K̂ satisfies K̂ = PĈTR−1 (5.62) and P is the solution to 0 = Q−PĈTR−1CP + PÂT + ÂP. (5.63) The full system is show in figure 5.1. 46 Chapter 5. Effective Dynamometer Bandwidth Improvement + + ∫ Af Cf F̂a B′ + + + ∫ A′ C′ + + D′ F̂m Compensated force (F̂a) K̂ − + Dynamometer Measured force (Fm)Cutting force (Fa) Force model Dynamometer model Figure 5.1: Kalman Filter Block Diagram 5.3 Experimental Results One method which could be used to test the dynamometer force compensation results would be to measure the force with both a dynamometer and another sensor, and compare the force measured by the dynamometer before and after compensation with the real applied force measured by the other sensor. There are several practical problems with method. Primarily, the reference sensor must have a large enough bandwidth such that forces near the first mode of the sensor to be compensated are measured undistorted by the reference sensor. In addition, the reference dynamometer must be small enough (or the dynamometer to be compensated must be large enough) that the reference dynamometer can be mounted on top of the test dynamometer. For these reasons, using a reference dynamometer was impractical. Instead, an indirect method of testing the Kalman filter was used. The tangential force on each tooth of a cutting tool is Ft(φ) = Ktcah(φ) +Ktea (5.64) 47 Chapter 5. Effective Dynamometer Bandwidth Improvement when the tooth is cutting, where h(φ) is the chip thickness, which is approximately h(φ) = c sinφ. (5.65) The cutting coefficients Ktc and Kte do not depend on the spindle speed. A similar relation- ship holds for the radial cutting force Kr(φ). These forces can be transformed into the X and Y axis Fx(φ) = −Ft cosφ− Fr sinφ (5.66) Fy(φ) = Ft sinφ− Fr cosφ (5.67) The cutting forces as a function of tool angle are independent of the spindle speed. To measure the effectiveness of the Kalman filter, the cutting forces at a low speed Fxl(t), Fyl(t) are measured. These forces are converted to force as a function of angle using the relation φ = Ωt. (5.68) The forces are measured at a spindle speed close to the resonance, and converted to forces as a function of angle, and compared with the low speed forces. If the Kalman filter performs as expected, the two forces will match. The transfer function of the X- and Y-axes of the target dynamometer, and an associated models are shown in figures 5.2 and 5.3, respectively. For both axes there is one dominant mode; however, the dynamometer model includes several of the higher frequency modes as well. It was found that if these higher-frequency modes are not included, the mismatch between the model and the real dynamics can cause the an amplification of high-frequency noise. In order to design a Kalman filter, both the variance of the measurement noise and the process noise must be known. The measurement noise can be estimated by measuring the variance of the dynamometer with no applied forces. The variance of the applied force is more difficult to measure, so instead of attempting to measure it, this is treated as a tunable parameter, which can be used to adjust the bandwidth of the generated Kalman filter. With the model developed previously, a Kalman filter is designed to compensate the dynamics of both the X and Y axes. Since the noise model depends on the spindle frequency, a separate 48 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.2: Dynamometer Force-Force Transfer Function Figure 5.3: Dynamometer Force-Force Transfer Function 49 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.4: Kalman Filter for X-Axis at Tooth-Passing Frequency of 930 Hz Figure 5.5: Kalman Filter for Y-Axis at Tooth-Passing Frequency of 930 Hz 50 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.6: X-Axis Cutting Test at 13950 RPM Kalman filter must be designed for each spindle frequency. Typical filters are shown in figures 5.4 and 5.5. In order to test the effectiveness of the Kalman filter, two slotting cutting tests are performed with a four fluted cylindrical endmill. One test is performed with a spindle speed of 750 rpm, giving a tooth passing frequency of 50 Hz. Another test is performed with a spindle speed of 13950 rpm, a tooth passing frequency of 930 rpm, which corresponds to the natural frequency of the X axis of the dynamometer. The first, low frequency, test is undistorted by any dynamometer dynamics. The second test is compensated by the Kalman filter compensation algorithm, and both the uncompensated and compensated cutting forces are compared with the low speed reference test. The results are shown in figures 5.6 and 5.7. To compare the effectiveness of the dynamometer compensation algorithm at different spindle speeds, tests were done at six different spindle speeds between 750 rpm and 18000 rpm with a four fluted tool. This gives tooth passing frequencies from 50 Hz to 1200 Hz. To compare the effectiveness of the compensation algorithm at different frequencies, the 10th and 90th percentiles were plotted as a function of tooth passing frequency in figures 5.8 and 51 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.7: Y-Axis Cutting Test at 13950 RPM 5.9. This shows the range of force signal, which is expected to be constant. The 10th and 90th percentiles were chosen instead of the minimum and maximum to minimize the effect of noise. Although the range of the compensated cutting forces remains approximately constant over all tooth-passing frequencies, the average cutting force decreases as the spindle speed increases. This may occur because the cutting coefficients are decreasing, as the spindle speed increases, rather than staying constant as predicted. In summary, the Kalman filter used in this chapter is capable of reproducing the applied force signal with the correct overall amplitude. It performs less well at correctly estimating the waveform of the applied force. This is because in order to accurately reproduce the cutting force waveform it is necessary to compensate the first several harmonics of the applied force, which lie beyond the bandwidth of the sensor. Also, for the dynamometer used, the region beyond the principal mode was difficult to model making compensation impossible. 52 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.8: X-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90th Percentile) 53 Chapter 5. Effective Dynamometer Bandwidth Improvement Figure 5.9: Y-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90th Percentile) 54 Chapter 6 Integrated Smart Machining System The automated cutting force coefficient identification from spindle power or dynamometers is integrated with the frequency response function of the tool measured automatically with the computer controlled hammer. The objective is to embed a smart machining system to a CNC, which allows the operator to automatically identify chatter free spindle speeds and cutting depths. To produce an automatic smart machining system, it is necessary to integrate the algo- rithms developed in this thesis into a CNC machining system, so the necessary steps can be performed with the press of a button. In a production system, these algorithms would run on the CNC, or the front panel. This is impractical in a research setting. Instead, a prototype system was developed which placed the algorithms on a PC, which communicated with the CNC to execute the CNC-side commands and perform data collection from the CNC. The prototype system consists of a Mori-Seiki NMV5000 milling machine using a Fanuc 30i CNC, a standard laptop PC with a data acquisition card connected to the Fanuc CNC via ethernet network (figure 6.1. The PC is able to send commands and read data from the Fanuc CNC using both the Fanuc FOCAS libraries[10], and the Fanuc Servo Guide software[11], which is built on top of the FOCAS libraries. The FOCAS libraries are used by the operator’s panel to communicate with the CNC, so integrating the components developed in this thesis into the front panel of the machine tool is possible. 6.1 Integration with Cutting Coefficient Prediction To measure the load meter voltage necessary to perform the cutting coefficient identification, the Fanuc Servo Guide software was used to measure the spindle load meter current. The process is as follows: 55 Chapter 6. Integrated Smart Machining System Figure 6.1: CNC and Automatic Hammer Connection to Laptop Computer • A test slotting cut is programmed into the CNC, with the beginning of the cut at the start of a NC code block, with a cut at least a second long. • The Fanuc Servo Guide software is set up to measure the spindle power (channel labeled LMDAT) with a start trigger at the block given in step 6.1. • The test cut is run, and the spindle power measurements are collected. • Steps 6.1 to 6.1 are repeated at different feeds per tooth. • The data from the above steps is used to calculate the tangential cutting coefficient, as described in chapter 3. Although the experimental setup used for this thesis uses the Fanuc Servo Guide, it is not necessary to use this software. The Servo Guide software uses undocumented functions of the Fanuc FOCAS libraries for its data acquisition routines. If documenation for these routines can be obtained, this procedure could be automated into a self-contained program. 56 Chapter 6. Integrated Smart Machining System 6.2 Integration with Automated Transfer Function Measurement Unit To implement the procedure for positioning, calibrating and actuating the automatic hammer described in chapter 4 it is necessary to be able to send commands to the CNC, and perform actions when those commands have been executed. For this, the Direct Numerical Control (DNC) facility of the Fanuc controller is used. This facility is intended to allow part programs to be sent directly from a PC. The Fanuc FOCAS libraries have functions which allow a DNC program to be generated dynamically. This facility enables automatic execution of the algorithms described in chapter 4. The program for automated transfer function measurements is a C++ program which is divided into four sections: main loop, flute finding, capacitive sensor calibration, and the frequency response function (FRF) measurement. Full source code is provided in Appendix 7.1. The main loop is contained entirely in the main() function. It establishes the connection to the CNC, and enters the cnc_dncstart2() function, which waits for the operator to start the machine in DNC mode. Once the cnc_dncstart2() function returns, the next steps of the algorithm are executed in order (flute finding, sensor calibration and FRF measurement). Once the FRF has been measured, the loop sends the program halt ocde (M30) to the CNC and terminates DNC mode by calling the cnc_dncend2() function. The operator can now change to another mode and continue machining, or switch tools and measure the FRF of another tool. In order to execute the flute finding and sensor calibration algorithms, it is necessary to send commands to the CNC. This is done through the run_cmd() function, which in turn calls the FOCAS function cnc_dnc2(). The cnc_dnc2() command takes three parameters: a handle which identifies the CNC, the text of the CNC commands to be executed, and a pointer to an integer which contains the number of characters to be sent to the CNC. Once the cnc_dnc2() function returns, this integer contains the number of characters which were actually transmitted to the CNC. It is possible that only a part of the command string will be transmitted to the CNC, in which case the cnc_dnc2() function must be called again 57 Chapter 6. Integrated Smart Machining System with the rest of the string of commands. This retransmission is performed by the run_cmd() function, so the rest of the program does not have to handle partial transmissions. The flute finding code implements the algorithms described in section 4.1. In order to implement these algorithms, the distance from the capacitive sensor to the tool surface at a given angle must be measured. This is performed by • Issuing a command to the CNC to rotate the spindle to the target angle. On the machine used, this is done by issuing the commands #1133=angle M119 where angle is the desired angle θ expressed as a number from 0-4095 angle = 4096θ 2pi . (6.1) • Waiting for 200 ms for the CNC to begin acting on the command. • Measuring the spindle speed and waiting for the spindle to come to rest. The spindle is assumed to have come to rest once the spindle speed is zero in five measurements in a row. • The average voltage output by the capacitive sensor over 10 ms is measured using a data acquisition card (DAQ). This voltage is used as the distance between the capacitive sensor and the tool surface. The tool positioning required for sensor calibration is performed similarly. For the axis positions it is possible to measure the distance remaining, so distance remaining is used to determine when the command has finished executing, instead of when the machine comes to rest. • Issue a command to move the CNC by the amount required for the calibration algo- rithm Xdist 58 Chapter 6. Integrated Smart Machining System where dist is replaced with the desired offset. • Wait until the distance remaining to travel is zero. • The average voltage output by the capacitive sensor over 10 ms is measured using a data acquisition card (DAQ). This voltage is used as the distance between the capacitive sensor and the tool surface. Finally, an external program (MalTF.exe) is started to perform the frequency response function measurement. This program accepts a command line flag to communicate the calculated displacement sensor sensitivity. In the future the frequency response function measurement, and tool positioning and sensor calibration code could be more tightly inte- grated, although this isn’t necessary. The current level of integration achieves the objective of automatic frequency response function measurement. 6.3 Chatter Prediction The tangential cutting coefficient measured using the method developed in chapter 3 is now combined with the frequency response function measured with the automatic FRF measure- ment system from chapter 4 to provide an estimate of the chatter-free cutting conditions. To calculate these chatter-free cutting conditions, the experimentally proven and widely used chatter stability method presented by Altintas and Budak[3] is used in the proposed system. The stability theory is briefly described here. 6.3.1 Chatter Stability Law The dynamic milling force is expressed byFx(t) Fy(t) = 1 2 aKt axx(t) axy(t) ayx(t) ayy(t) ∆x(t) ∆y(t) (6.2) 59 Chapter 6. Integrated Smart Machining System where ∆x and ∆y are the vibrations between successive tooth periods. aij are the directional dynamic milling force coefficients, given as axx = N−1∑ j=0 −g(φj) [sin 2φj +Kr (1− cos 2φj)] (6.3) axy = N−1∑ j=0 −g(φj) [(1 + cos 2φj) +Kr sin 2φj] (6.4) ayx = N−1∑ j=0 g(φj) [(1− cos 2φj)−Kr sin 2φj] (6.5) axx = N−1∑ j=0 g(φj) [sin 2φj −Kr (1 + cos 2φj)] , (6.6) where N is the number of teeth, and φj is the angular position of tooth j, and g(φj) is a function indicating if the tooth is in cut. It is unity if the tooth is cutting, and zero if the tooth is out of cut. The dynamics of the machine tool spindle/tool holder/cutter combination can be identi- fied from the frequency response function, and written asx(t) y(t) = φxx φxy φyx φyy Fx(t) Fy(t) . (6.7) By substituting this into 6.2, the eigenvalue problem[[ I ] − 1 2 Kta (F (t)− F (t+ T )) [ A(t) ] [ Φ ]] = 0 (6.8) is obtained. To solve this, some simplifications must be made. First, [A(t)] is rewritten as[ A(t) ] = [ A0 ] + [ A′(t) ] , (6.9) where [A0] is the average value of [A(t)]. [A ′(t)] is ignored for an initial estimate. This equation will be critically stable if det [[ I ] − 1 2 Kta ( 1− e−iωcT ) [A0] [Φ(iωc)]] = 0, (6.10) where ωc is the principal chatter frequency of the system. Let Λ be the eigenvalues of[ A0 ] [ Φ(iωc) ] . By comparison of the eigenvalue formula with equation 6.10, Λ = −N 4pi alimKt(1− e−iωcT ). (6.11) 60 Chapter 6. Integrated Smart Machining System Solving for alim, ensuring that it is a real number, gives alim = −2pi<[Λ] NKt (1 + κ2), (6.12) where κ = =[Λ] <[Λ] . (6.13) The spindle speed corresponding to each chatter frequency can also be calculated as n = 60 N ωc pi − 2 tan−1 κ+ 2kpi (6.14) in rpm, where k is chosen such that the spindle speed is positive. From these equations, the chatter stability limit for a cutting process can be determined from the number of teeth N , the engagement profile of the cutter, the dynamics of the ma- chine represented by the frequency response function (FRF) Φ, and the mechanistic cutting force coefficients of the cutter Kt and Kr. 6.4 Prediction of Stability Charts In a smart machining system, the number of teeth and engagement angles are provided by the process planner. An estimate of the machine dynamics is measured by the automatic hammer system described in chapter 4, and Kt is estimated from the spindle load as described in chapter 3. The only missing parameter is Kr, which can be identified cutting force measurements with a dynamometer, but not from spindle power measurements. The value of Kr depends on the geometry of the tool, and material properties of the workpiece material. Because of this, it will be different for each tool/workpiece combination. However, it is possible to get an estimate of the stability lobes without knowing the value of Kr. Figure 6.2 shows two different stability charts, one with Kr = 0.25 and one with Kr = 0.5, both during slotting. This represents the practical extremes in Kr variation. Although the two stability lobes differ substantially in critical depth of cut, they both share some important features. First, the absolute stable depth of cut is 6 mm in both cases. Second, the stability lobes have very similar natural frequencies in both cases. In the smart machining system, a Kr value of 0.3 will be used, as this is a common Kr value. 61 Chapter 6. Integrated Smart Machining System Figure 6.2: Comparison of Stability Chart with Different Kr As a comparison, a stability chart was generated using the traditional instrumented hammer and accelerometer tap-testing method, and the cutting coefficients were obtained from a database through the orthogonal-to-oblique cutting coefficient transformation[4]. This was compared with the stability chart generated when these parameters were obtained as described in this thesis, and the result is shown in figure 6.3. Again, although the predicted maximum stable depth of cut varies widely at certain spindle speeds, the gross features, such as spindle speed of stable pockets, are comparable. The proposed smart machining strategy, which uses an automated hammer and low-cost estimation of cutting force coefficient from available spindle power, is robust and practical to use on production machines. 62 Chapter 6. Integrated Smart Machining System Figure 6.3: Comparison of Stability Chart with State of the Art Approach 63 Chapter 7 Summary and Future Research In this thesis the construction of a system for automatically determining the stable, chatter- free cutting conditions for a cutting operation was investigated. This system consists of four parts. First is a method to interface with a Computer Numerically Controlled (CNC) milling machine and determine the tangential cutting coefficient from the spindle load me- ter readings. Second, a solenoid-actuated automatic frequency response measurement unit, which is integrated to the CNC machine to automatically position the cutting tool correctly and automatically calibrate the displacement sensor. Third, a method for compensating the dynamics of a dynamometer to obtain force readings near the natural frequency of the dynamometer with improved accuracy at high spindle speeds. Finally, using the frequency response measurement and the cutting coefficients obtained using the methods presented previously to calculate the chatter-free regions of a machine tool. 7.1 Limitations and Future Work The readily available load meter of machine tools was used to measure the cutting coefficient. However many other signals, including spindle However many other signals, including spindle and axis current and axis currents are also readily available on the CNC machine tools. Since the cutting conditions can be chosen when measuring the cutting coefficients, it is possible that by combining the output of several different sensors and using several cutting tests with different cutting conditions a more accurate measurement of the cutting coefficients could be obtained. The ball screw-drives have position dependent high friction which clouds the force estimation from the drive current. However, linear motor driven axis do not have ball screw and nut, which are the largest contributors to the friction. Experience indicates that the current signals, which are directly proportional to the cutting forces, have higher bandwidth, 64 Chapter 7. Summary and Future Research i.e. 100 Hz in an average machine tool. Tangential, radial and axial cutting force coefficients can be identified from the current signals of linear motor drives, as opposed to obtaining only tangential cutting force coefficient from spindle motor power. The weakest link in the smart machining system developed in this thesis is the automatic transfer function measurement unit. Due to the vertical offset between the impact and response measurement locations, the dynamic stiffnesses of tool modes differ substantially from the direct measurements which are needed to accurately predict the chatter-free regions. Positioning the response sensor on the opposite side of the tool would allow measuring the direct transfer function; however the current capacitive sensor cannot accommodate the wide range of tool diameters if placed at a fixed location opposite the hammer. There are a couple of improvements which could be made to the Kalman filter. In order to account for the periodic nature of the applied force, the applied force was decomposed into its Fourier Series, and an multivariable ordinary differential equation which generates the first N harmonics of that Fourier series was designed. This was necessary because the Kalman filter was designed as a continuous-time Kalman filter, and there is no differential equation which generates a time delay necessary to implement the true equation for a periodic equation Fa(t) = Fa(t− T ). (7.1) If the Kalman filter was designed as a discrete-time Kalman filter however, it is trivial to write a difference equation for equation 7.1. Another area for improvement is the design of the Kalman filter. Using the approach presented in this thesis, a new Kalman filter must be designed for each spindle speed. The model could be extended to include the spindle speed as an estimated state. This would make the model non-linear, so a non-linear extension of the Kalman filter such as the Extended Kalman Filter or Unscented Kalman Filter would be required. 65 Bibliography [1] Y. Altintaş. Prediction of cutting forces and tool breakage in milling from feed drive current measurements. Journal of Engineering for Industry, 1992. [2] Y. Altintaş and A.A. Ber. Manufacturing automation: metal cutting mechanics, ma- chine tool vibrations, and CNC design. Applied Mechanics Reviews, 54:B84, 2001. [3] Y. Altintaş and E. Budak. Analytical prediction of stability lobes in milling. CIRP Annals - Manufacturing Technology, 44(1):357 – 362, 1995. [4] E. Budak, Y. Altintaş, and E. J. A. Armarego. Prediction of milling force coefficients from orthogonal cutting data. Journal of Manufacturing Science and Engineering, 118(2):216–224, 1996. [5] G. Byrne, D. Dornfeld, I. Inasaki, G. Ketteler, W. König, and R. Teti. Tool condition monitoring (TCM)the status of research and industrial application. CIRP Annals- Manufacturing Technology, 44(2):541–567, 1995. [6] J. Chae and S.S. Park. High frequency bandwidth measurements of micro cutting forces. Int. J. of Machine Tools and Manufacture, 47:1433–1441, 2007. [7] N. Constantinides and S. Bennett. An investigation of methods for the on-line estimation of tool wear. International Journal of Machine Tools and Manufacture, 27(2):225 – 237, 1987. [8] L. Deshayes, L. Welsch, A. Donmez, R. Ivester, D. Gilsinn, R. Rhorer, E. Whitenton, and F. Potra. Smart machining systems: Issues and research trends. In Innovation in Life Cycle Engineering and Sustainable Development, pages 363–380. Springer Nether- lands, 2006. 66 Bibliography [9] D. J. Ewins. Modal Testing: Theory, Practice and Application (Mechanical Engineering Research Studies Engineering Design Series). Taylor & Francis Group, February 2003. [10] Fanuc. Fanuc Open CNC: FOCAS1/FOCAS2 CNC/PMC Data window library. [11] Fanuc. Fanuc Servo Guide, 2001-2006. [12] V. Giurgiutiu and A. N. Zagrai. Embedded self-sensing piezoelectric active sensors for on-line structural identification. Transactions - American Society of Mechanical Engineers Journal of Vibration and Acoustics, 124(1):116–125, 2002. [13] G.C. Goodwin, S.F. Graebe, and M.E. Salgado. Control system design. Prentice Hall Upper Saddle River, NJ, 2001. [14] Y.H. Jeong and D.W. Cho. Estimating cutting force from rotating and stationary feed motor currents on a milling machine. International Journal of Machine Tools and Manufacture, 42(14):1559 – 1566, 2002. [15] J. Kiefer. Sequential minimax search for a maximum. Proceedings of the American Mathematical Society, 4(3):502–506, 1953. [16] T.Y. Kim and J. Kim. Adaptive cutting force control for a machining center by us- ing indirect cutting force measurements. International Journal of Machine Tools and Manufacture, 36(8):925 – 937, 1996. [17] M. Tse and R. Bilne. Design of an Automated Frequency Response Test Unit. M.Eng Report, 2003. [18] Y. Oh, W. Kwon, and C. Chu. Drilling torque control using spindle motor current and its effect on tool wear. International Journal of Advanced Manufacturing Technology, 24(5-6):327 – 334, 2004. [19] S.S. Park and Y. Altintaş. Dynamic compensation of spindle integrated force sen- sors with kalman filter. Journal of Dynamic Systems, Measurement, and Control, 126(3):443–452, 2004. 67 Bibliography [20] J. S. Popovics, W. Song, J. D. Achenbach, J. H. Lee, and R. F. Andre. One-sided stress wave velocity measurement in concrete. Journal of Engineering Mechanics, 124(12):1346–1353, 1998. [21] W. Press, S. Teukolsky, W. Vetterling, and B. Flannery. Numerical Recipes in C. Cambridge University Press, Cambridge, UK, 1st edition, 1988. [22] M. Santochi, G. Dini, G. Tantussi, and M. Beghini. A sensor integrated tool for cutting force monitoring. ANNALS-CIRP, 46:49–52, 1997. [23] J.-H. Tong, T.-T. Wu, and C.-K. Lee. Fabrication of a piezoelectric impact hammer and its application to the In-situ nondestructive evaluation of concrete. Japanese Journal of Applied Physics, 41(Part 1, No. 11A):6595–6600, 2002. 68 Appendix A Automatic Hammer CNC Integration Source Code // Pos i t ionToo l . cpp : Def ines the entry po in t f o r the conso l e a p p l i c a t i o n . // #include <tchar . h> #include <s t d i o . h> #include <s t d l i b . h> #include <30 i / fw l ib32 . h> #include <malloc . h> #include < l i m i t s> #include <ca s s e r t> #include <algor ithm> #include <numeric> #include <vector> #include <NIDAQmx. h> #define WIN32 LEAN AND MEAN #include <windows . h> #define PROG NUM ”” 69 Appendix A. Automatic Hammer CNC Integration Source Code using namespace std ; int cur axe s ; void r ead addre s s ( char ∗ address , unsigned short ∗port ) { char l i n e [ 8 0 ] ; do { p r i n t f ( ”CNC address : ” ) ; f g e t s ( l i n e , 80 , s td in ) ; } while ( s s c a n f ( l i n e , ”%[ˆ:/?#@! $ & ’()∗+,;= ]:%hd ” , address , port ) != 2) ; } void read channe l ( char ∗ channel ) { char l i n e [ 8 0 ] ; do { p r i n t f ( ”Cap senso r channel : ” ) ; f g e t s ( l i n e , 80 , s td in ) ; } while ( s s c a n f ( l i n e , ”%s ” , channel ) != 1) ; } short run cmd ( short fhnd , const char ∗ l i n e ) { short r e t ; long len , n ; l en = ( long ) s t r l e n ( l i n e ) ; 70 Appendix A. Automatic Hammer CNC Integration Source Code while ( l en ) { n = len ; r e t = cnc dnc2 ( fhnd , &n , ( char ∗) l i n e ) ; switch ( r e t ) { case EW BUFFER: continue ; case EW OK: l en −= n ; l i n e += n ; break ; case EW RESET: r e t = cnc dncend2 ( fhnd , DNC CANCEL) ; i f ( r e t ) return r e t ; return EW RESET; } } return EW OK; } void wa i t f o r ax i s move ( short hndl ) { bool i s done ; ODBAXIS a x i s d i s t ; S leep (200) ; 71 Appendix A. Automatic Hammer CNC Integration Source Code do { c n c d i s t a n c e ( hndl , ALL AXES, s izeof (ODBAXIS) , & a x i s d i s t ) ; i s done = true ; for ( int i = 0 ; i < cur axe s ; ++i ) { i f ( a x i s d i s t . data [ i ] ) { i s done = fa l se ; break ; } } } while ( ! i s done ) ; } char channel [ 8 0 ] ; double measure d i s t ( ) { i n t32 a i r e t ; TaskHandle a i t a s k ; a i r e t = DAQmxCreateTask( ” DistanceRead ” , &a i t a s k ) ; i f ( a i r e t ) { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } 72 Appendix A. Automatic Hammer CNC Integration Source Code a i r e t = DAQmxCreateAIVoltageChan ( a i t a sk , channel , NULL, DAQmx Val Cfg Default , −10.0 , 10 . 0 , DAQmx Val Volts , NULL) ; i f ( a i r e t ) { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } a i r e t = DAQmxCfgSampClkTiming( a i t a sk , NULL, 50000 , DAQmx Val Rising , DAQmx Val FiniteSamps , 512) ; i f ( a i r e t ) { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } a i r e t = DAQmxExportSignal ( a i t a sk , DAQmx Val SampleClock , ”PFI7” ) ; i f ( a i r e t ) 73 Appendix A. Automatic Hammer CNC Integration Source Code { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } double sample array [ 5 1 2 ] ; long samples read ; a i r e t = DAQmxReadAnalogF64( a i t a sk , DAQmx Val Auto , −1, DAQmx Val GroupByChannel , sample array , s izeof ( sample array ) / s izeof ( sample array [ 0 ] ) , &samples read , NULL) ; a s s e r t ( samples read == 512) ; double sample avg = accumulate ( sample array , sample array + 512 , 0 . 0 ) / 5 1 2 . 0 ; DAQmxClearTask( a i t a s k ) ; return sample avg ; } double measure at ( short hndl , short ang le ) { short r e t ; 74 Appendix A. Automatic Hammer CNC Integration Source Code char cmd [ 2 5 6 ] ; ang le %= 4096 ; i f ( ang le < 0) ang le += 4096 ; #i f 0 r e t = cnc wrmacro ( hndl , 1133 , 10 , ang le %4096 , 0) ; i f ( r e t ) { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } #else s p r i n t f (cmd , ”#1133=%d\nM119\n” , ang le ) ; #endif i f ( r e t = run cmd ( hndl , cmd) ) { return numer i c l im i t s<double> : : s ignal ing NaN ( ) ; } // need to wai t a wh i l e here . // wai t f o r s p i n d l e to s top ODBACT2 sspeed ; S leep (200) ; int speeds [ 5 ] ; int k = 0 ; 75 Appendix A. Automatic Hammer CNC Integration Source Code memset ( speeds , 0xcd , s izeof ( speeds ) ) ; do { i f ( r e t = cnc ac t s 2 ( hndl , 1 , &sspeed ) ) { f p r i n t f ( s tde r r , ” Error read ing ac tua l s p i n d l e speed : %d\n” , r e t ) ; c n c f r e e l i b h n d l ( hndl ) ; return 1 ; } speeds [ k++] = sspeed . data [ 0 ] ; i f ( k > 4) k = 0 ; } while ( speeds [ 0 ] | | speeds [ 1 ] | | speeds [ 2 ] | | speeds [ 3 ] | | speeds [ 4 ] ) ; return measure d i s t ( ) ; } const double phi = (1 + s q r t ( 5 . 0 ) ) / 2 . 0 ; void bracket max ( short hndl , short ∗ l e f t , short ∗ centre , short ∗ r i g h t ) { #i f 1 double fa , fb , f c ; short ax , bx , cx ; ax = 0 ; bx = 32 ; 76 Appendix A. Automatic Hammer CNC Integration Source Code f a = measure at ( hndl , ax ) ; fb = measure at ( hndl , bx ) ; i f ( fb < f a ) { swap ( fa , fb ) ; swap ( ax , bx ) ; } cx = bx + phi ∗(bx − ax ) ; f c = measure at ( hndl , cx ) ; double fu ; short u , ulim ; while ( fb <= f c ) { double r = ( bx − ax ) ∗( fb − f c ) ; double q = ( bx − cx ) ∗( fb − f a ) ; double rq = r − q ; i f ( cx > bx ) { ulim = bx + 64 ; } else { ulim = bx − 64 ; } i f ( abs ( r − q ) < 1e−3) { u = cx + phi ∗( cx − bx ) ; fu = measure at ( hndl , u ) ; } else { 77 Appendix A. Automatic Hammer CNC Integration Source Code u = bx − ( ( bx − cx )∗q − ( bx − ax )∗ r ) /( r − q ) ; i f ( ( bx − u) ∗(u − cx ) > 0) { fu = measure at ( hndl , u ) ; i f ( fu > f c ) { ax = bx ; f a = fb ; bx = u ; fb = fu ; continue ; } else i f ( fu < fb ) { cx = u ; f c = fu ; continue ; } u = cx + phi ∗( cx − bx ) ; fu = measure at ( hndl , u ) ; } else i f ( ( cx − u) ∗(u − ulim ) > 0) { fu = measure at ( hndl , u ) ; i f ( fu > f c ) { bx = cx ; cx = u ; u = cx+phi ∗( cx − bx ) ; fb = f c ; f c = fu ; fu = measure at ( hndl , u ) ; } 78 Appendix A. Automatic Hammer CNC Integration Source Code } else i f ( ( u − ulim ) ∗( ulim − cx ) > 0) { u = ulim ; fu = measure at ( hndl , u ) ; } else { u = cx + phi ∗( cx − bx ) ; fu = measure at ( hndl , u ) ; } } ax = bx ; bx = cx ; cx = u ; f a = fb ; fb = f c ; f c = fu ; } i f ( ax < bx && ax < cx ) { ∗ l e f t = ax ; i f ( bx < cx ) { ∗ c en t r e = bx ; ∗ r i g h t = cx ; } else { ∗ c en t r e = cx ; ∗ r i g h t = bx ; } } else i f ( bx < cx ) { ∗ l e f t = bx ; i f ( ax < cx ) { 79 Appendix A. Automatic Hammer CNC Integration Source Code ∗ c en t r e = ax ; ∗ r i g h t = cx ; } else { ∗ c en t r e = cx ; ∗ r i g h t = ax ; } } else { ∗ l e f t = cx ; i f ( ax < bx ) { ∗ c en t r e = ax ; ∗ r i g h t = bx ; } else { ∗ c en t r e = bx ; ∗ r i g h t = ax ; } } a s s e r t (∗ r i g h t − ∗ l e f t < 4096) ; #else double m = −11.0; short mx = −1; for ( int i = 0 ; i < 4096 ; i += 32) { double measure = measure at ( hndl , i ) ; i f ( measure > m) { m = measure ; mx = i ; } } ∗ l e f t = mx − 32 ; ∗ c en t r e = mx; ∗ r i g h t = mx + 32 ; 80 Appendix A. Automatic Hammer CNC Integration Source Code #endif } short f ind max ( short hndl , short l e f t , short centre , short r i g h t ) { short x1 , x2 ; short x0 = l e f t ; short x3 = r i g h t ; const double r = phi − 1 . 0 , c = 1 .0 − r ; i f ( abs ( r i g h t − c en t r e ) > abs ( c en t r e − l e f t ) ) { x1 = cent r e ; x2 = cent r e + c ∗( r i g h t − cen t r e ) ; } else { x2 = cent r e ; x1 = cent r e − c ∗( c en t r e − l e f t ) ; } double f0 , f1 , f2 , f 3 ; f 1 = measure at ( hndl , x1 ) ; f 2 = measure at ( hndl , x2 ) ; while ( abs ( x3 − x0 ) > 5) { i f ( f 2 > f 1 ) { 81 Appendix A. Automatic Hammer CNC Integration Source Code x0 = x1 ; x1 = x2 ; x2 = r∗x1 + c∗x3 ; f 0 = f1 ; f 1 = f2 ; f 2 = measure at ( hndl , x2 ) ; } else { x3 = x2 ; x2 = x1 ; x1 = r∗x2 + c∗x0 ; f 3 = f2 ; f 2 = f1 ; f 1 = measure at ( hndl , x1 ) ; } } i f ( f 1 > f 2 ) { return x1 ; } else { return x2 ; } } template <class T> in l ine T s ign ( const T &t ) 82 Appendix A. Automatic Hammer CNC Integration Source Code { i f ( t < T( ) ) return T(−1) ; else return T(1) ; } double c a l i b r a t e a n d z e r o ( short hndl ) { double d e l t a d i s t ; double p r e v d i s t = measure d i s t ( ) ; i f ( p r e v d i s t > −0.1) { // a l r eady zeroed −− need to f i nd some other way to c a l i b r a t e d e l t a d i s t = −0.1; } else i f ( p r e v d i s t < −5) { d e l t a d i s t = 0 . 1 ; } else { d e l t a d i s t = 0 . 0 5 ; } double d i s t ; double gain = 0 . 0 ; char cmd [ 2 5 6 ] ; short r e t ; 83 Appendix A. Automatic Hammer CNC Integration Source Code do { s p r i n t f (cmd , ”X%.3 f \n” , d e l t a d i s t ) ; run cmd ( hndl , cmd) ; wa i t f o r ax i s move ( hndl ) ; d i s t = measure d i s t ( ) ; i f ( abs ( p r e v d i s t ) < 9 . 5 ) { gain = abs ( d e l t a d i s t /( d i s t − p r e v d i s t ) ) ; // mm/V d e l t a d i s t = −d i s t ∗ gain /2 ; i f ( abs ( d e l t a d i s t ) > 0 . 10 ) { d e l t a d i s t = s i gn ( d e l t a d i s t ) ∗ 0 . 1 ; } } else { d e l t a d i s t = −0.1∗ s i gn ( d i s t ) ; } p r e v d i s t = d i s t ; } while ( abs ( d i s t ) > 0 . 1 ) ; return gain ; } 84 Appendix A. Automatic Hammer CNC Integration Source Code int tmain ( int argc , TCHAR∗ argv [ ] ) { char address [ 2 5 6 ] ; unsigned short port ; unsigned short hnd ; short r e t ; ODBSYS s y s i n f o ; int max axes ; r ead addre s s ( address , &port ) ; r ead channe l ( channel ) ; i f ( r e t = c n c a l l c l i b h n d l 3 ( address , port , 10 , &hnd) ) { f p r i n t f ( s tde r r , ” Error number %hd\n” , r e t ) ; return r e t ; } i f ( r e t = c n c s y s i n f o (hnd , &s y s i n f o ) ) { f p r i n t f ( s tde r r , ” Error number %hd\n” , r e t ) ; c n c f r e e l i b h n d l (hnd ) ; return r e t ; } p r i n t f ( ” Contro l l ed axes : %.2 s/%d ( cur r ent /max)\n” , s y s i n f o . axes , s y s i n f o . max axis ) ; max axes = s y s i n f o . max axis ; i f ( s y s i n f o . axes [ 0 ] >= ’ 0 ’ && s y s i n f o . axes [ 0 ] <= ’ 9 ’ ) { 85 Appendix A. Automatic Hammer CNC Integration Source Code cur axe s = 10∗( s y s i n f o . axes [ 0 ] − ’ 0 ’ ) + ( s y s i n f o . axes [ 1 ] − ’ 0 ’ ) ; } else { cur axe s = s y s i n f o . axes [ 1 ] − ’ 0 ’ ; } i f ( cu r axe s < 0 | | cur axe s > max axes ) { f p r i n t f ( s tde r r , ” I n v a l i d number o f c o n t r o l l e d axes : %d\n” , cur axe s ) ; c n c f r e e l i b h n d l (hnd ) ; return 1 ; } p r i n t f ( ” Contro l l ed axes : %d/%d ( cur rent /max)\n” , cur axes , max axes ) ; p r i n t f ( ”Kind o f CNC: %.2 s ” , s y s i n f o . cnc type ) ; i f ( ( s y s i n f o . addin fo & 0x02 ) == 0x02 ) { p r i n t f ( ” i ” ) ; } switch ( s y s i n f o . mt type [ 1 ] ) { case ’M’ : i f ( s y s i n f o . mt type [ 0 ] == ’M’ ) { p r i n t f ( ” 2−path machining cent r e \n” ) ; } else 86 Appendix A. Automatic Hammer CNC Integration Source Code { p r i n t f ( ” machining cent r e \n” ) ; } break ; case ’T ’ : switch ( s y s i n f o . mt type [ 0 ] ) { case ’T ’ : p r i n t f ( ” 2/3 path l a the \n” ) ; break ; case ’M’ : p r i n t f ( ” m i l l t u rn \n” ) ; break ; case ’ ’ : p r i n t f ( ” l a the \n” ) ; break ; } break ; case ’P ’ : p r i n t f ( ” punch pr e s s \n” ) ; break ; case ’L ’ : p r i n t f ( ” l a s e r \n” ) ; break ; case ’W’ : p r i n t f ( ” wire cut\n” ) ; break ; default : p r i n t f ( ” unknown\n” ) ; } 87 Appendix A. Automatic Hammer CNC Integration Source Code p r i n t f ( ” S e r i e s : %.4 s\n” , s y s i n f o . s e r i e s ) ; p r i n t f ( ” Vers ion : %.4 s\n” , s y s i n f o . v e r s i on ) ; while (1 ) { char prognum [ 2 5 6 ] ; while (1 ) { /∗ wai t f o r DNC connect ∗/ r e t = cnc dnc s ta r t2 (hnd , prognum ) ; switch ( r e t ) { case EW REJECT: continue ; case 0 : break ; default : f p r i n t f ( s tde r r , ” Error whi l e wa i t ing f o r DNC connect : %d\n” , r e t ) ; i f ( r e t == −1) { char buf [ 3 2 ] ; p r i n t f ( ”DNC s e s s i o n in p rog r e s s . Force takeover ( y/n) ? ” ) ; f g e t s ( buf , s izeof ( buf ) , s td in ) ; i f ( ! s tr icmp ( buf , ”y\n” ) ) 88 Appendix A. Automatic Hammer CNC Integration Source Code { cnc dncend2 (hnd , DNC READERR) ; continue ; } } c n c f r e e l i b h n d l (hnd) ; return 1 ; } i f ( strcmp ( prognum , PROG NUM) ) { f p r i n t f ( s tde r r , ” Unrecognized program number %s .\n” , prognum ) ; cnc dncend2 (hnd , DNC OPENERR) ; continue ; } short l e f t , centre , r i g h t ; const short nteeth = 4 ; bracket max (hnd , &l e f t , ¢re , &r i g h t ) ; short low pos = find max (hnd , l e f t , centre , r i g h t ) ; i f ( low pos <= −9.5) { p r i n t f ( ” Error : c u t t e r not in range o f d i sp lacement s enso r .\n” ) ; 89 Appendix A. Automatic Hammer CNC Integration Source Code goto prog end ; } i f ( run cmd (hnd , ”G91\n” ) == EW RESET) continue ; i f ( run cmd (hnd , ”G01F60Z−8.73\n” ) == EW RESET) continue ; wa i t f o r ax i s move (hnd) ; l e f t = low pos ; r i g h t = low pos + 4096/ nteeth ; c en t r e = ( l e f t + r i g h t ) / phi ; short high pos = find max (hnd , l e f t , centre , r i g h t ) ; i f ( run cmd (hnd , ”Z8 .73\n” ) == EW RESET) continue ; wa i t f o r ax i s move (hnd) ; char cmd [ 2 5 6 ] ; s p r i n t f (cmd , ”#1133=%d\nM119\n” , 2∗ high pos − low pos ) ; i f ( run cmd (hnd , cmd) == EW RESET) continue ; double gain = c a l i b r a t e a n d z e r o (hnd) ; 90 Appendix A. Automatic Hammer CNC Integration Source Code s p r i n t f (cmd , ” .\\MalTF . exe /c autohammer . c f g / s e t OSensor [ 0 ] . Gain=%g” , gain /1000 .0 ) ; system (cmd) ; prog end : i f ( run cmd (hnd , ”M02\n%\n” ) == EW RESET) continue ; cnc dncend2 (hnd , DNC NORMAL) ; } } return 0 ; } 91
Cite
Citation Scheme:
Usage Statistics
Country | Views | Downloads |
---|---|---|
United States | 8 | 0 |
Canada | 4 | 8 |
China | 3 | 4 |
India | 1 | 0 |
City | Views | Downloads |
---|---|---|
Longueuil | 4 | 8 |
Mountain View | 3 | 0 |
Unknown | 3 | 0 |
Beijing | 3 | 4 |
Sunnyvale | 2 | 0 |
Bangalore | 1 | 0 |
{[{ mDataHeader[type] }]} | {[{ month[type] }]} | {[{ tData[type] }]} |
Share
Share to: