Optimization of Computer Numerical Control Interpolation Parameters Using a Backpropagation Neural Network and Genetic Algorithm with Consideration of Corner Vibrations

: This paper presents an optimization algorithm for tuning the interpolation parameters of computer numerical control (CNC) controllers; it operates by considering multiple objective functions, namely, contour errors, the machining time (MT), and vibrations. The position commands, position errors, and vibration signals from 1024 experiments were considered in the designed trajectory. The experimental data—the maximum contour error (MCoE), MT, and corner vibration (CVib)—were analyzed to compute the performance index. A backpropagation neural network (BPNN) with 20 hidden layers was applied to predict the performance index. The correlation coefﬁcients for the predicted values and experimental results for the MCoE, MT, and CVib based on the validation data were 0.9984, 0.9998, and 0.9354, respectively. The high correlation coefﬁcients highlight the accuracy of the model for designing the interpolation parameter. After the BPNN model was developed, a genetic algorithm (GA) was adopted to determine the optimized parameters of the interpolation under different weighting of the performance index. A weighted sum approach involving the objective function was employed to determine the optimized interpolation parameters in the GA. Thus, operators can judge the feasibility of the interpolation parameter for various weighting settings. Finally, a mixed path was selected to verify the proposed algorithm.


Introduction
In the milling process, the finished product requires a fine surface texture, highprecision contour, and short machining time (MT).To achieve high-precision machining, machine errors, such as static error, dynamic error, and process error, should be minimized [1].Generally, dynamic errors are caused by interpolation error, servo lag [2,3], and vibrations [3,4].Surface quality is typically determined through considerations of surface roughness [5,6] and surface finish.Among the causes of machine errors, vibrations not only affect dynamic errors and surface texture [7] but can also shorten the tool life [8].Vibrations may be passively suppressed by machine tools with high damping capability.However, for existing machine tools, path planning may play a critical role in reducing contour errors and improving surface quality.
Computer numerical control (CNC) controller interpolation that considers the acceleration/deceleration (Acc/Dec) planning of the machining trajectory has considerable effects on the finished product.Therefore, adjusting Acc/Dec planning [9] not only improves contouring accuracy and suppresses machine vibration, improving surface quality, but may also reduce the overall MT.A specific instrument was developed to measure the relative dynamic displacement between the tool and workpiece at the tool center point (TCP) such that the limits for the axis acceleration and jerk could be adjusted to improve the contour accuracy [10].In [11], the findings revealed that vibrations are mainly caused by the acceleration and jerk of each axis, especially in the corners.An integrated dynamic Acc/Dec method [12] was proposed to determine the corner velocity according to the maximum dynamic contour error; the method entails considering the command and servo dynamic errors.Related studies on predicting contour errors have typically employed an analytical formulation that is generally based on the rigid body assumption.Another approach to minimizing tracking errors and unwanted vibrations, an interpolation using a linear combination of B-spline basis functions that employ the forward filter was proposed [9].Other methods have involved the use of a virtual cyber physical system (CPS) to design the Acc/Dec parameters to suppress the unwanted vibrations.However, extensive experiments are required to determine the parameters of a CPS system [13], making it difficult to implement.
Other methods for developing CPS models are data-driven approaches that capture data through experiments that employ various CNC controller parameters.An artificial neural network (ANN) [14] and an ANN integrated with a genetic algorithm were applied to compute performance indices, such as the minimum surface roughness [6] and tracking and contour errors [15].In multi-objective optimization methods, weighted sum approaches have been adopted to determine the optimal parameters.Search methodologies such as a genetic algorithm [16] or particle swarm optimization [15] have been applied.The adaptive neuro-fuzzy inference system was applied to predict the contour error and tracking error [15]; however, vibration data at the TCP were not included in the data-driven approach.To reduce the data capture time, various experimental designs, such as the Taguchi experiment design (TED) [6,17] method and full factorial design (FFD) [18], have been proposed.The designers claimed that a FFD could deliver a more accurate model with fewer data.However, this paper reveals that many experiments must be conducted to establish the ANN model for the CNC dynamic model.Thus, the data acquisition process is not only time consuming but also labor intensive.
Currently, no paper has developed a CPS model that includes vibration effects using a data-driven method.To predict the chatter vibration, the single frequency model (SFM) and the modern collocation method Chebyshev polynomials (CCM) were applied, and the mounting positions of accelerometers were indicated, in [19].The finite element approach [20,21] is generally applied to predict vibration behavior.However, because of highly uncertain structural characteristics (e.g., stiffness), the damping ratio cannot be identified accurately.Thus, the finite element approach is not feasible for predicting the vibrations of the TCP accurately under various Acc/Dec conditions.A more suitable approach for constructing a CPS model that can predict the contour error, MT, and TCP vibrations simultaneously is using an ANN with a well-designed experimental process.The design process in this paper involved the use of a data acquisition system that could capture the data automatically without any operator.The ranges of the Acc/Dec parameters were selected in accordance with the coarse machining to fine machining process.The data were applied to construct an ANN model.Subsequently, the weighted sum and GA approaches were adopted to determine the optimized Acc/Dec parameters when subject to various cost functions of the contour error, MT, and vibration.
This paper is divided into five sections.Section 2 introduces the interpolation design.Section 3 reveals the experimental process and the data analysis procedures for converting the machine performance index.In Sections 4.1 and 4.2, the Z-score and a backpropagation neural network (BPNN) for prediction are described.In Section 4.3, how a weighted sum approach was employed to identify design optimization concerns to determine the optimized parameters is described.Finally, a mixed path was selected to verify this paper's proposed algorithm.

