Research on Fusion Predictive Control Method of Size and Roundness in Online Grinding

In order to solve the problem that the error evaluation delay and the size and roundness of workpiece can not meet the processing requirements at the same time in online measurement. First this paper proposes an online fusion control method for the size and roundness error of workpiece, which can not only improve the processing efficiency, but also improve the consistency of workpiece quality. Then, the Long Short-Term Memory(LSTM) is used to predict the workpiece information of online measurement, and the error is calibrated according to the predicted value. The LSTM is used to predict the workpiece information in real time, and the process parameters are adjusted in time when the prediction value is out of the theoretical boundary to avoid error accumulation. Finallyr the online grinding measurement experiment based on the LSTM is designed and carried out, and the relationship between the dimension of input tensor and the prediction accuracy is analyzed through the experimental results. The results show that the LSTM can accurately predict the grinding size sequence and roundness sequence, and has good universality. The small batch machining is carried out according to the experimental results. Statistical analysis shows that the grinding accuracy is significantly improved by using the fusion prediction and calibration method.

network can well solve the problem of time sequence prediction, and is also very suitable for the prediction and control of size and roundness errors in online grinding measurement.
In this paper, an fusion control method of size and roundness in online grinding of shaft parts using LSTM network is proposed to solve the problems that the error evaluation delay in online measurement and the size and roundness can not meet the processing requirements at the same time. The main contents are as follows. The second chapter provides the theoretical basis of LSTM method, the third chapter gives the fusion control theory and prediction method, the fourth chapter verifies the feasibility of the method through experiments, and the fifth chapter draws conclusions.

Online prediction based on LSTM
The Long Short-Term Memory (LSTM) is a kind of neural network. The structural feature of the neural network is that it is stacked layer by layer, and the specific operations perform by each layer of neurons on the input data are stored in the weight matrix of that layer. That is, the data transformation of each layer is parameterized by its weight.
The purpose of learning is to find weights for all layers of the neural network, so that the network can correctly correspond to each example input with its target value.
To control the output of the network, it is necessary to measure the distance between the prediction value and the target value, which is realized by the loss function of the network. The input of the loss function is the prediction value and the target value of the network, and the output is the loss value, which is used to measure the consistency of the network in the current example.
The basic way of learning is to use the loss value as a feedback signal to adjust the weight value to reduce the loss value corresponding to the current example. This adjustment is completed by the optimizer, which uses the back propagation algorithm to gradually adjust the weight value in the correct direction and reduce the loss value gradually.
With enough training, the weight value can minimize the loss value, and the prediction value is very close to the target value. The trained networks can be used to represent nonlinear mappings between the input value and the target value. The training process of the network is shown in Figure 1.  Because of the long range correlation of the time series, that is, the value of the next moment depends on the previous value, the network can be used to predict time series according to this characteristic. By adding a large number of loops between the neural nodes in the hidden layer, the recurrent neural network enables the information to be preserved in the network for a long time during transmission, so it has the ability of memory. The structure of the typical recurrent neural network (RNN) is shown in Figure 2.

Ht
Although the RNN has a certain memory capacity, the last step of each hidden layer unit calculation needs to be output by a fractional processing operation. After several runs, the numerical value will still decay rapidly, and its memory capacity is not enough to cope with the long range dependence of real sequences. Therefore, the LSTM optimizes the hidden layer neural nodes of the recurrent network and adds new gating units to retain timing information for a longer time. Compared with the RNN, the gating unit sets up a self-loop to the internal state of the LSTM. The neural node structure diagram of hidden layer of LSTM is shown in Figure 3. Figure 3. Structure diagram of hidden layer neural node of the LSTM In the Figure 3, ft, it and ot respectively represent the control signals of the forgetting gate, the input gate and the output gate. The relationship between each nerve node and the gated signal is shown in Formula (2).
Where, Wif，Wii and Wio represent the weight matrix between the input node and the forgetting gate, the input gate and the output gate . Whf, Whi and Who represent the weight matrix between the output value of the hidden layer at the previous moment and the forgetting gate, the input gate and the output gate. Ct is the output value of the network at the current moment, and Ct-1 is the output value of the LSTM at the last moment.
Through the activation function, the gate control signals ft, it and ot are applied to Ct, and the functions of memory, the input and the output of the LSTM unit are realized. Among them, the input gate determines the input value at the current moment and the system state at the previous moment to update the internal state. The forgetting gate determines the update of the internal state of the previous moment to the internal state of the current moment.
The output gate determines the internal state to update the system state. The LSTM is used to train the change sequence of workpiece data in grinding process in batches, and an appropriate LSTM network is obtained to represent the mapping relationship between the input sequence and the prediction value. The accurate prediction of grinding process can be realized by applying the mapping to grinding process.

