Sensing and Compensating the Thermal Deformation of a Computer-numerical-control Grinding Machine Using a Hybrid Deep-learning Neural Network Scheme

Thermal error plays a deterministic role in the machining precision of computer-numerical-control (CNC) tool machinery. Previously, three ways had been proposed to overcome thermal error problems: prevention, restraint, and compensation. The first two ways may be performed in the initial design stage. The last one includes the challengeable features of case-by-case simulation of cutting paths, searching for characteristic temperature points, thermal deformation measurement, and establishing an accurate thermal model. Different from most of the previous studies concerning mathematical thermal models, which have many restrictions and disadvantages, in this study, we propose a novel hybrid thermal error modelling scheme of the Grey system theorem and deep-learning neural network. Specifically, a linear-guide-way grinding machine, never seen in previous thermal-error-compensation-related studies, was chosen as the target to identify the usefulness of our proposed scheme. Results show that the proposed hybrid model has a comprehensive prediction ability of thermal behavior for the target CNC grinding machine.


Introduction
For a grinding machine, the machining error means the relative position error between the grinding head and the workpiece.This machining error mainly comes from, for example, the structure dynamic deformation, thermal distortion, grinding head error, workpiece error, mechanism kinematic error, controller error, and controlling rule error.Among these errors, the thermal deformation error plays the most important role and is difficult to handle.The thermal deformation error is as high as 70% of the total error. (1)There are two categories of heat sources, internal and external, that cause the thermal deformation of machines, as shown in Table 1.In general, there are three strategies to reduce the thermal error of grinding machines: adopting a thermally stabilized structural design, restraining heat generation from components, machine users, and the environment, and compensating the thermal error in real time.Among these strategies, the thermal error compensation technique is the most effective and popular.
Previously, we found a few published papers concerning the issue of how to reduce the thermal error of a grinding machine.Our target is the three-head grinding machine, which is excellent and efficient for grinding a long linear guide way (over 4 m long), as shown in Fig. 1.This type of machine is the key manufacturing equipment in linear-guide-way production.The essential issue is how to reduce the machine thermal error.This machine features a long and narrow bed and column-type three-grinding-head structures, which are different from other machining centers or lathes commonly found in the market and extensively investigated by scholars.It is necessary and significant to investigate the thermal error of this machine and its compensation method.
In this paper, we attempt to propose a comprehensive thermal error compensation model for a computer-numerical-control (CNC) grinding machine, featuring a column-type structure, a long bed with a large height-to-width ratio, and a three-grinding-head mechanism.
Moreover, the manipulation procedure of the thermal error compensation in this study is designed as follows: (1) select the axes or goals (three grinding heads) on the machine to be compensated, (2) set the proper tool (sand wheel) paths in simulation experiments as close to the actual grinding conditions as possible, (3) select key points for temperature measurement, (4) measure the thermal error of goals and temperature rise at key points, (5) formulate an accurate mathematical relationship between the temperature rise and the thermal error, and (6) compare and verify the constructed thermal error model.It is clear that every process is important.Once the target machine is selected, we need to manipulate the thermal error modelling via the above steps in accordance with the machine features.
In the above manipulation procedures, the fifth item, the thermal error model, plays a deterministic role.(18) The compensation accuracy of machine tools was apparently improved via the use of the abovementioned thermal error models.Among the proposed thermal mathematic models, the model built by the ANN is known to be excellent and popular since it has excellent ability for dealing with multi-input and multi-output mapping problems.This essence is particularly suitable for our study in building mathematic models.However, this method has limitations: too many hidden layers result in training difficulty and performance degradation.This disadvantage obstructs the application and development of ANN.However, this defect has recently been overcome through the use of the so-called "deep neural network (DNN)".
Regarding the above discussion, in this study, we aim to build a thermal error model using GT and DNN hybrid schemes to enhance the thermal precision of a CNC grinding machine with a challengeable long and narrow bed and three-head column structures.

