Virtual machining considering dimensional, geometrical and tool deﬂection errors in three-axis CNC milling machines

Virtual manufacturing systems can provide useful means for products to be manufactured without the need of physical testing on the shop ﬂoor. As a result, the time and cost of part production can be decreased. There are different error sources in machine tools such as tool deﬂection, geometrical deviations of mov- ing axis and thermal distortions of machine tool structures. Some of these errors can be decreased by controlling the machining process and environmental parameters. However other errors like tool deﬂec- tion and geometrical errors which have a big portion of the total error, need more attention. This paper presents a virtual machining system in order to enforce dimensional, geometrical and tool deﬂection errors in three-axis milling operations. The system receives 21 dimensional and geometrical errors of a machine tool and machining codes of a speciﬁc part as input. The output of the system is the modiﬁed codes which will produce actual machined part in the virtual environment.


Introduction
Since the early 1990s, with the development of computers and digital environments a paradigm shift in manufacturing from 'real' to 'virtual' production has resulted in a build-up of research interests in the field. With the aid of computers, simulating and modeling of a physical manufacturing system become possible in virtual environments. The objective of simulating manufacturing technologies in virtual reality systems is to design a completely digital factory. The part is modeled and produced in a computer simulation environment with predicted errors in order to achieve the best accuracy in the produced part by choosing optimized process parameters. Virtual simulation provides a strong tool for producing and analyzing parts in digital environments in order to decrease cost and time. The main objective is to understand and emulate the behavior of a particular manufacturing system on a computer environment. As a result, a reduction of testing and experiments on the shop floor can be achieved. Machining accuracy of CNC machines is under influence of many errors which cases differences between designed and produced parts. These include force and stress, geometrical deviations of machine tool structure, thermal variations, tool wear as well as servo errors. Among these, the geometric errors of machine tool components and tool deflection errors are of the biggest sources of inaccuracy which need more attention. As a result a virtual machining system which can simulate and include geometric and tool deflection errors in virtual environment, is an effective and necessary system in industry.