Fusion predictive control of size and roundness
Online measurement and grinding processing technology has greatly improved the efficiency and intelligence of grinding processing. This processing method can show the processing process in real time. This method can realize the closed-loop control of the workpiece error, so the accuracy and efficiency can be significantly improved.
In the grinding process, the error can be calibrated in time to improve the machining accuracy. The online measurement system is shown in Figure 4. The system is mainly composed of the measurement device, drive device, control device, control system, grinding wheel feed device and so on. Among them, the measurement device obtains the data of the workpiece in real time. The sensor probes transmit the workpiece data to the measurement device in real time in the contact relative measurement mode. The control device receives the data sent by the measurement device and predicts the timing information of the data. And the control system adjusts the processing parameters in time according to the predicted information. The grinding wheel feed device and drive device are adjusted according to the command of the control system to realize the closed-loop control of workpiece machining.

Fusion control of the Size and roundness
The online machining process of traditional shaft parts is divided into 5 stages according to the size of the workpiece and the characteristic points. They are the fast feed stage, the rough grinding processing stage, the semifinished grinding processing stage, the finished grinding processing stage and the light grinding processing stage.
In the step-by-step processing mode, the roundness of the workpiece is generally gradually reduced with the grinding process, mainly the reduction of the grinding wheel feed speed. The factors that affect the roundness error in the grinding process are complex, and one of the important factors is the original roundness error formed in the upper-level machining process. The original roundness error of the workpiece affects the roundness error of the nextlevel machining process through the change of the normal cutting force between the workpiece and the grinding wheel. Obviously, the online measurement and control of the workpiece roundness error by the measurement control system can not only improve the machining efficiency, but also realize the control of the final roundness error by decreasing the roundness error step by step in the grinding processOnline evaluation of roundness error can be used to show whether the machining process is normal. Compared with the roundness evaluation after machining, online evaluation can not only improve the machining efficiency, reduce the reject rate of workpiece, but also improve the consistency of workpiece quality.
Due to the different requirements on the accuracy of roundness error in the processing process, the online roundness error calculation methods are also different. In the stage of the rough grinding and the semi-finish grinding, the requirements on roundness are not high. So in order to save power consumption, the roundness information is approximated by ellipticity. And the calculation of ellipticity is shown in Formula (3).
In the processing stage after the finish grinding, because of the high precision evaluation of roundness at this time, the accuracy of ellipticity has not reached the evaluation standard. In this case, the online roundness evaluation method is used to evaluate roundness. Different from the measurement process of static workpiece after machining, the grinding wheel feed is a dynamic process. Therefore, the online roundness evaluation of grinding process is a real-time evaluation of dynamic grinding process by predicting the roundness error after machining. In the process of grinding wheel feeding, the contour size of the workpiece also changes constantly. The schematic diagram of the workpiece cross section during the grinding process is shown in Figure 5. According to geometry, the trajectory generated by a point leaving a fixed point at a uniform speed and rotating around the fixed point at a fixed angular speed is called Archimedes spiral, and its polar coordinate equation The following hypotheses can be made by analyzing the actual contour formation of workpiece in grinding process. When the workpiece rotates at a uniform speed and grinding wheel is fed at a uniform speed, other influencing factors such as workpiece rotation eccentricity, machine tool vibration, grinding wheel tremor and grinding heat are not considered. Under ideal conditions, the cross-section of workpiece contour in the grinding process is the spiral of Archimedes. Online roundness evaluation in grinding process is actually the roundness evaluation of spiral line which is similar to Archimedes spiral line. Compared with the measurement process of static workpiece after machining roundness error evaluation, the variation of the actual contour radius of the workpiece not only comes from the roundness error itself, but also includes the size change caused by the grinding wheel feed.
In the subsequent processing, the size changes caused by the grinding wheel feed can be eliminated continuously, and the Archimedes spiral of the workpiece contour section can be trimmed into a circle.
The principle of online roundness evaluation technology is to obtain the radius of the measuring point of the actual contour in the grinding process. The Archimedes spiral is compensated as circle through size compensation, and then the roundness error of the circle is calculated.
First, the measured polar coordinates of the workpiece's actual contour surface are set as (Ri，θi),(i=0,1,···,m), where Ri is the polar diameter of the measuring point, and θi is the polar angle of the measuring point. Then compensate the size, set the line l as the least square fitting line of the measured points in the rectangular coordinate system with abscissa and ordinate coordinates, and the slope is k, and Ri is the value of the compensated polar diameter. As shown in Formula 5.
The roundness error can be obtained by taking (Ri，θi) as the polar coordinate of the new measurement point after compensation. According to the evaluation standard [29] and [30] of the new generation GPS, the least square  (7): Similar to the size process in machining, the processing process can be divided according to roundness information. And it can be seen from the above that it is necessary to carry out the manufacturing mode of simultaneous size and roundness control in grinding. Therefore, the online processing process can be divided into five stages according to the process rules according to the feature points. Before P1 is the fast feed stage. P1-P2 is the rough grinding stage. P2-P3 is the semi-finish grinding stage. P3-P4 is the finish grinding stage. And after P5 is the light grinding processing stage. After the light grinding processing stage, the grinding wheel will be withdrawn. And the mark of reaching stage P is that size signal S and roundness signal point R both reach the specified value. When the control device detects the size and roundness of the workpiece reach the requirements of each stage, the control system automatically adjusts the process parameters to enter the next grinding stage, until the workpiece meets the design requirements, and the grinding wheel carries out back movement until the next cycle begins. In step by step machining mode, the fusion control processing process of the workpiece size and roundness error mode is shown in

