TECHNOLOGY FOR PROGRAMMING CONTOUR MILLING ON A CNC MACHINE

This paper reports a new technology for designing control programs for contour milling on CNC machines. The technology enables stabilization of the cutting process along the entire contour at the optimal level by controlling the feed, which ensures an increase in productivity when meeting the requirements for restrictions. Moreover, the effectiveness of using the technology improves with an increase in the complexity of the contour by changing the curvature of the surface. A mathematical model has been built for the interaction between the cutter and workpiece in the cutting zone when machining contours with variable curvature, which makes it possible to determine the main characteristic of the cutting process – the rate of cutting the allowance. The technology involves the use of a control program in G codes designed in any CAM system. At the first stage, a shape-formation trajectory in the form of a two-dimensional digital array is derived from the program. At the second stage, the cutter workpiece engagement in the cutting area is modeled simulated while determining the main characteristic of the cutting process – an analog of the material removal rate. And at the final stage, the simulation results are used to design a new control program, also in G-codes, with a new recorded law to control the feed, which enables the stabilization of the cutting process along the entire milling path. The software for the new technology has been developed, which automatically converts the preset control program in G-codes into a two-dimensional digital array, simulates the milling process, and designs a new control program in G-codes based on its results. The results of the experimental study into the milling of the preset contour using the developed simulation program showed an increase in productivity by 1.7 times compared to the original control program, designed in a conventional CAM system


Introduction
Contour 2.5D milling is a widespread operation for machining various contours in the form of pockets, internal and external surfaces of stamps, molds, and other similar parts. All such operations are performed on CNC machines; control programs are designed in a CAM system. From practice, it is known that machining contour surfaces is associated with significant changes in cutting conditions when moving the cutter along the shape-formation trajectory.
Almost all CAM systems correctly design geometric trajectories for the control program, make it possible to check whether the untreated areas of the contour remain, or any collisions might occur, but the cutting process in general remains to be studied. Thus, it can be stated that the choice of feed, speed, and depth of cutting are completely left to the programmer technologist. Therefore, he is forced to intuitively underestimate the cutting mode along the entire trajectory in order to avoid overloading the machine, breaking the tool when machining some areas with the worst cutting conditions.
Thus, scientific and technical tasks to devise automation systems for the preparation of control programs that resolve not only the issues related to geometric design of the shape-formation trajectories but also control over the cutting process remain relevant. Moreover, such control is absent in those CAM systems that are currently used in the industry.