Review of research work related to machining in the virtual environment
Lin and Fu [1] developed a Virtual Machine tool Structural Modeler (VMSM) by an interface system to present a machine tool in a virtual reality environment. Several modules such as component modules, module shape library, combination rule library and structure library are presented as architecture of the system. Kadir et al. [2] presented web-based virtual machine tool systems by mathematical modeling in order to take a more scientific approach to real behavior of machine tools and machining process. Virtual reality, web based techniques, mathematical modeling, hardware interactions and STEP-NC-based methodologies are considered in the research study. Yao et al. [3] presented a method for modeling of virtual workpiece with machining errors representation in turning process. They generated a virtual workpiece with geometric errors in the turning process and predicted the errors in a virtual measuring module.
Altintas et al. [4] presented current state of virtual machine tools structures and technologies by using the finite element models and  [5] presented a generalized process simulation as well as optimization strategy for 2½ axis milling operations in order to increase Material Removal Rate (MRR) with avoiding machining errors. Optimal spindle speeds, radial and axial depth of cut are recommended to the process planner by considering the chatter as well as spindle's torque/power limits. In order to predict and improve the performance of three-axis milling operations, a virtual cutting system with generalized process simulation and optimization strategies is presented by Merdol and Altintas [6]. Dimensional and geometrical errors of three-axis CNC milling machines are considered by Soori et al. [7] in order to present a virtual machining system to create actual parts in virtual environments. Volumetric error vectors at each machining path are generated to modify NC codes according to actual machining path. An integrated haptic virtual reality machining environment for the automatic generation of process plans is presented by Fletcher et al. [8] in order to generate practical and usable process plans.
Lin and Shen [9] developed a new application framework as 'enhanced virtual machining' to predict the shape errors of the sculptured surfaces from the machine tool errors quantitatively. They used solid and surface modeling approach to translate the machine's geometric errors into part geometry errors. A virtual machining system for evaluating and optimizing cutting performance of 2½ axis NC machining is presented by Ko et al. [10]. They considered models of cutting force with optimized cutting coefficients as well as error model of machined surface in order to enhance technology of virtual machining. A compensation method for tool deflection and geometric errors of three-axis milling operation by tool path modification is presented by Habibi et al. [11]. Machining codes of milling operation are used in their software in order to find solution and strategy for compensating the errors in terms of precision enhancing.
Suh and Cho presented an investigation on tool path computation by considering tool deflection error [12]. Workpiece geometry, cutting forces and feed rate adjustment via adaptive control are considered to present a compensation method. An enhanced machining simulator with tool deflection error analysis is presented by Dugas et al. [13]. In order to reduce the error, an optimization algorithm is developed by comparing a simulated model with the original geometry model. A compensation method for surface error due to tool deflection errors of a peripheral milling operation is presented by Rao and Rao [14]. Mechanistic model for cutting force estimation as well as cantilever beam model for cutter deflection estimation are used to improve the accuracy of curved geometries in peripheral milling.
De pince and Hascoët [15] presented mirror method for tool deflection error compensation. In this method, amount of tool deflection error based on the cutting forces are compared with pre-defined threshold error to determine steps of the error compensation. An innovative error compensation method by modification of NC codes is introduced by Eskandari et al. [16] to compensate the volumetric errors due to positional, geometrical and thermal errors of CNC milling machine.
There are a few publications in the area of tool deflection and geometrical error enforcement in virtual environments.
All of the proposed virtual machining systems presented so far, have focused on very comprehensive issues of milling operations such as technological review as well as structural analysis of virtual machining.
In the present study dimensional, geometric and tool deflection errors are enforced on the G-Code of parts for producing a real 3D model of machined parts in the virtual environment. The aim is to generate a modified NC code in order to produce real parts in virtual environments system. The input to the system is the initial NC code, geometry of cutting tool, CAD model of rough material, cutting force coefficients as well as dimensional and geometrical errors of the machine tool. The output is an NC code which will produce the actual machined part in the virtual environment.
The methodologies of geometrical errors for the 3-axis milling machine are presented in Section 3. Cutting force modeling for flat end milling tools as well as tool deflection prediction concept are described in Sections 4 and 5 respectively. The algorithm of software for enforcing the geometric and tool deflection errors in virtual environment is presented in Section 6. Finally the experimental validations of the developed algorithms and methods are described in Section 7.

Geometric errors and modeling methodology
Errors in the structure of machine tools such as inaccurate production of its elements as well as incorrect assembly of the elements; corrosion, backlash and accidental collision of moving axis to table or workpiece are the main sources of geometric errors. They have an effect on the accuracy of machined parts by guiding the cutting tool on the undesired machining path.
For a 3-axis milling machine, there are 21 geometric error components as 3 linear positioning errors, 6 straightness errors, 9 angular errors and 3 squareness errors. Fig. 1 shows errors for 3-axis milling machine.
Geometric error components for a 3 axis CNC milling are shown in Fig. 2.
Schematic of six degrees of freedom error motion of a machine tool carriage system is shown in Fig. 3.
The squareness errors between each pair of axis are shown in Fig. 4. Fig. 5 shows all the geometric errors of the moving axis together.
Laser interferometer system is an accurate equipment to measure the 21 dimensional and geometric errors.
Volumetric error vector is the spatial deviation between the nominal and real position of tool. The accurate estimation of volumetric errors vectors in target positions of machining path is the first step of creating a virtual machining system. In order to produce volumetric error vector, the geometric error model is constructed by using a rigid body model, small angle approximation of the error and homogeneous transformations. An appropriate error model can translate numerous parameters of geometrical errors into a single vector. In order to specify the nominal position of any point in space, a common reference should be imposed on the nominal  Where x, y, z are nominal positions and ıx(x); ıy(y); ız(z) are their respective positional errors along x, y, z directions respectively. ıy(x); ız(x); ıx(y); ız(y); ıx(z); ıy(z) are straightness errors, where the first subscript refers to error direction and the second refers to moving direction. εx(x); εy(x); εz(x); εx(y); εy(y); εz(y); εx(z); εy(z); εz(z) are angular errors, where the first subscript refer to axis of the rotation error, and the second refers to moving direction. ϕx(y); ϕx(z); ϕy(z) are the squareness errors between each pair of axes. In the present study, the error models for obtaining geometric errors presented by Okafor and Ertekin [17] are considered. Fig. 6 shows schematic of table and tool coordinate systems for a typical 3 axis milling machine.  The actual position and orientation of the X-axis carriage in reference coordinate system is given as the following equation.
where ε x2 (x) is the roll error of X-axis, ε y2 (x) is the pitch error of X-axis, ε z2 (x) is the yaw error of X-axis, a 2 is the constant offset in X direction between R1 and R2, b 2 is the constant offset in Y direction between R1 and R2, c 2 is the constant offset in Z direction between R1 and R2 and ı x2 (x) is the linear displacement error of X axis.
where ı y2 (x) is the Y straightness of X axis as it moves in X direction, ı z2 (x) is the Z straightness of X axis as it moves in X direction, ˛x y is the squareness error between X and Y axes, ˛x z is the squareness error between X and Z axes, x is the nominal X axis position which amplifies ˛x y to yield and abbe error in Y direction in Eq. (2) and x is the nominal X axis position which amplifies ˛x z to yield and abbe error in Z direction in Eq. (3). Similarly, other matrixes for the actual position and orientation of the Y-axis and Z-axis carriages between base coordinate system of R and coordinate systems of R1 and R3 in Fig. 6 can be shown as Eqs. (A.1) and (A.2) in Appendix A.
Position of work and tool can be shown as Eqs. (5) and (6). where, where W x , W y and W z are the elements of work coordinates on the table and T x , T y and T z are the elements of tool coordinates for X, Y and Z directions respectively, as shown in Fig. 6. Nojedeh et al. [18] presented an overall geometric error vector in their study for showing the effects of all geometrical errors and kinematical deviations of machine tool's moving axes. The