Introduction of Interpolator
An interpolator is used to generate the velocity profile and position commands by interpreting a part program for each axis.For a linear interpolation (G01), Figure 1 reveals the S-shaped velocity and Acc/Dec profiles [22,23] for a single block that consists of constant speed periods (A), a constant slope for the Acc/Dec periods (B), and a constant Acc/Dec period (C).Based on the S-shaped Acc/Dec control, the velocity profile can be calculated according to the maximum velocity f max , the maximum acceleration A max , the time constant of the S-shaped Acc/Dec T2, and the maximum jerk J max , as illustrated in Figure 1.Generally, each axis has an allowable acceleration value that is determined according to the driving capability of its servo motor.Compared with a single block, multiple blocks of numerical control (NC) codes require one more parameter, which is given as the corner velocity V c [24] (Figure 2b).However, velocity discontinuity may occur when the velocity profile is distributed to each axis, as indicated in Figure 2c,d.Clearly, a higher corner velocity reduces the MT, but discontinuity can cause high acceleration and jerk for each axis as well as a large vibration in the corner.To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to T a that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1 reveals how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to Ta that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1 reveals how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.Table 1.Trends in machine performance as the interpolation parameters change.

Experimental Designs
To establish the data-driven model, an automated acquisition system (AAS) was developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure 4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.

Increase
Appl.Sci. 2021Sci. , 11, 1665 To reduce discontinuity, the Acc/Dec after interpolation (ADA applied.The ADAI is a finite impulse response 25 filter with a time that smooths the acceleration and jerk profile, as displayed in Figure ADAI sacrifices contour accuracy and increases the MT.Table 1 rev performance varies as the interpolation parameters change.The tra parameter settings for the contour errors, MT, and corner vibration current researchers to propose an optimization method based on t model.

Experimental Designs
To establish the data-driven model, an automated acquisitio developed.The AAS uses the Fuji Automatic Numerical Control ( API Specifications library (FOCAS) to capture the position com feedback.The tracking error and contour error can be comput vibration signal measured by a three-axis accelerometer (PCB 356A Piezotronics, Depew, NY, USA) is captured using National Instrum 9234).To ensure the AAS could acquire data without operators, th NI ANSI C support was used together with the FOCAS library.interface (HMI) program is presented in Figure 4.The program connect the CNC controller and NI device and to execute experim using a designed script file that can change the values of five interpo the total acquisition time.Here, the sampling rate for the CNC was the NI-9234 was 2048 Hz.To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to Ta that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1

Experimental Designs
To establish the data-driven model, an automated acquisition system (AAS) was  the ADAI [25].

Experimental Designs
To  Table 1.Trends in machine performance as the in Para.

Experimental Designs
To establish the data-driven model, a To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to Ta that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1 reveals [25].Table 1.Trends in machine performance as the interpolation parameters change. Para.

Experimental Designs
To establish the data-driven model, an automated acquisition system (AAS) was To reduce discontinuity, the Acc/Dec after interpolation (ADA applied.The ADAI is a finite impulse response 25 filter with a time that smooths the acceleration and jerk profile, as displayed in Figure ADAI sacrifices contour accuracy and increases the MT.Table 1 rev performance varies as the interpolation parameters change.The tra parameter settings for the contour errors, MT, and corner vibration current researchers to propose an optimization method based on t model.To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to Ta that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1 reveals how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.

Experimental Designs
To establish the data-driven model, an automated acquisition system (AAS) was developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.the ADAI [25].

Experimental Designs
To To reduce discontinuity, the Acc/Dec a applied.The ADAI is a finite impulse respo that smooths the acceleration and jerk profil ADAI sacrifices contour accuracy and increa performance varies as the interpolation par parameter settings for the contour errors, M current researchers to propose an optimiza model.

Experimental Designs
To establish the data-driven model, a developed.The AAS uses the Fuji Automa API Specifications library (FOCAS) to ca feedback.The tracking error and contour vibration signal measured by a three-axis ac Piezotronics, Depew, NY, USA) is captured 9234).To ensure the AAS could acquire dat NI ANSI C support was used together wi interface (HMI) program is presented in F connect the CNC controller and NI device using a designed script file that can change t the total acquisition time.Here, the samplin the NI-9234 was 2048 Hz.To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is applied.The ADAI is a finite impulse response 25 filter with a time constant equal to Ta that smooths the acceleration and jerk profile, as displayed in Figure 3.The application of ADAI sacrifices contour accuracy and increases the MT.Table 1 reveals      the ADAI [25].

