Development of an Analyzing and Tuning Methodology for the CNC Parameters Based on Machining Performance

: This paper proposes the development of a tuning methodology which can set the proper values of the Computer Numerical Control (CNC) parameters to achieve the required machining performance. For the conventional operators of machine tools, the CNC parameters were hard to be adjusted to optimal settings, which was a complicated and time-consuming task. To save time in ﬁnding optimal CNC parameters, the objective of this research was to develop a practical methodology to tune the CNC parameters e ﬀ ectively for easy implementation in the commercial CNC controller. Firstly, the e ﬀ ect of the CNC parameters in the CNC controller on the tool-path planning was analyzed via experiments. The machining performance was deﬁned in the high-speed (HS) mode, the high-accuracy (HP) mode, and the high-surface-quality (HQ) mode, according to the dynamic errors of several speciﬁed paths. Due to the CNC parameters that have a particularly critical e ﬀ ect on the dynamic errors, the relationship between the CNC parameters and the dynamic errors was validated by the measured data. Finally, the tuning procedure deﬁned the anticipated dynamic errors for the three machining modes with the actual machine. The CNC parameters will correspond with anticipated dynamics errors based on several speciﬁed paths. The experimental results showed that the HS mode was the fastest to complete the path, and the completion time of the HP and HQ modes were increased by 37% and 6%, respectively. The HP mode had the smallest dynamic errors than other modes, and the dynamic errors of the HS and HQ modes are increased by 66% and 16%. In the HQ mode, the motion oscillation was reduce signiﬁcantly, and the tracking error of the HS and HP modes were increased by 85% and 28%. The advantage of the methodology is that it simpliﬁes set-up steps of the CNC parameters, making it suitable for practical machine applications. ( V c ), arc velocity ( V a ), and smoothing time constant ( T a ) for the velocity proﬁle with path velocity ( V p ), and, ﬁnally, the completed position command required for each axis ( S cx , S cy , S cz ). The most important function of the controller’s interpolator is making the velocity proﬁles of each axis as smooth as possible to avoid tool-path drastic speed changes. The drastic speed changes would produce force, causing machine deformation or oscillation during the machining process, which would a ﬀ ect the accuracy of the workpiece and surface. This study adjusted the parameters and analyzed the experimental results with an actual machine to develop the tuning methodology for machining modes.


Introduction
There are many kinds of products produced with Computer Numerical Control (CNC) machine tools. According to the workpiece weight, geometric shape, material, tools, and cutting conditions, the operator needs to estimate the proper manufacturing processes, so the machining requirements will not be the same. Some products require an extremely smooth surface, such as plastic injection molds, while others require high geometrical accuracy and little tolerance, such as precision machine elements (cf., gears), and still others require high cutting efficiency (i.e., material removal rate) and allow larger tolerance, such as the aluminum brackets for bicycle or aerospace. This situation is why machine tools have focused on how to accomplish high-surface-quality (HQ), high-accuracy (HP) and high-speed (HS) machining. Most of the commercial CNC machine tools are equipped with a standard set of CNC parameters, which are not changed according to the different machining demands. The standard set of A number of studies have analyzed the effects of the tool-path planning to follow the desired contours, and jerk control strategies have been proposed [1][2][3][4]. According to the path distance and feedrate of the NC code, the form of the acceleration profile must first be defined by the presetting of jerk and acceleration for CNC parameters; the acceleration profile of the triangle or trapezoid was planned. Some literature introduced the advanced method for interpolation, such as Non-Uniform Rational B-Splines (NURBS) and Bazier [5,6]. Sencer et al. [7] literature presented the algorithm with learning for NC code re-established. Therefore, the objective of the tool-path planning is to ensure the feedrate can be smoothed for precision results as required. Tapie et al. [8] proposed the circular tests for high speed machining, and proposed the limit values of jerk, acceleration, and circular velocity. However, the tool path is not only a circular path, but also contains straight and corner paths. This study did not discuss the other CNC parameters. Pateloup et al. [9] presented the corner optimization. However, it proposed the corner with arc path for pocket machining. In general, the The goal of this study was to analyze the relationships among machining modes, CNC parameters, and dynamic errors, followed by developing the tuning procedure which can tune the proper values of the CNC parameters to match the selected machining mode; it is shown on the red dot frame in Figure 1. Firstly, an analysis of the CNC parameters based on algorithm of tool-path planning in the conventional controller, and the principle of tool-path planning was organized. It proposed the dynamic errors chain that we have to observe in actual machine tools. In this paper, dynamic errors signify the deviation between the position of the NC code and the actual position of the feed drive system. It contains two parts: One part is the difference between the S g and S c , another part is the difference between the S c and S a . Secondly, we experimented on the machining modes with different CNC parameters and collected data. It presents a tuning criteria for the three machining modes and CNC parameters. Finally, this study adjusted the CNC parameters and analyzed the experimental results with an actual machine to develop the tuning methodology for machining modes. It proposes the tuning methodology and procedure for the CNC parameters based on machining requirements.
A number of studies have analyzed the effects of the tool-path planning to follow the desired contours, and jerk control strategies have been proposed [1][2][3][4]. According to the path distance and feedrate of the NC code, the form of the acceleration profile must first be defined by the presetting of jerk and acceleration for CNC parameters; the acceleration profile of the triangle or trapezoid was planned. Some literature introduced the advanced method for interpolation, such as Non-Uniform Rational B-Splines (NURBS) and Bazier [5,6]. Sencer et al. [7] literature presented the algorithm with learning for NC code re-established. Therefore, the objective of the tool-path planning is to ensure the feedrate can be smoothed for precision results as required. Tapie et al. [8] proposed the circular tests for high speed machining, and proposed the limit values of jerk, acceleration, and circular velocity. However, the tool path is not only a circular path, but also contains straight and corner paths. This study did not discuss the other CNC parameters. Pateloup et al. [9] presented the corner optimization. However, it proposed the corner with arc path for pocket machining. In general, the corner path consists of two short lines, and the limit of corner velocity avoids the vibration after the corner motion. This study did not obtain the corner velocity of CNC parameters.
Andolfatto et al. [10] presented the dynamic errors at the tool center point, and included the contour error caused by a closed loop feed drive system and actual error from the machine structure that defined the feedback position to relate tool center point. However, this study did not discuss the error caused by CNC parameters. Lee et al. [11] also established a servo parameter tuning method based on the corner error. The experimental results based on the corner error measurements showed that the proposed tuning methods are very effective in improving the corner accuracy of a three-axis high-speed CNC machine tool. Parenti et al. [12] proposed the acceleration spectrum of the acceleration profiles which exert significant effects on the behavior of the dynamic errors in the CNC machine tools at the tool center point. Bringmann et al. [13] introduced a measurement device based on the "R-test" for measuring displacements in the three linear degrees of freedom, and for evaluating the dynamic errors of the machine at the tool center point. The CNC parameters, such as jerk and acceleration limits, can be set to obtain the required dynamic path accuracy. However, the proposed tuning method was proven only for the HP mode, and not for the HQ or HS mode. Li et al. [14] presented the different feedrate effect on the dynamic errors of the feed drive system. This proposal was useful for HQ mode, but this study did not have any solutions to tune the other modes.
Some studies have analyzed the influence of motion errors for the machining performance. Some scholars focus on the dynamic errors caused by tool geometrics [15][16][17]. It is dependent on a larger machine and the dynamic errors' source on machine structure. Mia et al. [18] presented intelligent optimization of hard-turning parameters. This paper proposed the evolutionary algorithms for cutting conditions. Their dynamic errors adjust method was to change the cutting conditions. The main disadvantage is that the error between the measuring tool center point and the geometry of NC code must be considered. This is not a trivial task for the machine's operator. Li et al. [19,20] introduced the ambient environmental temperature effect on the positioning accuracy of moving carrier on machine tools. Therefore, the carrier embedded cooling channels to achieve thermal error suppression, and the machine tools were operated in an air conditioning chamber in which the temperature could be controlled. However, the variation of accuracy caused by thermal deformation of machine tools comes from the long-term machining. Actually, there are not any CNC parameters to solve the problem of thermal displacement.
Several works developed the virtual machine tool technology which predicts the contour error of the closed loop feed drive system of the CNC machine tools [21][22][23][24][25][26]. However, the virtual machine tool technology proposed by these previous works involved a mechatronic model which integrated the servo driver, mechanics of the feed drive mechanism, and the dynamics of the machine structures. Although the effects on the dynamic errors after changing the CNC and servo parameters have been studied, they did not establish or propose any tuning algorithm to switch the machining performance between HS, HP, and HQ modes.
Conventional controllers have been provided with the functions of the HS, HP, and HQ modes in the CNC machine tools; they are predominantly used in trajectory generation [27,28]. When the user selects a machining mode, the controller has to process feedrate with the NC blocks. In order to achieve the machining strategy, the control method has to match the tolerance value of the path contour via a relevant NC program. However, the algorithm of different machining modes isn't included in the feed drive system of real CNC machine tools; the function is merely processed in the interpolation of the controller. This paper presents a tuning methodology for the CNC parameters, and, hence, matches the machine's dynamic errors according to the selection of machining modes which are set by the mixed combination of three machining modes: The HS mode, HP mode, and HQ mode. The relationship between CNC parameters and dynamic errors is defined in Section 2. Section 3 uses simple paths to test the tuning criteria of the CNC parameters and different machining requirements. The tuning methodology and procedure of the CNC parameters based on machining modes were implemented in this section. In Section 5, the CNC parameters were estimated based on the relevant machining modes for experimental validation. Finally, the conclusion is presented in Section 6.