Cutting force model
The cutting force model proposed by Engin and Altintas [19] is used in the present research work. The equations presented by this model can be defined parametrically for different helical end mills. By substituting values for the parameters according to tool envelop geometry, cutting force equations for any type of cutting tools can be obtained. A typical milling operation with a general end mill is shown in Fig. 7 [19].
The differential tangential (dF t ), radial (dF r ) and axial (dF a ) cutting forces acting on an infinitesimal cutting edge segment are given in the following equation.
⎧ ⎪ ⎨ ⎪ ⎩ dF t = K te ds + K tc h(ϕ j , k)db dF r = K re ds + K rc h(ϕ j , k)db dF a = K ae ds + K ac h(ϕ j , k)db (9) where h(ϕ j , k) is the uncut chip thickness normal to the cutting edge and varies with the position of the cutting point and cutter rotation. Where ϕ pj is pitch angle of flute j, ϕ j (z) is total angular rotation of flute j at level z on the XY plane, (z) is radial lag angle and Ä(z) is axial immersion angle. In the differential chip, dz is differential height of the chip segment, ds is the length of cutting edge and h j is height of valid cutting edge from tool tip.
In flat end milling operation, the uncut chip thickness can be shown as the following equation [20].
h(ϕ j , k) = S tj Sin(ϕ j ) (10) where S tj and ϕ j are feed per tooth and radial lag angle of tooth j respectively.
In the ball end milling operation, spherical part of the tool should be considered in calculation of uncut chip thickness and can be shown as Eq. (B.1) in Appendix B [21,22].
db is the projected length of an infinitesimal cutting flute in the direction along the cutting velocity which can be shown as the following equation.
Details of db and Un-cut chip thickness h(ϕ j , k) are shown in Fig. 8.
The edge cutting coefficients K te , K re and K ae are constants and related to the cutting edge length ds. The sheer force coefficients K tc , K rc and K ac are identified either mechanistically from milling tests conducted [23,24] or by a set of orthogonal cutting tests using an oblique transformation method presented by Budak and Tekeli [25]. Sub-indices (c) and (e) represent shear and edge force components, respectively.
The cutting force coefficients, especially the edge (K te , K re , K ae )and radial (K rc ), increase with tool wear, hence they can be calibrated with a worn tool in order to consider the influence of wear on the process [5]. The positions of the cutting points along the flute are evaluated by using the geometric model. The location of the same flute point on the cut surface is identified by using both the rigid body kinematics as well as structural displacements of the cutter and workpiece. In Section 7, coefficients of the edge cutting as well as the sheer force are obtained by an experimental operation to validate the present research work.
Once the chip load is identified and cutting coefficients are evaluated for the local edge geometry, the cutting forces in Cartesian coordinate system can be evaluated as Eq. (12).
The total cutting forces for the rotational position ϕ j can be found by integrating as the following equation. (13) where N f is the number of flutes on the cutter, z 1 and z 2 are the contact boundaries of the flute which is in the cut and Ä j is axial immersion angle of flute j.
In the flat end mill the Ä = 90 • , thus the cutting force of Eq. (14) can be simplified as Eq. (B.2) in Appendix B.

