On-Machine Measurement and Error Compensation for 6061 Aluminum Alloy Hexagonal Punch Using a Turn-Milling Machine

: For machining parts with complex shapes, consisting of computer numerical control (CNC) machine tools, different CNC machine tools will be used according to the machining method. If the workpiece is removed for off-machine measurement after machining, when the size is incorrect, it will need to be returned to the CNC machine tool for secondary machining. In this case, the workpiece surface quality and machining accuracy will be affected, which is very time-consuming. On-machine measurement and complex machine center is a key to solve this problem. In the recent researches that the touch probe was integrated on three or ﬁve axis machine for error compensation and shape construction based on on-machine measurement, but turning-milling machine was rare. In addition, the most types of parts were thin-walled parts or thin web parts. In this study, a contact measurement system is integrated into a CNC combined turning-milling machine for on-machine measuring. Macro-programming is used to design the machining path of A6061-T6 aluminum alloy hexagonal punch, and the action of probe measurement is added to the machining path. As the measured data exceed the tolerance range, the calculated data are fed back to the controller for machining improvement by compensation. The ﬁnished hexagonal punch is measured in a 3D coordinate measuring machine and the error is compared. The experimental results show that the contact probe needs to be corrected before machining, and the size of the corrected workpiece can reach the tolerance range of ± 0.01 mm. The size error of rough machining is larger than that of ﬁned machining, and the size error of rough machining will increase with the length of the workpiece.


Introduction
In relation to the progress of science and technology, the industry not only requires the performance and service life of industrial products but also pursues machining methods of high efficiency, high precision, and high quality. In the case of national defense science and technology and aerospace industry products, the machining time of parts is long, and workpieces are no longer in a simple geometric shape. The accuracy requirements of the products are gradually becoming stringent, thus, quality management is important. However, when the quality control is performed after machining, the poor-quality products will need to be eliminated, which may cause delivery delay or excessive waste for the workpieces that take more cost and time to process. If defects can be detected in each process of machining, where the size is obtained, calculated, and fed back to the machining path, errors can be corrected in real time, thereby, avoiding cumulative error of all machining programs and improving the yield rate in the final quality management [1][2][3][4].
There are two kinds of common surface size measurement: Contact measurement and non-contact measurement. The former is performed using a 3D coordinate measuring machine (CMM), while the latter is mainly based on triangular laser scanner or automatic optical inspection. The advantage of non-contact measurement is that compared with to design the machining path of A6061-T6 aluminum alloy hexagonal punch, and the action of probe measurement is added to the machining path. After obtaining the measured data, the sizes are compared. When the measured data exceed the tolerance range, the calculated data are fed back to controller for compensation machining. The finished hexagonal punch is measured in a 3D CMM and the error between them is compared. Additionally, the size errors before and after calibration of contact probe and the influence of rough and finish machining on OMM are discussed.

Workpiece Measurement Technology
The measurement technology can be divided into on-machine measurement, in situ measurement, and off-machine measurement; according to the measuring time and location, it can be divided into pre-process measurement, in-process measurement, and post-process measurement [21][22][23][24][25][26].

Pre-Process Measurement
Before machining, we can use measuring tools or fixtures to measure the workpiece, as shown in Figure 1b.
Machines 2021, 9, x FOR PEER REVIEW 3 of 16 with contact probe [16][17][18][19][20][21]. In this study, contact measurement system is integrated into CNC turning-milling machine for on-machine measuring (OMM). Macro programming is used to design the machining path of A6061-T6 aluminum alloy hexagonal punch, and the action of probe measurement is added to the machining path. After obtaining the measured data, the sizes are compared. When the measured data exceed the tolerance range, the calculated data are fed back to controller for compensation machining. The finished hexagonal punch is measured in a 3D CMM and the error between them is compared. Additionally, the size errors before and after calibration of contact probe and the influence of rough and finish machining on OMM are discussed.

Workpiece Measurement Technology
The measurement technology can be divided into on-machine measurement, in situ measurement, and off-machine measurement; according to the measuring time and location, it can be divided into pre-process measurement, in-process measurement, and postprocess measurement [21][22][23][24][25][26].

Pre-Process Measurement
Before machining, we can use measuring tools or fixtures to measure the workpiece, as shown in Figure 1b.