Literature review and problem statement
The most advanced companies in the high-tech market offer CAM systems in which a control program for machining complex surfaces by milling is designed taking into consideration some characteristics of shape-formation (SolidCAM, Siemens NX). Such systems are combined with the common name iMachining, which means «intellectual Machining». It is claimed that the control program takes into consideration the change in machining conditions and leads to stabilization and optimization of the process [1]. However, it is established that stabilization is carried out by controlling the feed, which is formed on the basis of an analysis of the geometric trajectory of shape-formation [2]. At the same time, the cutting process is not considered; it is proposed instead to reduce the range of uncertainty when taking into consideration the rigidity of a particular technological machining system by choosing one of eight possible levels that adapts the estimated machining to actual conditions. This is how it is proposed to overcome standard problems related to the stiffness of a spindle, workpiece, and tool, to avoid excessive vibration [3]. The practical use of iMachining technology makes it possible to improve productivity, although there are untapped control capabilities of the cutting mode, and the level of efficiency would depend on the specific production conditions.
Additionally, based on the analysis of the geometric conditions of shape-formation, Delcam (Autodesk) proposes a Vortex strategy, which is based on the use of special trochoidal trajectories, owing to which a constant cutting angle of the cutter with the workpiece is maintained during cutting [4]. It is argued that such control ensures the stabilization of cutting modes, although it is known from the physics of the cutting process that there is no proportional dependence between the cutting force and the cutting angle. Therefore, stabilization of the cutting angle cannot lead to stabilization of the main characteristics of the cutting processstrength and power.
In addition, when implementing the proposed technology, there are significant problems with the implementation of planned trajectories, especially at high-speed machining (HSM). Therefore, an additional program was developed, Machine DNA Profiler [4], which, as a result of dynamic tests on a particular equipment, provides the necessary conditions for the use of such control. All this greatly complicates the practical use of the proposed technology.
Current research in the field of control over the milling of complex surfaces is aimed at the use of intelligent technologies based on the analysis of the projected interaction of the tool with the workpiece in the cutting zone [5]. The intelligent system analyzes and calculates the rate of removal of the allowance (Material Removal Rate -MRR), focusing on the geometrical parameters of the trajectory of the tool. After that, the cutting force is calculated using a physical model. Subsequently, an intelligent algorithm for optimizing feed speed is implemented, taking into consideration the control of the cutting force with the boundary conditions to control the feed. Thus, the optimization is carried out according to the criterion of the «reference» cutting force, which is maintained constant in all areas of the contour by adjusting the feed. However, the algorithm, similarly to those in previous works, is focused on analyzing the trajectory of shape-formation, which does not make it possible to adequately take into consideration the cutting process itself.
To analyze the machining process, a simulation algorithm is recommended, taking into consideration the image space since in the case of complex trajectories of the tool, it is impossible to give an analytical description of the material removal process [6]. Information obtained as a result of modeling can be used to improve machining efficiency.
The greatest approximation to the evaluation of the actual situation in the cutting zone is achieved taking into account the interaction of the tool with the workpiece. Strategies for control by the trajectories of shape-formation during the machining of complex surfaces by the criterion of maintaining the angle of hooking at the predefined «reference» level are proposed in [7]. However, these solutions are similar to traditional methods of generating the trajectories of the tool, which are usually based on geometric reasoning and cannot take into consideration the different cutting conditions that occur during contour milling.
To obtain the desired surface quality and performance, all the main process parameters, the feed, speed, and depth of cutting must be selected using an accurate milling process model. For accurate simulation of the process, an instantaneous calculation of the geometry of the cutter workpiece engagement (CWE) is required. The hooking of the cutter with the workpiece mainly reflects the location of the input/output of the cutting edge depending on the height, and this is one of the most important requirements for predicting the cutting forces [8]. Two methods of calculating CWE are proposed. The first method employs a discrete model that uses three ortho-gonal dexel fields, and the second method is a model based on the simulation of solids using the Parasolid graphical core. It has been shown that a method based on solid state modeling is faster and more accurate. Obviously, it is advisable to use such methods for three-and five-axis milling with spherical cutters.
Simulation and optimization of the cutting process requires a geometric representation of the interaction of the cutter with the workpiece (CWE) at discrete intervals along the trajectory of the tool. To that end, mainly five systems are used: solid state, frame models, voxel-based models, point models, and analytical models.
The choice of models of the workpiece and tool depends on the direction of simulation, the required accuracy of the results, and the requirements for the time of calculation [9]. To fulfill the requirement of versatility, all related geometries offer to model triangular grids [10]. Calculations of the intersection of a triangle-triangle are performed by implementing logical operations of selection between the models of the tool grid and the workpiece. The analysis shows that to simulate the interaction of the final cutter with the workpiece at 2.5D contour milling, it is enough to use modified point models [11].
A general approach used to plan feed control is the material removal rate (MRR) model. In an MRR-based approach, where the feed is inversely proportional to the average or instantaneous volumetric removal rate, it is proposed to take into account the effect exerted on the mechanics by the cutting process to maintain the average or instantaneous machining efforts at given values [12].
Thus, the issue of designing such an NC program for contour milling that would ensure stabilization of the cutting process along the entire contour at the optimal level remains unresolved. It seems expedient, to optimize the contour milling process, to apply a single-criterion problem with the objective MRR function to the maximum, when assuring all the limitations of the quality of machining. However, the MRR function on the contour is not determined by conventional dependences and, therefore, it is advisable to determine all the main characteristics of the process as a result of digital simulation.