Tool deflection model
Because of tool deflection, cutter is deviated from the theoretical positions given in machining codes. So the cutter moves away for an amount of ı from the desired machining path.
The tool deflection equation used by Rao and Rao [26] and Law et al. [27] is determined as the following equation.
where a is the axial depth of cut, I is the equivalent moments of area. E is Young's module of elasticity and L is the length of tool that is out of spindle.
Using the average of cutting forces of Eq. (13), tool deflection errors at each machining path can be calculated by cantilever beam model of Eq. (14). So, by applying these errors to the G-Codes as explained in Section 6, modified NC codes according to actual machining path can be generated.

Software for enforcement geometric and tool deflection errors
In order to implement the proposed method, a geometric and tool deflection errors enforcement software is developed in this work. The ideal tool path (tool tip and tool orientation) and NC codes are generated by a CAD/CAM system such as SolidCAM. Having the machine tool errors and NC codes input in the software, every geometric and tool deflection error parameter is calculated at each cutter path. Finally the errors are added and applied to the G-Codes and the corresponding modified NC codes according to actual machining path are developed.
The flowchart of the software is shown in Fig. 9.

Software and algorithms verification
Visual Basic programming language is used for the development of this software. It can read G-Code of parts and understand the details of the file for information analysis. The software can apply both geometric and tool deflection errors together or each on its own depending on the user decision. The algorithms of the software is presented in Appendix C.
As scribed before, to calculate the tool deflection error, the cutting force of the milling operation has to be calculated. As a result, a dialog for calculating cutting force according to machining parameters and tool details is designed. In order to calculate the cutting force the software considers 4 models of tools due to different cutting edge angles. Fig. 10 shows the cutting force calculator dialog box.
In order to present the average of the tool deflection error to the operator, a dialog box is provided as shown in Fig. 11.  The new G-Codes are generated by the software in a text format file which can be used by any CAM softwares. These codes are according to the errors and conditions of real machining enviroments.

G02 and G03 conversion
If the machining codes include circular path codes such as G02 and G03, then these codes are broken into small enough segments in order to impose the error effects on them. The user also defines a tolerance parameter, which limits the maximum length of the segments of the arcs after the error implementation. The analytical equation of a typical arc is as the following equation.
x i = x c + R cos(Â) The segmentation algorithm for circular path is illustrated as the following equation.
where Â s is the start angle of arc and dÂ is the angular steps of arc segments. Fig. 12 shows details of circular division for G02 arcs.

The largest error of each axis
Because of time consuming and expensive error compensation methods of all 21 errors of 3 axis machine tools, it is possible to increase machine tools accuracy by reducing the largest error of each axis. Therefore by eliminating or reducing this error, the accuracy of machine tools will improve easily and cost effectively. A side effect of the present work is to find the largest error of each axis of a machine tool in each target positions. The developed software can present a suggestion to the user for increasing the accuracy of the machine tool. This will be by compensating completely or decreasing the largest error of each axis. The software presents all geometric errors to the user starting from largest right down to the lowest. The user can remove or decrease each of the errors and see the effect on the final volumetric error vector. Fig. 13 shows dialog box of geometric error monitoring.

