# A New Error Prediction Method for Machining Process Based on a Combined Model

Authors: Wei Zhou; Xiao Zhu; Jun Wang; Yan Ran
Journal: Mathematical Problems in Engineering
 (2018)

---

## Abstract

Machining process is characterized by randomness, nonlinearity, and uncertainty, leading to the dynamic changes of machine tool machining errors. In this paper, a novel model combining the data processing merits of metabolic grey model (MGM) with that of nonlinear autoregressive (NAR) neural network is proposed for machining error prediction. The advantages and disadvantages of MGM and NAR neural network are introduced in detail, respectively. The combined model first utilizes MGM to predict the original error data and then uses NAR neural network to forecast the residual series of MGM. An experiment on the spindle machining is carried out, and a series of experimental data is used to validate the prediction performance of the combined model. The comparison of the experiment results indicates that combined model performs better than the individual model. The two-stage prediction of the combined model is characterized by high accuracy, fast speed, and robustness and can be applied to other complex machining error predictions.


---

## Body

## 1. Introduction

In recent years, machining accuracy has become one of the most critical criteria for the performance of machine tools, especially in the circumstances where the precision of machine components is related directly to the product quality. The modeling and prediction of machining errors are highly significant for the implementation of machining error compensation methods. As the machining process is very complicate, subject to the systemic and random factors and the coupling effect between the various factors, machining errors are inevitable. Therefore, the key problem to enhance the machining accuracy is to establish a scientific and reasonable prediction model. Some researchers [1] have concentrated on the development of machining error models by using various modeling methodologies during the last few decades.The precision of the machining error is affected by many kinds of errors, including kinematic error, tool deformation error, tool rotation error, and thermal error [2]. Many researches [3, 4] have focused on the prediction of machined workpiece in recent years. But the most of existing prediction methods consider only one or two error types and ignore the inherent characteristics of the machining error data. In this article, the machining error, as a comprehensive reflection of various errors effects, is predicted by the optimized combined model.The grey theory is established and developed originally by Chinese scholar Deng [5] in 1982. Compared with other mathematics models, grey theory can make full use of the discrete random data sequence to generate more regularly data information. Wu [6] et al. used a grey model based on the data characteristics of water consumption to simulate the water demands of one city from 2009 to 2015 and forecast it in 2016. Chen [7] proposed a grey model for damage prognosis of high-speed blades. However, considering the fact that grey system model requires that original data must be monotonically increasing or decreasing, some researches proposed optimized grey model. Shih et al. [8] improved the GM(1, 1) by changing the background and initial values. Cui et al. [9] provided the NGM(1, 1) based on the GM(1, 1), which belongs to an entirely optimized GM(1, 1). Chen et al. [10] proposed the MGM for predicting the varied capacity with discharge cycles in electric vehicles.Artificial neural network (ANN) uses the mathematical method to abstract the human brain information processing unit, simplifies the biological neurons, and can effectively deal with the problems of nonlinearity, ambiguity, and uncertainty. Hence, it has been widely used for modeling nonlinear time series [11, 12]. Dynamic neural network has added the delay link or feedback link to have the ability of memory and dynamic tracking. Ma [13] proposes a dynamic fuzzy neural network to achieve high-precision forecasting for the wind speed. Typical dynamic neural networks are such as NAR (nonlinear autoregressive) neural networks. Kari [14] proposed a method to reproduce car kinematics during a collision using NAR model whose parameters are estimated by use of feedforward neural network. Ruiz [15] provided a methodology to predict future energy consumption using NAR and the nonlinear autoregressive neural network with exogenous inputs (NARX), respectively.However, although optimized, the sole grey model fails to receive a perfect performance while its row data is nonlinear, and the prediction accuracy may decline gradually with the passage of time [16]. Artificial neural network obtains good performance in the prediction of nonlinear system, but it generally requires a large number of training samples and thus needs a long training computation time as well as having poor generalization capability [17]. With respect to the limitations of the sole prediction models, many scholars have proposed some combination models to fill the gap of each model. Khalil [18] applied a method of the combination of unsupervised k-means clustering algorithm and ANN to forecast hourly global horizontal solar radiation. Xiang et al. [19] developed a vector-angle-cosine hybrid model for thermal error prediction.Analyzing the characteristics of different forecasting models, combining different forecasting models properly, and finding a more scientific and reasonable combination model become the key point to improve the prediction accuracy. Based on the above analysis, the combination forecasting model based on the MGM and NAR neural networks will be studied in this paper. Firstly, we describe the modeling process of the MGM and the NAR neural network, respectively, in Section2. Then we present the combined model in Section 3 and validate the model through an experiment of spindle machining error in Section 4. In the last section, we give a conclusion and a discussion of future work.