Experimental Designs
To establish the data-driven model, an automated acquisitio To reduce discontinuity, the Acc/Dec a applied.The ADAI is a finite impulse respo that smooths the acceleration and jerk profil ADAI sacrifices contour accuracy and increa performance varies as the interpolation par parameter settings for the contour errors, M current researchers to propose an optimiza model.

Para.
Contour Errors

Experimental Designs
To establish the data-driven model, a developed.The AAS uses the Fuji Automa API Specifications library (FOCAS) to ca feedback.The tracking error and contour vibration signal measured by a three-axis ac Piezotronics, Depew, NY, USA) is captured 9234).To ensure the AAS could acquire dat NI ANSI C support was used together wi interface (HMI) program is presented in F connect the CNC controller and NI device using a designed script file that can change t the total acquisition time.Here, the samplin the NI-9234 was 2048 Hz.The experiments were conducted on a three-axis horizontal milling machine (Tongtai HA-500II was manufactured by Tongtai Machine and Tool Co., LTD., R.O.C., Kaohsiung City, Taiwan), with the three-axis accelerometer (PCB 356A32) installed on the spindle housing, as shown in Figure 5.To investigate the dynamic responses for setting various interpolation parameters, a FFD was adopted in this study.The design of the interpolation parameters is presented in Table 2; the values of the parameters were selected according to the various machining conditions.Each parameter, namely, A max , T a , T2, V c , and f max , was set to four different levels.In total, 1024 experiments were conducted for the FFD, and the designed parameter ranges were applied to various machining processes.The 1024 experiments for the given trajectory discussed in Section 3 required 9 h to complete.However, the AAS could command the machine to conduct the designed trajectory and capture the data automatically without pressing the cycle-start button.Compared with the TED, the FFD obtained an enhanced ANN model; this finding is described in Section 4.2.

Preprocessing of the Data into Performance Index
In this study, the minimized cost function was selected to be the weighted sum of different performance indices.The three performance indices were the maximum contour error (MCoE), MT, and corner vibration (CVib).The captured data had to be converted into performance indices before the training process commenced.

Analysis of Contour Error and MT
The contour error is defined as the short distance between the desired contour and machining contour, as shown in Figure 6, where the desired contour is obtained from the G-code and the machining contour is obtained from the position feedback.The rectangular trajectory, as displayed in Figure 7, can be tested by tuning various interpolator parameters.The maximum acceleration, ADAI, time constant of the S-shaped Acc/Dec corner velocity, and maximum velocity all may have dramatic effects on corner errors, vibration, and MT.Thus, the testing trajectory in Figure 7 was applied as the machining trajectory under various interpolator parameters.For the trajectory consisting of a straight-line segment, the contour error could be computed by simply applying the point-to-line formulation.Compared with the TED, the FFD obtained an enhanced ANN model; this finding is described in Section 4.2.

Preprocessing of the Data into Performance Index
In this study, the minimized cost function was selected to be the weighted sum of different performance indices.The three performance indices were the maximum contour error (MCoE), MT, and corner vibration (CVib).The captured data had to be converted into performance indices before the training process commenced.

Analysis of Contour Error and MT
The contour error is defined as the short distance between the desired contour and machining contour, as shown in Figure 6, where the desired contour is obtained from the G-code and the machining contour is obtained from the position feedback.The rectangular trajectory, as displayed in Figure 7, can be tested by tuning various interpolator parameters.The maximum acceleration, ADAI, time constant of the S-shaped Acc/Dec corner velocity, and maximum velocity all may have dramatic effects on corner errors, vibration, and MT.Thus, the testing trajectory in Figure 7 was applied as the machining trajectory under various interpolator parameters.For the trajectory consisting of a straight-line segment, the contour error could be computed by simply applying the point-to-line formulation.Figure 8 reveals the contour errors of the experiment, with the , , T2, , and being given as 2700 mm/s , 35 ms , 0 ms , 220 mm/min , and 1000 mm/min , respectively.The maximum contour in corners 1, 2, and 3 was approximately 60 μm.The other contour errors away from the corner were much less than that of the maximum contour.On the basis of this observation, the MCoE was selected as the first performance index.The MT is also a critical factor and thus was selected as the second performance index.In this case, the MT equaled 7.361 s.

