Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Automated identification of cutting force coefficients and tool dynamics on CNC machines Dunwoody, Keith 2010

You don't seem to have a PDF reader installed, try download the pdf

Item Metadata

Download

Media
[if-you-see-this-DO-NOT-CLICK]
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
Original Record: 1.0070939 +original-record.json
Full Text
1.0070939.txt
Citation
1.0070939.ris

Full Text

Automated Identi cation ofCutting Force Coe cients andTool Dynamics on CNCMachinesbyKeith DunwoodyB.A.Sc., The University of British Columbia, 2005A THESIS SUBMITTED IN PARTIAL FULFILLMENT OFTHE REQUIREMENTS FOR THE DEGREE OFMASTER OF APPLIED SCIENCEinThe Faculty of Graduate Studies(Mechanical Engineering)THE UNIVERSITY OF BRITISH COLUMBIA(Vancouver)March 2010c Keith Dunwoody 2010AbstractThe complexity and variation of parts are continuously increasing due to technologically ori-ented consumers. The objective of present manufacturing industry is to increase the qualitywhile decreasing the machining costs. This thesis presents a smart machining strategy whichallows the automated prediction of chatter-free cutting conditions using sensors integratedto 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 coe cient and frequency response function (FRF) of the machine at itstool tip. The cutting force coe cients are estimated from the cutting force measurementscollected through dynamometers in laboratory environment. The thesis presents an alterna-tive identi cation of tangential cutting force coe cient from average spindle power signalswhich are readily available on machine tools. When tangential, radial and axial cutting forcecoe cients are needed, the forces need to be collected by piezoelectric sensors embedded tomechanical structures. The structural dynamics of sensor housings distort the force mea-surements at high spindle speeds. A Kalman  lter is designed to compensate the structuralmodes of the sensor assembly when the spindle speed and its harmonics resonate one of themodes the measuring system. The FRF of the system is measured by a computer controlledimpact modal test unit which is integrated to CNC. The impact head is instrumented witha 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 isestimated automatically. The measured FRF and cutting force coe cient estimated fromthe 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 selectthe chatter-free cutting conditions, leading to improved quality and productivity.iiTable of ContentsAbstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiTable of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiiList of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Background and Literature Review . . . . . . . . . . . . . . . . . . . . . . . 32.1 Identi cation of Cutting Force Coe cients . . . . . . . . . . . . . . . . . . . 32.2 Automatic Transfer Function Measurement . . . . . . . . . . . . . . . . . . 62.3 E ective Dynamometer Bandwidth Improvement . . . . . . . . . . . . . . . 83 Identi cation of Cutting Force Coe cients from Spindle Power . . . . . 103.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2 Extraction of Cutting Torque from Spindle Load Sensor . . . . . . . . . . . 113.2.1 Limitation of Torque Estimation using Load Meter . . . . . . . . . . 143.3 Identi cation of Tangential Cutting Force Coe cient . . . . . . . . . . . . . 164 Automatic Impact Modal Testing of Milling Cutters . . . . . . . . . . . . 194.1 Automatic Spindle Orientation . . . . . . . . . . . . . . . . . . . . . . . . . 214.2 Automatic Capacitive Sensor Calibration . . . . . . . . . . . . . . . . . . . 244.3 Signal Processing of Automatic Hammer Signal . . . . . . . . . . . . . . . . 254.3.1 Force Measurement Windowing . . . . . . . . . . . . . . . . . . . . . 254.3.2 Spectral Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.4 Hammer-Displacement Sensor O set Compensation . . . . . . . . . . . . . . 31iiiTable of Contents4.5 Comparison of Automatic Hammer with Traditional Impact Test . . . . . . 334.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 E ective Dynamometer Bandwidth Improvement . . . . . . . . . . . . . . 375.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375.2 Dynamic Model of Cutting Force Measurement System . . . . . . . . . . . . 385.3 Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 Integrated Smart Machining System . . . . . . . . . . . . . . . . . . . . . . 556.1 Integration with Cutting Coe cient Prediction . . . . . . . . . . . . . . . . 556.2 Integration with Automated Transfer Function Measurement Unit . . . . . . 576.3 Chatter Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596.3.1 Chatter Stability Law . . . . . . . . . . . . . . . . . . . . . . . . . . 596.4 Prediction of Stability Charts . . . . . . . . . . . . . . . . . . . . . . . . . . 617 Summary and Future Research . . . . . . . . . . . . . . . . . . . . . . . . . 647.1 Limitations and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . 64Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66AppendicesAutomatic Hammer CNC Integration Source Code . . . . . . . . . . . . . . 69ivList of Figures2.1 Automatic Hammer[17] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.1 Load Meter Voltage in Air Cutting . . . . . . . . . . . . . . . . . . . . . . . 113.2 Load Meter Sensitivity by Spindle Speed . . . . . . . . . . . . . . . . . . . . 133.3 Load Meter Torque Estimate vs. Measured Torque . . . . . . . . . . . . . . 143.4 Torque in Air Cutting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.5 Load Meter Sensitivity by Spindle Speed . . . . . . . . . . . . . . . . . . . . 174.1 Automatic Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.2 Measurement Heights for Finding Flutes . . . . . . . . . . . . . . . . . . . . 214.3 Cosine-Taper Window for Force Signal Windowing . . . . . . . . . . . . . . . 264.4 Automatic Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.5 Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs.Cross) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.6 Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs.Direct) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.7 Comparison of Automatic Hammer vs Traditional Tap Testing (Compensatedvs. Direct) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354.8 Predicted Stability of Slot Machining . . . . . . . . . . . . . . . . . . . . . . 355.1 Kalman Filter Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 475.2 Dynamometer Force-Force Transfer Function . . . . . . . . . . . . . . . . . . 495.3 Dynamometer Force-Force Transfer Function . . . . . . . . . . . . . . . . . . 495.4 Kalman Filter for X-Axis at Tooth-Passing Frequency of 930 Hz . . . . . . . 505.5 Kalman Filter for Y-Axis at Tooth-Passing Frequency of 930 Hz . . . . . . . 50vList of Figures5.6 X-Axis Cutting Test at 13950 RPM . . . . . . . . . . . . . . . . . . . . . . . 515.7 Y-Axis Cutting Test at 13950 RPM . . . . . . . . . . . . . . . . . . . . . . . 525.8 X-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to90th Percentile) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.9 Y-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to90th Percentile) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546.1 CNC and Automatic Hammer Connection to Laptop Computer . . . . . . . 566.2 Comparison of Stability Chart with Di erent Kr . . . . . . . . . . . . . . . . 626.3 Comparison of Stability Chart with State of the Art Approach . . . . . . . . 63viChapter 1IntroductionPresent computer numerical controlled (CNC) machine tools have integrated tool setting,in-situ inspection, positioning error compensation, vision and communication with remotelylocated maintenance computers for on-line troubleshooting. However, machining processcontrol and monitoring tasks have not been widely implemented in industry, despite intensiveresearch e orts since 1980s, due to poor reliability of algorithms and sensors. Industryremoved most tool condition monitoring systems since they frequently failed to detect thetool wear and breakage, and stopped the machines which led to poor productivity. Therecent advances in electronics, sensors and computer technology created new opportunitiesto add intelligence to CNC machine tools. However, any new on-line process monitoringand control task must be reliable and should not hinder the production  ow. This thesisproposes an automated approach to one problem commonly encountered in industry: chatterprediction.A common problem in industry is the chatter vibrations during milling and wear of thespindles. 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 toolfailure, damage to the machine tool spindle and workpiece. The machine tool vibrations canbe avoided by predicting the critical depth of cut and speeds, and choosing a spindle speedand depth of cut in the stable region. This stable region depends on the frequency responseof the machine at the tool tip and cutting force coe cients of work material to be machined.Each frequency response function and cutting force coe cient are strongly dependent on theparticular tool geometry and work material, and their preparation in the data base prior toproduction is rather a costly process, and require scienti c expertise.This thesis presents robust sensors and on-line algorithms to measure the material cut-ting coe cients and dynamic sti ness changes of the spindle. From this data, the chatter1Chapter 1. Introductionfree, stable depth of cuts and speeds are identi ed automatically. The Frequency ResponseFunction is measured with a computer controlled impact testing unit, and cutting forcecoe cients of materials are identi ed automatically from the spindle power sensor when ac-tivated by the operator on demand. A communication protocol between the CNC and anexternal PC is designed, which allows command and data exchange between the machinetool 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 activatethe FRF measurement from the panel through computer commands. The tool is positionedautomatically 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. Theoperator is allowed to conduct trial test cuts with the same tool and speci c work material.The spindle power is collected and sent to measurement computer. The power data, whichis calibrated against cutting forces and torque, is used to identify cutting force coe cientsautomatically. The measured FRF and cutting force coe cients are used to predict chatterstability charts, which enable the operator to select optimal depth of cut and spindle speedswithout violating the maximum torque and power limit of the machine tool.Henceforth, the thesis is organized as follows. Chapter 2 presents related literature abouton-line machine tool monitoring, control and chatter prevention methods. The estimation ofcutting forces and cutting force coe cients from the machine spindle load meter is presentedin Chapter 3. The integration of automated impact hammer to CNC machine tool and itsreliability are explained in Chapter 4. The cutting force measurement technique developed inChapter 3 are su cient for measuring the average torque on the spindle, but cannot be usedto 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 distortthe cutting forces if the spindle speed or tooth passing frequency is close to a mode of thedynamometer. This can occur during high-speed machining. Chapter 5 presents a methodfor compensating the dynamics of a dynamometer to make them more useful during highspeed machining. The impact test and cutting force coe cients are integrated to a previouslydeveloped chatter stability and machine tool diagnostic system in Chapter 6. The thesis isconcluded with a summary and future research issues in Chapter 7.2Chapter 2Background and Literature ReviewAs 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 apart. Smart machining systems aim to improve productivity and part machining quality byintegrating sensors to the machine tool, combined with physics based predictive models toprovide actionable information to the machine tool operator. This allows a smart machiningsystem to provide the  rst and every part correct; improve the response of the productionsystem; 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 machiningcenters to automatically determine chatter free, stable cutting conditions for a machiningoperation. The cutting coe cients, which relate feed per toot to the cutting force needto be determined. The frequency response function at the tip of the cutting tool must bemeasured, and this information is used with a model of the chatter process to determine thechatter-free cutting conditions.A method of extending the e ective bandwidth of dynamometers is also examined. Al-though dynamometers are not practical in the average machine shop, this technique allowsless costly dynamometers to be used in laboratories to measure cutting forces at high spindlespeed.2.1 Identi cation of Cutting Force Coe cientsIn order to predict the chatter-free pockets in a machining operation it is necessary to identifythe 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 asFt = Ktcah( ) +KteaFr = Krcah( ) +Krea (2.1)3Chapter 2. Background and Literature Reviewwhere (Ktc, Krc) are the cutting force coe cients, and (Kte, Kre) are the edge force coe -cients in tangential and radial directions, respectively. The chip thickness change periodicallyas h = csin where c is the feed per tooth, and  is the immersion angle of the cutter whichchanges 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 coe cients are ideally identi ed from direct cutting force measurementscarried out with dynamometers.Tool wear can be correlated to the cutting force since as the cutting tool wear, thecutting force increases due to a larger friction load. There are di erent approaches used inforce measurement for TCM: Direct measurement using a dynamometer, force plates andrings, force-measuring bearings, force and torque at spindles, pins and extension sensors,displacement sensors, and motor current and e ective power.Direct measurement using a piezoelectric dynamometer is the simplest method of forcemeasurement and has a high bandwidth. However dynamometers are unsuitable for use inproduction due to high cost and a lack of overload-protection in case of a collision. Forceplates and rings use piezoelectric sensors mounted between elements of the turret (in thecase of turning machines), or behind the spindle  ange (in the case of milling machines).So far results have been poor due to a high-degree of cross-talk, and force distortion dueto the dynamics of the machine which may change over time. Some work has been doneto compensate the machine dynamics in such systems using a Kalman  lter[19]. Park etal. later extended the Kalman Filter compensation strategy to micro milling systems[6].Spindle bearings are instrumented with strain gauges to measure the force. The outputof these sensors must be low-pass  ltered to eliminate the ball contact frequency. Thetorque can also be measured through a sensor placed directly in the machine tool spindleor tool holder. However, a complex system is required to measure the torque through theentire power range of the tool, and the measurement must be transmitted from the rotatingspindle[5].Pins and extension sensors measure the cutting force indirectly through the extension of4Chapter 2. Background and Literature Reviewmachine elements. These have low sensitivity, so are not suitable for the task of measuringcutting coe cients. Similarly cutting force can also be measured indirectly by measuring thebending of the tool through non-contact displacement sensors. Such sensors have a high riskof interference in the form of chips, dirt and cooling  uid. In a similar vein, strain gaugeshave been mounted into a turning tool to measure the cutting forces[22]. This system hadgood sensitivity, but the measured force was a combination of the tangential force, feed forceand radial force. This makes it suitable for tool condition monitoring, where the change inforce is important, but unsuitable for measuring cutting coe cients, where the magnitudeof each component is important.The  nal method is to estimate the force from the current or power applied to the spindleor axis motors. This will be discussed in more depth below, however all such systems sharesome common disadvantages. Forces measured in this way include bearing and guidewayfriction components, which are often much higher than the cutting forces and may varysubstantially based on the lubrication state and motor speed. Also, due to the large massesthe output signal has a limited frequency bandwidth.The cutting forces can be measured from the motor current[1], [16]. The feed and spindledrive servos have low frequency bandwidth and may not accurately capture cutting forceswhich are periodic at the spindle speeds times number of teeth on the cutter. However,the cutting force coe cients can be extracted from average cutting forces, which can becorrelated to average current drawn by the spindle or motor current sensors. The predictionaccuracy 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 timevarying velocities. Furthermore, this method is poor at determining the force in a direction ifthat axis is not moving due to the uncertainty in the static friction force, although empiricalmodels have been developed for this case[14].Spindle motor power[7] and spindle motor current[18] have been used to estimate thecutting torque. The bandwidth of the spindle motor is lower than the bandwidth of theaxis feed drives. However, the friction which must be compensated is also lower. Since themeasurement will be averaged to determine the cutting coe cient, the bandwidth of thesensor is less important than an accurate average measurement. This thesis will use spindle5Chapter 2. Background and Literature Reviewmotor power to estimate the tangential cutting force coe cient.The total torque drawn from the spindle motor isTc =XnD2 Ft;n; (2.3)where D is the cutter diameter and Ft;n is the cutting force of the nth tooth. The totalpower drawn by the spindle motor isPc = Tc D (2.4)By measuring the average motor power (  Pc), the tangential cutting force coe cients (Ktc,Kte) can be identi ed during cutting with know depth of cut, speed and radial engagementcondition. The radial cutting force coe cient (Krc, Kre) cannot be predicted from the spindlepower since the spindle power is related only to tangential force (i.e. torque). However, theradial and axial cutting force coe cients do not a ect the absolute stability limits but mainlythe 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 thesisproposes to use average power to predict the fundamental parameter, the tangential cuttingforce coe cients, from the average motor power, which is available in CNC machines. Theinstantaneous cutting force can be reconstructed from the tangential cutting coe cient, feedper tooth and depth of cut.2.2 Automatic Transfer Function MeasurementThe principal methods of measuring the force to displacement frequency response function(FRF) measurement use instrumented hammers and shakers to apply a force and measure theresponse with an accelerometer or displacement sensor[9]. These techniques require lengthymanual setup and cannot be used directly in a smart machining system.Several techniques of performing automatic frequency response or impact testing havebeen investigated. Piezoelectric sensors have been embedded into a structure to measureits frequency response function[12]. This technique cannot be used to directly measure the6Chapter 2. Background and Literature ReviewFigure 2.1: Automatic Hammer[17]frequency response function to a force applied at a free surface like the tool tip. It could beused to  nd 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 tomeasure the impact force; the DC solenoid did not have a force sensor. The piezoelectricsensor had a force sensor to measure the time of impact accurately. In this case  ltering andwindowing was needed to eliminate extraneous peaks which were observed to either side ofthe primary impact.Bilne and Tse developed an solenoid-driven hammer[17] to measure the transfer functionnear the tip of a cutting tool (see  gure 4.4). The hammer is activated by a pulse froman 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 electronicsimmediately de-energize the solenoid and the hammer is returned to the rest position by aspring. The force applied to the tool is measured by a piezoelectric force sensor mounted onthe hammer, and the response is measured by the capacitive displacement sensor mountedbelow the hammer.The advantages of this system over a traditional manual hammer are that it can deliver7Chapter 2. Background and Literature Reviewquick, repeatable strikes to the tool. The integrated displacement sensor allows the system tobe run without requiring an external response sensor, such as an accelerometer. This hammeris used as the basis for the automatic frequency response measurement system described inChapter 4.2.3 E ective Dynamometer Bandwidth ImprovementThe cutting forces are either measured by using table dynamometers or spindle integratedsensing systems, where both use piezoelectric sensors. Piezoelectric sensors detect the strainbetween the two mechanical interface surfaces, and naturally re ect the mass, springs anddamping element chains in the embedded mechanical structure. As a result, the bandwidthof the force sensing systems is limited by the natural modes of the structure which can bewell below the tooth passing frequencies used in milling operations. The aim of the smartmeasurement system is to remove the dynamic distortions from the measured force signals,so that the cutting forces and force coe cients are more accurately identi ed.Park[19] developed a spindle integrated force sensor system for measuring the cuttingforces at the tool tip by measuring the force sensors embedded in the spindle housing. He thenused a Kalman  lter to compensate for the dynamics of the spindle and spindle housing.Hewas able to expand the bandwidth of the spindle integrated sensing system to 1000 Hz bycompensating the  rst three bending modes of the spindle structure. He later expanded thealgorithms to compensate high frequency dynamics of micro end mills operating over 50,000rev/min[6].This thesis presents a robust Kalman  lter method which is able to compensate the mostdominant mode of the structure which is carrying the sensor. The method is illustrated on atable 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  eld, this thesis focuses only onautomated FRF measurement, cutting force measurements at high speeds, and identi cationof cutting force coe cients from power signals available in CNC system. These methods arerobust, practical and do not hinder the operation of the machine during production, hence8Chapter 2. Background and Literature Reviewthey contribute to smart machining technology.9Chapter 3Identi cation of Cutting ForceCoe cients from Spindle Power3.1 IntroductionThe cutting force coe cients are used to predict cutting forces, torque, power and chat-ter stability to identify optimal machining operations on the machine tools. The cuttingforce coe cients are dependent on the material properties such as yield strength and hard-ness, and have traditionally been identi ed in laboratories by measuring cutting forces usingdynamometers. The cutting forces in X, Y, and Z directions are measured with a dynamome-ter, and from the workpice material-tool geometry speci c cutting coe cients in the radial,tangential and axial directions are calculated.This thesis presents a method of predicting one of the cutting force coe cients fromaverage power measurement sensors available on standard machine tools. Several test cutsare performed by the machine tool operator, and the power drawn by the spindle motoris measured using a computer connected to the CNC (the details of this connection arefurther explained in Chapter 6). The cutting torque is calculated from the spindle power.By combining the cutting torques calculated during several test cuts at di erent feed rates,the mechanistic cutting coe cients can be calculated, and entered into a cutting coe cientdatabase. This eliminates the need for costly tests in a laboratory with a dynamometer.10Chapter 3. Identi cation of Cutting Force Coe cients from Spindle PowerFigure 3.1: Load Meter Voltage in Air Cutting3.2 Extraction of Cutting Torque from Spindle LoadSensorThe  rst step in cutting coe cient identi cation is to measure the cutting forces during a testcut. Most machines include load meters which display the power being drawn by the machinespindle, so the operator can know if the machine is approaching an overload condition. Thisvoltage output of this sensor can be read by a computer connected to the CNC and usedto estimate the torque on the machine tool, which provides enough information to estimateone of the three mechanistic cutting coe cients.The load meter on the machine tool returns a voltage V which is proportional to theaverage power being drawn by the spindle drive motorV = KP;= KT! (3.1)where T is the total torque applied to the spindle by the motor, ! is the angular speed of11Chapter 3. Identi cation of Cutting Force Coe cients from Spindle Powerthe spindle, and K is a constant. The applied torque consists of the torque Tc applied tocutting, and the torque lost to friction TfT = Tc +Tf: (3.2)The friction is assumed to consist of viscous and Coulomb componentsTf = 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 givesV = K!(Tc +b! +Tcf): (3.4)Rearranging this equation gives the cutting torque in terms of load meter voltage and spindlespeedTc(V;!) = VK! b! Tcf: (3.5)There are three machine-tool speci c coe cients which must be identi ed: the viscous fric-tion b, the Coulomb friction Tcf and the load meter constant K.To identify these coe cients, air cutting tests were performed on the target machine, aMori-Seiki NMV-5000 machine tool. For an air-cutting test, the cutting torque Tc = 0, soV = Kb!2 +KTcf!: (3.6)Air cutting tests were performed from 1000 to 20000 Hz, and the voltage measured by thespindle load meter was plotted ( gure 3.1). From this data the voltage equivalent of theviscous and Coulomb frictionVb = Kb (3.7)VTf = KTcf (3.8)can be determined through least-squares  tting. For the Mori-Seiki machine tool tested, theseparameters 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 prediction12Chapter 3. Identi cation of Cutting Force Coe cients from Spindle PowerFigure 3.2: Load Meter Sensitivity by Spindle Speedin practice (see section 3.2.1). To avoid the unphysical result of negative friction, the frictionforce is assumed to be zero below 2000rpm (209 rad/s).To measure the load meter coe cient K, slot milling tests were conducted with spindlespeeds starting at 1000 rpm in 1000 rpm increments up to the maximum spindle speed ofthe machine tool, 20;000 rpm. The true average cutting torque (Tc) was measured usingKistler rotating dynamometer, while the average power was obtained from the spindle loadmeter 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 torquetorqueK! = V  VfTc(3.10)was plotted in  gure 3.2. The coe cient K was estimated by  tting a straight line to thedata using least squares. For the Mori-Seiki NMV-5000 machine tool tested, K was foundto be 3:88 10 4 V=W. By substituting K into KTcf and Kb, the Coulomb and viscous13Chapter 3. Identi cation of Cutting Force Coe cients from Spindle PowerFigure 3.3: Load Meter Torque Estimate vs. Measured Torquefriction constants are found to beTcf = 0:0647 Nmb = 3:70 10 4 Nm/(rad/s)9=; !> 209 rad/s, or 2000 rpm (3.11)3.2.1 Limitation of Torque Estimation using Load MeterThis method of estimating cutting torque has a couple of limitations stemming from thenature of the load meter sensor, which must be considered when planning cutting forcecoe cient identi cation tests. First, the data from the load meter is low-pass  ltered, sothis technique can only be used to obtain the average cutting torque, not the instantaneouscutting torque. Second, since the load meter measures power, the cutting force estimate isinaccurate 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 theoperator when the machine is operating within safe limits. For this purpose, the importantmeasure is the average power being applied to the spindle motor. In addition, the spindlehas a large moment of inertia, and the bandwidth of the spindle velocity control loop is low,14Chapter 3. Identi cation of Cutting Force Coe cients from Spindle Powerwhich means that the power reported by the load meter is a low-pass  ltered version of theinstantaneous cutting power. This can be seen in  gure 3.3. This shows the torque andload-meter readings as the cutting tool leaves the workpiece. The torque measured by thedynamometer falls to zero immediately, while the load meter reading falls o exponentially.From this graph it appears the load-meter has approximately a  rst order response. Todiscover the approximate bandwidth of the load meter, the step response of a  rst ordersystem was  tted to the load meter data. This gives a bandwidth of approximately 7 Hz forthe load meter. To have a tooth-passing frequency less of less than 7 Hz, a two  uted toolmust be rotating at less than 210 rpm. This is much lower than the practical spindle speeds onmodern milling machines, making this method impractical for measuring the instantaneouscutting 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 inaccuratemeasurements. 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 isapproximately 3 10 4 V. The di erence in estimated torque for these two measurements, Tc = 1K! V; (3.12)is the minimum cutting torque error. For the cutters used in this thesis, the average cuttingtorque was between 2 3 Nm, so to get the quantization error below 10%, the spindle speedmust be above 35 rpm, and to get the quantization error below 1% the spindle speed mustbe 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 majorityof the spindle speeds except under 2000 rpm as can be seen from the torque measurementsagainst the spindle speed shown in  gure 3.4. To avoid the unphysical negative friction,friction is assumed to be zero below 2000 rpm. Since the spindle load method is less accurateat low spindle speed, so the error in the friction model at low spindle speed is unimportantin practice.15Chapter 3. Identi cation of Cutting Force Coe cients from Spindle PowerFigure 3.4: Torque in Air Cutting3.3 Identi cation of Tangential Cutting ForceCoe cientThe estimated average cutting torque from the spindle load meter needs to be correlated tocutting torque model based on metal cutting mechanics.The tangential cutting force per unit depth of cut along the cutting edge j of a millingcutter is given bydFt;j( ) = Ktch( ) +Kte; (3.13)where h( ) is the chip thickness at the cutting edge angle  [2]. The corresponding instanta-neous cutting torque isdTc;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 toothis in cut, and zero if it is out of cut. The chip thickness changes as cutter rotates,h( ) = st sin( ): (3.15)16Chapter 3. Identi cation of Cutting Force Coe cients from Spindle PowerFigure 3.5: Load Meter Sensitivity by Spindle SpeedThe average torque per unit depth of cut is thusd Tc;j = R2 Z 2 0g( ) [Ktcst sin( ) +Kted ]: (3.16)If the cutting tests are performed in slotting mode for simplicity,g( ) =8><>:1 if 0  < 0 if    < 2 : (3.17)the average torque per unit length for a single tooth reduces tod Tc;j = RKtc st + RKte2 ; (3.18)or a total average torque of Tc = RNaKtc st +RNaKte2 : (3.19)where a is the axial depth of cut.Cutting tests were performed with varying feeds per tooth st, and the measured andestimated cutting torque was shown in  gure 3.5. Straight lines were  t to both the measured17Chapter 3. Identi cation of Cutting Force Coe cients from Spindle Powertorque from dynamometer and estimated torque from the load, and the slope and interceptswere matched to the coe cients in equation 3.19. The cutting coe cients were estimated tobeKtc = 1040N=mm2 (3.20)Kte = 9:81N=mm (3.21)from the load meter measurements. The cutting coe cients obtained from the rotatingdynamometer measurements wereKtc = 936N=mm2 (3.22)Kte = 13:9N=mm; (3.23)which gives a value of Ktc which agrees within 11% with the estimation from the load metermodel. The prediction accuracy is su cient to use the model for on-line identi cation oftangential cutting force coe cients from cutting tests using the available load meters on theproduction machines.The cutting force identi cation model can be integrated to CNC system for smart, au-tomated, on line design of material machining data base in production  oors.18Chapter 4Automatic Impact Modal Testing ofMilling CuttersTo 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 di cult operation, which requires a trainedtechnician or engineer with specialized test equipment. This test must be repeated for everycutting tool used in manufacturing a part as each cutting tool will have a di erent FRF. Ifthe machine tool could measure its own FRF, the process of calculating the stable cuttingregions of a machine tool would be greatly reduced.In order to automate this process an automatic hammer was developed which can beintegrated to the controller of a machine tool. The automatic hammer can be activatedfrom the front panel of the CNC by the operators. The chatter stability charts can beautomatically calculated from the FRF measurements, and the operators can be advised toselect chatter free conditions and the current health of the spindle can be reported to avoiddamages to bearings.The automatic hammer is a device invented by Matthew Tse and Ryan Bilne for theirMaster 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 theirdevice simpli es the measurement of the frequency response, the device itself is not enoughto achieve the goal of one touch FRF measurement. This chapter expands their work tointegrate the hammer with a CNC to produce a system which can perform high qualitytransfer function measurement completely automatically.The automatic hammer (shown in  gure 4.1) consists of a solenoid actuated plunger witha force sensor on the end to hit the tool, and a capacitive displacement sensor to measure19Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.1: Automatic Hammerthe response. The force sensor and the solenoid are connected to a solenoid control circuitrywhich activates the solenoid in response to a signal transmitted from a connected PC. Thecircuitry energizes the solenoid until the hammer head on the solenoid hits the tool. The forceand displacement are recorded by a computer, and the FRF between force and displacementis calculated.Several di culties have been identi ed 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 o set between the impact force and measurement of vibration points must beconsidered.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 andcalibrate the displacement sensor. The accuracy of the developed system is then tested usinga normal laptop computer connected to a Mori-Seiki NMV-5000 5-axis milling machine.20Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.2: Measurement Heights for Finding Flutes4.1 Automatic Spindle OrientationIn order to get an acceptable impact on the tool, it must be aligned so that the hammerstrikes a surface of the tool which is approximately perpendicular to the direction of travelof the hammer, and the path of the hammer is free of interference from other parts of thetool. On an inserted cutter, this is not di cult since there is typically a large  at surfacelocated behind the inserts. On a traditional endmill however the only acceptable location isbehind the  ute edge.To position the tool correctly, the location of a  ute at the height of hammer the mustbe found (marked A on  gure 4.2). However, the displacement sensor cannot be moved tothis location, since the tool would impact against the table. Instead, the  ute is located atthe bottom of the tool (C), and midway between A and C (B). Assuming the helix angle isconstant, the location of the  ute at point  A is A = 2 B  C; (4.1)where  B and  c are the locations of the  ute at points B and C, respectively.Locating the  ute is a minimization problem; the  ute is at the angle where the distancebetween the displacement sensor and the tool is minimized. To  nd the location of a  ute,21Chapter 4. Automatic Impact Modal Testing of Milling Cuttersthree points are found: a central point, where the sensor is close to the  ute, and a pointto the left and a point to the right of the central point, where the tool is further away fromthe sensor. Using the golden section search algorithm described below, the left, center andright points are moved towards each other, making sure that tool is always closer to thesensor at the central point than either the left or right points. This ensures that the toolis closest to the sensor at some point between the left and right points. Once the left andright points are within 1:5 of each other, the algorithm is terminated. This bound o erssu cient accuracy so the hammer will hit the  ute. Additional accuracy is not required, anda smaller bound would require more measurements, increasing the length of time requiredto run the algorithm.The technique used to locate the  ute is the Golden Section Search[15]. This algorithmkeeps track of three points: the left bound A, right bound B, and a point C between thetwo. A test point X is chosen in the larger of the regions between A and C, and betweenC and B. Suppose the point X is chosen between A and C. Then if d(X) d(C), the newbracketing triplet will be A, X, and C. Alternatively, if d(C) <d(X), then the new bracketwill 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 BC AB A = W: (4.2)Furthermore, suppose that the test point X is a fraction beyond A ofX AB A = Z: (4.3)The next bracket will either be of length W, or of length 1 Z. To maximize the worst-caseperformance, these two must be equal, orW = 1 Z: (4.4)Now assume the initial points A, B, and C were selected by the same strategy. Then Wmust be the same proportion of the whole interval, as Z is of the smaller interval ABW = ZW: (4.5)22Chapter 4. Automatic Impact Modal Testing of Milling CuttersSubstituting in equation 4.4 and solving givesW = 1 =p5 12 ; (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. Thealgorithm given in Numerical Recipes in C[21] is adopted here. First, the distance to thetool 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 otherpoints n =  n 1 +8<: ( 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  nalpoint  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 themaximum step size of 22:5 is reached, the interval found will no longer be optimal for thegolden section search; however a maximum step size is required because the golden sectionsearch algorithm assumes there is only one local maximum inside the bracketed region. Ifthere are more than one local maximum, the algorithm could converge to a local maximumwhich is not necessarily the global maximum. In order to ensure there will be only one localmaximum in the bracket, it is necessary to  nd the maximum bracket size such that thereis only one local maximum in any such bracket.The maximum step size must be carefully chosen. On one hand, if the maximum stepsize is too small, the bracketing algorithm will often achieve the maximum step size, whichwill slow down both the bracketing and the minimization algorithms. On the other hand, ifthe maximum step size is too large, the chosen bracket may include multiple local maxima,causing the algorithm to fail to correctly locate the  ute edge.23Chapter 4. Automatic Impact Modal Testing of Milling Cutters4.2 Automatic Capacitive Sensor CalibrationThe calibration for the capacitive sensor is only valid when the target is a thick metal sheetthat is  at within an area roughly 30% larger than the target of the capacitive sensor. Dueto the  utes 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, thecalibration is designed such that at the end of the calibration the tool is positioned such thatthe voltage output from the capacitive sensor is approximately zero. The capacitive sensorhas a non-linear sensitivity, and is more sensitive the closer the tool is to the sensor, sopositioning the tool such that the voltage output of the displacement sensor is zero ensuresmaximum 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  rst mea-sured. The machine is then jogged 50  m, and the voltage is measured again. This is usedto obtain an estimate of the sensitivityS =  V x: (4.8)Then an estimate of the distance required to zero the voltage of the sensor xremaining = VS: (4.9)If the distance remaining is less than 200  m, then the CNC is jogged half the estimatedremaining distance; otherwise it is jogged 100  m. This slow approach ensures that the tooldoes not impact against the displacement sensor. This is repeated until the voltage is morethan  0:1 V. The last sensitivity measurement is taken as the sensitivity of the sensor forthe FRF measurement.There are two major potential sources of error in this measurement. First, the CNC mayhave low positioning accuracy, so it may move a di erent amount than what is instructed.Secondly, there may be noise in the displacement sensor measurement. This noise was foundto be negligible in the  ute  nding algorithm; however, the sensitivity is the derivative ofthe data, which will tend to magnify the e ect of noise. In order to measure the error of theCNC axis, a laser interferometer was set up to measure the displacement along the same axisas the automatic hammer was measuring. The CNC was then programmed to move between24Chapter 4. Automatic Impact Modal Testing of Milling Cutters10 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 theinstructed distance to within  100nm, which is the display precision of the interferometer.4.3 Signal Processing of Automatic Hammer SignalThe goal of signal processing for the automatic hammer setup is to reduce the e ect of noiseand systematic errors on the measured FRFs. There are two sources of noise in the automatichammer system which are eliminated using digital signal processing. First, it is known thatthe force is zero except during the impact. The force data is multiplied by a window functionwhich sets the force to zero away from the impact. Second, random noise is a signi cantproblem, especially in the displacement sensor readings. So several measurements are takenand averaged as described by Ewins[9].4.3.1 Force Measurement WindowingThe purpose of windowing is usually to reduce signal distortion (leakage) which occurs whenthe discrete Fourier transform of a non-periodic function is taken. In the automatic hammersystem, this is not a problem. The measurement time is su ciently long that the systemhas a chance to settle back to its steady state value after each impact, so it can be treatedas 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 noisewill occur over the entire measurement. Therefore, the overall noise in the signal can besigni cantly reduced by setting the force signal to zero outside the small region where theactual force signal exists. This is especially important for the automatic hammer. Sincesome 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 solenoidis activated.There is a similar problem with the displacement measurement. Although there is nocross-talk between the solenoid driver circuit and the displacement circuit, since the responsehas an exponential fallo , it is mostly limited to within the  rst 0:2 s after the impact.25Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.3: Cosine-Taper Window for Force Signal WindowingThe noise reduction algorithm is presented as follows. The discrete Fourier transform(DFT) of the measured signal fn isUk =N 1Xn=0fne2 iN kn: (4.10)where N is the total number of samples, and k is the number of the harmonic. Assumingthat the measurement error is a Gaussian process with zero mean, the error at each point is 2Uk =N 1Xm=0     @@fmN 1Xn=0fne2 iN kn     2 2fm= N 2f; (4.11)where epsilonfm is the measurement error at point m. Since the noise is assumed to be astationary process, the error  fm at each measurement point is identical. This error is called f. The measured signal is windowed aswn = unwn; (4.12)26Chapter 4. Automatic Impact Modal Testing of Milling Cutterswhere wn is the window function. For the windowed signal,Wk =N 1Xn=0wnfne2 iN kn: (4.13)The error in the windowed signal is 2Wk =N 1Xm=0     @@fmN 1Xn=0wnfne2 iN kn     2 2fm (4.14)=  2fN 1Xn=0w2n: (4.15)As a result, the error is decreased by Wk Uk =vuut 1NN 1Xn=0w2n (4.16)when the window is used.For the force signal windowing, a cosine taper window was chosen. Such a window isshown with a typical force signal in  gure 4.3. A cosine-taper window is de ned asW(t) =8>>>>>>>><>>>>>>>>:12hcos  t tpstps tts + 1iif t>= tts and t<tps1 if t>= tps and t<tpe12hcos  t tpette tpe + 1iif t>= tpe and t<tte0 otherwise(4.17)There are four important points: the start of the initial cosine taper tts, the start of theplateau tps, the end of the plateau tpe, and the end of the  nal cosine taper tte. These pointsare automatically selected by  nding the maximum force, and then  nding the next pointwhere 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 betpe = tmax + 32tshoulder; (4.18)and the end of the window istte = tpe +tshoulder: (4.19)27Chapter 4. Automatic Impact Modal Testing of Milling CuttersThe last point before the force peak where the force rises above 10% of the peak value isalso found, and the same procedure is followed to  nd tps and tts.This method of determining the force window size was chosen to ensure that the forcewindow was unity wherever the force sensor was in contact with the machine tool, it huggedthe force signal as tightly as possible so as much of the noise as possible is eliminated, andit had a smooth drop o between 1 and 0.A typical force signal produced by the automatic hammer has a width of 0:4 ms, with a50 000 Hz sampling rate, and sample length of 0:2 s, which gives an error 6 % of the errorof the unwindowed signal.4.3.2 Spectral AveragingIn order to reduce the e ect of noise on the calculated transfer function, several force anddisplacement measurements have been made. The Fourier transforms of the force Fn(j!) anddisplacement Xn(j!) of each measurement are calculated, and the auto- and cross-spectraof each measurement are calculated:Sff;n =jFnj2; (4.20)Sxx;n =jXnj2; (4.21)Sfx;n = F nXn: (4.22)The average spectrum over all M measurements is then calculated Sff = 1MMXn=1Sff;n (4.23) Sfx = 1MMXn=1Sfx;n (4.24) Sxx = 1MMXn=1Sxx;n: (4.25)These spectra are then used to calculate the measured transfer function one of two ways.EitherHm1 = Sfx Sff; (4.26)28Chapter 4. Automatic Impact Modal Testing of Milling CuttersorHm2 = Sxx S fx (4.27)In the noise free case these equations both simplify to the normal equation for calculatingthe transfer functionHm = X F: (4.28)If the transfer function is calculated using equation 4.28, the error at each point will be 2Hm =MXm=1N 1Xn=0    @@xmn X F    2 2xn +MXm=1N 1Xn=0    @@fmn X F    2 2fn= NM 1   F  2  2x +jHmj2 2f (4.29)If the transfer function is calculated using equation 4.26, the error in the transfer functionmeasurement is 2Hm =MXm=1N 1Xn=0    @@xmn Sfx Sff    2 2xn +MXm=1N 1Xn=0    @@fmn Sfx Sff    2 2fn= 1 S2ff" MXm=1N 1Xn=0    @ Sfx@xmn    2 2xn +MXm=1N 1Xn=0    @ Sfx@fmn Hm1@ Sff@fmn    2 2fn#(4.30)but@ Sfx@xmn =@@xmn1MMXp=1F pN 1Xq=0xpqe 2 ikN q= F mM e 2 ikN n: (4.31)Similarly,@ Sfx@fmn =XmM e2 ikN n: (4.32)29Chapter 4. Automatic Impact Modal Testing of Milling CuttersFinally,@ Sff@fmn =@@fmn1MMXp=1 N 1Xq=0fpqe 2 ikN q!  N 1Xr=0fpre 2 ikN r!= @@fmn1MMXp=1N 1Xq=0N 1Xr=0fpqfpre 2 ikN (r q)= 1M"N 1Xq=0fmqe 2 ikN (n q) +N 1Xr=0fmre 2 ikN (r n)#= 2MN 1Xq=0fmq cos 2 kN (n q) = 2M"cos 2 nN k N 1Xq=0fmq cos 2 qN k + sin 2 nN k N 1Xq=0fmq sin 2 qN k #= 2M cos 2 nN k <[Fm] + sin 2 nN k =[Fm] : (4.33)Substituting equations 4.31 through 4.33 into equation 4.30 gives 2Hm1 = 1M2  S2ff MXm=1N 1Xn=0Sff;m 2x+MXm=1N 1Xn=0hSxx;m 4<hX mHm1e 2 kN ni  cos 2 nN k <[Fm] + sin 2 nN k =[Fm] +4jHm1j2 cos 2 nN k <[Fm] + sin 2 nN k =[Fm] 2# 2f!:(4.34)In order to simplify this equation, approximateN 1Xn=0f nN  Z N0f nN dn (4.35)for large N. SinceZ T0cos 2 kxT sin 2 kxT dx = 0 (4.36)Z T0cos2 2 kxT dx = T2 (4.37)Z T0sin2 2 kxT dx = T2 (4.38)30Chapter 4. Automatic Impact Modal Testing of Milling Cuttersfor any integer k, equation 4.34 reduces to 2Hm1  NMjHm1j2 Sff 1jHm1j2 2x + 2fCfx ; (4.39)where Cfx is the coherence, de ned asCfx =   Sfx  2 Sxx  Sff; (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   Sfx  224MXm=1N 1Xn=0     @ Sxx@xmn Hm2@ S fx@xmn     2 2xn +MXm=1N 1Xn=0     Hm2@ S fx@fmn     235 NMjHm2j2 Sxx  2xCfx +jHm2j2 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 increasingthe number of measurements will always increase the accuracy of the measurement, as moremeasurements 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 errorin the force measurement  f contributes more to the overall error than the error in thedisplacement  x.4.4 Hammer-Displacement Sensor O setCompensationTo predict the chatter-free cutting conditions, it is necessary to obtain the frequency responsefunction (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 forceapproximately 15 mm above the tool tip (see  gure 4.4. This will increase the apparent31Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.4: Automatic Hammersti ness of the cutting tool. As a result, the predicted chatter stability obtained using thisFRF will be higher than the real chatter stability.This apparent increase in sti ness can be compensated under the assumptions that1. the most  exible part of the spindle/tool holder/tool structure is the tool,2. the tool can be approximated as a beam, and3. the bending of the tool is quasi-static.Under these assumptions, the sti ness of the tool at the tool tip isXaFa =L33EI; (4.42)where L is the stick-out of the tool from the toolholder, E is Young’s modulus, and I is thearea moment of inertia of the tool. The sti ness of the tool for a force applied higher on thetool and the displacement measured at the tool tip isXaFb =l 2b6EI (3L lb) (4.43)where lb = L  where  is the o set between the displacement sensor and force sensor inthe automatic hammer. Solving equation 4.43 for EI and substituting into equation 4.4232Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.5: Comparison of Automatic Hammer vs. Traditional Tap Testing (Cross vs. Cross)givesXaFa =2L3l 2b (3L lb)XaFb: (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 e ect of this compensationcan be seen by comparing  gure 4.6 with  gure 4.7. The FRF with the correction appliedmatches more closely with the FRF measured manually.4.5 Comparison of Automatic Hammer withTraditional Impact TestA test of the full automatic hammer system was performed, including edge detection andautomatic calibration. This was compared with a FRF measurment performed with a manualhammer striking the tool at the same height as the automatic hammer, and measuring theresponse with a capacitive sensor positioned at the tool tip (see  gure 4.5). In this case the33Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 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 ofthe machine was then measured with a traditional tap testing method: an instrumentedhammer to apply and measure the impulse, and an laser sensor to measure the response. Inthis 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 o set compensation is shown in  gure 4.6. Since the automatic hammeris much quicker than the manual hammer, the transfer function obtained by the automatichammer was averaged over 20 measurements, while the FRF obtained by the traditionalmethod was only averaged over 5 measurements.The increased sti ness due to the o set between the hammer and the displacement sensorcan easily be observed near the mode at 2400 Hz. By contrast, the sti ness of this mode ismuch closer in the corrected FRF ( gure 4.7).The e ect of this correction can be seen in the stability chart ( gure 4.8). In all three cases(corrected automatic hammer FRF, uncorrected automatic hammer FRF and traditional34Chapter 4. Automatic Impact Modal Testing of Milling CuttersFigure 4.7: Comparison of Automatic Hammer vs Traditional Tap Testing (Compensatedvs. Direct)Figure 4.8: Predicted Stability of Slot Machining35Chapter 4. Automatic Impact Modal Testing of Milling Cuttersmethod FRF) the stable cutting pockets occur at the same spindle speeds. However, dueto the apparent increased sti ness, the uncorrected automatic hammer measurements havea much higher absolute stability limit compared with both the corrected and traditionalFRF measurements. The stability limit inside the more stable pockets matches more closelywith the uncorrected measurement than the corrected measurement. This is because themaximum 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 theassumptions used when developing the correction algorithm do not apply in this region.4.6 ConclusionSince the automatic hammer is completely automated, it can measure the frequency responsefunction of the machine tool much quicker than the traditional method. It can also be used bya machine tool operator with minimal training. However, the traditional method measuresthe direct FRF at the tool-tip, while the automatic method measures a cross-FRF, withthe impact located approximately 15 mm above the response measurement point. Whenthis cross-FRF is used to approximate the direct transfer FRF, it is similar to the directFRF at low frequencies. At high frequencies the two FRF di er substantially, with theFRF measured by the automatic hammer not detecting modes above 3000 Hz. The FRFmeasured by the automatic hammer can be used as a starting point for locating the stablecutting regions.36Chapter 5E ective Dynamometer BandwidthImprovement5.1 IntroductionThe 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 measureinstantaneous 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 thespindle. Integrating a dynamometer to the machine tool adds  exibility to the structure. Ifthe periodic cutting force frequency is near a resonance frequency of the sensing system, themeasured cutting forces are distorted and incorrectly recorded. The lowest natural frequencyof the sensing system can be as low as 200 Hz depending on the mass of the workpiecemounted on the dynamometer, or spindle which houses the force cells. If a force is appliedat this frequency, the workpiece and dynamometer will vibrate, and the measured force willbe distorted compared to the applied force. In order to recover the real applied force fromthe distorted measured force, a state space model of the dynamometer is developed, and aKalman  lter is derived to recover the applied force, similar to the technique proposed byPark for his spindle integrated force sensor system[19].In this technique, the dynamics of the mechanical system are  rst identi ed by applyinga known force impact to the dynamometer using an instrumented hammer and measuringthe response to get a frequency response function (FRF). The FRF is then used to constructa state space system which captures the dynamics of the dynamometer. This system is then37Chapter 5. E ective Dynamometer Bandwidth Improvementmodi ed as described below such that the applied force on the dynamometer is treated asanother state. A Kalman  lter is then designed to estimate the state of this model, and fromthat state an estimate of the applied force can be extracted.5.2 Dynamic Model of Cutting Force MeasurementSystemThe dynamometer is modeled as a linear time invariant (LTI) system which has an appliedforce Fa as the input and produces a measured force Fm. The dynamometer dynamics canbe modeled as a transfer function of the formFmFa = H(s) =1Xk=1Kks2 + 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 in nite number of modes. Here the dynamics of thedynamometer are approximated by a model with a  nite number of modes, M, which is validfor frequencies 0 <!<!n;M. For any modeHk(j!) = Kk !2 +j2 k!n;k! +!2n;k Kk!2n;kwhen ! !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 beapproximated by a constantK0 =1Xk=M+1Kk!2n;k: (5.4)This gives an approximate transfer function of the dynamometer,H(s) K0 +MXk=1Kks2 + 2 k!n;ks+!2n;kfor 0 <!<!n;M (5.5)38Chapter 5. E ective Dynamometer Bandwidth ImprovementTo determine the transfer function of the dynamometer, the frequency response function(FRF) of the dynamometer is measured by striking it with an instrumented hammer. Theinput force from the hammer and output force from the dynamometer are measured. Themeasured FRF is  t to the above model using a non-linear least-squares method, with theadditional constraint that the static gain of the system is known to be 1 since the both thehammer and dynamometer are calibrated to produce a force in Newtons, soK0 = 1 MXk=1Kk: (5.6)To design a Kalman  lter to compensate these dynamics, a state space system withthese input-output characteristics must be designed. There is no unique state space systemwith certain system. Indeed, there are in nitely many state space systems with the samedynamics. The two standard forms are the controllable canonical form and the observablecanonical form. Since the extended system must be observable, the observable canonical formis most appropriate. To write the state space model of the system in observable canonicalform, the transfer function of the system must  rst be written as a system with a commondenominatorH(s) = b0 +b1s+   +bnsna0 +a1s+   +sm : (5.7)This can be written in observable canonical form as_x ==Az }| {26666664 am 1 1 0    0 am 2 0 1... ... ... a0 0 0    037777775x+=Bz }| {26666664bnbn 1...b037777775Fa (5.8)y =h1 0    0i| {z }=Cx: (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) =kUk  U 1  ; (5.10)39Chapter 5. E ective Dynamometer Bandwidth Improvementwhere any norm can be used. In this thesis in nity norm is used for simplicity. For theobservable canonical form,kAk1 = maxfa0;a1 + 1;:::am 1 + 1g: (5.11)Since for the modes of interest of the dynamometer !i  j 8i;j,kAk1 = a0 =MYk!2k: (5.12)Similarly,  A 1  1 =               0 0    1a0 0  am 10 a0  am 2... ... ...0 0     a1               ja0j using Cramer’s rule (5.13)= maxk>0 1a0;1 aka0  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 approachesthe machine precision, which is 10 12 for double precision[21]. The natural frequencies ofa dynamometer are !n 103, so the observable canonical form will be ill-conditioned withmore than two modeled modes.Instead, the state-space model is constructed by composing the state space models ofseveral mode individually. Split the transfer function into the sum of transfer functions foreach modeH(s) =MXk=1Hk(s); (5.16)whereHk(s) = Kks2 + 2 k!n;ks+!2n;k: (5.17)40Chapter 5. E ective Dynamometer Bandwidth ImprovementEach individual mode has a corresponding canonical observable form_xk ==Anz }| {24 2 k!n;k 1 !2n;k 035xk +=Bnz }| {24 0Kk35Fa (5.18)yk =h1 0i| {z }=Cnxk (5.19)The total response of the system y is given as:y =MXk=1yk +K0Fa: (5.20)Let x be the total state of the systemx0 =26666664x1x2...xn37777775; (5.21)then a state space model of the system can be written as_x0 ==A0z }| {26666666666666664 2 1!n;1 1 0 0    0 0 !2n;1 0 0 0 0 00 0  2 k!n;k 1 0 00 0  !2n;k 0 0 0... ... ...0 0  2 k!n;k 10 0     !2n;k 037777777777777775x +=B0z }| {266666666666666640K10K2...0KM37777777777777775Fa (5.22)y =h1 0 1 0    1 0i| {z }=C0x0 + K0|{z}=D0Fa: (5.23)For this new state space model,kA0k1 = max!2n;k; (5.24)41Chapter 5. E ective Dynamometer Bandwidth Improvementand   A0 1   =            A1 1 0    00 A2 1... ... ...0    AM 1            = maxk !n;k k : (5.25)This gives a condition number approximately (A0) maxk !2n;k : (5.26)This form is well conditioned for any number of modes as long as the natural frequency ofall modeled modes !n;k < 106 rad/s.In order to construct a Kalman  lter, it is necessary to write the system in state spaceform with known inputs and outputs, and unknown process and measurement noise. For theKalman  lter to be optimal, the process and measurement noise must both be uncorrelatedzero mean white noise processes with a known variance. However, in the case of milling, theforce applied to the dynamometer is not a white-noise. A model must be developed whichmodels the applied force as white-noise passed through some  lter[13]. To obtain this  lter,the applied force is written as a periodic function Fp(t) multiplied by some slowly varyingenvelope A(t)Fa(t) = A(t)Fp(t): (5.27)Expanding Fp as a Fourier series givesFa =1Xn= 1an(t)e2 inT t; (5.28)where A(t) is considered approximately constant. De ningFp;n = an(t)e2 inT t; (5.29)andGp;n = iFp;n; (5.30)42Chapter 5. E ective Dynamometer Bandwidth Improvementgives_Fp;n = 2 nT Gp;n + _ane2 inT t (5.31)_Gp;n = 2 nT Fp;n +i_ane2 inT t; (5.32)for n6= 0 and_Fp;0 = _a0 (5.33)Since _an is not known a priori, _ane2 inT t can be treated as a white-noise source with varianceQn = _a2n = constant: (5.34)This has the form of a state-space model with an in nite number of states. For thepurpose of the dynamometer compensation, this model is approximated as a model with2N+1 states, the DC component and the  rstN harmonics. The tests done in this thesis havebeen performed with a 4- uted tool, so N = 12 was chosen, with the fundamental frequencybeing the spindle frequency. The spindle frequency was chosen as the fundamental frequencyinstead of the tooth passing frequency to account for any runout in the measurement. Byusing 12 harmonics, the third harmonic of the tooth passing frequency is included, which isrequired to properly capture the cutting forces[19]._xf ==Afz }| {2 T266666666666666666640 0 0 0 0    0 00 0 1 0 0 0 00  1 0 0 0 0 00 0 0 0 2 0 00 0 0  2 0 0 0... ... ...0 0 0 0 0 0 N0 0 0 0 0     N 037777777777777777775xf +=Bfz}|{I wFa =h1 1 0 1 0    1 0i| {z }=Cfxf:(5.35)The dynamometer model is expanded to a composite model which includes the forcemodel. The state vector of the composite model contains the states of both the dynamometer43Chapter 5. E ective Dynamometer Bandwidth Improvementmodel and the applied force modelz =24x0xf35: (5.36)The expanded system is then_z(t) =24A0 B0Cf0 Af35z(t) +24 0Bf35w(t) (5.37)Fm =hC0 D0Cfiz(t) +v(t): (5.38)This gives a new state space system with state space matrices^A =24A0 B0Cf0 Af35 ^B =240035^C = hC0 D0Cfi ^D = 0;(5.39)which is disturbed by some white noiseh0 BfiTw(t) and v(t), each with impulsive corre-lationE8<:24 0Bf35w(t)w( )Th0 Bfi9=; = Q (t  ) (5.40)Efv(t)v( )g= 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  nd a linear  lter which is driven by themeasured force Fm and produces a state estimate ^z. An estimate of the applied force ^Facan be extracted from the estimated state. The  lter will be optimized by minimizing thefunctionJt = E ~z(t)~z(t)T (5.42)where~z(t) = ^z(t) z(t) (5.43)is the estimation error. This is the Kalman  lter problem.To derive the solution to this problem, the derivation of the Kalman  lter given inGoodwin[13] is followed. Begin by considering a time-varying state-space model_xt(t) = At(t)xt(t) + wt(t)yt(t) = Ct(t)xt(t) +vt(t) (5.44)44Chapter 5. E ective Dynamometer Bandwidth Improvementwhere wt(t) and vt(t) have zero mean and are uncorrelated, andE wt(t)wt( )T = Qt (t  ) (5.45)Efv(t)v( )g= Rt (t  ): (5.46)For this model, compute the covariance  P(t) = E xt(t)xt( )T given the initial covariance P0 = E xt(0)xt(0)T . The solution to equation 5.44 isxt(t) =  t(t;0)x0t +Z t0 t(t; )wt( )d (5.47)where the state transition matrix  t(t; ) is the matrix such thatxt(t) =  t(t; )xt( ): (5.48)Squaring the solution given in equation 5.48 and taking the expectation gives P(t) =  t(t;0) P0 t(t;0)T +Z t0 t(t; )Qt( ) t(t; )Td : (5.49)Di erentiating this equation givesd P(t)dt = At(t) P(t) +  P(t)At(t)T + Qt(t): (5.50)Returning to the original problem of obtaining an estimate, ^z(t), of the state z(t). Assumethe  lter has the form:d^z(t)dt =^A^z(t) + K(t)hFm(t) ^C^z(t)i; (5.51)where K(t) is a gain matrix yet to be determined. Subtracting equation 5.37 from equation5.51 givesd~z(t)dt = ^A K(t)^C ~z(t) + K(t)v(t) w(t): (5.52)Comparing equation 5.52 with 5.44 givesxt(t) = ~z(t); At(t) = ^A K(t)^C ; wt(t) = K(t)v(t) w(t): (5.53)ThereforedP(t)dt = ^A K(t)^C P(t) + P(t) ^A K(t)^C T+ K(t)RK(t)T + Q: (5.54)45Chapter 5. E ective Dynamometer Bandwidth ImprovementTo determine the gain K(t) which minimizes equation 5.54, letK(t) = ^K(t) + ~K(t); (5.55)where^K(t) = P(t)^CTR 1: (5.56)Substituting equation 5.55 into equation 5.54 givesdP(t)dt = ^A ^K(t)^C P(t) + P(t) ^A ^K(t)^C T+ ^K(t)R ^K(t)T + ~K(t)R ~K(t)T + Q:(5.57)It can clearly be seen that _P(t) is minimized if ~K(t) = 0. Thus, ^K(t) is the optimal timevarying  lter gain. At a steady state condition,0 = ^A ^K(t)^C P(t) + P1 ^A ^K(t)^C T+ ^K(t)R ^K(t)T + ~K(t)R ~K(t)T + Q (5.58)^K1 = P1^CTR 1: (5.59)The steady state Kalman gain ^K1 is used instead of the time varying gain ^K(t) to avoidrecomputing the Kalman gain at every time.To summarize, the estimated applied force is_^z = ^A^z(t) + ^K Fm ^C^z(t) (5.60)^Fa = h01 2M Cfi^z (5.61)where the optimal gain ^K satis es^K = P^CTR 1 (5.62)and P is the solution to0 = Q P^CTR 1CP + P^AT + ^AP: (5.63)The full system is show in  gure 5.1.46Chapter 5. E ective Dynamometer Bandwidth Improvement++RAfCf^FaB0 +++ RA0C0 ++D0^FmCompensatedforce ( ^Fa)^K  +DynamometerMeasuredforce (Fm)Cuttingforce (Fa)ForcemodelDynamometermodelFigure 5.1: Kalman Filter Block Diagram5.3 Experimental ResultsOne method which could be used to test the dynamometer force compensation results wouldbe to measure the force with both a dynamometer and another sensor, and compare theforce measured by the dynamometer before and after compensation with the real appliedforce measured by the other sensor.There are several practical problems with method. Primarily, the reference sensor musthave a large enough bandwidth such that forces near the  rst mode of the sensor to becompensated are measured undistorted by the reference sensor. In addition, the referencedynamometer must be small enough (or the dynamometer to be compensated must be largeenough) that the reference dynamometer can be mounted on top of the test dynamometer.For these reasons, using a reference dynamometer was impractical. Instead, an indirectmethod of testing the Kalman  lter was used. The tangential force on each tooth of a cuttingtool isFt( ) = Ktcah( ) +Ktea (5.64)47Chapter 5. E ective Dynamometer Bandwidth Improvementwhen the tooth is cutting, where h( ) is the chip thickness, which is approximatelyh( ) = csin : (5.65)The cutting coe cients 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 Xand Y axisFx( ) = 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. Tomeasure the e ectiveness of the Kalman  lter, 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 asa function of angle, and compared with the low speed forces. If the Kalman  lter performsas expected, the two forces will match.The transfer function of the X- and Y-axes of the target dynamometer, and an associatedmodels are shown in  gures 5.2 and 5.3, respectively. For both axes there is one dominantmode; however, the dynamometer model includes several of the higher frequency modes aswell. It was found that if these higher-frequency modes are not included, the mismatchbetween the model and the real dynamics can cause the an ampli cation of high-frequencynoise.In order to design a Kalman  lter, both the variance of the measurement noise and theprocess noise must be known. The measurement noise can be estimated by measuring thevariance of the dynamometer with no applied forces. The variance of the applied force ismore di cult to measure, so instead of attempting to measure it, this is treated as a tunableparameter, which can be used to adjust the bandwidth of the generated Kalman  lter. Withthe model developed previously, a Kalman  lter is designed to compensate the dynamics ofboth the X and Y axes. Since the noise model depends on the spindle frequency, a separate48Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.2: Dynamometer Force-Force Transfer FunctionFigure 5.3: Dynamometer Force-Force Transfer Function49Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.4: Kalman Filter for X-Axis at Tooth-Passing Frequency of 930 HzFigure 5.5: Kalman Filter for Y-Axis at Tooth-Passing Frequency of 930 Hz50Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.6: X-Axis Cutting Test at 13950 RPMKalman  lter must be designed for each spindle frequency. Typical  lters are shown in gures 5.4 and 5.5.In order to test the e ectiveness of the Kalman  lter, two slotting cutting tests areperformed with a four  uted cylindrical endmill. One test is performed with a spindle speedof 750 rpm, giving a tooth passing frequency of 50 Hz. Another test is performed with aspindle speed of 13950 rpm, a tooth passing frequency of 930 rpm, which corresponds tothe natural frequency of the X axis of the dynamometer. The  rst, low frequency, test isundistorted by any dynamometer dynamics. The second test is compensated by the Kalman lter compensation algorithm, and both the uncompensated and compensated cutting forcesare compared with the low speed reference test. The results are shown in  gures 5.6 and 5.7.To compare the e ectiveness of the dynamometer compensation algorithm at di erentspindle speeds, tests were done at six di erent spindle speeds between 750 rpm and 18000rpm with a four  uted tool. This gives tooth passing frequencies from 50 Hz to 1200 Hz. Tocompare the e ectiveness of the compensation algorithm at di erent frequencies, the 10thand 90th percentiles were plotted as a function of tooth passing frequency in  gures 5.8 and51Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.7: Y-Axis Cutting Test at 13950 RPM5.9. This shows the range of force signal, which is expected to be constant. The 10th and90th percentiles were chosen instead of the minimum and maximum to minimize the e ect ofnoise. Although the range of the compensated cutting forces remains approximately constantover all tooth-passing frequencies, the average cutting force decreases as the spindle speedincreases. This may occur because the cutting coe cients are decreasing, as the spindlespeed increases, rather than staying constant as predicted.In summary, the Kalman  lter used in this chapter is capable of reproducing the appliedforce signal with the correct overall amplitude. It performs less well at correctly estimatingthe waveform of the applied force. This is because in order to accurately reproduce thecutting force waveform it is necessary to compensate the  rst several harmonics of the appliedforce, which lie beyond the bandwidth of the sensor. Also, for the dynamometer used, theregion beyond the principal mode was di cult to model making compensation impossible.52Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.8: X-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90thPercentile)53Chapter 5. E ective Dynamometer Bandwidth ImprovementFigure 5.9: Y-Axis Cutting Force Range by Tooth Passing Frequency(10th Percentile to 90thPercentile)54Chapter 6Integrated Smart Machining SystemThe automated cutting force coe cient identi cation from spindle power or dynamometersis integrated with the frequency response function of the tool measured automatically withthe computer controlled hammer. The objective is to embed a smart machining system toa CNC, which allows the operator to automatically identify chatter free spindle speeds andcutting 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 beperformed with the press of a button. In a production system, these algorithms would run onthe CNC, or the front panel. This is impractical in a research setting. Instead, a prototypesystem was developed which placed the algorithms on a PC, which communicated with theCNC 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 Fanuc30i CNC, a standard laptop PC with a data acquisition card connected to the Fanuc CNCvia ethernet network ( gure 6.1. The PC is able to send commands and read data fromthe Fanuc CNC using both the Fanuc FOCAS libraries[10], and the Fanuc Servo Guidesoftware[11], which is built on top of the FOCAS libraries. The FOCAS libraries are used bythe operator’s panel to communicate with the CNC, so integrating the components developedin this thesis into the front panel of the machine tool is possible.6.1 Integration with Cutting Coe cient PredictionTo measure the load meter voltage necessary to perform the cutting coe cient identi cation,the Fanuc Servo Guide software was used to measure the spindle load meter current. Theprocess is as follows:55Chapter 6. Integrated Smart Machining SystemFigure 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 thestart 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 labeledLMDAT) 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 di erent feeds per tooth. The data from the above steps is used to calculate the tangential cutting coe cient,as described in chapter 3.Although the experimental setup used for this thesis uses the Fanuc Servo Guide, it isnot necessary to use this software. The Servo Guide software uses undocumented functionsof the Fanuc FOCAS libraries for its data acquisition routines. If documenation for theseroutines can be obtained, this procedure could be automated into a self-contained program.56Chapter 6. Integrated Smart Machining System6.2 Integration with Automated Transfer FunctionMeasurement UnitTo implement the procedure for positioning, calibrating and actuating the automatic hammerdescribed in chapter 4 it is necessary to be able to send commands to the CNC, and performactions 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 programsto be sent directly from a PC. The Fanuc FOCAS libraries have functions which allow aDNC program to be generated dynamically. This facility enables automatic execution of thealgorithms described in chapter 4.The program for automated transfer function measurements is a C++ program whichis divided into four sections: main loop,  ute  nding, capacitive sensor calibration, and thefrequency response function (FRF) measurement. Full source code is provided in Appendix7.1.The main loop is contained entirely in the main() function. It establishes the connectionto the CNC, and enters the cnc_dncstart2() function, which waits for the operator to startthe machine in DNC mode. Once the cnc_dncstart2() function returns, the next steps ofthe algorithm are executed in order ( ute  nding, sensor calibration and FRF measurement).Once the FRF has been measured, the loop sends the program halt ocde (M30) to the CNCand terminates DNC mode by calling the cnc_dncend2() function. The operator can nowchange to another mode and continue machining, or switch tools and measure the FRF ofanother tool.In order to execute the  ute  nding and sensor calibration algorithms, it is necessary tosend commands to the CNC. This is done through the run_cmd() function, which in turncalls the FOCAS function cnc_dnc2(). The cnc_dnc2() command takes three parameters:a handle which identi es the CNC, the text of the CNC commands to be executed, and apointer to an integer which contains the number of characters to be sent to the CNC. Oncethe cnc_dnc2() function returns, this integer contains the number of characters which wereactually transmitted to the CNC. It is possible that only a part of the command string willbe transmitted to the CNC, in which case the cnc_dnc2() function must be called again57Chapter 6. Integrated Smart Machining Systemwith 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  ute  nding code implements the algorithms described in section 4.1. In order toimplement these algorithms, the distance from the capacitive sensor to the tool surface at agiven angle must be measured. This is performed by Issuing a command to the CNC to rotate the spindle to the target angle. On themachine used, this is done by issuing the commands#1133=angleM119where angle is the desired angle  expressed as a number from 0-4095angle = 4096 2 : (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 spindleis assumed to have come to rest once the spindle speed is zero in  ve measurements ina row. The average voltage output by the capacitive sensor over 10 ms is measured using a dataacquisition card (DAQ). This voltage is used as the distance between the capacitivesensor and the tool surface.The tool positioning required for sensor calibration is performed similarly. For the axispositions it is possible to measure the distance remaining, so distance remaining is used todetermine when the command has  nished executing, instead of when the machine comes torest. Issue a command to move the CNC by the amount required for the calibration algo-rithmXdist58Chapter 6. Integrated Smart Machining Systemwhere dist is replaced with the desired o set. Wait until the distance remaining to travel is zero. The average voltage output by the capacitive sensor over 10 ms is measured using a dataacquisition card (DAQ). This voltage is used as the distance between the capacitivesensor and the tool surface.Finally, an external program (MalTF.exe) is started to perform the frequency responsefunction measurement. This program accepts a command line  ag to communicate thecalculated displacement sensor sensitivity. In the future the frequency response functionmeasurement, 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 objectiveof automatic frequency response function measurement.6.3 Chatter PredictionThe tangential cutting coe cient measured using the method developed in chapter 3 is nowcombined 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. Tocalculate these chatter-free cutting conditions, the experimentally proven and widely usedchatter stability method presented by Altintas and Budak[3] is used in the proposed system.The stability theory is brie y described here.6.3.1 Chatter Stability LawThe dynamic milling force is expressed by24Fx(t)Fy(t)35 = 12aKt24axx(t) axy(t)ayx(t) ayy(t)3524 x(t) y(t)35 (6.2)59Chapter 6. Integrated Smart Machining Systemwhere  x and  y are the vibrations between successive tooth periods. aij are the directionaldynamic milling force coe cients, given asaxx =N 1Xj=0 g( j) [sin 2 j +Kr (1 cos 2 j)] (6.3)axy =N 1Xj=0 g( j) [(1 + cos 2 j) +Kr sin 2 j] (6.4)ayx =N 1Xj=0g( j) [(1 cos 2 j) Kr sin 2 j] (6.5)axx =N 1Xj=0g( 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 afunction indicating if the tooth is in cut. It is unity if the tooth is cutting, and zero if thetooth is out of cut.The dynamics of the machine tool spindle/tool holder/cutter combination can be identi- ed from the frequency response function, and written as24x(t)y(t)35 =24 xx  xy yx  yy3524Fx(t)Fy(t)35: (6.7)By substituting this into 6.2, the eigenvalue problem hIi 12Kta(F(t) F(t+T))hA(t)ih i = 0 (6.8)is obtained. To solve this, some simpli cations must be made. First, [A(t)] is rewritten ashA(t)i=hA0i+hA0(t)i; (6.9)where [A0] is the average value of [A(t)]. [A0(t)] is ignored for an initial estimate. Thisequation will be critically stable ifdet hIi 12Kta 1 e i!cT hA0ih (i!c)i = 0; (6.10)where !c is the principal chatter frequency of the system. Let  be the eigenvalues ofhA0ih (i!c)i. By comparison of the eigenvalue formula with equation 6.10, = N4 alimKt(1 e i!cT): (6.11)60Chapter 6. Integrated Smart Machining SystemSolving for alim, ensuring that it is a real number, givesalim = 2 <[ ]NKt(1 + 2); (6.12)where = =[ ]<[ ]: (6.13)The spindle speed corresponding to each chatter frequency can also be calculated asn = 60N !c  2 tan 1 + 2k (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 determinedfrom the number of teeth N, the engagement pro le of the cutter, the dynamics of the ma-chine represented by the frequency response function (FRF)  , and the mechanistic cuttingforce coe cients of the cutter Kt and Kr.6.4 Prediction of Stability ChartsIn a smart machining system, the number of teeth and engagement angles are provided bythe process planner. An estimate of the machine dynamics is measured by the automatichammer system described in chapter 4, and Kt is estimated from the spindle load as describedin chapter 3. The only missing parameter is Kr, which can be identi ed cutting forcemeasurements with a dynamometer, but not from spindle power measurements.The value of Kr depends on the geometry of the tool, and material properties of theworkpiece material. Because of this, it will be di erent for each tool/workpiece combination.However, it is possible to get an estimate of the stability lobes without knowing the valueof Kr. Figure 6.2 shows two di erent stability charts, one with Kr = 0:25 and one withKr = 0:5, both during slotting. This represents the practical extremes in Kr variation.Although the two stability lobes di er substantially in critical depth of cut, they both sharesome 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 smartmachining system, a Kr value of 0:3 will be used, as this is a common Kr value.61Chapter 6. Integrated Smart Machining SystemFigure 6.2: Comparison of Stability Chart with Di erent KrAs a comparison, a stability chart was generated using the traditional instrumentedhammer and accelerometer tap-testing method, and the cutting coe cients were obtainedfrom a database through the orthogonal-to-oblique cutting coe cient transformation[4]. Thiswas compared with the stability chart generated when these parameters were obtained asdescribed in this thesis, and the result is shown in  gure 6.3. Again, although the predictedmaximum stable depth of cut varies widely at certain spindle speeds, the gross features, suchas spindle speed of stable pockets, are comparable. The proposed smart machining strategy,which uses an automated hammer and low-cost estimation of cutting force coe cient fromavailable spindle power, is robust and practical to use on production machines.62Chapter 6. Integrated Smart Machining SystemFigure 6.3: Comparison of Stability Chart with State of the Art Approach63Chapter 7Summary and Future ResearchIn 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 offour parts. First is a method to interface with a Computer Numerically Controlled (CNC)milling machine and determine the tangential cutting coe cient 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 correctlyand automatically calibrate the displacement sensor. Third, a method for compensatingthe dynamics of a dynamometer to obtain force readings near the natural frequency of thedynamometer with improved accuracy at high spindle speeds. Finally, using the frequencyresponse measurement and the cutting coe cients obtained using the methods presentedpreviously to calculate the chatter-free regions of a machine tool.7.1 Limitations and Future WorkThe readily available load meter of machine tools was used to measure the cutting coe cient.However many other signals, including spindle However many other signals, including spindleand axis current and axis currents are also readily available on the CNC machine tools. Sincethe cutting conditions can be chosen when measuring the cutting coe cients, it is possiblethat by combining the output of several di erent sensors and using several cutting tests withdi erent cutting conditions a more accurate measurement of the cutting coe cients could beobtained. The ball screw-drives have position dependent high friction which clouds the forceestimation from the drive current. However, linear motor driven axis do not have ball screwand nut, which are the largest contributors to the friction. Experience indicates that thecurrent signals, which are directly proportional to the cutting forces, have higher bandwidth,64Chapter 7. Summary and Future Researchi.e. 100 Hz in an average machine tool. Tangential, radial and axial cutting force coe cientscan be identi ed from the current signals of linear motor drives, as opposed to obtainingonly tangential cutting force coe cient from spindle motor power.The weakest link in the smart machining system developed in this thesis is the automatictransfer function measurement unit. Due to the vertical o set between the impact andresponse measurement locations, the dynamic sti nesses of tool modes di er substantiallyfrom 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 thedirect transfer function; however the current capacitive sensor cannot accommodate the widerange of tool diameters if placed at a  xed location opposite the hammer.There are a couple of improvements which could be made to the Kalman  lter. In orderto account for the periodic nature of the applied force, the applied force was decomposedinto its Fourier Series, and an multivariable ordinary di erential equation which generatesthe  rst N harmonics of that Fourier series was designed. This was necessary because theKalman  lter was designed as a continuous-time Kalman  lter, and there is no di erentialequation which generates a time delay necessary to implement the true equation for a periodicequationFa(t) = Fa(t T): (7.1)If the Kalman  lter was designed as a discrete-time Kalman  lter however, it is trivial towrite a di erence equation for equation 7.1. Another area for improvement is the design ofthe Kalman  lter. Using the approach presented in this thesis, a new Kalman  lter must bedesigned for each spindle speed. The model could be extended to include the spindle speedas an estimated state. This would make the model non-linear, so a non-linear extension ofthe Kalman  lter such as the Extended Kalman Filter or Unscented Kalman Filter wouldbe required.65Bibliography[1] Y. Altinta s. Prediction of cutting forces and tool breakage in milling from feed drivecurrent measurements. Journal of Engineering for Industry, 1992.[2] Y. Altinta s 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 s and E. Budak. Analytical prediction of stability lobes in milling. CIRPAnnals - Manufacturing Technology, 44(1):357 { 362, 1995.[4] E. Budak, Y. Altinta s, and E. J. A. Armarego. Prediction of milling force coe cientsfrom 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 onig, and R. Teti. Tool conditionmonitoring (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 estimationof 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 inLife Cycle Engineering and Sustainable Development, pages 363{380. Springer Nether-lands, 2006.66Bibliography[9] D. J. Ewins. Modal Testing: Theory, Practice and Application (Mechanical EngineeringResearch 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 sensorsfor on-line structural identi cation. Transactions - American Society of MechanicalEngineers 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 HallUpper Saddle River, NJ, 2001.[14] Y.H. Jeong and D.W. Cho. Estimating cutting force from rotating and stationaryfeed motor currents on a milling machine. International Journal of Machine Tools andManufacture, 42(14):1559 { 1566, 2002.[15] J. Kiefer. Sequential minimax search for a maximum. Proceedings of the AmericanMathematical 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 andManufacture, 36(8):925 { 937, 1996.[17] M. Tse and R. Bilne. Design of an Automated Frequency Response Test Unit. M.EngReport, 2003.[18] Y. Oh, W. Kwon, and C. Chu. Drilling torque control using spindle motor current andits e ect on tool wear. International Journal of Advanced Manufacturing Technology,24(5-6):327 { 334, 2004.[19] S.S. Park and Y. Altinta s. Dynamic compensation of spindle integrated force sen-sors with kalman  lter. Journal of Dynamic Systems, Measurement, and Control,126(3):443{452, 2004.67Bibliography[20] J. S. Popovics, W. Song, J. D. Achenbach, J. H. Lee, and R. F. Andre. One-sidedstress 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 cuttingforce monitoring. ANNALS-CIRP, 46:49{52, 1997.[23] J.-H. Tong, T.-T. Wu, and C.-K. Lee. Fabrication of a piezoelectric impact hammer andits application to the In-situ nondestructive evaluation of concrete. Japanese Journalof Applied Physics, 41(Part 1, No. 11A):6595{6600, 2002.68Appendix AAutomatic Hammer CNC IntegrationSource Code// PositionTool . cpp : Defines the entry point for the consoleapplication .//#include <tchar . h>#include <s t d i o . h>#include <s t d l i b . h>#include <30 i / fwlib32 . h>#include <malloc . h>#include <l i m i t s>#include <cassert>#include <algorithm>#include <numeric>#include <vector>#include <NIDAQmx. h>#define WIN32 LEAN AND MEAN#include <windows . h>#define PROG NUM ""69Appendix A. Automatic Hammer CNC Integration Source Codeusing namespace std ;int cur axes ;void read address ( char  address , unsigned short  port )fchar l i n e [ 8 0 ] ;do fp r i n t f ( "CNC address : " ) ;f g e t s ( l i n e , 80 , stdin ) ;g while ( s s c a n f ( l i n e , "%[^:/?#@! $ & ’() +,;= ]:%hd " ,address , port ) != 2) ;gvoid read channel ( char  channel )fchar l i n e [ 8 0 ] ;do fp r i n t f ( "Cap sensor channel : " ) ;f g e t s ( l i n e , 80 , stdin ) ;g while ( s s c a n f ( l i n e , "%s " , channel ) != 1) ;gshort run cmd ( short fhnd , const char  l i n e )fshort r e t ;long len , n ;len = ( long ) s t r l e n ( l i n e ) ;70Appendix A. Automatic Hammer CNC Integration Source Codewhile ( len ) fn = len ;r e t = cnc dnc2 ( fhnd , &n , ( char  ) l i n e ) ;switch ( r e t )fcase EW BUFFER:continue ;case EW OK:len  = 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;ggreturn EW OK;gvoid wait for axis move ( short hndl )fbool is done ;ODBAXIS a x i s d i s t ;Sleep (200) ;71Appendix A. Automatic Hammer CNC Integration Source Codedo fc n c d i s t a n c e ( hndl , ALL AXES, sizeof (ODBAXIS) , &a x i s d i s t ) ;is done = true ;for ( int i = 0 ; i < cur axes ; ++i )fi f ( a x i s d i s t . data [ i ] )fis done = false ;break ;ggg while ( ! is done ) ;gchar channel [ 8 0 ] ;double measure dist ( )fint32 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 )freturn numeric limits<double>:: signaling NaN ( ) ;g72Appendix A. Automatic Hammer CNC Integration Source Codea i r e t = DAQmxCreateAIVoltageChan ( ai task ,channel ,NULL,DAQmx Val Cfg Default , 10.0 ,10.0 ,DAQmx Val Volts ,NULL) ;i f ( a i r e t )freturn numeric limits<double>:: signaling NaN ( ) ;ga i r e t = DAQmxCfgSampClkTiming( ai task ,NULL,50000 ,DAQmx Val Rising ,DAQmx Val FiniteSamps ,512) ;i f ( a i r e t )freturn numeric limits<double>:: signaling NaN ( ) ;ga i r e t = DAQmxExportSignal ( ai task , DAQmx Val SampleClock ,"PFI7" ) ;i f ( a i r e t )73Appendix A. Automatic Hammer CNC Integration Source Codefreturn numeric limits<double>:: signaling NaN ( ) ;gdouble sample array [ 5 1 2 ] ;long samples read ;a i r e t = DAQmxReadAnalogF64( ai task ,DAQmx Val Auto , 1,DAQmx Val GroupByChannel ,sample array ,sizeof ( sample array ) / sizeof ( 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 ;gdouble measure at ( short hndl , short angle )fshort r e t ;74Appendix A. Automatic Hammer CNC Integration Source Codechar cmd [ 2 5 6 ] ;angle %= 4096;i f ( angle < 0) angle += 4096;#i f 0r e t = cnc wrmacro ( hndl , 1133 , 10 , angle %4096, 0) ;i f ( r e t )freturn numeric limits<double>:: signaling NaN ( ) ;g#elses p r i n t f (cmd , "#1133=%dnnM119nn" , angle ) ;#endifi f ( r e t = run cmd ( hndl , cmd) )freturn numeric limits<double>:: signaling NaN ( ) ;g// need to wait a while here .// wait for spindle to stopODBACT2 sspeed ;Sleep (200) ;int speeds [ 5 ] ;int k = 0 ;75Appendix A. Automatic Hammer CNC Integration Source Codememset ( speeds , 0xcd , sizeof ( speeds ) ) ;do fi f ( r e t = cnc acts2 ( hndl , 1 , &sspeed ) )ff p r i n t f ( stderr , " Error reading actuals p i n d l e speed : %dnn" , r e t ) ;c n c f r e e l i b h n d l ( hndl ) ;return 1 ;gspeeds [ k++] = sspeed . data [ 0 ] ;i f ( k > 4) k = 0 ;g while ( speeds [ 0 ] jj speeds [ 1 ] jj speeds [ 2 ] jj speeds [ 3 ]jj speeds [ 4 ] ) ;return measure dist ( ) ;gconst 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 )f#i f 1double fa , fb , f c ;short ax , bx , cx ;ax = 0 ;bx = 32;76Appendix A. Automatic Hammer CNC Integration Source Codefa = measure at ( hndl , ax ) ;fb = measure at ( hndl , bx ) ;i f ( fb < fa ) fswap ( fa , fb ) ;swap ( ax , bx ) ;gcx = bx + phi (bx  ax ) ;f c = measure at ( hndl , cx ) ;double fu ;short u , ulim ;while ( fb <= f c )fdouble r = ( bx  ax ) ( fb  f c ) ;double q = ( bx  cx ) ( fb  fa ) ;double rq = r  q ;i f ( cx > bx ) fulim = bx + 64;g else fulim = bx  64;gi f ( abs ( r  q ) < 1e 3)fu = cx + phi ( cx  bx ) ;fu = measure at ( hndl , u) ;g else f77Appendix A. Automatic Hammer CNC Integration Source Codeu = bx  ( ( bx  cx ) q  ( bx  ax ) r ) /( r  q ) ;i f ( ( bx  u) (u  cx ) > 0)ffu = measure at ( hndl , u) ;i f ( fu > f c )fax = bx ;fa = fb ;bx = u ;fb = fu ;continue ;g else i f ( fu < fb ) fcx = u ;f c = fu ;continue ;gu = cx + phi ( cx  bx ) ;fu = measure at ( hndl , u) ;g else i f ( ( cx  u) (u  ulim ) > 0) ffu = measure at ( hndl , u) ;i f ( fu > f c ) fbx = cx ;cx = u ;u = cx+phi ( cx  bx ) ;fb = f c ;f c = fu ;fu = measure at ( hndl , u) ;g78Appendix A. Automatic Hammer CNC Integration Source Codeg else i f ( ( u  ulim ) ( ulim  cx ) > 0) fu = ulim ;fu = measure at ( hndl , u) ;g else fu = cx + phi ( cx  bx ) ;fu = measure at ( hndl , u) ;ggax = bx ;bx = cx ;cx = u ;fa = fb ;fb = f c ;f c = fu ;gi f ( ax < bx && ax < cx )f l e f t = ax ;i f ( bx < cx ) f centre = bx ; r i g h t = cx ;g else f centre = cx ; r i g h t = bx ;gg else i f ( bx < cx ) f l e f t = bx ;i f ( ax < cx ) f79Appendix A. Automatic Hammer CNC Integration Source Code centre = ax ; r i g h t = cx ;g else f centre = cx ; r i g h t = ax ;gg else f l e f t = cx ;i f ( ax < bx ) f centre = ax ; r i g h t = bx ;g else f centre = bx ; r i g h t = ax ;gga s s e r t ( r i g h t   l e f t < 4096) ;#elsedouble m =  11.0;short mx =  1;for ( int i = 0 ; i < 4096; i += 32)fdouble measure = measure at ( hndl , i ) ;i f ( measure > m) f m = measure ; mx = i ; gg l e f t = mx  32; centre = mx; r i g h t = mx + 32;80Appendix A. Automatic Hammer CNC Integration Source Code#endifgshort find max ( short hndl , short l e f t , short centre , short r i g h t )fshort 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  centre ) > abs ( centre  l e f t ) )fx1 = centre ;x2 = centre + c ( r i g h t  centre ) ;gelsefx2 = centre ;x1 = centre  c ( centre  l e f t ) ;gdouble f0 , f1 , f2 , f3 ;f1 = measure at ( hndl , x1 ) ;f2 = measure at ( hndl , x2 ) ;while ( abs ( x3  x0 ) > 5)fi f ( f2 > f1 )f81Appendix A. Automatic Hammer CNC Integration Source Codex0 = x1 ;x1 = x2 ;x2 = r x1 + c x3 ;f0 = f1 ;f1 = f2 ;f2 = measure at ( hndl , x2 ) ;gelsefx3 = x2 ;x2 = x1 ;x1 = r x2 + c x0 ;f3 = f2 ;f2 = f1 ;f1 = measure at ( hndl , x1 ) ;ggi f ( f1 > f2 )freturn x1 ;gelsefreturn x2 ;ggtemplate <class T>inline T sign ( const T &t )82Appendix A. Automatic Hammer CNC Integration Source Codefi f ( t < T( ) ) return T( 1) ; else return T(1) ;gdouble c a l i b r a t e a n d z e r o ( short hndl )fdouble d e l t a d i s t ;double p r e v d i s t = measure dist ( ) ;i f ( p r e v d i s t >  0.1)f// already zeroed   need to find some other wayto calibrated e l t a d i s t =  0.1;gelse i f ( p r e v d i s t <  5)fd e l t a d i s t = 0 . 1 ;gelsefd e l t a d i s t = 0 . 0 5 ;gdouble d i s t ;double gain = 0 . 0 ;char cmd [ 2 5 6 ] ;short r e t ;83Appendix A. Automatic Hammer CNC Integration Source Codedo fs p r i n t f (cmd , "X%.3 fnn" , d e l t a d i s t ) ;run cmd ( hndl , cmd) ;wait for axis move ( hndl ) ;d i s t = measure dist ( ) ;i f ( abs ( p r e v d i s t ) < 9 . 5 )fgain = abs ( d e l t a d i s t /( d i s t  p r e v d i s t ) ) ;// mm/Vd 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)fd e l t a d i s t = sign ( d e l t a d i s t ) 0 . 1 ;ggelsefd e l t a d i s t =  0.1 sign ( d i s t ) ;gp r e v d i s t = d i s t ;g while ( abs ( d i s t ) > 0 . 1 ) ;return gain ;g84Appendix A. Automatic Hammer CNC Integration Source Codeint tmain ( int argc , TCHAR argv [ ] )fchar 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 ;read address ( address , &port ) ;read channel ( 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) )ff p r i n t f ( stderr , " Error number %hdnn" , r e t ) ;return r e t ;gi f ( r e t = c n c s y s i n f o (hnd , &s y s i n f o ) )ff p r i n t f ( stderr , " Error number %hdnn" , r e t ) ;c n c f r e e l i b h n d l (hnd) ;return r e t ;gp r i n t f ( " Controlled axes : %.2 s/%d ( current /max)nn" , 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 ’ )f85Appendix A. Automatic Hammer CNC Integration Source Codecur axes = 10 ( s y s i n f o . axes [ 0 ]  ’ 0 ’ ) + ( s y s i n f o .axes [ 1 ]  ’ 0 ’ ) ;gelsefcur axes = s y s i n f o . axes [ 1 ]  ’ 0 ’ ;gi f ( cur axes < 0 jj cur axes > max axes )ff p r i n t f ( stderr , " I n v a l i d number of c o n t r o l l e d axes: %dnn" , cur axes ) ;c n c f r e e l i b h n d l (hnd) ;return 1 ;gp r i n t f ( " Controlled axes : %d/%d ( current /max)nn" , cur axes ,max axes ) ;p r i n t f ( "Kind of CNC: %.2 s " , s y s i n f o . cnc type ) ;i f ( ( s y s i n f o . addinfo & 0x02 ) == 0x02 ) fp r i n t f ( " i " ) ;gswitch ( s y s i n f o . mt type [ 1 ] )fcase ’M’ :i f ( s y s i n f o . mt type [ 0 ] == ’M’ )fp r i n t f ( " 2 path machining centrenn" ) ;gelse86Appendix A. Automatic Hammer CNC Integration Source Codefp r i n t f ( " machining centrenn" ) ;gbreak ;case ’T ’ :switch ( s y s i n f o . mt type [ 0 ] )fcase ’T ’ :p r i n t f ( " 2/3 path lathenn" ) ;break ;case ’M’ :p r i n t f ( " millturnnn" ) ;break ;case ’ ’ :p r i n t f ( " lathenn" ) ;break ;gbreak ;case ’P ’ :p r i n t f ( " punch pressnn" ) ;break ;case ’L ’ :p r i n t f ( " l a s e rnn" ) ;break ;case ’W’ :p r i n t f ( " wire cutnn" ) ;break ;default :p r i n t f ( " unknownnn" ) ;g87Appendix A. Automatic Hammer CNC Integration Source Codep r i n t f ( " S e r i e s : %.4 snn" , s y s i n f o . s e r i e s ) ;p r i n t f ( " Version : %.4 snn" , s y s i n f o . version ) ;while (1)fchar prognum [ 2 5 6 ] ;while (1)f/ wait for DNC connect  /r e t = cnc dncstart2 (hnd , prognum ) ;switch ( r e t )fcase EW REJECT:continue ;case 0 :break ;default :f p r i n t f ( stderr , " Error whilewaiting f o r DNC connect : %dnn" ,r e t ) ;i f ( r e t ==  1) fchar buf [ 3 2 ] ;p r i n t f ( "DNC s e s s i o n inprogress . Forcetakeover ( y/n) ? " ) ;f g e t s ( buf , sizeof ( buf ) ,stdin ) ;i f ( ! stricmp ( buf , "ynn" ) )88Appendix A. Automatic Hammer CNC Integration Source Codefcnc dncend2 (hnd ,DNC READERR) ;continue ;ggc n c f r e e l i b h n d l (hnd) ;return 1 ;gi f ( strcmp ( prognum , PROG NUM) )ff p r i n t f ( stderr , " Unrecognizedprogram number %s .nn" , prognum );cnc dncend2 (hnd , DNC OPENERR) ;continue ;gshort l e f t , centre , r i g h t ;const short nteeth = 4 ;bracket max (hnd , &l e f t , &centre , &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) fp r i n t f ( " Error : c u t t e r not in rangeof displacement sensor .nn" ) ;89Appendix A. Automatic Hammer CNC Integration Source Codegoto prog end ;gi f ( run cmd (hnd , "G91nn" ) == EW RESET)continue ;i f ( run cmd (hnd , "G01F60Z 8.73nn" ) ==EW RESET) continue ;wait for axis move (hnd) ;l e f t = low pos ;r i g h t = low pos + 4096/ nteeth ;centre = ( 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 .73nn" ) == EW RESET)continue ;wait for axis move (hnd) ;char cmd [ 2 5 6 ] ;s p r i n t f (cmd , "#1133=%dnnM119nn" , 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) ;90Appendix A. Automatic Hammer CNC Integration Source Codes p r i n t f (cmd , " .nnMalTF . exe /c autohammer .cfg / s e t OSensor [ 0 ] . Gain=%g" , gain/1000.0) ;system (cmd) ;prog end :i f ( run cmd (hnd , "M02nn%nn" ) == EW RESET)continue ;cnc dncend2 (hnd , DNC NORMAL) ;ggreturn 0 ;g91

Cite

Citation Scheme:

    

Usage Statistics

Country Views Downloads
United States 25 2
Canada 19 8
China 18 10
Republic of Korea 15 1
Unknown 15 1
India 10 2
Peru 8 0
Singapore 7 5
Malaysia 7 7
Taiwan 6 5
Russia 5 0
Belgium 3 1
Spain 2 1
City Views Downloads
Unknown 58 14
Seoul 14 0
Shenzhen 7 0
Singapore 7 5
Pantai 6 7
Montreal 6 0
Mumbai 5 0
Ashburn 5 0
Mountain View 4 0
Longueuil 4 8
Sunnyvale 4 0
Shanghai 3 0
Beijing 3 5

{[{ mDataHeader[type] }]} {[{ month[type] }]} {[{ tData[type] }]}
Download Stats

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.24.1-0070939/manifest

Comment

Related Items