Tool-Path Planning in the CNC Controller
The function of the interpolator is to generate the velocity profile of the tool path, so the interpolator needs to provide smooth velocity change during the contour machining via a multi-axis machine tool. The tool-path planning algorithm maintains a smooth velocity transition during the high-speed feed motion. Most commercial CNC controllers use S-curve velocity profile along with the function of jerk control. According to the specific feedrate and displacement from the NC code, the kinematic profiles (velocity) are generated by the interpolator in the CNC controller with the CNC parameters (jerk, acceleration, and time constant of the acceleration/deceleration (Acc/Dec)). Figure 2 shows the typical trapezoidal acceleration profile. For feed motion along the tool path, acceleration profiles are linear, velocity profiles are parabolic, and position profiles are cubic for regions 1, 3, 5, and 7 where time constant of Acc/Dec with constant jerk occurs. Acceleration values are constant and jerk is zero for regions 2 and 6, where velocity profiles are linear and position profiles are parabolic. In region 4, jerk and acceleration values are zero, velocity is constant, and position is linear. If the feed motion has the greatest acceleration, the acceleration profile does not have the regions 2 and 6. When the triangular acceleration profile has been generated, the result is no constant acceleration, but it has a short acceleration peak. While this profile is useful to reduce machining time, it has very high requirements on the performance of the machine. Finally, the result of the tool-path planning is divided into the position command of each feed axis to enter the servo loop, and the motor that drives each feed axis reaches the position required for the workpiece shape.
Actually, the tool-path geometry not only consists of a straight path, but also includes circular and curved paths generated from many short lines. The general purpose machine tool consists of three mutually perpendicular linear axes, and the multi-axis synchronous motion makes the tool-path process a complex shape. Figure 3 shows the tool path with complex shape. It consists of many short lines. When the X and Y axes are in synchronous motion for the tool path, the path velocity will be reduced to distribute the X-axis velocity (V x ) and Y-axis velocity (V y ). The P 1 and P 2 are the corner motion. The feedrate must be decreased at t P1 and t P2 (as shown in Figure 3). One of the CNC parameters is to set a corner velocity (V c ) for the tool-path planning; the V c is composed of the V x and Appl. Sci. 2020, 10, 2702 5 of 21 V y . The purpose is to define the time point at which the V y starts to increase velocity when the V x has decelerated to the V c . three mutually perpendicular linear axes, and the multi-axis synchronous motion makes the toolpath process a complex shape. Figure 3 shows the tool path with complex shape. It consists of many short lines. When the X and Y axes are in synchronous motion for the tool path, the path velocity will be reduced to distribute the X-axis velocity ( ) and Y-axis velocity ( ). The and are the corner motion. The feedrate must be decreased at and (as shown in Figure 3). One of the CNC parameters is to set a corner velocity ( ) for the tool-path planning; the is composed of the and . The purpose is to define the time point at which the starts to increase velocity when the has decelerated to the .  The NC code is circular with the radius ( ), and the circular path is composed of the X-axis and the Y-axis. In fact, the path velocity ( ) has to be consistent, while the and are changing path process a complex shape. Figure 3 shows the tool path with complex shape. It consists of many short lines. When the X and Y axes are in synchronous motion for the tool path, the path velocity will be reduced to distribute the X-axis velocity ( ) and Y-axis velocity ( ). The and are the corner motion. The feedrate must be decreased at and (as shown in Figure 3). One of the CNC parameters is to set a corner velocity ( ) for the tool-path planning; the is composed of the and . The purpose is to define the time point at which the starts to increase velocity when the has decelerated to the .  The NC code is circular with the radius ( ), and the circular path is composed of the X-axis and the Y-axis. In fact, the path velocity ( ) has to be consistent, while the and are changing The NC code is circular with the radius (R), and the circular path is composed of the X-axis and the Y-axis. In fact, the path velocity (V p ) has to be consistent, while the V x and V y are changing constantly, and each axis is constantly accelerating and decelerating at the same time. Tapie et al. [8] showed that the velocity profiles are similar to the sine wave during the feed motion. There are two kinds of CNC parameters to limit the velocity of the circular path for the interpolator in a commercial controller. One is the arc velocity (V a ) and the other is centripetal acceleration (A c ). The feedrate of NC code (V f ) is similar to the V p , but the V f is only used in the velocity of the circular path for the tool-path planning. The relationship between the centripetal acceleration and the arc velocity is expressed as: When V f is larger than the feed motion, the greater centripetal acceleration is excited, causing the error between the circular path and the ideal path at the same time.
The flow chart of the tool-path planning was organized as shown in Figure 4. According to the path geometry and feedrate of the NC code, the form of the acceleration profile must first be defined. The profile of the triangle or trapezoid was planned by presetting jerk (J p ), acceleration (A p ), and time constant of the Acc/Dec (T p ). These values can be preset by the CNC parameters of the controller. The actual acceleration (A p ) will be defined by the tool-path planning. It includes the corner velocity (V c ), arc velocity (V a ), and smoothing time constant (T a ) for the velocity profile with path velocity (V p ), and, finally, the completed position command required for each axis (S cx , S cy , S cz ). The most important function of the controller's interpolator is making the velocity profiles of each axis as smooth as possible to avoid tool-path drastic speed changes. The drastic speed changes would produce force, causing machine deformation or oscillation during the machining process, which would affect the accuracy of the workpiece and surface. This study adjusted the parameters and analyzed the experimental results with an actual machine to develop the tuning methodology for machining modes. error between the circular path and the ideal path at the same time.
The flow chart of the tool-path planning was organized as shown in Figure 4. According to the path geometry and feedrate of the NC code, the form of the acceleration profile must first be defined. The profile of the triangle or trapezoid was planned by presetting jerk ( ), acceleration ( ), and time constant of the Acc/Dec ( ). These values can be preset by the CNC parameters of the controller. The actual acceleration ( ) will be defined by the tool-path planning. It includes the corner velocity ( ), arc velocity ( ), and smoothing time constant ( ) for the velocity profile with path velocity ( ), and, finally, the completed position command required for each axis ( , , ). The most important function of the controller's interpolator is making the velocity profiles of each axis as smooth as possible to avoid tool-path drastic speed changes. The drastic speed changes would produce force, causing machine deformation or oscillation during the machining process, which would affect the accuracy of the workpiece and surface. This study adjusted the parameters and analyzed the experimental results with an actual machine to develop the tuning methodology for machining modes.