Analysis of CVibs
As shown in Figure 2, the discontinuity of the velocity profile in the corner can cause a large acceleration and jerk.The vibrations in corner 3 in the x direction in Figure 9 validate the observation.The parameters of , , T2, , and used in the Figure 8 reveals the contour errors of the experiment, with the A max , T a , T2, V c , and f max being given as 2700 mm/s 2 , 35 ms, 0 ms, 220 mm/min, and 1000 mm/min, respectively.The maximum contour in corners 1, 2, and 3 was approximately 60 µm.The other contour errors away from the corner were much less than that of the maximum contour.On the basis of this observation, the MCoE was selected as the first performance index.The MT is also a critical factor and thus was selected as the second performance index.In this case, the MT equaled 7.361 s. Figure 8 reveals the contour errors of the experiment, with the , , T2, , and being given as 2700 mm/s , 35 ms , 0 ms , 220 mm/min , and 1000 mm/min , respectively.The maximum contour in corners 1, 2, and 3 was approximately 60 μm.The other contour errors away from the corner were much less than that of the maximum contour.On the basis of this observation, the MCoE was selected as the first performance index.The MT is also a critical factor and thus was selected as the second performance index.In this case, the MT equaled 7.361 s.

Analysis of CVibs
As shown in Figure 2, the discontinuity of the velocity profile in the corner can cause a large acceleration and jerk.The vibrations in corner 3 in the x direction in Figure 9 validate the observation.The parameters of , , T2, , and used in the

Analysis of CVibs
As shown in Figure 2, the discontinuity of the velocity profile in the corner can cause a large acceleration and jerk.The vibrations in corner 3 in the x direction in Figure 9 validate the observation.The parameters of A max , T a , T2, V c , and f max used in the experiment were 2700 mm/s 2 , 35 ms, 0 ms, 580 mm/min, and 1500 mm/min, respectively.To further analyze the vibration behavior in the corner, four periods were marked as A, B, C, and D. As indicated in Figure 2, period A corresponds to the motion of the x axis moving in a state of constant velocity.Period C is the state right after the corner as shown in Figure 7. Due to the discontinuity velocity profile as shown in Figure 2, excessive vibration might occur as shown in Figure 9. Period D corresponds to the motion for the y axis moving at a constant velocity.Because the vibration of period B corresponds to the designed Acc/Dec, the residual vibration at period C could cause machining marks in the corner.The vibration in period C was selected as the third performance index.
experiment were 2700 mm/s , 35 ms , 0 ms , 580 mm/min , and 1500 mm/min , respectively.To further analyze the vibration behavior in the corner, four periods were marked as A, B, C, and D. As indicated in Figure 2, period A corresponds to the motion of the x axis moving in a state of constant velocity.Period C is the state right after the corner as shown in Figure 7. Due to the discontinuity velocity profile as shown in Figure 2, excessive vibration might occur as shown in Figure 9. Period D corresponds to the motion for the y axis moving at a constant velocity.Because the vibration of period B corresponds to the designed Acc/Dec, the residual vibration at period C could cause machining marks in the corner.The vibration in period C was selected as the third performance index.To further observe the vibration behavior around the corner, the fast Fourier transform (FFT) for the periods A, C, and D was calculated (Figure 10).Four major peaks were observed at 30, 40, 116, and 426 Hz.The first natural frequency was revealed to be 30 Hz, which affects the machining process more dramatically compared with the other modes.Furthermore, the magnitude of the 30 Hz mode was highly dependent upon the interpolator parameters.The analysis of 1024 experiments revealed that the 30 Hz vibration mode can be effectively reduced by tuning the interpolation parameters, whereas the other frequency modes were less susceptible to change.Therefore, the vibration magnitude of 30 Hz was selected as the third performance index.

Modeling and Optimization Concerns
The machine performance index is well known to be highly affected by Acc/Dec planning.A data-driven model is presented in this section for predicting the machine performance index.The MCoE and MT were computed from the command and position feedback, and the CVib was computed from the accelerometer.The Z-score was applied to normalize the performance index, and the BPNN was applied to establish the model and used to evaluate the testing trajectory.