Mathematic Method
The convolutional neural network (CNN) has proven to be the state of the art of the comprehensive network of DNNs, and is capable of mapping multi-output with multi-input modelling problems.This technique was developed in the 1980s and 1990s. (19)Since 2012, when it was dramatically revived, this technique has conquered most computer vision fields and is growing rapidly. (20)The CNN consists of a neural network that extracts features of the input image and another neural network that classifies the feature image (Fig. 2).The fundamentals of the CNN are as follows.
The simplest neural network is called a multilayer perception (MLP).The nth layer of an MLP can be expressed as There are many different functions chosen for φ, such as step, sigmoid, and hyperbolic tangent functions.Here, we adopt a rectified linear unit (ReLU).The ReLU function is defined as the positive component of its input: It was discovered that even a single hidden layer is sufficient for an MLP to express any continuous function with arbitrary precision (Universal Approximation Theorem). (21)However, how to construct such a neural network is still trial-and-error work.As known, expressing complicated functions is quite expensive for a two-layer MLP since a hidden layer needs far too many neurons.Instead, DNN researchers have used networks with multiple narrow layers.The trade-off and challenge with DNNs lies in how to tune them to solve a given problem.CNNs adopt a machine learning algorithm that consists of a set of rules for using and updating a set of parameters (i.e., tune weights) in accordance with labeled data provided to it.Moreover, the learning type of the CNN in this study is chosen to be reinforcement learning, which is related to supervised learning but decouples the form of the training outputs from that of the inference output.The output of reinforcement learning is called an action, and the label for each training input is called a reward.Training phase , x r M → Inference phase ( ) A model infers some output action from its input, that action produces some reward from the external system, and then, the initial input and subsequent reward are used to update the model.Furthermore, it is difficult to decide the initial distribution of random values of model parameters.It is suggested that these values should be small and random.Moreover, we chose the cross-entropy loss function to evaluate the difference between the true and the estimated outputs.
This loss function is chosen because it is capable of dealing with the relationship between multi-input and multi-output.Finally, to adjust the model weights to minimize the loss function, we use the stochastic gradient descent (SGD) method in conjunction with the backpropagation technique to finish the model training work.A CNN is like a large MLP where many of the weights in a layer are tied together in a specific pattern.In training, when a gradient update is applied to one of these weights, it is applied to all of them.

Experimental conditions
To investigate the thermal behavior of the target grinding machine, the following specific machining experiment is designed.We now consider the most frequently encountered grinding condition (shown in Table 2) in which the three heads operate simultaneously to perform the upper, right, and left surface grinding for a linear guide way.The workpiece is made of S45C steel with surface heat treatment, hardness of HRC45, and narrow and long dimensions of 60 × 50 × 1500 mm 3 .The diameter of the three sand wheels is selected to be 405 mm.Our simulation condition is set as the above conditions but without actual grinding.

Temperature and thermal error measurements
The sensing units were composed of thermal sensors and displacement sensors.The resistance thermometers (PT100) were employed as temperature sensors for detecting the temperature variation of thermal key points on the machine.Moreover, the eddy current displacement sensors were used to detect the thermal error of the three grinding heads.For temperature measurements, the thermal key points should be carefully chosen since the numbers and locations of the temperature sensors have a considerable influence on the accuracy of the thermal error modelling and compensation results.In general, there are some potential rules in selecting the thermal key points: (22) (1) close to the main heat sources; (2) capable of reflecting the temperature field of a system; and (3) having a close relationship with the thermal error.On the basis of these rules, a total of ten thermal sensors were stamped on the key points, as listed in Table 3 and shown in Fig. 3. On the other hand, three displacement sensors were stamped at the end (near workpiece) of the three grinding heads.
Then, the temperature at key points as well as the thermal error at grinding-head ends were measured synchronously using the measurement system under the simulation test conditions described previously.Figures 4 and 5 show the measurement results of machine temperature variation and grinding-head displacement, respectively.In Fig. 4, it is seen that the environmental room temperature is about 25 ℃ and is increasing steadily to about 30 ℃.A maximum increase of 5 ℃ is detected.In addition, an apparent temperature field with a variation from 0 to 25 ℃ forms on the machine surface, which is stimulated by all possible heat sources in a test run.In Fig. 5, the thermal drifts of the three individual heads are detected (only considering the −Z direction for the upper head, the +X direction for the left head, and the −X direction for the right head).It is found that the upper head has the largest deformation (δ U , max.−140 µm) compared with the other two heads (right head δ R , max.+119 µm; left  head δ L , max.−109 µm).These three deformations contribute the most error in the final dimension precision of the workpiece, and they should be carefully examined in the following compensation procedure.