The Dynamic Errors' Chain Corresponding to the Trajectory Generation
Dynamic errors signify the deviation between the path of the NC code and the actual path. They contain the error from the NC code after interpolation in the controller that is a command error. In Figure 1, the command error ( ) is the deviation between the original command from the NC code ( ) and the position command ( ) through the interpolator, expressed as: The command error represents the influence of the CNC parameters in the tool-path planning. Contour error ( ) is another dynamic error, caused by the dynamic characteristics of the servo loop and feed drive system. The corresponding contour error is the deviation between the position command ( ) and actual position ( ) expressed as:

The Dynamic Errors' Chain Corresponding to the Trajectory Generation
Dynamic errors signify the deviation between the path of the NC code and the actual path. They contain the error from the NC code after interpolation in the controller that is a command error. In Figure 1, the command error (ε 1 ) is the deviation between the original command from the NC code (S g ) and the position command (S c ) through the interpolator, expressed as: The command error represents the influence of the CNC parameters in the tool-path planning. Contour error (ε 2 ) is another dynamic error, caused by the dynamic characteristics of the servo loop and feed drive system. The corresponding contour error is the deviation between the position command (S c ) and actual position (S a ) expressed as: where S c and S a are position command and actual position, respectively. Numerous studies [4,11,17] used the contour error to analyze the performance of machine tools. The phenomenon of servo delay causes position error, called tracking error, on a single axis, and is named as contour error if the path was simultaneously moving by multi-axis. The dynamic errors (ε 3 ) include ε 1 and ε 2 , introduced as: The ε 1 was caused by the interpolator in tool-path planning, while the ε 2 was caused by the closed loop feed drive system of the machine. Figure 5 shows the dynamic errors chain with ε 1 and ε 2 for the corner path and the circular path, respectively. In the following description, we focused on the development of the HS/HP/HQ mode by observing the dynamic errors during the axis movement.

The
was caused by the interpolator in tool-path planning, while the was caused by the closed loop feed drive system of the machine. Figure 5 shows the dynamic errors chain with and for the corner path and the circular path, respectively. In the following description, we focused on the development of the HS/HP/HQ mode by observing the dynamic errors during the axis movement. The tool-path planning purpose is to control the path velocity and slow down the velocity change of each axis when the machine moves along the three-dimensional path. When the velocity of each axis changes drastically, the generation of acceleration causes the machine to be stressed and thus generates errors and vibrations.