Z-Score (Standard Score)
Because each dimension of the performance index is different, the accuracy of the trained model might be biased.To address this problem, a normalization and standardization process is generally used in machine learning.The Z-score is used to convert the raw data according to  = ( − )/ , where μ and  are the mean and standard deviation of the population, respectively.For the testing and training data, the To further observe the vibration behavior around the corner, the fast Fourier transform (FFT) for the periods A, C, and D was calculated (Figure 10).Four major peaks were observed at 30, 40, 116, and 426 Hz.The first natural frequency was revealed to be 30 Hz, which affects the machining process more dramatically compared with the other modes.Furthermore, the magnitude of the 30 Hz mode was highly dependent upon the interpolator parameters.The analysis of 1024 experiments revealed that the 30 Hz vibration mode can be effectively reduced by tuning the interpolation parameters, whereas the other frequency modes were less susceptible to change.Therefore, the vibration magnitude of 30 Hz was selected as the third performance index.

Modeling and Optimization Concerns
The machine performance index is well known to be highly affected by Acc/Dec planning.A data-driven model is presented in this section for predicting the machine performance index.The MCoE and MT were computed from the command and position feedback, and the CVib was computed from the accelerometer.The Z-score was applied to normalize the performance index, and the BPNN was applied to establish the model and used to evaluate the testing trajectory.Because each dimension of the performance index is different, the accuracy of the trained model might be biased.To address this problem, a normalization and standardization process is generally used in machine learning.The Z-score is used to convert the raw data according to z = (x − µ)/σ, where µ and σ are the mean and standard deviation of the population, respectively.For the testing and training data, the µ and σ of the MCoE were 46.08 and 21.17 µm, respectively.The µ and σ of the MT were 12.69 and 7.45 s, respectively.The µ and σ of the CVib were 7.62 and 6.16 mm/s 2 , respectively.

BPNN Algorithm
A conventional BPNN algorithm [26], displayed in Figure 11, was applied to predict the machine performance indices.Several methodologies, such as [16,18], were tested, but the BPNN was the most accurate for predicting the information index and could be applied later in the optimization process with less computational burden.The architecture contained five inputs, three output elements, 20 hidden layers, and one output layer.The inputs were the interpolation parameters listed in Table 2, and the outputs were the performance indices, namely, the MCoE, MT, and CVib.The training dataset was from the 1024 experiments described in Section 3, and the validation dataset comprised 64 randomly selected experiments and the parameter ranges in Table 2. Besides, 1024 experiments were conducted for the training dataset; another 64 experiments were conducted for the validation of the training model.The other four experiments were executed for testing the optimization process.A total of 1092 experiments were conducted in the study.In Table 3, the training and validation results for the root mean square error (RMSE) and maximum error (ME) are listed to demonstrate the accuracy of the trained model.
In the validation dataset, the RMSE and ME of the MCoE were 1.0976 and 5.5356 µm, respectively.The RMSE and ME of the MT were 0.1305 and 0.5847 s, respectively.The RMSE error was approximately 1% when a mean value of MT µ equal to 12.69 s was applied.Finally, the RMSE and ME of the CVib were 4.48 and 8.28 mm/s 2 , respectively.The correlation coefficients of the predicted values and experimental results were calculated using the Excel CORREL function.The equation for the correlation coefficient for a two random variable array of X and Y is defined as where x and y are the means of the data of x and y, respectively.The correlation coefficients of the predicted values and experimental results for the MCoE, MT, and CVib based on the validation data were 0.9984, 0.9998, and 0.9354, respectively.As indicated in the introduction, the vibration of a machine tool is extremely difficult to predict using the finite element method.The high correlation coefficients suggest the developed model is accurate for designing the interpolation parameters.Experimental design is a crucial concern in developing data-driven models.The TED has the advantage of requiring a relatively low number of experiments, which reduces the data acquisition time.However, the results might not be as accurate as those generated through a FFD [27].To compare the performance of the two experimental design approaches, L16(4 5 ) arrays-including five factors and four levels-were used in the TED in this study.Only 16 experiments were conducted with the training dataset.The RMSE and ME of the MCoE were 19.33 and 40.47 µm, respectively.The RMSE and ME of the MT were 2.1144 and 7.9993 s, respectively.The CVib was 13.52 and 26.12 mm/s 2 , respectively.Thus, the accuracy of the TED-based model was much lower than that of the FFD.Although the number of experiments needed in the FFD was much higher than that in the TED, the AAS provided a convenient platform for conducting more experiments with less effort.