In-Process Measurement
As this step is usually performed on the machine tool, it will integrate with OMM, as shown in Figure 1c. One way to conduct in-process measurement is that in the actual machining process, we do not stop the machining process, but constantly obtain the size data in the machining process to detect whether the machining size is up to standard. The measurement method of in-process measurement is to use the cutting tool assembled with the touch sensor to process and can be equipped with a fast-cutting tool fixture to correct the tool, and also set tool coordinates to improve the accuracy of machining measurement. When the cutting tool positioning is completed before cutting, the cutting tool equipped with touch sensor will constantly feedback the machining point data for size comparison. The advantage of this measurement method is that it takes the cutting tool itself as the measurement probe, and there is no need to change the measurement tool before the measurement. Therefore, it can be processed and measured more quickly. But it is a big problem that there is also the interference of cutting chip and cutting fluid in use.
The other type is the in-cycle measurement, which uses the machining interval of each stage to replace the measuring tool for testing, and the measured data can be fed back to controller for compensation machining. The above steps can be performed repeatedly, and machining will be completed when the measured values meet the set values. The advantage of this method is that it can reduce the time spent on off-machine inspection and has high accuracy.

Post-Process Measurement
The finished workpiece is removed from the machine and moved to another testing machine such as 3D CMM for size inspection. Off-machine and moving to other inspection OMM after machining can avoid the error sources caused by the machine, such as vibration, cutting chip, and cutting fluid. However, it is also easy to say that the size is not up to the standard and needs to be processed again, as shown in Figure 1d.

Workpiece and Cutting Tools
The workpiece material is A6061-T6 aluminum alloy bar material with Ø = 26 mm, which is a precipitation-hardening type of heat treatment alloy. The 6000 series of aluminum alloy with magnesium and silicon as the main alloy elements, thus, it is the most commonly used aluminum alloy. The geometric shape of the workpiece is a hexagonal punch. In the macro-programming machining path, the changed machining size can be set as shown in Figure 2. In the hexagonal punch, the sizes of the turning parts are D1 and D2, the sizes of the milling parts are L1, L2, and L3, and the sizes are set to D1 = 19.8 ± 0.01 mm and D2 = 23.5 ± 0.01 mm; L1, L2, and L3 are all 17.8 ± 0.01 mm. Figure 3 shows the used turning tools and end milling cutters. The turning part is a hard alloy aluminum turning tool (VCGT 130304-AK, Korloy, Seoul, Korea). The machining data of the rough turning were spindle speed 4700 rpm, depth-of-cut 0.5 mm and feed rate 0.3 mm/rev. The fine turning was same spindle speed and feed rate 0.15 mm/rev. The milling part is a 3-edge tungsten steel end milling cutter with Ø10 for aluminum alloy (AE51003TB, Speed Tiger, Taichung, Taiwan). The machining data of the milling were spindle speed 3000 rpm and feed rate 2000 mm/min.

On-Machine Measuring System
The OMM system is established on the CNC turning-milling machine. T divided into cutting tool measuring device, workpiece measuring device, an structions. The CNC turning-milling machine model is Vturn-A20YCV, as s ure 4. The controller adopts FANUC 0i-TF, and the maximum speed of the reach 5000 rpm. The maximum speed of fast movement of each axis can reach The fastest cutting feed is 1260 mm/min, the actual machining accuracy of the spindle is ±0.01°, and the repeat positioning accuracy is ±0.010 mm.