CNC Parameters' Tuning Criteria for the Machining Modes
Different workpieces have different requirements in the machining process, such as aerospace or difficult-to-cut materials, which require higher efficiency for material removal; the surface quality and accuracy are not the priority requirements, as defined in the HS mode. Regarding the structure of the wing used in aerospace, the product demand is high geometric accuracy. As surface quality was not the priority requirement for this product, it was defined via the HP mode. The mold of the optical component needs to have good surface quality and the accuracy needs at least to match the requirement, so it defines with the HQ mode. The tuning criteria of the CNC parameters for the three kinds of the machining mode are summarized in Figure 6. The relationship between the CNC parameters' tuning criteria of the three machining modes is defined below: • HS mode: The objective is to set the feed motion of machine tools suitable for the larger dynamic errors. It will finish the tool path with the shortest time for motion. In order to reach the target, the CNC parameters' values of jerk, acceleration, corner velocity, and arc velocity must be The tool-path planning purpose is to control the path velocity and slow down the velocity change of each axis when the machine moves along the three-dimensional path. When the velocity of each axis changes drastically, the generation of acceleration causes the machine to be stressed and thus generates errors and vibrations.

CNC Parameters' Tuning Criteria for the Machining Modes
Different workpieces have different requirements in the machining process, such as aerospace or difficult-to-cut materials, which require higher efficiency for material removal; the surface quality and accuracy are not the priority requirements, as defined in the HS mode. Regarding the structure of the wing used in aerospace, the product demand is high geometric accuracy. As surface quality was not the priority requirement for this product, it was defined via the HP mode. The mold of the optical component needs to have good surface quality and the accuracy needs at least to match the requirement, so it defines with the HQ mode. The tuning criteria of the CNC parameters for the three kinds of the machining mode are summarized in Figure 6. The relationship between the CNC parameters' tuning criteria of the three machining modes is defined below: • HS mode: The objective is to set the feed motion of machine tools suitable for the larger dynamic errors. It will finish the tool path with the shortest time for motion. In order to reach the target, the CNC parameters' values of jerk, acceleration, corner velocity, and arc velocity must be increased. At the same time, the HS mode will cause larger oscillation after the Acc/Dec motion, and it will mark the vibration texture on the surface. • HP mode: The dynamic errors should be kept to a minimally tight tolerance. The motion path is close to the ideal path of the NC code. In order to reach the goal, the values of jerk, acceleration, corner velocity, and arc velocity must be reduced for HP mode. Therefore, the smaller values of the CNC parameters result in larger cycle time. • HQ mode: The goal is to obtain a smoother machining surface. This means that we must maintain minimal oscillation during feed motion. In addition to reducing the values of jerk, acceleration, corner velocity, and arc velocity, smoothing time constant must be provided to restrain the mechanical resonance. The magnitude of the dynamic errors is between the HS mode and HP mode. In the HQ mode, the motion hardly oscillates, and, therefore, contributes to the smooth surface quality on the geometric surface of the product. maintain minimal oscillation during feed motion. In addition to reducing the values of jerk, acceleration, corner velocity, and arc velocity, smoothing time constant must be provided to restrain the mechanical resonance. The magnitude of the dynamic errors is between the HS mode and HP mode. In the HQ mode, the motion hardly oscillates, and, therefore, contributes to the smooth surface quality on the geometric surface of the product.

Experimental Platform
The experiments were performed on a three-axis machine tool with SYTEC's PC-based CNC controller, and DELTA's ASDA-A2 servo motor and servo driver. The absolute encoder was implemented in the servo motor and the linear scale was mounted on the feed drive system. The resolution of linear scale was 1 for the HEIDENHAIN LS100-series. The software of ASDAsoft was used to ensure the operating system with real-time performance.
The experiments presented how to verify the validity of the tuning criteria of the three machining modes based on several specified paths, such as straight, square, and circular paths. According to the requirements of tool-path planning, the relevant CNC parameters are listed in Table  1. In addition to the path geometries and feedrate of NC code, the acceleration profile of the triangle or trapezoid was planned via the CNC parameters in the table for the tool-path planning, such as

Experimental Platform
The experiments were performed on a three-axis machine tool with SYTEC's PC-based CNC controller, and DELTA's ASDA-A2 servo motor and servo driver. The absolute encoder was implemented in the servo motor and the linear scale was mounted on the feed drive system. The resolution of linear scale was 1 µm for the HEIDENHAIN LS100-series. The software of ASDAsoft was used to ensure the operating system with real-time performance.
The experiments presented how to verify the validity of the tuning criteria of the three machining modes based on several specified paths, such as straight, square, and circular paths. According to the requirements of tool-path planning, the relevant CNC parameters are listed in Table 1. In addition to the path geometries and feedrate of NC code, the acceleration profile of the triangle or trapezoid was planned via the CNC parameters in the table for the tool-path planning, such as preset jerk (J p , N100), acceleration (A p , N200), and time constant of Acc/Dec (T p , N300), and then included the corner velocity (V c , N500), arc velocity (V a , N600), and smoothing time constant (T a , N400). The J p , A p , and T p will be limited by the CNC parameters of each axis based on the tool-path planning in the interpolator, such as the J x (N101), J y (N102), J z (N103), A x (N201), A y (N202), A z (N203), T x (N301), T y (N302), and T z (N303). Therefore, when testing for specified paths, the J x , J y , J z , A x , A y , and A z have to be set to extreme limits and the T x , T y , and T z have to be set to zero. Its advantage is that the J p and A p of the path can be fully presented. It is useful to estimate the relationship between the CNC parameters and dynamic errors. In addition, in order to understand the efforts of CNC parameters, the feedrate has to be kept the constant value for specified paths in the NC code. The geometrical shape of NC code is S g as the idea position, the CNC controller completing the position command (S cx , S cy , S cz ) required for each axis servo loop, and the feed motion resulted in actual position (S ax , S ay , S az ) source from linear scale. The S cx , S cy , S cz and S ax , S ay , S az were measured and stored by the ASDAsoft, and the numerical analysis was performed with MATLAB. According to the various paths and the relevant CNC parameters, we designed the experimental conditions to validate how the CNC parameters influence the dynamic errors when the machine was set as HS, HP, and HQ mode individually. On the other hand, the experimental data was collected as an important basis for the tuning methodology of CNC parameters. Figure 7 shows the experimental results of the straight path with distance 350 mm and feedrate 60,000 mm/min. Herein, three selections of CNC parameters were introduced for the HS mode, as shown in Figure 7 (blue solid line: N100 is 200 m/s 3 , N200 is 6.8 m/s 2 ; green dashed line: N100 is 200 m/s 3 , N200 is 9.8 m/s 2 ; red dotted line: N100 is 100 m/s 3 , N200 is 9.8 m/s 2 ) and the command signals for position, velocity, acceleration, and jerk were observed by the CNC controller. With the blue solid line with larger jerk and smaller acceleration limit, it was easy to reach the accelerated limitation. The acceleration profile was trapezoidal and the path completion time was t l1 . The green dashed line had the increased acceleration limitation. The acceleration was larger than in the first condition, and the time of Acc/Dec was shorter than in the first condition, so that the path completed time t l2 was shortened. With the red dotted line, although the accelerated limitation was larger and the jerk was smaller, the acceleration profile was triangular. The third condition path completed time was the longest t l3 . Finally, the path completion time was compared to t l3 > t l1 > t l2 , and the t l2 was the shortest time to complete the machining process. This result verified that the HS mode had larger J p and A p .