Online prediction and calibration based on the LSTM
The LSTM is introduced to predict size and roundness data, and the size and roundness values obtained by online measurement are used for the networks training. First, the original data is divided into data sets. The training set is used to train the network, and the mapping relationship trained is tested in the test set to evaluate the training results. In the training stage, the data of the training set are processed in batches. By setting the sequence size, select a number of data points as the training input, and take the data at the next moment of the sequence as the prediction target value of this input. Continuously moving the sequence backwards yields the input and output tensors of the network. The LSTM network is trained to construct data mapping with input and output tensors. After the proper network is trained, the mapping relationship between the input data set and the output prediction value can be obtained. The test input tensor is constructed according to the same sequence size in the test set, and the prediction value can be obtained directly by using the data mapping relationship. The LSTM network training and prediction process is shown in Figure 7.
Size or roundness data set   Figure 9 is the schematic diagram of the size calibration. Figure 10 is the schematic diagram of the roundness calibration. Online measurement method is used to update the size and roundness error sequence in real time, and the data set with specified sequence size is input into the trained the LSTM network, and the processing prediction value is obtained according to the mapping relationship. Once the prediction value exceeds the boundary, the feed mechanism is immediately controlled to change the grinding parameters and the working state of the machine tool is changed for calibration. In this way, the processing error is reduced in time to avoid error accumulation and improve the accuracy of processing. According to the explanation in Chapter 3.1, the flow chart of online predictive control based on the LSTM for online grinding based on four signal points is shown in Figure 10.  Figure 10. Flow chart of online predictive control based on the LSTM for online grinding In order to verify the validity and accuracy of the proposed method, an online measuring grinding experiment is designed and carried out using the LSTM network to predict and calibrate grinding processes in this chapter.