Thermal error modeling
First, to understand as well as trim the measured temperature data, the popular data mining scheme of the GT is adopted.The GT, first proposed by Professor Julong Deng, (23) is a theory for analyzing a system with uncertainty due to a small amount of data or incomplete information.We use the GM(1,N) scheme of GT, (16) which essentially is a first-order differential equation for treating the relationship between multi-input and one output, as an auxiliary method to mine the influence weighting of temperature on thermal deformation.Through the selection of high-weighting temperature, we can properly trim the obtained temperature data.From the previously obtained measured temperature and deformation data (requires normalization), we can calculate the weight of temperature at ten key points for every grinding head via the GT scheme.Most importantly, the result of the influence of ten thermal key points on the upper grinding head is shown in Fig. 6.The order of influence (R means ranking) is The same influence sequence may be found for the other two grinding heads.Examining the overall measured temperature data, we found that T3 is negligible since it has a very small weight of 0.17.
Second, using the above relatively important nine temperature rises as input and three grinding head deformations as output, we can construct a CNN network.This CNN network has five layers: one input layer, one convolution layer (10 neurons), one pooling layer, one hidden layer (7 neurons), and one output layer (3 neurons).Only three layers, the convolution, hidden, and output layers, contain weight matrices that require training.Through training, the weights of neurons for each layer are determined.We trained our model using SGD with a batch size of 90 examples, momentum of 0.86, and weight decay of 0.0006.We initialized the weights in each required layer from a Gaussian distribution with zero mean and a standard deviation of 0.01.We used an equal learning rate (initialized at 0.01) for all required layers.
The obtained final trained results may be expressed in the form of a prediction curve of thermal error.Figure 7 shows the measured and predicted results for the upper grinding head.It is seen that the maximum measured thermal error is −140 µm.Moreover, after compensation using our prediction model, the maximum thermal error can be reduced to −1.8 µm, which corresponds to a 98.7% improvement.

Verification
To verify the proposed thermal error model, a new grinding test is performed.The test condition is shown in Table 4. Compared with the original modelling experiment, the spindle speed and bed moving speed have been changed.This means that a possible situation of   An improvement of 98.4% of the thermal error is achieved.This result verifies the good prediction ability of our proposed hybrid CNN thermal error model.

Conclusions
In this study we showed a novel compensation approach for thermal errors of a CNC grinding machine with long guide way (over 4 m).The thermal error, which is the main source of the inaccuracy of a CNC grinding machine, can be reduced effectively via our proposed thermal error compensation method using the hybrid modelling technique involving the determination of test conditions, key thermal location selection, temperature data reduction using the GT, and mathematic mapping using a CNN.We found that, for the chosen complicated grinding machine with a specific long and narrow bed and the column-type three-grinding-head structure, the hybrid CNN scheme is successful in establishing a thermal error model that solves the problem of multiple temperature inputs and multiple thermal error outputs.An apparent improvement of 98.7% in the thermal error in the simulation experiment was reached.The maximum thermal error of the upper grinding head was reduced to −1.8 µm in the simulation experiment and −3.2 µm in the verification experiment.The prediction results are satisfactory.It is conceivable that the proposed hybrid CNN thermal error modelling scheme can be widely applied to other complicated CNC grinding machines so as to ensure their machining precision.

Fig. 6 .
Fig. 6. (Color online) Effect of increase in temperature at key points on the upper-head (UH) deformation (in the −Z direction).

Fig. 7 .
Fig. 7. (Color online) Measured and predicted results for the upper grinding head.
material is considered.Using the constructed CNN networks including all obtained parameters and inputting the measured temperature data of the verification test, we can predict the thermal deformation of the three heads.The experimental and model-predicted results are shown in Fig.8.It is seen that the maximum measured thermal error is about −200 µm, and through compensation, the maximum thermal error can be reduced to −3.2 µm.

Fig. 8 .
Fig. 8. (Color online) Thermal deformation before and after compensation in the verification test.

Table 1
Thermal error sources of a CNC grinding machine.

Table 2
Simulation test conditions of grinding.

Table 3
Key locations of temperature sensors.

Table 4
Verification test conditions of grinding.