Parameters' Analysis by Straight Path
The first condition had a short acceleration time, but it was limited by the acceleration setting parameter N200. Therefore, the profile was a trapezoidal acceleration profile. This was a disadvantage for the machine because the machine received force for a long period, which made machine dynamic errors or oscillations happen more easily. The second condition set an upper acceleration limitation, thus shortening the segment time during acceleration and deceleration. If the dynamic characteristics' performance of the servo and the machine are raised, the maximum accelerated limitation can be increased, so that it can be a triangular acceleration profile, and the path completion time can be reduced. The acceleration profile was triangular for the third condition. The jerk could reach the maximum acceleration directly, but the maximum acceleration was not large enough, making the finishing time longer; the path completion time was finally increased. However, the larger J p and A p will excite the resonance of the machine, which will cause vibration during the feeding process, and the workpiece surface will suffer worse oscillation textures. Since HQ mode pursues good surface quality, it needs to maintain a constant feedrate by avoiding acceleration and deceleration during the motion, since the feed force instantaneously causes vibration on the machine (as shown in Figure 8) during acceleration and deceleration. Then, some distinct vibration caused the surface of the workpiece to become rough. However, it is impossible that no acceleration or deceleration occurred during the motion of the three-dimensional path. Therefore, the HQ mode is not meant to preclude small dynamic errors. Its significance is in reducing the oscillation caused by acceleration and deceleration of each axis. The oscillation of the Acc/Dec machine cannot be defined by the ε 1 after interpolation; the oscillated behavior resulted from the dynamic characteristics of the real machine. Therefore, the HQ mode was used to observe the tracking error of each axis, reduce the oscillation of the feed drive system during the period of acceleration and deceleration, and avoid the rough surface on the workpiece. The Acc/Dec is equivalent to an impact on the input of the mechanism. If the bandwidth of the impact is greater than the resonance mode of the machine, the resonance is easily excited. Generally, the controller smoothed the oscillation during acceleration and deceleration by the filter for the time constant parameter. The function of the filter was to ensure smooth path velocity but it increased the completion time of the machining and the dynamic errors of the path. Figure 9 shows the experimental results of a straight path whose distance was 25 mm, acceleration was 10 m/s 2 , and feedrate was 6000 mm/min with different filter T a (N400). Figure 9 shows the tracking error for a single axis, and it also shows the spectrum of the fast Fourier transformation (FFT) based on the tracking error. The spectrum can be observed that there were two peaks caused by the oscillation of the feed drive system. Their resonance frequencies were 38 and 46 Hz, respectively. The first resonance should have been suppressed by the proper T a . It can be observed that after the T a was 26 ms, the first resonance was suppressed. If the T a was based on the second resonance frequency, then the oscillation still was excited for the feed drive system. For the tracking error, it was found that after increasing T a , the oscillation was reduced after passing of the Acc/Dec (red line in Figure 9). In addition, when the T a was 0, the path completion time was t s1 . When the T a was 26 ms, the path completion time was extended to t s2 . In this case, the T a was 0 ms for the HS mode, and the T a was 26 ms for the HQ mode.      Figure 10 shows a square path in the left with a side length of 30 , feedrate was 5000 ⁄ , acceleration was 4 ⁄ , and jerk was 200 ⁄ by setting the three different corner velocities (N500), which were 100/1000/3000 ⁄ , respectively, and observing the influence of the at the corners for , , and . The right of Figure 10 shows the testing result of the . The larger caused larger dynamic errors (green line in Figure 10), and the period time of the path was shorter. The smaller caused smaller dynamic errors (blue line in Figure 10), and the period time of the path was longer. Error! Reference source not found. shows a velocity profile of a typical square path. The diagrams from top to bottom were the , , and , respectively. The completed time was > > in these results. Figure 11 shows the acceleration profile of the square path. The diagrams from top to bottom were and , respectively. First, observing the velocity and acceleration of , , and , the larger value of the would cause the velocity at the corners to suddenly become discontinuous, resulting not only in a large acceleration but also the and becoming unstable (green line in Figure 11) at the corners; oscillation would occur in the constant velocity section. The smaller would cause smooth velocity because the and reached the set value of the parameter at the corner. The performance of the HP mode included the dimensional accuracy and  Figure 10 shows a square path in the left with a side length of 30 mm, feedrate was 5000 mm/min, acceleration was 4 m/s 2 , and jerk was 200 m/s 3 by setting the three different corner velocities (N500), which were 100/1000/3000 mm/min, respectively, and observing the influence of the V c at the corners for C 1 , C 2 , and C 3 . The right of Figure 10 shows the testing result of the C 1 . The larger V c caused larger dynamic errors (green line in Figure 10), and the period time of the path S c was shorter. The smaller V c caused smaller dynamic errors (blue line in Figure 10), and the period time of the path S c was longer. Figure 11 shows a velocity profile of a typical square path. The diagrams from top to bottom were the V x , V y , and V p , respectively. The completed time was t c1 > t c2 > t c3 in these results. Figure 12 shows the acceleration profile of the square path. The diagrams from top to bottom were A x and A y , respectively. First, observing the velocity and acceleration of C 1 , C 2 , and C 3 , the larger value of the V c would cause the velocity at the corners to suddenly become discontinuous, resulting not only in a large acceleration but also the A x and A y becoming unstable (green line in Figure 12) at the corners; oscillation would occur in the constant velocity section. The smaller V c would cause smooth velocity because the A x and A y reached the set value of the parameter at the corner. The performance of the HP mode included the dimensional accuracy and geometric accuracy of the workpiece, which means the dynamic errors needed to be smallest when the path was performed. In this case, the V c was 3000 mm/min for the HS mode, and the V c was 100 mm/min for the HP mode. However, if the V c is largest, the completion time is shortest for the path, but the dynamic errors will increase on the corner at the same time.      ; red line: 6000 ⁄ ; green line: 9000 ⁄ ) and observe the feedback signals. In order to easily observe the testing results with variant , the feedrate of NC code must be greater than 9000 ⁄ ; otherwise, is limited by the feedrate. Figure 13 shows the conversion of a circular path into a straight line. The diagrams from top to bottom show that actual radius value and dynamic errors were due to different , respectively. The horizontal axis in the error graph is the angle, and the black line is the reference path. The four quadrants of the circular path, , , , and , were the reverse directions of the axis, at the position of the axis where acceleration and deceleration occur. The acceleration value was limited by parameters including N101~103, N201~203, and N301~303. The sharp corners caused the backlash of the feed drive system, and the sharp corners' error value reduced the dynamic errors, so that the influence of , , , and should not be estimated in the dynamic errors. To analyze the influence of on the circular path, a large will produce large dynamic errors, and a smaller will produce smaller dynamic errors. Figure 14 shows the velocity curve for a typical circular path. The diagrams from top to bottom present , , and . The and are sine waves, and had a constant velocity except at the start position and the end position. Comparing the completion time of the path, the result was > > . In this case, the was 9000 ⁄ for the HS mode, and the was 3000 ⁄ for the HP mode. However, if the is largest, the completion time is shortest for the path, and the dynamic errors increase at the same time.