Design Optimization Concerns and Components of the Multi-Objective Function
After the BPNN model was developed, the next step was to define the cost function for optimization.Here, the genetic algorithm (GA) was applied to search for the optimum solution based on unconstrained functions.The GA, relying on biologically inspired operators such as selection, crossover, and mutation to generate high-quality solutions, is commonly used in nonlinear optimization problems.The GA provided the multi-objective optimization solution with the given constraints on the interpolation parameters.Here, a weighted sum approach 16 was adopted, and the objective function was given as where f 1 , f 2 , and f 3 represent the BPNN outputs, and w 1 , w 2 , and w 3 are the weighting functions, respectively.The objective function with constraints is listed in Table 4. Depending on the machining process, different weightings were selected; the results are listed in Table 5.For example, if w 1 , w 2 , and w 3 were set to (1, 0, 0), accuracy was the major priority.
The GA algorithm determined the optimization interpolation parameters with the lowest acceleration A max , feedrate f max , and corner velocity V c , and the largest time constants T a and T2 within the given constraints.For the weighting selected as (0, 1, 0), the major priority was MT, and the corresponding results are given in Table 6.The machine time was approximately 5 s, which was the shortest among the four cases.Generating noteworthy results that had not been reported in the literature was the priority; thus, the vibration for Case 3 was selected.In Case 3, the CVib was the lowest among the four cases, but the MT was longer than that of Case

Conclusions
This study proposed an optimization algorithm for tuning the CNC interpolation parameters by considering multiple objective functions such as contour errors, the machining time, and corner vibrations.It is known that the five different parameters of , , 2, and of the interpolator can influence the objective functions significantly.For example, a higher level of acceleration will reduce the machining time and increase the contour error and corner vibrations.However, no systematic approach has been adopted to determine the optimal solutions under different machining processes.In this study, 1024 experiments were conducted, and the experimental data-the MCoE, MT, and CVib-were captured automatically and analyzed to compute the performance index.A BPNN with 20 hidden layers was applied to establish the relationship between the interpolation parameter and performance index.The correlations between the predicted values and experimental results for the MCoE, MT, and CVib were 0.9984, 0.9998, and 0.9354, respectively.Then, the GA was adopted based on the BPNN model to determine the optimized interpolation parameter.The experimental results validate the accuracy and efficiency of the proposed algorithm.With the developed optimization methodology, operators can set up the parameters systematically by selecting different weighting without a trial-and-error process.The future work will be adding the surface

Conclusions
This study proposed an optimization algorithm for tuning the CNC interpolation parameters by considering multiple objective functions such as contour errors, the machining time, and corner vibrations.It is known that the five different parameters of   ,   , 2,   and   of the interpolator can influence the objective functions significantly.For example, a higher level of acceleration will reduce the machining time and increase the contour error and corner vibrations.However, no systematic approach has been adopted to determine the optimal solutions under different machining processes.In this study, 1024 experiments were conducted, and the experimental data-the MCoE, MT, and CVib-were captured automatically and analyzed to compute the performance index.A BPNN with 20 hidden layers was applied to establish the relationship between the interpolation parameter and performance index.The correlations between the predicted values and experimental results for the MCoE, MT, and CVib were 0.9984, 0.9998, and 0.9354, respectively.Then, the GA was adopted based on the BPNN model to determine the optimized interpolation parameter.The experimental results validate the accuracy and efficiency of the proposed algorithm.With the developed optimization methodology, operators can set up the parameters systematically by selecting different weighting without a trial-and-error process.The future work will be adding the surface

Conclusions
This study proposed an optimization algorithm for tuning the CNC interpolation parameters by considering multiple objective functions such as contour errors, the machining time, and corner vibrations.It is known that the five different parameters of A max , T a , T2, V c and f max of the interpolator can influence the objective functions significantly.For example, a higher level of acceleration will reduce the machining time and increase the contour error and corner vibrations.However, no systematic approach has been adopted to determine the optimal solutions under different machining processes.In this study, 1024 experiments were conducted, and the experimental data-the MCoE, MT, and CVibwere captured automatically and analyzed to compute the performance index.A BPNN with 20 hidden layers was applied to establish the relationship between the interpolation parameter and performance index.The correlations between the predicted values and experimental results for the MCoE, MT, and CVib were 0.9984, 0.9998, and 0.9354, respectively.Then, the GA was adopted based on the BPNN model to determine the optimized interpolation parameter.The experimental results validate the accuracy and efficiency of the proposed algorithm.With the developed optimization methodology, operators can set up the parameters systematically by selecting different weighting without a trial-and-error process.The future work will be adding the surface roughness into the performance indices such that one will be able to determine the surface quality, machining time, and contour errors simultaneously.

Figure 2 .
Figure 2. Corner velocity in velocity profile: (a) a sample NC code and multiple blocks (b) tangent velocity profile (c) x-axis velocity profile (d) y-axis velocity profile.