## 2. Metabolic Grey Model

### 2.1. The Modeling Theory of the GM(1, 1)

The most commonly used grey system model is the GM(1,1). Firstly, the GM(1,1) is established by using the detected primary data sequence. LetX(0)={x(0)(1),x(0)(2),…,x(0)(i),…,x(0)(n)} be the machining error sequence. In order to make the original data sequence more regular and convenient for the calculation, the spindle machining error sequence is accumulated once:(1)X1=x11,x12,…,x1i,…,x1nx1k=∑i=1kx0i,k=1,2,3,…,nThen corresponding differential equation of GM (1,1) model is expressed as(2)dx1dt+ax1=bwhere a is the development coefficient and b is the ash effect.A sequence of intermediate values of a cumulative sequenceB(1)(k+1) can be calculated:(3)B1k+1=12x1k+x1k+1,k=1,2,…,n-1whereB(1)(k+1) is the background of the GM(1,1). The GM (1,1) model can be established:(4)x1k+1-x1k+aB1k+1=bThe least squares method can be used to estimate the parameters of the models a and b:(5)abT=BTB-1BTYNwhere(6)YN=x02x03⋯x0nTB=-B121-B131⋮⋮-B1n1The approximate time response of the GM (1,1) model can be expressed as(7)x^1k+1=x11-bae-ak+ba,k=1,2,…,nSubstituting the model parameters estimated by (5) into (7) can be used to obtain a cumulative error accumulation sequence x^(1). Then we have the output of GM(1,1) as the restored error sequence through the following formula:(8)x^0k+1=x^1k+1-x^1k=1-eax11-bae-akAs above stated, its modeling and prediction are based on all data whenk≤n. Due to the continuous development of the system, the impact of the old data will be gradually reduced, and the real significance of the model prediction accuracy of the impact of data is only a few of the data from the current data. Therefore, in order to improve the prediction accuracy of the GM(1, 1), this paper uses the MGM.


### 2.2. The Establishment of MGM

Based on the above modeling processes of GM(1, 1), it cannot effectively reflect the characteristics of the continuous situation. Deng et al. [20] proposed the MGM, which is a significant improvement to the prediction of the grey theory. Its modeling steps are as follows:( 1 ) Assumption X(0)={x0i∣i=1,2,3,…,n},  x(0)(N) is chosen as origin of sequence of the GM(1, 1),  N<n and N=1,2,3,…,n-1.( 2 ) Calculate the prediction datum x^(0)(N+1) and then add new data x(0)(N+1) instead of the first data x(0)(1). Thus, we can establish an updated sequence X(0)=x02,x03,…,x0N+1, which is similar to the original sequence but obtains a new data.( 3 ) Then, after a total of (n-N+1) forecasting models of GM (1, 1) are established we obtain the prediction datum x^(0)(n+1).As an improved grey prediction model, the MGM(1, 1) can add new information and remove old information in what is also a metabolic process [21]. According to the calculation process demonstrating the modeling steps of the MGM(1,1), however, the model has no feedback mechanism and lacks self-learning and self-organization ability in terms of dynamic machining errors. So we utilize the results of the MGM(1,1) as input to the NAR neural network and develop the second-step predicting of the combined model.


## 2.1. The Modeling Theory of the GM(1, 1)

The most commonly used grey system model is the GM(1,1). Firstly, the GM(1,1) is established by using the detected primary data sequence. LetX(0)={x(0)(1),x(0)(2),…,x(0)(i),…,x(0)(n)} be the machining error sequence. In order to make the original data sequence more regular and convenient for the calculation, the spindle machining error sequence is accumulated once:(1)X1=x11,x12,…,x1i,…,x1nx1k=∑i=1kx0i,k=1,2,3,…,nThen corresponding differential equation of GM (1,1) model is expressed as(2)dx1dt+ax1=bwhere a is the development coefficient and b is the ash effect.A sequence of intermediate values of a cumulative sequenceB(1)(k+1) can be calculated:(3)B1k+1=12x1k+x1k+1,k=1,2,…,n-1whereB(1)(k+1) is the background of the GM(1,1). The GM (1,1) model can be established:(4)x1k+1-x1k+aB1k+1=bThe least squares method can be used to estimate the parameters of the models a and b:(5)abT=BTB-1BTYNwhere(6)YN=x02x03⋯x0nTB=-B121-B131⋮⋮-B1n1The approximate time response of the GM (1,1) model can be expressed as(7)x^1k+1=x11-bae-ak+ba,k=1,2,…,nSubstituting the model parameters estimated by (5) into (7) can be used to obtain a cumulative error accumulation sequence x^(1). Then we have the output of GM(1,1) as the restored error sequence through the following formula:(8)x^0k+1=x^1k+1-x^1k=1-eax11-bae-akAs above stated, its modeling and prediction are based on all data whenk≤n. Due to the continuous development of the system, the impact of the old data will be gradually reduced, and the real significance of the model prediction accuracy of the impact of data is only a few of the data from the current data. Therefore, in order to improve the prediction accuracy of the GM(1, 1), this paper uses the MGM.