Parameters' Analysis by Circular Path
In summary, in order to reduce the dynamic errors, the jerk, acceleration, , and need to be reduced properly, so that the advantage of HP mode is fewer dynamic errors, but the path completion time becomes longer. In general, HP mode is used for the finishing process, and most machining requirements are dimensional accuracy and geometric accuracy. However, mold processing needs more dimensional accuracy requirement, not geometric accuracy.  Figure 13 shows the experimental results of a circular path with a radius of 15 mm, acceleration of 4 m/s 2 , and jerk of 200 m/s 3 . Adjust the three conditions of different V a (N600) (blue line: 3000 mm/min; red line: 6000 mm/min; green line: 9000 mm/min) and observe the feedback signals. In order to easily observe the testing results with variant V a , the feedrate of NC code must be greater than 9000 mm/min; otherwise, V a is limited by the feedrate. Figure 14 shows the conversion of a circular path into a straight line. The diagrams from top to bottom show that actual radius value and dynamic errors were due to different V a , respectively. The horizontal axis in the error graph is the angle, and the black line is the reference path. The four quadrants of the circular path, A 1 , A 2 , A 3 , and A 4 , were the reverse directions of the axis, at the position of the axis where acceleration and deceleration occur. The acceleration value was limited by parameters including N101~103, N201~203, and N301~303. The sharp corners caused the backlash of the feed drive system, and the sharp corners' error value reduced the dynamic errors, so that the influence of A 1 , A 2 , A 3 , and A 4 should not be estimated in the dynamic errors. To analyze the influence of V a on the circular path, a large V a will produce large dynamic errors, and a smaller V a will produce smaller dynamic errors. Figure 15 shows the velocity curve for a typical circular path. The diagrams from top to bottom present V x , V y , and V p . The V x and V y are sine waves, and V p had a constant velocity except at the start position and the end position. Comparing the completion time of the path, the result was t a1 > t a2 > t a3 . In this case, the V a was 9000 mm/min for the HS mode, and the V a was 3000 mm/min for the HP mode. However, if the V a is largest, the completion time is shortest for the path, and the dynamic errors increase at the same time. Appl. Sci. 2020, 10, x FOR PEER REVIEW 15 of 22

Tuning Methodology and Procedure for the CNC Parameters
The relationship between CNC parameters and the three machining modes was verified in Section 3. The experimental results showed the effectiveness of our proposed machining mode for corresponding CNC parameters, which is relevant to the dynamic errors of the machine. The tuning methodology and procedures of the CNC parameters were defined by the simple path, as shown in Figure 15. Firstly, the anticipated dynamic errors were defined as the maximum magnitude of the tool path that had first been allowed. In this paper, the anticipated dynamic errors of the HS/HP/HQ mode were set to 0.05/0.01/0.02 , respectively. Actually, the anticipated dynamic errors had no absolute value. They must to be adjusted by the operator for the product requirements. The specified paths used the relevant feedrate for testing. We suggest the proper feedrate that the machining condition used. According to anticipated dynamic errors and the circular test, the and could be easily calculated based on Equation (1), secondly. For the and straight test, the was calculated. The and were estimated based on the square test. The tuning procedure was based on actual measurement of the machine's two-dimensional contouring performance. The machine's dynamic errors were measured with simple paths, and the best combination of CNC parameters were chosen. A practical methodology will be discussed in this section in detail. In summary, in order to reduce the dynamic errors, the jerk, acceleration, V c , and V a need to be reduced properly, so that the advantage of HP mode is fewer dynamic errors, but the path completion time becomes longer. In general, HP mode is used for the finishing process, and most machining requirements are dimensional accuracy and geometric accuracy. However, mold processing needs more dimensional accuracy requirement, not geometric accuracy.