The aim and objectives of the study
The aim of this work is to devise a design technology for the control program of contour 2.5D milling with stabilization of the material removal rate at the optimal level, which will improve the machining performance while ensuring the predefined quality.
To accomplish the aim, the following tasks have been set: -to devise a procedure for converting the G-codes of the control program into two-dimensional digital arrays of the trajectory of shape-forming movements, which will allow the use of simulation technology based on voxel models; -to build a mathematical model of the interaction between the cutter edge and the workpiece in the cutting zone with contour 2.5D milling; -to devise a procedure for simulation the interaction of the cutter and the workpiece in the movement of the shape-forming trajectory with the construction of an MRR change file and determine the law of feed control, which ensures the stabilization of the cutting mode along the contour at the highest possible level; -to build a module for the formation of a new control program in G-codes with control over the cutting mode on a CNC machine; -to implement all devised procedures in the application package and check the effectiveness of the proposed technology.

The study materials and methods
The object of our research is the process of contour 2.5D milling, which is carried out according to the NC program on a CNC machine. Given the need to take into consideration the cutting process, which occurs in the zone of interaction of the cutter edge and the workpiece, we adopted a working hypothesis of designing software control based on the results of preliminary digital modeling of such interaction.
To devise new technology, theoretical methods for studying the geometric interaction of the cutter and the workpiece (CWE) with the construction of appropriate mathematical models were primarily applied. Such theoretical provisions underlie the developed original automation software for all stages of the new technology. The principles of modeling the process of contour milling with the use of digital arrays of models of forming trajectories were formed. The adequacy of the proposed solutions and the projected increase in the performance of contour milling are confirmed as a result of simulating by real software.

1. The procedure for converting the G-codes of the original control program into two-dimensional digital arrays
Contour milling is performed on a CNC machine according to the program designed in any CAM system. Thus, the source data for devising the new technology can be a control program in G-codes. Underlying the design of the new control program of contour 2.5D milling with stabilization of the material removal rate at the optimal level is digital simulation of the interaction between the cutter and workpiece in the cutting zone. Therefore, it became necessary to represent the trajectory recorded in the G-codes of the source program in the form of two-dimensional digital arrays, which will enable such simulation.
Thus, the two-dimensional digital arrays built will solve the problem by numerical method when using the representation of the contour of the workpiece in the form of a voxel model 2D [11].
The trajectories of movement in most cases of CNC systems (ISO 6983/DIN 66025) are set by two types of geometric objects: the segment of the line, and the arc of the circle. Therefore, to solve the problem of forming two-dimensional digital arrays of displacement coordinates, the method of analysis using the regular expression language was used [13,14]. To search, we use a pattern string («template», «mask»), consisting of symbols and metacharacters and determining the search condition. To manipulate text, an additional replacement string is set, which can also contain special characters.
The devised algorithm makes it possible to select the type of section in the text file of the control program (G01straight line, G02, G03 -arc of the circle) and determine all the necessary numerical parameters for these sections: the coordinates of the beginning and end, and, for the arc of the circle, there is also a radius. Hereafter, trajectory segmenta-tion is used, which leads to the construction of digital arrays at a predefined step. Arrays of digital data on the sections of the line are calculated from the following dependences: where x A , y A are the start coordinates; x B , y B are the coordinates of the end of the section; h is the calculation step; α is the angle of inclination of the section. Calculation is performed to the condition: If the element of the trajectory is an arc, then in the G-codes of the control program it can be represented in different ways. However, in any case, segmentation will be carried out using the coordinates x С , y С of the center of the arc, radius R, and step δ at the angle: the calculation is performed to the condition: The segmentation function is performed only for work movements since no cutting occurs during idling.
The next step is the preparation of digital arrays of the workpiece contour. For this purpose, formulas (1), (2) are used, similar to those presented above, with the replacement of radius R of the shape-formation trajectory with the radius of the cutter. The digital arrays of the workpiece contour are built by the digital arrays of the trajectory only on the first pass.
Hereafter, all stages in the development of programming technology are considered on a specific example of contour milling using the original developed software. Fig. 1, a shows the estimation-technological scheme to form the trajectory of the cutter for machining the contour formed by two straight, conjugated arc circles. The workpiece has an equidistant allowance with a thickness of 3 mm. The control program (Fig. 1, b) used the coordinates of the sections of the trajectory of the center of the cutter during cutting and the cutting mode recommended in [15] for the mill ∅20 mm when machining carbon steel with an allowance of 3 mm and a thickness of 10 mm: spindle speed, 2000 rpm; feed, 750 mm/min.
The transformation of the predefined machining trajectory into two-dimensional digital arrays is performed in a special program (Fig. 2) according to the algorithm described above using the language of regular expressions.
The program uses the «Load file G-code» button, which opens a dialog box, loads the source file of the control NC program in G-codes (Fig. 1, b). Then the desired step of the digital array is selected, and the generated arrays of the cutting trajectory and the workpiece contour appear in the graphical field and can be saved in a separate file in *.txt format.