## 2.2. The Establishment of MGM

Based on the above modeling processes of GM(1, 1), it cannot effectively reflect the characteristics of the continuous situation. Deng et al. [20] proposed the MGM, which is a significant improvement to the prediction of the grey theory. Its modeling steps are as follows:( 1 ) Assumption X(0)={x0i∣i=1,2,3,…,n},  x(0)(N) is chosen as origin of sequence of the GM(1, 1),  N<n and N=1,2,3,…,n-1.( 2 ) Calculate the prediction datum x^(0)(N+1) and then add new data x(0)(N+1) instead of the first data x(0)(1). Thus, we can establish an updated sequence X(0)=x02,x03,…,x0N+1, which is similar to the original sequence but obtains a new data.( 3 ) Then, after a total of (n-N+1) forecasting models of GM (1, 1) are established we obtain the prediction datum x^(0)(n+1).As an improved grey prediction model, the MGM(1, 1) can add new information and remove old information in what is also a metabolic process [21]. According to the calculation process demonstrating the modeling steps of the MGM(1,1), however, the model has no feedback mechanism and lacks self-learning and self-organization ability in terms of dynamic machining errors. So we utilize the results of the MGM(1,1) as input to the NAR neural network and develop the second-step predicting of the combined model.


## 3. NAR Neural Network

In the first-step predicting, the machining errors are processed by the MGM(1,1) based on the linear time series. In all applications subject to high variations and rapid transients, however, the time series cannot be modeled by a linear model [22], and so a nonlinear model should be proposed for time series. As a dynamic recurrent neural network, the NAR neural network forms a discrete, nonlinear, autoregressive system including the input layers, hidden layers, and output layers. The model can be defined as(9)yt=fyt-1,yt-2,…,yt-p+etwhere p is the number of delays, which is also the order of the NAR neural network. f(·) is the unknown smooth function, y(t) the output, t the time vector, and e(t) the corresponding error item.We assume thatE[e(t)∣y(t-1),y(t-2),…]=0 and that e(t) has finite variance δ2. The value of y(t) is determined by the delay sequence of {y(t-1),y(t-2),…,y(t-p)}, indicating that NAR neural network has memory tracking function, which can reflect the development trend of things. The specific structure is shown in Figure 1.Figure 1
NAR neural network structure.W i j and Wj represent the weights; xi is the input. The mathematics algorithm of the neural network is expressed as follows:(10)y=∑j=1lWjf∑i=1pWijxii=1,2,…p;j=1,2,…lIn time series prediction with neural networks, the main problems have usually been the selection of the length of the input vectors and the actual structure of the network [23]. These problems are similar in all neural architectures.The order of the NAR neural network is determined according to the residual variance, which is judged according to the one-step prediction variance [24]. As the order increases, the results of the one-step prediction are, respectively, calculated. However, the prediction accuracy of the neural network will not increase with the order increasing. Furthermore, increasing the number of orders makes the system more complex and restricts the computational power of the neural network.The transfer function of the hidden layer is the most commonly used nonlinear excitation function: unipolar Sigmoid function. The function and its derivatives are continuous and have a very good effect on dealing with problems. The expression is(11)fx=11-e-xThe prediction performance of the network is decreasing because of the large range of the error data, and the output value of the activation function of the network output layer is restrictive. Therefore, it is necessary to normalize error data before training and forecasting. This paper is normalized by (12) so that each input sample data falls within the interval [0,1].(12)xi′=xi-xminxmax-xminThe structure and sample selection of NAR neural network have an important influence on the generalization ability of neural networks, and it is very important to choose a fast and effective training algorithm. The parametersWij and Wj (weights) are estimated in the training process. In this paper, Bayesian regularization (BR) algorithm [25] is adopted to optimize the performance evaluation function of neural networks, which improves the generalization ability of neural networks and reduces the computational complexity. The BR algorithm is given by the following formula:(13)Fw=α·Ew+β·EDwhereEw is the sum of squares for all network weights, ED is the sum of squares for all network errors, α and β are regularization coefficients.(14)Ew=∑wi2ED=∑ti-ai2α=γ2Eww0β=m-γ2EDw0where wi is the network weight, ti and ai are the network expectations and actual values of the training samples of the group i, respectively, m is the total number of network weights, γ is the effective number of network parameters, and w0 is the network weight of F(w).In summary, the modeling procedure of NAR neural network model is shown in Figure2. When the NAR neural network is being established, the residual variance method is used to determine the order firstly. According to the Kolmogorov theorem [26], the number of hidden layer nodes can be set. The open loop model is used to train the NAR network to meet the error precision requirement and then convert it into closed loop mode for prediction. The outliers made the prediction by NAR neural networks difficult.Figure 2
Flow chart of NAR neural network prediction model.