Decrease
Appl.Sci.2021Sci., 11, 1665       To reduce discontinuity, the Acc/Dec a applied.The ADAI is a finite impulse respo that smooths the acceleration and jerk profil ADAI sacrifices contour accuracy and increa performance varies as the interpolation par parameter settings for the contour errors, M current researchers to propose an optimiza model.
reveals how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.
developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure 4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.Increase Appl.Sci.2021, 11, 1665 To reduce discontinuity, the Acc/Dec after interpolation (ADA applied.The ADAI is a finite impulse response 25 filter with a time that smooths the acceleration and jerk profile, as displayed in Figure ADAI sacrifices contour accuracy and increases the MT.Table 1 rev performance varies as the interpolation parameters change.The tra parameter settings for the contour errors, MT, and corner vibration current researchers to propose an optimization method based on t model.

Figure 3 .
Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI).(b) establish the data-driven model, an automated acquisitio developed.The AAS uses the Fuji Automatic Numerical Control ( API Specifications library (FOCAS) to capture the position com feedback.The tracking error and contour error can be comput vibration signal measured by a three-axis accelerometer (PCB 356A Piezotronics, Depew, NY, USA) is captured using National Instrum 9234).To ensure the AAS could acquire data without operators, th NI ANSI C support was used together with the FOCAS library.interface (HMI) program is presented in Figure 4.The program connect the CNC controller and NI device and to execute experim using a designed script file that can change the values of five interpo the total acquisition time.Here, the sampling rate for the CNC was the NI-9234 was 2048 Hz.Increase Appl.Sci.2021, 11, 1665 To reduce discontinuity, the Acc/Dec a applied.The ADAI is a finite impulse respo that smooths the acceleration and jerk profil ADAI sacrifices contour accuracy and increa performance varies as the interpolation par parameter settings for the contour errors, M current researchers to propose an optimiza model.
developed.The AAS uses the Fuji Automa API Specifications library (FOCAS) to ca feedback.The tracking error and contour vibration signal measured by a three-axis ac Piezotronics, Depew, NY, USA) is captured 9234).To ensure the AAS could acquire dat NI ANSI C support was used together wi interface (HMI) program is presented in F connect the CNC controller and NI device using a designed script file that can change t the total acquisition time.Here, the samplin the NI-9234 was 2048 Hz.Decrease T2 Appl.Sci.2021, 11, 4 of 16 how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.

Figure 3 .
Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI).(b) Velocity profiles out of the ADAI [25].Table 1. Trends in machine performance as the interpolation parameters change.Para.Contour Errors Machining Time Corner Vibrations developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure 4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.Decrease Appl.Sci.2021, 11, 1665

Table 1 . 3 .
Trends in machine performance as the interpolation parameters ch Experimental Procedure and Analysis Process 3.1.Experimental Designs To establish the data-driven model, an automated acquisitio developed.The AAS uses the Fuji Automatic Numerical Control ( API Specifications library (FOCAS) to capture the position com feedback.The tracking error and contour error can be comput vibration signal measured by a three-axis accelerometer (PCB 356A Piezotronics, Depew, NY, USA) is captured using National Instrum 9234).To ensure the AAS could acquire data without operators, th NI ANSI C support was used together with the FOCAS library.interface (HMI) program is presented in Figure 4.The program connect the CNC controller and NI device and to execute experim using a designed script file that can change the values of five interpo the total acquisition time.Here, the sampling rate for the CNC was the NI-9234 was 2048 Hz.Increase Appl.Sci.2021, 11, 1665 To reduce discontinuity, the Acc/Dec a applied.The ADAI is a finite impulse respo that smooths the acceleration and jerk profil ADAI sacrifices contour accuracy and increa performance varies as the interpolation par parameter settings for the contour errors, M current researchers to propose an optimiza model.
The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure 4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.

Increase
Appl.Sci.2021, 11, 1665 To reduce discontinuity, the Acc/Dec after interpolation (ADA applied.The ADAI is a finite impulse response 25 filter with a time that smooths the acceleration and jerk profile, as displayed in Figure ADAI sacrifices contour accuracy and increases the MT.Table 1 rev performance varies as the interpolation parameters change.The tra parameter settings for the contour errors, MT, and corner vibration current researchers to propose an optimization method based on t model.

Figure 3 .
Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI).(b) establish the data-driven model, an automated acquisitio developed.The AAS uses the Fuji Automatic Numerical Control ( API Specifications library (FOCAS) to capture the position com feedback.The tracking error and contour error can be comput vibration signal measured by a three-axis accelerometer (PCB 356A Piezotronics, Depew, NY, USA) is captured using National Instrum 9234).To ensure the AAS could acquire data without operators, th NI ANSI C support was used together with the FOCAS library.interface (HMI) program is presented in Figure 4.The program connect the CNC controller and NI device and to execute experim using a designed script file that can change the values of five interpo the total acquisition time.Here, the sampling rate for the CNC was the NI-9234 was 2048 Hz.Decrease Appl.Sci.2021, 11, 1665
how the machine performance varies as the interpolation parameters change.The tradeoff among various parameter settings for the contour errors, MT, and corner vibration (CVib) motivated the current researchers to propose an optimization method based on the constructed ANN model.