2. Mathematical model of the interaction of the cutter blade with the workpiece in the cutting zone
All the data obtained are necessary and sufficient to model the cutting process. In the process of modeling, to determine the geometrical parameters of the interaction of cutters and workpiece, two main processing algorithms for previously constructed digital arrays are used, represented in [11].
The first algorithm determines the coordinates of the start and end points of the cutting arc, and the second rearranges the output digital arrays of the workpiece contour. Before the beginning of the cutting arc, the digital array is complemented by the coordinate of this point, followed by the coordinates of the points of the cutting arc to the end point and then the output array of the workpiece. At the same time, the numbers of digital arrays are rebuilt for the next step of modeling. Thus, the cutting arc moves along the contour of the workpiece in accordance with the feed direction, and the contour of the workpiece at each step consists of a processed contour, part of the tool's surface, and a contour processed on the previous pass.
This approach makes it possible at each step of the simulation to evaluate the cutting process by the size of the angle of the cutting arc j and the main strength characteristics. Since the milling process is inherently jerky, cutting conditions are more expedient to estimate by the average cutting force correlated with MRR [16]. At the same time, it is also possible to estimate the instantaneous values of the cutting force and its components [11]. MRR is determined by the dependences derived from the analysis of the geometric interaction of the mill and the workpiece as the area of the figure A 1 B 1 A 2 B 2 , which is formed when the cutter moves along the trajectory of the equidistant by the value of the feed f t per tooth (Fig. 3). Obviously, the area of such a figure is equal to the area of the figure A 1 CDA 2 , which can be defined as the difference in the area of sectors: where R c is the radius of the curvature of the contour; R m is the radius of the mill; H is the depth of cutting. Given that f t <<R m , the cutting depth can be determined through the cutting angle j: H = R m (1-сos j), and the sector angle: α = f t /(R c ±R m ). In (3), the «-» sign is for the concave contour, the «+» sign is for the convex contour.
As a result of simple algebraic transformations, the analog MRR, which corresponds to the area of the figure A 1 B 1 A 2 B 2 , is determined from the following formula: Analysis of the resulting formula proves its versatility. All parameters included in it are calculated by numerical simulation of the contour milling process.
The cutting angle is determined at each step of the simulation when the first algorithm for machining previously built digital arrays functions: where x e , y e are the coordinates of equidistant points; the sign «+» is at x A <x e and x B >x e , the sign «-» otherwise. When machining rectilinear contours R c →∞, therefore, for (4), it having place face uncertainty of the ∞/∞ type. After applying Lopital's rule to reveal such uncertainty, we obtain: which corresponds to the known formula for a particular case of machining the rectilinear section of the contour [16].

3. Modeling the interaction of cutters and blanks with the formation of an MRR file determining the law of feed control
At the next stage, simulation of the milling process is performed in a program developed in an object-oriented environment (Fig. 4). The data for modeling are in a file built at the previous stage and loaded into the program from the interface. It is recommended to choose the feed according to the maximum permissible cutting force (550 N) in accordance with the methodology and dependence (7) at the stage of preceding modeling. Therefore, the feed recommended for machining flat surfaces was reduced to 450 mm/min.