On-Machine Measuring System
The OMM system is established on the CNC turning-milling machine. The system is divided into cutting tool measuring device, workpiece measuring device, and Macro instructions. The CNC turning-milling machine model is Vturn-A20YCV, as shown in Figure 4. The controller adopts FANUC 0i-TF, and the maximum speed of the spindle can reach 5000 rpm. The maximum speed of fast movement of each axis can reach 24 mm/min. The fastest cutting feed is 1260 mm/min, the actual machining accuracy of the C axis of the spindle is ±0.01 • , and the repeat positioning accuracy is ±0.010 mm.  The high precision motorized arm (HPMA) and tool setting probe (RP3) are adopted to correct the coordinate position of the cutting tool. When the cutting tool encounters the setting probe of RP3, the position coordinate will be returned to the controller and the cutting tool will be set as the reference tool. Other tools will be set sequentially using the reference tool with known size and coordinate position, and the accuracy can reach 1.0 μm.
We use the OLP40 contact probe (tough trigger probe). The probe is an electrical contact type and has the function of optical signal transmission with measurement accuracy of 1.0 μm. When any point of OLP40 contact probe touches the surface of the workpiece, The high precision motorized arm (HPMA) and tool setting probe (RP3) are adopted to correct the coordinate position of the cutting tool. When the cutting tool encounters the setting probe of RP3, the position coordinate will be returned to the controller and the cutting tool will be set as the reference tool. Other tools will be set sequentially using the reference tool with known size and coordinate position, and the accuracy can reach 1.0 µm.
We use the OLP40 contact probe (tough trigger probe). The probe is an electrical contact type and has the function of optical signal transmission with measurement accuracy of 1.0 µm. When any point of OLP40 contact probe touches the surface of the workpiece, the resistance in the probe will increase, and infrared light will be emitted on the side of the probe to transmit the signal from around. At this time, the contact signal is received through cooperating with OMI-2 optical machine interface (OMI). The received signal is transmitted through the transmission line to the CNC controller of the turning-milling machine, and the mechanical position at contact is calculated and recorded in the variables of the FANUC 0i-TF controller.
Since the program required for the contact lathe probe is a Marco program, the designs of both the machining path and measurement path are edited by Marco. The program flow of the hexagonal punch OMM is presented in Figure 5. The machining path and OMM program of hexagonal punch are written by Macro. The OMM is performed in machining, and then, the measured size data is compared with the standard size input in Macro. After comparison, there are three conditions to determine: Qualified size, over-cutting non-compensable size, and compensable size. If the compensable size is obtained after comparison, the program will determine whether the cutting tool abrasion is excessive. There will be remainders when there is too much abrasion loss. Table 1 is the main program O0399 of OMM and Macro-program O0404 of D1 size, # 700 is the design size of drawing, and # 600 is the size measured by contact probe. Subtraction of these two is the machining error size of # 716. When the size error is greater than 0.01 mm, it indicates that the machining is over-cut and machining will be stopped; if the size error is less than 0.01 mm, it indicates that it is within the tolerance range and the next machining pass is performed. # 10,002 is to record the cutting tool abrasion value. If this value is less than −0.11, it means too much cutting tool abrasion and will affect the machining size; the machining will be stopped. Table 2 lists the Macro programming of rough turning and finish turning of cylindrical machining, including O0400 and O0403 (P400 and P403 in Table 1).
First, the surface roughness of the hexagonal punch was measured with a Mitutoyo SJ-400 surface roughness tester to ensure that the size accuracy of the measurement would not have additional errors due to the surface roughness. Then, Cordax RS-25 coordinate measuring machine is used to check the size accuracy of the machined products. Results are compared with those of on-machine inspection by OLP40 contact probes. The instrument uses granite guide rails, which have low temperature variation and relatively stable accuracy and a repeatability accuracy of 3 µm. will be stopped. Table 2 lists the Macro programming of rough turning and finish turning of cylindrical machining, including O0400 and O0403 (P400 and P403 in Table 1).     When there are problems with the positioning accuracy of the machine, spindle, and probe calibration, they will affect the accuracy and repeatability of contact probe. Therefore, such problems are of great significance for probe calibration, such as the offset of X and Y direction of probe and the radius of probe ball nose, which will influence the accuracy of measurement. The lever-type dial indicator (scale = 0.002 mm) is taken as the measuring tool to correct the probe offset, and the subroutine of OLP40 contact probe function is used to correct the radius of the ball nose. Subroutines used are diameter calibration (P9082) and length calibration (P9801), as shown in Figure 6. The calibration procedure is as follows:

1.
Use the diameter calibration (P9082) in OLP40 contact probe subroutine; build the X axis of the spindle to identify the axle center of the spindle; 2.
Move the OLP40 contact probe to the center of the X axis of combined turning-milling machine; 3.
Fix the dial indicator on the spindle claw and put the probe close to the probe ball nose, as shown in Figure 7; 4.
Rotate the spindle to make the dial indicator probe rotate around the probe ball nose; 5.
Adjust the X and Y directions so that the pointer of the lever-type dial indicator does not deviate; 6.
After the above steps, the offsets of X and Y axes are compensated and corrected to the compensation value in the probe; 7.
Then, adopt the diameter calibration (P9082) in the OLP40 contact probe subroutine, build the X axis of the spindle, and the radius compensation value of the ball nose is automatically found and stored in controller.
probe calibration, they will affect the accuracy and repeatability of contact probe. Therefore, such problems are of great significance for probe calibration, such as the offset of X and Y direction of probe and the radius of probe ball nose, which will influence the accuracy of measurement. The lever-type dial indicator (scale = 0.002 mm) is taken as the measuring tool to correct the probe offset, and the subroutine of OLP40 contact probe function is used to correct the radius of the ball nose. Subroutines used are diameter calibration (P9082) and length calibration (P9801), as shown in Figure 6. The calibration procedure is as follows: 1. Use the diameter calibration (P9082) in OLP40 contact probe subroutine; build the X axis of the spindle to identify the axle center of the spindle; 2. Move the OLP40 contact probe to the center of the X axis of combined turning-milling machine; 3. Fix the dial indicator on the spindle claw and put the probe close to the probe ball nose, as shown in Figure 7; 4. Rotate the spindle to make the dial indicator probe rotate around the probe ball nose; 5. Adjust the X and Y directions so that the pointer of the lever-type dial indicator does not deviate; 6. After the above steps, the offsets of X and Y axes are compensated and corrected to the compensation value in the probe; 7. Then, adopt the diameter calibration (P9082) in the OLP40 contact probe subroutine, build the X axis of the spindle, and the radius compensation value of the ball nose is automatically found and stored in controller.
Using the above calibration procedure, the X axes of the probe and the spindle can be positioned so that they do not deviate. Then, the length calibration (P9801) in the OLP40 contact probe subroutine can be used to determine the position of the Z axis of the probe.