The most suitable position of the machine tool table
Another side effect of the present work is by analyzing the errors of the machine tool, the software can divide the machining area in different sections where each section is labeled according to its error value. This means the software can present the machinist with the most suitable machining area, where the least error is present in the machine tool. So the highest accuracy achieved by the machine tool without any error compensation will be known to the user.

Validation
In order to experimentally validate the virtual machining software, a spline curve as a free form profile is considered for machining and comparison in real and virtual environment. In the current work, geometrical errors of an EMCO VMC600 CNC machine tool are measured by Renishaw ML10 interferometer and 21 geometric error parameters identified. The workpiece material is AL7075T6 and the cutting tool used is HSS flat end mill with 10 mm diameter, helix angel 30 • and flute number 4. The spline profile has 0.33 mm radial and 10 mm axial depth of cut.
Cutting force model of Engin and Altintas [19] is used in this study. In order to estimate the cutting coefficients, the average cutting forces of twenty slot milling tests with 1.5 mm axial depth of cut have been measured by Kistler dynamometer. By increasing the feed rate, average of cutting forces increase linearly which shows a coherent relation between them. For fitting the experimental cutting forces with respect to feed rate, linear curve fitting is used and the diagram is obtained as Fig. 14.
The cutting force coefficients are as Eq. (18).
K tc = 937.334, K te = 5.0386 K rc = 292.067, K re = 6.7597 (18) K ac = 171.37, K ae = −0.83067 After supplying the error measurement data and G-Codes into the software, the error enforced G-Codes are generated. The cutting test was carried out on the same three-axis machine tool in Vericut [28] by generated G-Codes after geometric and tool deflection error enforcement. After machining in Vericut, machined parts were inspected for contour errors at some designated key points by  CAD surface comparator software in order to find the errors of part in virtual environment. Fig. 15 shows profile of the test workpiece.
Machining G-Codes of part without errors are as Fig. 16.
The developed software enforces geometric errors and tool deflection error by error model of Eq. (14). For circular path as G02 and G03 number of sections is taken as 30 by considering 0.01 mm of tolerance for geometric error vector of each point. The new G-Codes are as Fig. 17.
The workepiece is measured by ZEISS CMM machine in order to find error distances of nominal and machined profile. Distances between machined and nominal profiles of real part are shown in Fig. 18.
Distances between each point of virtual machined part and nominal profile is shown in Fig. 19.
Profile errors along the curve length are as Fig. 20. The diagrams show that actual machined part and the one on the virtual environment show a good compatibility.

Conclusion
In the present work, the geometric errors of 3 axis CNC milling machine tool and tool deflection errors are enforced on G-Codes of parts in order to produce actual 3D parts with free form surfaces in virtual environment. Visual Basic programming language is used to develop the virtual machining software. First the information regarding the geometric errors of the machine tool and the machining codes for the specific part are entered to the system. Using geometric error models the new target position of the machining path is produced. Calculating the cutting forces, the amount of tool deflection errors are estimated and enforced on the previously developed machining codes. As a result, a new part is produced in virtual environment according to the actual machining conditions. The software has some suggestion to the user in order to boost the accuracy level of machine tools by simple and easy methods. In order to compare the errors of the virtual and actual machined parts a free form spline is machined using the developed procedure. An 89.3% compatibility is obtained in comparison between real and virtual parts. The results show that the system has the ability of generating real like parts in the virtual environments. According to the knowledge of the authors, the previous studies did not consider the dimensional, geometrical and tool deflection errors in order to present a virtual part by a virtual machining system. Only comprehensive issues of milling operations such as technological review as well as structural analysis of virtual machining are presented in research works of virtual machining. The present system can provide a tool to enhance the quality of produced parts as well as efficiency of parts production. It can also be concluded that the geometric error modeling used in Eqs. (4) and (5) can suitably simulate the errors of a 3-axis CNC milling machine in virtual environment. In addition, it shows that the cutting force models in Eq. (13) as well as the tool deflection prediction concept in Eq. (14) are reliable. The system can be developed further to a 5-axis CNC milling machine in order to generate more sophisticated parts in the virtual environment. The concept used in the present work can also be applied for turning operations. These are the future research work of the authors.
Appendix C.