Tuning Methodology and Procedure for the CNC Parameters
The relationship between CNC parameters and the three machining modes was verified in Section 3. The experimental results showed the effectiveness of our proposed machining mode for corresponding CNC parameters, which is relevant to the dynamic errors of the machine. The tuning methodology and procedures of the CNC parameters were defined by the simple path, as shown in Figure 16. Firstly, the anticipated dynamic errors were defined as the maximum magnitude of the tool path that had first been allowed. In this paper, the anticipated dynamic errors of the HS/HP/HQ mode were set to 0.05/0.01/0.02 mm, respectively. Actually, the anticipated dynamic errors had no absolute value. They must to be adjusted by the operator for the product requirements. The specified paths used the relevant feedrate for testing. We suggest the proper feedrate that the machining condition used. According to anticipated dynamic errors and the circular test, the A p and V a could be easily calculated based on Equation (1), secondly. For the A p and straight test, the J p was calculated. The T a and V c were estimated based on the square test. The tuning procedure was based on actual measurement of the machine's two-dimensional contouring performance. The machine's dynamic errors were measured with simple paths, and the best combination of CNC parameters were chosen. A practical methodology will be discussed in this section in detail.

Allowable Acceleration
The acceleration of any axis results from the force caused by the feed drive system, and leads to contour error on the components. This means that by measuring dynamic errors and correlating them to effective acceleration, maximum allowable acceleration values for each axis can be set depending on the anticipated path accuracy. According to the circular testing, the dynamic errors can be evaluated due to the limited circle radius . With small circles and increasing , the required acceleration values become very high (Equation (1)). Examples can be seen in Figure 12 and Figure 13. According to Newton's second law and Hooke's law expressed as: where and are equivalent mass and equivalent stiffness, which are assumed the constants for the closed loop feed drive system in this paper, they are usually hard to tune by the machine operator. The and are acceleration and deformation of system. According to Equation (5), we can easily understand the relationship between acceleration and dynamic errors. Finally, the equation of acceleration and dynamic errors was obtained by the linear regression method expressed as: where is allowable acceleration for path movement, is allowable acceleration for axis movement, and is anticipated dynamic errors. According to Equation (6), the allowable acceleration has limits of HS/HP/HQ modes: 3.02/0.48/1.12 ⁄ , respectively. Therefore, these tests are useful for verifying the allowable acceleration value. This means that the CNC parameters related to acceleration can be evaluated. When the NC code was a circular path, the N600 of CNC parameters will be defined by the radius of curvature and Equation (1). In this paper, the radius of curvature of the commercial controller was 5 , and the arc velocities in HS/HP/HQ mode were 7373/2939/4490 , ⁄ respectively.

Allowable Acceleration
The acceleration of any axis results from the force caused by the feed drive system, and leads to contour error on the components. This means that by measuring dynamic errors and correlating them to effective acceleration, maximum allowable acceleration values for each axis can be set depending on the anticipated path accuracy. According to the circular testing, the dynamic errors can be evaluated due to the limited circle radius R. With small circles and increasing V a , the required acceleration values A a become very high (Equation (1)). Examples can be seen in Figures 13 and 14. According to Newton's second law and Hooke's law expressed as: where m and k are equivalent mass and equivalent stiffness, which are assumed the constants for the closed loop feed drive system in this paper, they are usually hard to tune by the machine operator. The a and ∆x are acceleration and deformation of system. According to Equation (5), we can easily understand the relationship between acceleration and dynamic errors. Finally, the equation of acceleration and dynamic errors was obtained by the linear regression method expressed as: where A p is allowable acceleration for path movement, A a is allowable acceleration for axis movement, and ε 3 is anticipated dynamic errors. According to Equation (6), the allowable acceleration has limits of HS/HP/HQ modes: 3.02/0.48/1.12 m/s 2 , respectively. Therefore, these tests are useful for verifying the allowable acceleration value. This means that the CNC parameters related to acceleration can be evaluated. When the NC code was a circular path, the N600 of CNC parameters will be defined by the radius of curvature and Equation (1). In this paper, the radius of curvature of the commercial controller was 5 mm, and the arc velocities in HS/HP/HQ mode were 7373/2939/4490 mm/min, respectively.

Allowable Jerk
The jerk profiles were similar to the impact force on the mechanical structure. The jerk is a dynamic excitation of the machine, which will cause oscillation in its structure resonance, meaning relative displacements between tool and workpiece, as illustrated in Figure 8. The oscillating characteristic is created by the driving torque or force. This means the measured tracking error of the relevant resonance frequencies can be identified with FFT. For this reason, the allowable jerk values for each axis can be identified at the same time. According to the straight path testing, the mechanical resonance can be identified with tracking error, as illustrated in Figure 9 (blue line). The first resonance of machine was about 38 Hz. The allowable jerk (J p ) can be evaluated due to the time constant of Acc/Dec (T p ) and allowable acceleration (A p ) (maximum value J p = A p /T p ). The allowable acceleration was set in Section 4.1, and the allowable jerk limits of HS/HP/HQ mode were 114.88/18.29/42.44 m/s 3 , respectively. It means that the CNC parameters related to jerk can be evaluated.

Smoothing Time Constant
The smoothing time constant is similar to the filter, which can smooth the velocity profiles in tool-path planning. The smoothing filter must be designed such that it cancels the mechanical resonance. Its time constant must be set at the inverse of the resonance frequency. According to the square path testing, dynamic errors can be observed at the corner, as illustrated in Figure 17. The oscillation can be seen on the straight line after the corner. In Figure 18

Allowable Jerk
The jerk profiles were similar to the impact force on the mechanical structure. The jerk is a dynamic excitation of the machine, which will cause oscillation in its structure resonance, meaning relative displacements between tool and workpiece, as illustrated in Figure 8. The oscillating characteristic is created by the driving torque or force. This means the measured tracking error of the relevant resonance frequencies can be identified with FFT. For this reason, the allowable jerk values for each axis can be identified at the same time. According to the straight path testing, the mechanical resonance can be identified with tracking error, as illustrated in Figure 9 (blue line). The first resonance of machine was about 38 . The allowable jerk ( ) can be evaluated due to the time constant of Acc/Dec ( ) and allowable acceleration ( ) (maximum value = ⁄ ). The allowable acceleration was set in Section 4.1, and the allowable jerk limits of HS/HP/HQ mode were 114.88/18.29/42.44 , ⁄ respectively. It means that the CNC parameters related to jerk can be evaluated.

Smoothing Time Constant
The smoothing time constant is similar to the filter, which can smooth the velocity profiles in tool-path planning. The smoothing filter must be designed such that it cancels the mechanical resonance. Its time constant must be set at the inverse of the resonance frequency. According to the square path testing, dynamic errors can be observed at the corner, as illustrated in Figure 16. The oscillation can be seen on the straight line after the corner. In Figure 17

