applied sciences
Article Optimization of Computer Numerical Control Interpolation Parameters Using a Backpropagation Neural Network and Genetic Algorithm with Consideration of Corner Vibrations
Hsiang-Chun Tseng 1, Meng-Shiun Tsai 2,*, Chih-Chun Cheng 1 and Chen-Jung Li 3
1 Department of Mechanical Engineering, National Chung Cheng University, Chiayi 62102, Taiwan; [email protected] (H.-C.T.); [email protected] (C.-C.C.) 2 Department of Mechanical Engineering, National Taiwan University, Taipei 106319, Taiwan 3 Department of Mechatronics Engineering, National Kaohsiung University of Science and Technology, Kaohsiung 824005, Taiwan; [email protected] * Correspondence: [email protected]
Abstract: 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 coefficients for the Citation: Tseng, H.-C.; Tsai, M.-S.; predicted values and experimental results for the MCoE, MT, and CVib based on the validation data Cheng, C.-C.; Li, C.-J. Optimization of were 0.9984, 0.9998, and 0.9354, respectively. The high correlation coefficients highlight the accuracy Computer Numerical Control of the model for designing the interpolation parameter. After the BPNN model was developed, Interpolation Parameters Using a a genetic algorithm (GA) was adopted to determine the optimized parameters of the interpolation Backpropagation Neural Network under different weighting of the performance index. A weighted sum approach involving the and Genetic Algorithm with objective function was employed to determine the optimized interpolation parameters in the GA. Consideration of Corner Vibrations. Thus, operators can judge the feasibility of the interpolation parameter for various weighting settings. Appl. Sci. 2021, 11, 1665. https:// Finally, a mixed path was selected to verify the proposed algorithm. doi.org/10.3390/app11041665
Academic Editor: Luis Norberto Keywords: interpolator; data driven; optimization; vibration; contour error; machine performance López De Lacalle
Received: 4 January 2021 Accepted: 8 February 2021 1. Introduction Published: 12 February 2021 In the milling process, the finished product requires a fine surface texture, high- precision contour, and short machining time (MT). To achieve high-precision machining, Publisher’s Note: MDPI stays neutral machine errors, such as static error, dynamic error, and process error, should be mini- with regard to jurisdictional claims in mized [1]. Generally, dynamic errors are caused by interpolation error, servo lag [2,3], and published maps and institutional affil- vibrations [3,4]. Surface quality is typically determined through considerations of surface iations. 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 Copyright: © 2021 by the authors. contour errors and improving surface quality. Licensee MDPI, Basel, Switzerland. Computer numerical control (CNC) controller interpolation that considers the acceler- This article is an open access article ation/deceleration (Acc/Dec) planning of the machining trajectory has considerable effects distributed under the terms and on the finished product. Therefore, adjusting Acc/Dec planning [9] not only improves conditions of the Creative Commons contouring accuracy and suppresses machine vibration, improving surface quality, but Attribution (CC BY) license (https:// may also reduce the overall MT. A specific instrument was developed to measure the creativecommons.org/licenses/by/ relative dynamic displacement between the tool and workpiece at the tool center point 4.0/).
Appl. Sci. 2021, 11, 1665. https://doi.org/10.3390/app11041665 https://www.mdpi.com/journal/applsci Appl. Sci. 2021, 11, 1665 2 of 15
(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 pro- posed [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 ap- plied 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. Section2 introduces the interpolation design. Section3 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. Appl. Sci. 2021, 11, 1665 3 of 15
2. 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), Figure1 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 fmax, the maximum acceleration Amax, the time constant of the S-shaped Acc/Dec T2, and the maximum jerk Jmax, as illustrated in Figure1.
Figure 1. S-shaped acceleration/deceleration (Acc/Dec) control for a signal block.
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 Vc [24] (Figure2b). However, velocity discontinuity may occur when the velocity profile is distributed to each axis, as indicated in Figure2c,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.
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. Appl. Sci. 2021, 11, 1665 4 of 16
Appl. Sci. 2021, 11, 1665 4 of 16
Appl. Sci. 2021, 11, 1665 To reduce discontinuity, the Acc/Dec after interpolation4 of 15 (ADAI) [12] for each axis is applied. The ADAI is a finite impulse response 25 filter with a time constant equal to Ta To reduce discontinuity,that smooths the Acc/Dec the acceleration after interpolation and jerk (ADAI)profile, [12]as displayed for each axisin Figure is 3. The application of applied. The ADAI is a ADAIfinite impulsesacrifices response contour 25accuracy filter with and aincrea timeses constant the MT. equal Table to 1T revealsa how the machine To reduce discontinuity, the Acc/Dec after interpolation (ADAI) [12] for each axis is that smooths the accelerationperformance and jerk varies profile, as asthe displayed interpolation in Figure para 3.meters The application change. The of tradeoff among various applied. The ADAI is a finite impulse response 25 filter with a time constant equal to T parameter settings for the contour errors, MT, and corner vibrationa (CVib) motivated the that smoothsADAI sacrifices the acceleration contour and accuracy jerk profile, and increa as displayedses the MT. in Figure Table 31. reveals The application how the ofmachine current researchers to propose an optimization method based on the constructed ANN ADAIperformance sacrifices contour varies accuracy as the interpolation and increases para themeters MT. Table change.1 reveals The howtradeoff the among machine various model. performanceparameter varies settings as the for interpolation the contour parameterserrors, MT, change.and corner The vibration tradeoff (CVib) among motivated various the parametercurrent settings researchers for the to contour propose errors, an optimiza MT, andtion corner method vibration based (CVib) on the motivated constructed the ANN currentmodel. researchers to propose an optimization method based on the constructed ANN model.
Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI). (b) Velocity profiles out of the ADAI [25]. Figure 3. (a) Velocity profiles in the Acc/Dec after interpolation (ADAI). (b) Velocity profiles out of Figurethe 3. (ADAIa) Velocity [25]. profiles in theTable Acc/Dec 1. Trends after in interpolation machine performance (ADAI). (b as) Velocitythe interpolation profiles out parameters of change. the ADAI [25]. Corner Para. Contour Errors Machining Time Table 1. Trends in machine performance as the interpolation parameters change. Vibrations Table 1. Trends in machine performance as the interpolation parameters change. ↗ Increase ↘ DecreaseCorner ↗ Increase Para. Contour Errors Machining Time Para. Contour Errors Machining↗ Increase Time Corner Vibrations↗Vibrations Increase ↘ Decrease
Amax ↗Increase Increase 2 ↘Decrease↘ Decrease Decrease Increase↗↗ Increase Increase ↘ Decrease
Ta ↗Increase Increase ↗Increase Increase↗ Increase Decrease↘↘ Decrease Decrease ↗ Increase T2 2 ↘Decrease Decrease ↗Increase Increase↗ Increase Decrease↘↘Decrease Decrease ↗ Increase
Vc ↗Increase Increase Decrease↘ Decrease Increase↗ Increase Vmax ↗Increase Increase3. Experimental ProcedureDecrease↘Decrease and Analysis ProcessIncrease↗ Increase 3.1. Experimental Designs 3. Experimental3. Experimental Procedure Procedure and Analysis andTo Analysisestablish Process Processthe data-driven model, an automated acquisition system (AAS) was 3.1. Experimental3.1. Experimental Designs Designsdeveloped. The AAS uses the Fuji Automatic Numerical Control (FANUC) Open CNC To establishTo establish the data-driven the data-drivenAPI model,Specifications model, an automated anlibrary automated acquisition(FOCAS) acquisition to system capture system (AAS) the (AAS)position was was command and position developed.developed. The AAS The uses AAS the uses Fujifeedback. the Automatic Fuji The Automa Numericaltrackingtic Numerical error Control and (FANUC)Control contour (FANUC) Open error CNC can Open APIbe CNCcomputed accordingly. The SpecificationsAPI Specifications library (FOCAS) libraryvibration to (FOCAS) capture signal the to measured positioncapture command theby aposition three-axis and command position accelerometer feedback. and (PCBposition 356A32 was made by PCB The trackingfeedback. error The and tracking contourPiezotronics, error error and can becontour Depew, computed errorNY, accordingly.USA) can isbe captured computed The vibration using accordingly. National signal Instrument The (NI) devices (NI- measuredvibration by a signal three-axis measured accelerometer9234). by aTo three-axis ensure (PCB the 356A32accelerometer AAS could was made acquire(PCB by 356A32 data PCB without Piezotronics,was made operators, by PCB the library provided by Depew,Piezotronics, NY, USA) is Depew, captured NY, usingNI USA)ANSI National is C captured support Instrument usingwas used (NI)National devicestogether Instrument (NI-9234). with the (NI)To FOCAS ensuredevices library. (NI- The human–machine the AAS9234). could To acquireensure datathe AAS withoutinterface could operators, acquire(HMI) theprogramdata library without is provided presented operators, by in NI the Figure ANSI library C4. support providedThe program by includes functions to was usedNI ANSI together C support with the was FOCASconnect used library. togetherthe CNC The with human–machinecontroller the FOCAS and NI interfacelibrary. device The(HMI)and humanto program execute–machine experiments sequentially by is presentedinterface in (HMI) Figure 4program. The programusing is presented a designed includes in script functionsFigure file 4. that toThe connect can program change the CNCthincludese values controller functions of five interp to olator parameters and and NI device and to execute experiments sequentially by using a designed script file that connect the CNC controllerthe total and acquisition NI device time.and to Here, execute the samplingexperiments rate sequentially for the CNC bywas 1000 Hz, and that for can change the values of five interpolator parameters and the total acquisition time. Here, using a designed script filethe thatNI-9234 can changewas 2048 th eHz. values of five interpolator parameters and the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz. the total acquisition time. Here, the sampling rate for the CNC was 1000 Hz, and that for the NI-9234 was 2048 Hz. Appl. Sci. 2021, 11, 1665 5 of 15
Figure 4. Human–machine interface (HMI) of the automated acquisition system.
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 Figure5.
Figure 5. Experimental machine and accelerometer setup.
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 Table2; the values of the parameters were selected according to the various machining conditions. Each parameter, namely, Amax, Ta, T2, Vc, and fmax, 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. Appl. Sci. 2021, 11, 1665 6 of 15
Appl. Sci. 2021, 11, 1665 6 of 16
Table 2. Levels of each interpolation parameter. Compared with the TED, the FFD obtained an enhanced ANN model; this finding is Parameter Unit Level 1 Level 2 Level 3 Level 4 described in Section 4.2. 2 Amax mm/s 900 1500 2100 2700 Ta ms 35 42 49 56 Table 2.T Levels2 of each inte ms rpolation parameter.0 8 16 24 ParameterVc mm/minUnit 220Level 1 340Level 2 Level 460 3 Level 580 4 fmax mm/min 300 500 1000 1500 mm/s 900 1500 2100 2700 ms 35 42 49 56 The 1024 experimentsms for the given0 trajectory discussed8 in Section16 3 required24 9 h
to complete. However,mm/min the AAS could 220 command the340 machine to460 conduct the designed580 trajectory and capturemm/min the data automatically300 without500 pressing1000 the cycle-start1500 button. Compared with the TED, the FFD obtained an enhanced ANN model; this finding is 3.2.described Preprocessing in Section of 4.2the. Data into Performance Index
3.2. PreprocessingIn this study, of the the minimized Data into Performance cost functi Indexon was selected to be the weighted sum of different performance indices. The three performance indices were the maximum contour In this study, the minimized cost function was selected to be the weighted sum of error (MCoE), MT, and corner vibration (CVib). The captured data had to be converted different performance indices. The three performance indices were the maximum contour into performance indices before the training process commenced. error (MCoE), MT, and corner vibration (CVib). The captured data had to be converted into 3.2.1.performance Analysis indices of Contour before Error the trainingand MT process commenced. 3.2.1.The Analysis contour of error Contour is defined Error and as the MT short distance between the desired contour and machiningThe contour contour, error as shown is defined in Figure as the 6, short where distance the desired between contour the desiredis obtained contour from andthe G-codemachining and contour, the machining as shown incontour Figure 6is, whereobtained the desiredfrom the contour position is obtained feedback. from The the rectangularG-code and thetrajectory, machining as contourdisplayed is obtained in Figu fromre 7, the can position be tested feedback. by tuning The rectangular various interpolatortrajectory, as parameters. displayed in The Figure ma7ximum, can be acceleration, tested by tuning ADAI, various time constant interpolator of the parameters. S-shaped Acc/DecThe maximum corner acceleration,velocity, and ADAI, maximum time constantvelocity all of themay S-shaped have dramatic Acc/Dec effects corner on velocity, corner errors,and maximum vibration, velocity and MT. all mayThus, have the dramatic testing trajectory effects on in corner Figure errors, 7 was vibration, applied and as MT.the machiningThus, the testingtrajectory trajectory under various in Figure interpolator7 was applied parameters. as the machining For the trajectory trajectory consisting under ofvarious a straight-line interpolator segment, parameters. the contour For the erro trajectoryr could be consisting computed of by a straight-line simply applying segment, the point-to-linethe contour errorformulation. could be computed by simply applying the point-to-line formulation.
Figure 6. Definition of contour error. Figure 6. Definition of contour error. Appl.Appl. Sci. Sci. 2021 2021, ,11 11, ,1665 1665 7 7of of 16 16 Appl. Sci. 2021, 11, 1665 7 of 15
Figure 7. Testing trajectory. (The corner 1, 2 and 3 were described in Section 3.2.1 and the period FigureA,Figure B, C 7. and Testing 7. TestingD were trajectory. trajectory.described (The in (The Section corner corner 3.2.2.).1, 1,2 and 2 and 3 we 3 werere described described in inSection Section 3.2.1 3.2.1 and and the the period period A, A, B,B, CC andand DD werewere describeddescribed inin SectionSection 3.2.2 3.2.2.)..). Figure 8 reveals the contour errors of the experiment, with the , , T2, , and FigureFigure 8 reveals8 reveals the the contour contour errors errors of the of experiment, the experiment, with withthe the , A max, T,2,T a , ,T and2, V c, being given as 2700 mm/s , 35 ms , 0 ms , 220 mm/min , and 1000 mm/min , 2 respectively. and beingfmax beinggiven The maximum givenas 2700 as 2700mm/scontourmm/s, in35 corners ,ms 35, ms0 1, ,ms 2, 0 and,ms 220, 3 220 wasmm/minmm/min approximately, and, and 1000 100060 mm/minμmmm/min. The , , respectively.otherrespectively. contour The errors The maximum maximum away from contour contour the incorner incorners corners were 1, 1,2,much 2,and and 3less was 3 wasthan approximately approximately that of the maximum60 60μmµm. The. The othercontour.other contour contour On the errors basis errors awayof awaythis from observation, from the the corner corner the wereMCoE were much was much selected less less than than as thatthe that first of of theperformance the maximum maximum contour.index.contour. The On OnMT the the isbasis also basis of a ofthiscritical this observation, observation, factor and the thus the MCoE MCoEwas wasselected was selected selected as the as assecondthe the first first performance performance performance index.index.index. TheIn Thethis MT MTcase, is isalso the also MTa critical a equaled critical factor factor 7.361 and s. and thus thus was was selected selected as as the the second second performance performance index.index. In Inthis this case, case, the the MT MT equaled equaled 7.361 7.361 s. s.
Figure 8. Maximum contour error (MCoE) and machining time (MT) for one experiment. (The period Figure 8. Maximum contour error (MCoE) and machining time (MT) for one experiment. (The 1, 2 and 3 were marked as the corner 1, 2 and 3 in Figure7, respectively.) period 1, 2 and 3 were marked as the corner 1, 2 and 3 in Figure 7, respectively.) Figure 8. Maximum contour error (MCoE) and machining time (MT) for one experiment. (The period3.2.2. 1, Analysis2 and 3 were of CVibsmarked as the corner 1, 2 and 3 in Figure 7, respectively.) 3.2.2. AnalysisAs shown of inCVibs Figure 2, the discontinuity of the velocity profile in the corner can cause a 3.2.2.large AsAnalysis acceleration shown of in CVibsFigure and jerk.2, the The discontinuity vibrations inof cornerthe velocity 3 in the profile x direction in the corner in Figure can9 causevalidate a thelargeAs observation. shownacceleration in Figure Theand parameters2,jerk. the Thediscontinuity vibrations of Amax of, inT thea ,cornerT velocity2, Vc ,3 andin profile thefmax x indirectionused the corner in thein Figure experimentcan cause 9 validate the observation.2 The parameters of , , T2, , and used in the a largewere 2700accelerationmm/s ,and 35 ms jerk., 0 ms The, 580 vibrationsmm/min in, and corner 1500 3mm/min in the x ,direction respectively. in Figure To further 9 analyze the vibration behavior in the corner, four periods were marked as A, B, C, and validate the observation. The parameters of , , T2, , and used in the D. As indicated in Figure2, period A corresponds to the motion of the x axis moving in a Appl. Sci. 2021, 11, 1665 8 of 16