Size Errors before and after Calibration of on-Machine Measuring Systems
Before calibration of contact probe, OMM is performed on turning-milling machine after machining, the sizes D1, D2, L1, L2, and L3 of three hexagonal punches are measured. The error between the size data recorded in controller and the drawing size is compared. The finished hexagonal punches are moved to 3D CMM for off-machine measurement, and the errors are compared between the sizes obtained after inspection and the size data on the original CAD diagram. Table 3 and Figure 8 show the results by OMM (before probe calibration) and CMM. As observed, the surface roughness after turning is 0.23-0.25 μm, and the surface roughness after milling is 0.434-0.486 μm. Both reach the surface quality of finish machining, thus, not affecting the size error. The measurement results by OMM, the average value and the error value of D1 were 19.805 mm and 0.005 Using the above calibration procedure, the X axes of the probe and the spindle can be positioned so that they do not deviate. Then, the length calibration (P9801) in the OLP40 contact probe subroutine can be used to determine the position of the Z axis of the probe.

Size Errors before and after Calibration of on-Machine Measuring Systems
Before calibration of contact probe, OMM is performed on turning-milling machine after machining, the sizes D1, D2, L1, L2, and L3 of three hexagonal punches are measured. The error between the size data recorded in controller and the drawing size is compared. The finished hexagonal punches are moved to 3D CMM for off-machine measurement, and the errors are compared between the sizes obtained after inspection and the size data on the original CAD diagram. Table 3 and Figure 8 show the results by OMM (before probe calibration) and CMM. As observed, the surface roughness after turning is 0.23-0. 25 Figure 8, the error between the result of OMM and the drawing size is within the tolerance (±0.01 mm), and the maximum error is 0.006 mm. However, the size error of the results measured by CMM is more than 0.05 mm, which has exceeded the tolerance range of the drawing size (±0.01 mm); therefore, there is the phenomenon of over-cutting.

Effects of Turning and Milling on on-Machine Measuring
The machining program is divided into rough machining and finish machining for turning and milling. After rough machining, OMM is performed, and then, finish machining is performed after inspection. OMM is performed again after finish machining, and the size errors are shown in Figures 10 and 11. According to the measured size errors after turning, the size error of rough machining is larger than that of finish machining. The error at the end of the workpiece reaches a maximum of ~0.035 mm and needs to be compensated several times before its size is within the set tolerance range. As the purpose of rough machining is to remove excess materials quickly and cut with large feed and cutting depth, the size error is larger when the workpiece is further away from the clamping end [24,29]. After finish machining, it can be found that the errors can be kept within the set