Corner Velocity
A higher corner velocity is useful for shorter cycle time, but it would cause larger dynamic errors (or corner error). If it is too high, it easily causes structural vibration at the corners. The vibration could be decreased by the smoothing time constant, but the errors would be increased at the corners. The corner velocity is proportional to the corner error. However, the corner error also includes the effect of the tracking error from the servo loop. However, while there is a lot of domain knowledge to tune the tracking error, it is not easy for the machine operator to use. Therefore, this paper regarded the servo loop as a black box. We proposed the experimental methods to create the relationship between the corner velocity and corner error. According to the experimental results of Section 3.4 for square path testing, the dynamic errors can be observed at the corner. We fed the different jerk, acceleration, , and feedrate for the square path, respectively, summarized as follows: • The larger jerk and acceleration will increase the corner error as the feedrate increases. If the is set to 3000 mm min ⁄ , when the feedrate exceeds 3000 mm min ⁄ , the corner errors are more stable. This is caused by the current feedrate being lower than the anticipated . The will give priority to the current feedrate for tool-path planning.
The experimental data on the square path were used to estimate the maximum corner errors of each measurement result. The jerk, acceleration, , and feedrate by the test conditions were considered as inputs, and the corner errors as outputs. Multiple regression analysis was used to obtain the regression formula for the inputs and outputs. Finally, the maximum corner error was set to the dynamic errors of the HS/HP/HQ modes expected in this paper. The feedrate was 4000 mm/min for the square path, the allowable acceleration, and allowable jerk, in Sections 4.1 and 4.2, as the inputs of the regression formula, and solving the allowable of the HS/HP/HQ modes. The corresponding were 1470/250/550 ⁄ , respectively.

Experimental Validation
In Section 3, the experimental results showed the effectiveness of our proposed machining modes for corresponding CNC parameters, which is relevant to the dynamic errors of the machine. According to the tuning methodology and procedures of the CNC parameters implemented, the relevant CNC parameters were estimated based on the anticipated dynamic errors in Section 4. This section proposed a single square path with the same 4000 / feedrate and the length was 30 to verify the validation of the tuning methodology. We used the three sets of CNC parameters

Corner Velocity
A higher corner velocity is useful for shorter cycle time, but it would cause larger dynamic errors (or corner error). If it is too high, it easily causes structural vibration at the corners. The vibration could be decreased by the smoothing time constant, but the errors would be increased at the corners. The corner velocity is proportional to the corner error. However, the corner error also includes the effect of the tracking error from the servo loop. However, while there is a lot of domain knowledge to tune the tracking error, it is not easy for the machine operator to use. Therefore, this paper regarded the servo loop as a black box. We proposed the experimental methods to create the relationship between the corner velocity and corner error. According to the experimental results of Section 3.4 for square path testing, the dynamic errors can be observed at the corner. We fed the different jerk, acceleration, V c , and feedrate for the square path, respectively, summarized as follows:

•
The larger jerk and acceleration will increase the corner error as the feedrate increases.

•
There are two sets of parameters: One is J p = 100 m/s 3 and A p = 2.5 m/s 2 , and the other one is J p = 50 m/s 3 , A p = 1.2 m/s 2 . The corner errors are more stable than the other set of parameters for the different feedrates.

•
If the V c is set to 3000 mm/min, when the feedrate exceeds 3000 mm/min, the corner errors are more stable. This is caused by the current feedrate being lower than the anticipated V c . The V c will give priority to the current feedrate for tool-path planning.
The experimental data on the square path were used to estimate the maximum corner errors of each measurement result. The jerk, acceleration, V c , and feedrate by the test conditions were considered as inputs, and the corner errors as outputs. Multiple regression analysis was used to obtain the regression formula for the inputs and outputs. Finally, the maximum corner error was set to the dynamic errors of the HS/HP/HQ modes expected in this paper. The feedrate was 4000 mm/min for the square path, the allowable acceleration, and allowable jerk, in Sections 4.1 and 4.2, as the inputs of the regression formula, and solving the allowable V c of the HS/HP/HQ modes. The corresponding V c were 1470/250/550 mm/min, respectively.

Experimental Validation
In Section 3, the experimental results showed the effectiveness of our proposed machining modes for corresponding CNC parameters, which is relevant to the dynamic errors of the machine. According to the tuning methodology and procedures of the CNC parameters implemented, the relevant CNC parameters were estimated based on the anticipated dynamic errors in Section 4. This section proposed a single square path with the same 4000 mm/min feedrate and the length was 30 mm to verify the validation of the tuning methodology. We used the three sets of CNC parameters (see Table 2) corresponding to the "HS, HP, and HQ modes" in the actual machine platform for validation, thereby observing the performance of the motion dynamic under various modes. The experimental results are listed in Table 3. We observed the time of the completion of the tool path was the fastest for HS mode. In HP mode, the minimum dynamic errors were of the corners. There was small oscillation that was caused by the tracking error after the cornering in HQ mode. According to the experimental results, the servo parameters could be ignored, and the relevant CNC parameters of the tool-path planning could be adjusted, which can affect the completion time, dynamic errors, and tracking error of the same path. The comparison of HS, HP, and HQ modes are listed in Table 4. In the HS mode, the completion time of the path was fastest than the other modes. However, the dynamic errors and the tracking error were increased by 66% and 85%, respectively. In the HP mode, although the completion time of the path was increased by 37% compared with the HS mode and the tracking error was increased by 28%, the HP mode was closed to the ideal path with highest accuracy. In the HQ mode, the surface quality of the workpiece was improved by focusing on reducing the machine resonance, although the dynamic errors were worse than the HP mode. The surface quality improved by 85% compared with the HS mode. However the completion time was only increased by 6% compared with the HS mode. The experimental results verified the tuning methodology for CNC parameters of Section 4. We found that no single set of CNC parameters was able to simultaneously satisfy all of the three machining modes: "High speed", "high accuracy", and "high surface quality". Actually, these three machining modes often contradict each other. For example, we may have the "high productivity", but with "low accuracy and poor surface finish."

Conclusions
Since the required product quality affected CNC parameters of the machine tools, the CNC parameters must be selected to vary the machining performance of the tool-path planning, named as