Fig. 4. Simulation program interface
When simulating on the screen of the oscilloscope, synchronously with the animation of the process in the graphical interface window, the main characteristics of the process, calculated according to the constructed mathematical model, appear. The cutting force is determined from known formulas using the specific cutting force, or coefficients of the linearized dependence from [15], and then integrated dependences [11]. A plot of the change in cutting force when simulating contour milling also appears on the virtual oscilloscope screen.
It can be stated that the cutting force depends on the analog MRR, which, in the process of contour milling, changes during the movement along the trajectory of shape formation. To stabilize the process, it is necessary to determine the optimal level of cutting force, which should be maintained by controlling the cutting mode. It is known that tool manufacturers recommend a certain mode of cutting milling rectilinear areas, depending on the brand of tool material and the material of the workpiece [15].
Contour milling is characterized by a change in MRR, so the mode recommended by the company for milling surfaces with an established MRR must be adapted to the worst cutting conditions when cutting contour milling. Consequently, the feed f t per tooth of mill should be reduced compared to the recommended f tr : where MRRmax, MRRmin is the maximum and minimum MRR value in the preceding simulation of the process using (4). Practice proves that it is advisable to accept the mode recommended by the manufacturer of the tool as optimal. Then, to stabilize the cutting process at the predefined level when moving along the entire contour in the function of the cutting path l, it is necessary to change the feed (mm/min) according to the following law: where MRR(l) is the MRR value at a specific point in the process (4), n is the number of cutter teeth, Ω is spindle speed (rpm). The machining process ends in 6.4 s and it is possible to save the simulation results file with the main characteristic (MRR), which evaluates the cutting process, for use in the next stage.

4. Module for forming a new control program in G-codes
Control over the milling process on a CNC machine is carried out according to the program recorded in G-codes. However, when simulating, an array of feed data was obtained, the size of which corresponds to the number of steps of execution of the numerical simulation algorithm. Such a large size of the program in G-codes can cause a certain delay in its implementation on a CNC machine. Therefore, somebody decided to discretize the resulting array by the initial value of the interval with reference to the coordinates of the movement according to the equidistant. Such sampling means converting a feed array with the predefined step to an array with the selected value of the change step threshold. For this purpose, the text of the source program is used, changing the reference points of switching the feed in accordance with the converted feed data sets.
To solve the problem, a special program was developed (Fig. 5) where the design of the law of supply control by numerical methods is carried out.
A simulation file is loaded into the program, which, when one presses the «Process» button, is automatically processed according to (8). As a result, a digital array of the law of feed control is formed, which would ensure the stabilization of the milling process at the optimal level (Fig. 5). The devised law of control represents a discrete function, the sampling step of which is equal to the step of the initial representation of digital arrays that were built during the simulation of the process.

Fig. 5. NC control design program interface
Based on the real possibilities of implementing control programs on CNC machines, the next stage is proposed, at which the procedure for sampling the resulting array with the predefined percentage of the change step is performed. Such an algorithm is embedded in the application program, the interface of which is shown in Fig. 5. It is possible to choose the percentage of sampling of the devised law of feed control. The algorithm changes the digital feed array in such a way that in the new array the previous feed value is stored until its value exceeds the amount specified by the selected step of sampling. The process is then repeated with a new feed value.
The program selected the value of a change in the threshold of 10 %, and the result of the received law of control is recorded in the program designed by NC. The new control NC program in G-codes contains 20 frames according to changes in the feed values at all sections of the milling path.