## 4. Prediction of Spindle Machining Error Based on Combined Model

By the researches mentioned, this paper indicates that forecasting the machining errors through the traditional grey model or the MGM can solely predict the trend of the original data sequence, but the prediction of the internal changes of the data is not enough. However, although the artificial neural network model can reflect the internal variation of machining error, it gradually deviates from the trend of the original data because of the delay nodes. These two methods have their own advantages, thus establishing a combination model to enhance the machining error prediction accuracy. The building process of the two constituent models is described as follows.Firstly, the GM(1,1) is used to deal with the detected machining error data. Then the prediction results of the GM(1,1) are processed repeatedly by the metabolic model. Next the residual values with strong randomness are used as the input values of the NAR neural network for nonlinear fitting optimization. Bayesian regularization algorithm is used to train the NAR neural network to adjust the weights and thresholds of the network nodes. Finally, the residual prediction values are corrected to improve the prediction accuracy of the model. The schematic diagram is shown in Figure3.Figure 3
Schematic diagram of the combined model based on metabolic and neural network.


## 5. Experimental Verification and Model Comparison

Spindle parts are commonly found in mechanical parts, and the machining accuracy of the spindle has a very large impact on the assembly process. Taking the spindle machining error data as an example, the modeling and prediction of the model are analyzed. As shown in Figure4, the specimen used in this research is a spindle with a length of 126 mm, and this paper selects the right end length of 56 mm with dimensional accuracy requirements of Φ24h80-0.033 as the measuring section of the spindle machining error.Figure 4
Part drawing of stepped spindle.The parts are processed on a CNC lathe with FANUC CNC system. The cutting fluid is used and left of the spindle is fixed, and the right side is machined. The machining process of the spindle is completed by two steps: roughing and finishing. The tool is made of carbide (YT15) machine tool. The rough and fine cutting parameters are shown in Table1.Table 1
Cutting parameters.
Processing name cutting parameters Rotating speed n (r/min) Cutting depthap (mm) Feed ratef (mm/r) roughing 600 2 0.25 finishing 1000 0.5 0.1On the same CNC lathe, 120 pieces are machined by continuous cutting with one cutting tool, and the spindle machining error is detected according to the order of processing. In the measurement, a total of 120 sample values are collected. According to the order of processing, 10 pieces of data are recorded in each group, a total of 12 groups, as shown in Table2. The spindle machining error sequence is shown in Figure 5.Table 2
Spindle machining error data (μm).
1 18.1 18.3 19.1 19.3 18.2 16.3 16.1 18.3 18.2 16.8 2 19.1 18.8 16.3 17.8 18.5 17.8 19.7 20.9 20.7 19.9 3 19.0 18.8 17.5 18.7 19.5 19.1 19.4 20.8 20.6 19.0 4 18.2 19.0 18.8 19.2 20.7 20.5 18.2 17.6 21.7 20.9 5 18.1 18.5 21.2 22.1 21.1 22.4 20.6 19.3 22.6 22.9 6 22.4 21.8 20.2 20.0 21.7 22.4 20.4 20.8 22.9 23.0 7 23.5 25.3 24.7 21.6 19.5 20.7 22.4 23.3 24.1 24.3 8 23.6 22.3 21.6 22.8 23.6 23.6 25.2 26.9 27.6 26.8 9 27.1 25.8 23.9 23.7 24.4 27.0 29.4 29.7 29.8 26.3 10 27.2 27.1 25.1 24.2 26.3 28.5 31.3 32.6 31.4 29.1 11 25.2 26.8 30.1 31.3 33.2 34.3 35.3 35.4 35.4 36.4 12 33.4 30.4 28.5 31.5 32.5 35.8 36.2 34.4 34.1 34.0Figure 5
Spindle machining error sequence.In order to compare the prediction results, the relative error test and the posterior difference test are used to judge the MGM and the combined model.(  1) The Relative Error. The original sequence and residuals are known as X(0) and e, respectively; then the relative error is(15)εi=eix0i×100%=x0i-x0∧ix0i×100%The average relative error is(16)ε¯=1n-1∑i=2nεi(  2) The Posterior Difference. Let the variance of the original data sequence X(0) and the residual sequence e be S12 and S22, respectively.The posterior difference ratio is(17)C=S2S1.The small error probability is(18)p=Pei-e¯<0.6745S1According to the size of P and C, the prediction accuracy of the model can be divided into four categories: “good”, “qualified”, “hard”, and “unqualified”. As shown in Table3, the final prediction accuracy level is max⁡C level, P level.Table 3
Reference table of inspection accuracy level.
Accuracy test level posterior difference ratioC small error probabilityp 1 (good) C ≤ 0.35 p > 0.95 2 (qualified) 0.35 < C ≤ 0.50 0.80 ≤ p < 0.95 3 (hard) 0.50 < C ≤ 0.65 0.70 ≤ p < 0.80 4 (unqualified) C > 0.65 p < 0.70In order to verify the effectiveness of the combined model and compare it with the predicted results of the metabolic grey model alone, in this paper, the first 100 pieces of data were used as the training data and the latter 20 pieces of data were used to validate the data.In the MGM, the first 100 pieces of data are accumulated and the estimated values of the MGM parameters are derived according to (5). The predictive value of the MGM is derived from formula (8). In this paper, the order of the NAR neural network is 7. The number of hidden nodes in the NAR neural network is 15. As shown in Figure 3, the output of the model is the spindle machining error, so the output layer node is set to 1. According to the NAR neural network theory and the modeling process, the MATLAB software is used to model and predict the spindle machining error data sequence. The results of the MGM and the combined model are shown in Figure 6. The prediction accuracy is shown in Table 4.Table 4
Comparison of model prediction accuracy.
Model Average Relative Errorε¯ Posterior Difference RatioC Small Error Probabilityp NAR model 0.157 0.521 0.750  Metabolic Model 0.063 0.357 0.983 Combined Model 0.042 0.226 0.993Figure 6
Comparison of different prediction models.It can be seen from Figure6 that the prediction results of the combined model are closer to the actual value of the spindle machining error, which can reflect the trend of the actual spindle machining error and have high prediction accuracy.As you can see from Table4, the average relative error of combined model is reduced from 0.157 to 0.042, decreased by 73%, and the posterior difference ratio decreased from 0.521 to 0.226, reaching level 1. The small error probability is improved, but it still belongs to level 1. Finally, the prediction accuracy of the combination model reaches level 1, which has been improved greatly. The combined model can be used to predict spindle machining errors and provide technical support for error compensation.


## 6. Conclusion

In this paper, a combined model for spindle machining error modeling is proposed to predict the machining accuracy of machine tools, considering the dynamic and nonlinearity of the machining error based on the time series. This paper mainly achieved the following results:( 1 ) The forecast combination based on the MGM and NAR neural network can be used to predict the spindle machining error of machine tools. The GM(1,1) and ANN, as two individual modeling processes, are optimized by the metabolic theory and the nonlinear autoregressive algorithm, respectively.( 2 ) Taking the advantages of the metabolic model and the dynamic neural network model, the two models are combined to effectively avoid the defects of the single model information processing and greatly improve the prediction accuracy of the spindle machining error. The optimized order of NAR neural network can be determined by minimizing the residual variance according to the one-step prediction variance.( 3 ) Comparing with other models, the combined model has the advantages of simple algorithm, high prediction accuracy, fast modeling speed, and low requirement of the original modeling data. It can be applied to other complex data sequence processing.The results of this study provide further research assumptions. On the one hand, if the weights of the two coupled models can be calculated according to different data characteristics, a better prediction model can be obtained. On the other hand, the impacts of time correlations among the prediction errors in combinations can be considered.



---

*Source: 3703861-2018-07-16.xml*