Table 1 .
Trends in machine performance as the interpolation parameters change.To establish the data-driven model, an automated acquisition system (AAS) was developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.

Increase
Appl.Sci.2021, 11, 1665 To reduce discontinuity, the Acc/Dec after interpolation (ADA applied.The ADAI is a finite impulse response 25 filter with a time that smooths the acceleration and jerk profile, as displayed in Figure ADAI sacrifices contour accuracy and increases the MT.Table 1 rev performance varies as the interpolation parameters change.The tra parameter settings for the contour errors, MT, and corner vibration current researchers to propose an optimization method based on t model.

Figure 3 .
Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI).(b) developed.The AAS uses the Fuji Automatic Numerical Control ( API Specifications library (FOCAS) to capture the position com feedback.The tracking error and contour error can be comput vibration signal measured by a three-axis accelerometer (PCB 356A Piezotronics, Depew, NY, USA) is captured using National Instrum 9234).To ensure the AAS could acquire data without operators, th NI ANSI C support was used together with the FOCAS library.interface (HMI) program is presented in Figure 4.The program connect the CNC controller and NI device and to execute experim using a designed script file that can change the values of five interpo the total acquisition time.Here, the sampling rate for the CNC was the NI-9234 was 2048 Hz.Decrease Appl.Sci.2021, 11, 1665

Increase 3 .
Experimental Procedure and Analysis Process 3.1.Experimental Designs To establish the data-driven model, an automated acquisition system (AAS) was developed.The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC API Specifications library (FOCAS) to capture the position command and position feedback.The tracking error and contour error can be computed accordingly.The vibration signal measured by a three-axis accelerometer (PCB 356A32 was made by PCB Piezotronics, Depew, NY, USA) is captured using National Instrument (NI) devices (NI-9234).To ensure the AAS could acquire data without operators, the library provided by NI ANSI C support was used together with the FOCAS library.The human-machine interface (HMI) program is presented in Figure 4.The program includes functions to connect the CNC controller and NI device and to execute experiments sequentially by using a designed script file that can change the values of five interpolator parameters and the total acquisition time.Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz.

Figure 4 .
Figure 4. Human-machine interface (HMI) of the automated acquisition system.

Figure 6 .
Figure 6.Definition of contour error.Figure 6. Definition of contour error.

Figure 6 .
Figure 6.Definition of contour error.Figure 6. Definition of contour error.

Figure 7 .
Figure 7. Testing trajectory.(The corner 1, 2 and 3 were described in Section 3.2.1 and the period A, B, C and D were described in Section 3.2.2.).

Figure 7 .
Figure 7. Testing trajectory.(The corner 1, 2 and 3 were described in Section 3.2.1 and the period A, B, C and D were described in Section 3.2.2.).

16 Figure 7 .
Figure 7. Testing trajectory.(The corner 1, 2 and 3 were described in Section 3.2.1 and the period A, B, C and D were described in Section 3.2.2.).

Figure 9 .
Figure 9. Raw vibrations of the high Acc/Dec experiment.(The period A, B, C and D were marked as in Figure 7, respectively.)

Figure 10 .
Figure 10.Fast Fourier transform (FFT) for vibrations of periods A, C, and D in Figure 9.

16 Figure 11 .
Figure 11.Architecture of the backpropagation neural network (BPNN).The inputs were the interpolation parameters listed in Table 2, and the outputs were the performance indices, namely, the MCoE, MT, and CVib.The training dataset was from the 1024 experiments described in Section 3, and the validation dataset comprised 64 randomly selected experiments and the parameter ranges in Table 2. Besides, 1024 experiments were conducted for the training dataset; another 64 experiments were conducted for the validation of the training model.The other four experiments were executed for testing the optimization process.A total of 1092 experiments were conducted in the study.In Table 3, the training and validation results for the root mean square error (RMSE) and maximum error (ME) are listed to demonstrate the accuracy of the trained model.

Table 1 .
Trends in machine performance as the interpolation parameters change.

Table 1 .
Trends in machine performance as the interpolation parameters ch

Table 1 .
Trends in machine performance as the in

Table 1 .
Trends in machine performance as the interpolation parameters change.

Table 1 .
Trends in machine performance as the in

Table 1 .
Trends in machine performance as the interpolation parameters change.

Table 1 .
Trends in machine performance as the in

Table 2 .
Levels of each interpolation parameter.

Table 2 .
Levels of each interpolation parameter.

Table 3 .
Training and validation results for the artificial neural network (ANN) model: the maximum contour error (MCoE) and machining time (MT) and corner vibration (CVib).

Table 3 .
Training and validation results for the artificial neural network (ANN) model: the maximum contour error (MCoE) and machining time (MT) and corner vibration (CVib).