Experimental study
The effectiveness of the devised control can be assessed using the developed process simulation program. To this end, the program provides an option to download the control program ( Fig. 4: Control «off -on») in the form of digital arrays for changing the feed of the previously obtained control law with reference to the coordinates of the cutting trajectory. Fig. 6 shows the results of modeling the process of milling the predefined contour with the control of the feed. Anybody sees that the main characteristics of MRR and the cutting force have changed their character, the range of change during the milling of the contour has decreased, and, when milling the concave area, the cutting force does not exceed the permissible value. It should be noted that when simulating, in order to evaluate, we left cutting and output areas of the tool as such at which the cutting conditions change. As a result, for milling the predefined contour, an increase in productivity of 1.7 times was achieved. Sure, the more complex the contour, the higher the effectiveness of the proposed technology.

Discussion of 2.5D contour milling programming technology
The devised technology for preparing control programs for contour 2.5D milling on a CNC machine is aimed at solving the problem of controlling the cutting mode in order to stabilize it at the optimal level. Our solution was possible due to the use of a numerical method for simulation the milling process with the automatic determination of the parameters of the interaction between the tool and workpiece (CWE) in the cutting zone along the entire milling path (Fig. 4). That is why this solution is significantly different from known attempts to design control over the cutting process, for example [3], which provides new properties. The simulation is based on the constructed mathematical model (4) based on the use of a generalized characteristic, material removal rate (MRR), which makes it possible to determine the law of feed control (8), which leads to the stabilization of the cutting process along the entire contour.
The technology should be used in parallel with CAM systems and is supported by the developed software that focuses on the possibility of use in the industry. The source data for the use of the devised technology is the control NC-program in G-codes, which was built when using the CAM system. Such a program is automatically converted into two-dimensional digital arrays of coordinates of geometric shape formation at a predefined step (Fig. 3). It is such arrays that make it possible to perform process modeling with the determination of its main characteristic -MRR. And, according to the results obtained, a specially developed application program (Fig. 5) automatically designs an NC program with a change in the feed according to the defined law (8).
Modeling the resulting control in comparison with the primary program in G-codes (Fig. 6) convincingly proved its effectiveness -for the predefined contour, the machining performance increased by 1.7 times.
So far, the technology supports contour 2.5D machining, but the laid principles make it possible to hope for an expansion of the scope of application for milling any 3D surfaces of parts, including finishing cutters of spherical shape.
However, for successful implementation in the industry, it is necessary to significantly refine the software, combine all developed software products into a single CAM system, test it on parts with different contours. It is planned to expand the capabilities of the technology for 3D machining using the developed numerical methods when representing the 3D surface as two 2D contours, for each of which it is possible to solve the problem of the proposed technology.

1.
A new 2.5D contour milling technology has been devised for a CNC machine, which makes it possible to design a control program with stabilization of the cutting process at an optimal level, which ensures an increase in productivity during machining (from 20 % to 60 %) with compliance with the requirements for restrictions. Moreover, the effectiveness of the use of technology increases with an increase in the complexity of the contour by changing the curvature of the surface.
2. A mathematical model has been constructed of the interaction of the mill with the workpiece in the cutting zone during the machining of contours with variable curvature, which is primary, the study of which was carried out with the help of the devised procedure of numerical simulation. This approach makes it possible to determine the main characteristic of the cutting process, material removal rate (MRR).
3. The technology involves the use of a control program in G-codes, designed in any CAM system. At the first stage, the trajectory of shape formation is pulled from the program in the form of a two-dimensional digital array. At the second stage, the interaction of the tool and the workpiece in the cutting area is modeled while determining the main charac-teristic of the cutting process -the material removal rate. Thus, we have automated the process of creating objective information about the cutting process, which makes it possible to design adequate control. 4. The algorithm and software of the module of designing the law of feed control at a predefined step of its sampling have been proposed. Such a control law is recorded in a new control program in G-codes, which ensures the stabilization of the cutting process along the entire milling path and can be directly used on the machine. 5. The results of the experimental study of milling the predefined contour using the devised technology, which is based, unlike known ones, on the analysis of the interaction of the tool and the workpiece in the cutting zone, proved its effectiveness. With the help of the developed software for the predefined contour, an NC program was designed, the simulation of which showed a 1.7-fold increase in performance compared to the original control program, which was designed in a conventional CAM system.