Start
Experimental device in this paper is the high-precision cylindrical grinding machine MGB1320E.The workpiece size is Φ50×42mm and the material is 45#. A small batch grinding experiment is carried out by using an outer circle radial cut method, and the grinding data of each stage in each grinding process is recorded for LSTM network training. The trained network is applied to online measurement and processing to verify whether the grinding accuracy is higher after prediction and calibration .

Grinding size prediction based on the LSTM
Since the finish grinding stage has obvious influence on the machining quality, the size data of the finish grinding stage is selected for experiment. First, the size data in the finish grinding stage are divided into data sets, and the results are shown in Figure 11.
After dividing the data set reasonably, the input and output tensors of different dimensions are constructed by changing the size of the sequence. The first dimension of the input tensor is equal to the sequence size, which is referred to as dimension size in this paper, and its value is equal to the number of input nodes of the LSTM network.
After the network training is completed, the prediction accuracy of different dimensions is evaluated by calculating the average relative error between the prediction size and the real size. After the input tensors of different dimensions participate in the training, the mapping relationship and test input tensors are used to predict. In order to clearly display the prediction results, input tensors of different dimensions are selected for comparison, and the results are shown in Figure 12. The size is expressed by machining allowance. As can be seen from Figure 11 and Table 1, the prediction results of test input tensors of different dimensions have some deviations, but the size change trend can be predicted. When the dimension size is 12, the most accurate prediction results can be obtained, and the prediction accuracy can reach 98.88%.   First, when the number of input nodes of the network is small, with the increase of data, the mapping that network can learn from the input tensor is more comprehensive. Increasing the number of input neurons can effectively improve the prediction accuracy, but it has a strong limitation. Second, when the dimension of the input tensor exceeds a certain size, the dependence of network on time series gradually increases, and its memory ability will decrease due to the fractional processing of network. At the same time, as the number of sampling points increases, the network is gradually affected by the noise in the size data, and the learned mapping relationship introduces too much systematic error, which affects the prediction accuracy. When the comprehensive adverse effect is greater than the learning ability of the network, the prediction accuracy decreases gradually, which shows that the prediction error increases gradually.

Grinding roundness prediction based on the LSTM
Since the finish grinding stage has obvious influence on the machining quality, the data of the finish grinding stage are selected for experiment. First, the roundness data in the finish grinding stage are divided into data sets, as shown in Figure 14, and the subsequent data are predicted.   Figure 14. As can be seen from Figure   15 and Table 2, the prediction results of test input tensors of different dimensions have some deviations, but the roundness change trend can be predicted. When the dimension size is 8, the most accurate prediction results can be obtained, and the prediction accuracy can reach 99.88%.

Machining Experiment Based on the Online Fusion Predictive Control Method
In order to verify the effectiveness of the LSTM network to improve machining accuracy, small batch machining experiments and precision statistical analysis are carried out. Use the grinder to process a batch of 500  Figure 15 and 16. It can be seen from statistical results Figure 16, Figure 17 and Table 3 that the mean and variance of relative errors are significantly improved when the roundness accuracy is satisfied after the addition of supplementary calibration processing, indicating that the online prediction and calibration processing using LSTM network can effectively improve the machining accuracy.  Table 3. Comparison of statistical data before and after calibration

Conclusion
In order to solve the problem that the error judgment lag and the size and workpiece roundness can not meet the machining requirements at the same time in online measurement, a fusion control method of workpiece size and workpiece roundness error is proposed. Then, LSTM is used to predict the workpiece information of online measurement, and the error is calibrated according to the prediction value. The online grinding measurement experiment based on LSTM is designed and carried out, and the relationship between the dimension of input tensor and the prediction accuracy is analyzed through the experimental results. The results show that the LSTM network can accurately predict the grinding size sequence and the roundness sequence of the grinding stage, and has good universality. It is suitable for online prediction and control. Statistical analysis shows that the online fusion control method can effectively improve the machining efficiency by shortening the intermediate measurement link and adjusting the machining process in time. Through online measurement and prediction, the size and roundness error of workpiece can be fusion controlled, which can effectively improve the machining accuracy. The online prediction and control method is used to carry out small batch machining, and the statistical analysis of the results show that the fusion prediction and control method of online grinding size and roundness using LSTM can improve the machining accuracy significantly.