Effects of Turning and Milling on on-Machine Measuring
The machining program is divided into rough machining and finish machining for turning and milling. After rough machining, OMM is performed, and then, finish machining is performed after inspection. OMM is performed again after finish machining, and the size errors are shown in Figures 10 and 11. According to the measured size errors after turning, the size error of rough machining is larger than that of finish machining. The error at the end of the workpiece reaches a maximum of ~0.035 mm and needs to be compensated several times before its size is within the set tolerance range. As the purpose of rough machining is to remove excess materials quickly and cut with large feed and cutting depth, the size error is larger when the workpiece is further away from the clamping end [24,29]. After finish machining, it can be found that the errors can be kept within the set Since the positioning accuracy of the machine and spindle, probe calibration, and the surface quality after machining will be reflected in the accuracy of contact probe measurement in actual machining [22,25,[27][28][29], it will lead to the results shown in Table 3 and Figure 8. After probe calibration, which is presented in Section 3.2, it can meet the required tolerance range, i.e., ±0.01 mm, indicating that the method of machining measurement and compensation machining of OMM during the machining is feasible, as shown in Table 4 and Figure 9.

Effects of Turning and Milling on on-Machine Measuring
The machining program is divided into rough machining and finish machining for turning and milling. After rough machining, OMM is performed, and then, finish machining is performed after inspection. OMM is performed again after finish machining, and the size errors are shown in Figures 10 and 11. According to the measured size errors after turning, the size error of rough machining is larger than that of finish machining. The error at the end of the workpiece reaches a maximum of~0.035 mm and needs to be compensated several times before its size is within the set tolerance range. As the purpose of rough machining is to remove excess materials quickly and cut with large feed and cutting depth, the size error is larger when the workpiece is further away from the clamping end [24,29]. After finish machining, it can be found that the errors can be kept within the set tolerance range. According to the size errors measured after milling, the size error of rough machining is also larger than that of finish machining. Due to the fixed C axis in milling, the size error of the clamping end of the workpiece is consistent with the two size errors of the workpiece ends. After finish machining, it can be found that the errors can be kept within the set tolerance range. The Figure 12 show the measurement of surface roughness parameters including Ra and Rz, after rough and finish machining respectively. As observed, the surface roughness after rough turning were about Ra = 1.645 µm and Rz = 6.352 µm; the surface roughness after rough milling were about Ra = 1.727 µm and Rz = 6.858 µm; the surface roughness after finish turning were about Ra = 0.236 µm and Rz = 1.283 µm; the surface roughness after finish milling were about Ra = 0.488 µm and Rz = 2.095 µm. Figure 13 is the surface shapes after rough milling and finish milling. As observed, the surface quality and size accuracy of rough machining are worse than those of finish machining due to the vibration in rough machining [30]. roughness parameters including Ra and Rz, after rough and finish machining respec-tively. As observed, the surface roughness after rough turning were about Ra = 1.645 μm and Rz = 6.352 μm; the surface roughness after rough milling were about Ra = 1.727 μm and Rz = 6.858 μm; the surface roughness after finish turning were about Ra = 0.236 μm and Rz = 1.283 μm; the surface roughness after finish milling were about Ra = 0.488 μm and Rz = 2.095 μm. Figure 13 is the surface shapes after rough milling and finish milling. As observed, the surface quality and size accuracy of rough machining are worse than those of finish machining due to the vibration in rough machining [30].   tively. As observed, the surface roughness after rough turning were about Ra = 1.645 μm and Rz = 6.352 μm; the surface roughness after rough milling were about Ra = 1.727 μm and Rz = 6.858 μm; the surface roughness after finish turning were about Ra = 0.236 μm and Rz = 1.283 μm; the surface roughness after finish milling were about Ra = 0.488 μm and Rz = 2.095 μm. Figure 13 is the surface shapes after rough milling and finish milling. As observed, the surface quality and size accuracy of rough machining are worse than those of finish machining due to the vibration in rough machining [30].

Conclusions
Using OLP40 contact probe and Macro programming, the OMM of combined turning-milling machine and compensation machining system are designed. Taking full advantage of the high repeatability and high precision of OLP40 contact probe, the size is measured successfully in machining. The size error is effectively compensated to the set tolerance range. Using this method, path planning, manufacturing, and measurement can be integrated into a single processing machine, and the time of off-machine measurement and repositioning for secondary machining can be saved, thereby significantly improving the production efficiency and product yield and avoiding unnecessary errors. The contact probe needs to be corrected before machining. If there is no center calibration between the machine spindle and the probe, the measurement size will be inaccurate. In this case, accurate compensation machining cannot be realized, resulting in over-cutting of the workpiece. The size error of rough machining is larger than that of finish machining, and the size error of rough machining will increase with the length of the workpiece.
In the future, two or more measurement functions can be used to match the measurement, and the use of mathematical expressions to calculate the more complex dimensions, such as 3D complex surfaces.

Conclusions
Using OLP40 contact probe and Macro programming, the OMM of combined turningmilling machine and compensation machining system are designed. Taking full advantage of the high repeatability and high precision of OLP40 contact probe, the size is measured successfully in machining. The size error is effectively compensated to the set tolerance range. Using this method, path planning, manufacturing, and measurement can be integrated into a single processing machine, and the time of off-machine measurement and repositioning for secondary machining can be saved, thereby significantly improving the production efficiency and product yield and avoiding unnecessary errors. The contact probe needs to be corrected before machining. If there is no center calibration between the machine spindle and the probe, the measurement size will be inaccurate. In this case, accurate compensation machining cannot be realized, resulting in over-cutting of the workpiece. The size error of rough machining is larger than that of finish machining, and the size error of rough machining will increase with the length of the workpiece.
In the future, two or more measurement functions can be used to match the measurement, and the use of mathematical expressions to calculate the more complex dimensions, such as 3D complex surfaces.