# Spindle Thermal Error Prediction Based on LSTM Deep Learning for a CNC Machine Tool
###### Abstract  
In the precision processing industry, maintaining the accuracy of machine tools for an extensive period is crucial. Machining accuracy is affected by numerous factors, among which spindle thermal elongation caused by an increase in machine temperature is the most common. This paper proposed a key temperature point selection algorithm and thermal error estimation method for spindle displacement in a machine tool. First, highly correlated temperature points were clustered into groups, and the characteristics of small differences within groups and large differences between groups were realized. The optimal number of key temperature points was then determined using the elbow method. Meanwhile, the long short-term memory (LSTM) modeling method was proposed to establish the relationship between the spindle thermal error and changes of the key temperature points. The results show the largest root mean square errors (RMSEs) of the proposed LSTM model and the key temperature point selection algorithm were within 0.6 \(\upmu\)m in the spindle thermal displacement experiments with different temperature changes. The results demonstrated that the combined methodology can provide improved accuracy and robustness in predicting the spindle thermal displacement. spindle thermal error; elbow method; long short-term memory (LSTM) +
Footnote †: journal: Applied  
10 May 2021  
17 June 2021  
**Publisher's Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. **  
**Vol. 2021**  
thermal error was established to collect the online temperature values from the key positions of a machine tool, calculate the compensation value using mathematical models, and communicate with the CNC controller. The axes positioning was periodically readjusted by the control of the machine tool, based on the received compensation value. Multiple linear regression (MLR) is a common algorithm for creating mathematical prediction models of thermal displacement [17; 18; 19; 20; 21; 22; 23]. Some neural network modeling techniques have also been proposed to obtain more robust and accurate predictions [24; 25; 26; 27; 28; 29; 30; 31; 32]. In addition, how to select and decide the representative temperature-sensitive points among numerous Initial Temperature Points (ITPs) is crucial. The performance of the selection method directly affects the accuracy of the estimation model as well as the cost of system implementation. [PERSON] et al. [21] proposed a modeling method based on a principal component regression (PCR) algorithm, which can eliminate the influence of multi-collinearity among temperature variables. Both PCR and MLR were given practice tests through thermal error experiments of actual machine. And the results show, the model had good forecasting accuracy and robustness using the PCR model. [PERSON] et al. [22] proposed using a fuzzy clustering algorithm to cluster highly correlated ITPs. With a gray prediction algorithm, the gray correlation between the temperature points of each group and displacements was analyzed. The temperature point with the greatest gray correlation was selected as the key temperature point (KTP) for each group. Finally, a ridge regression algorithm was proposed to establish the thermal displacement model. [PERSON] et al. [23] presented a new thermal error modeling method called GR-SUE. In the GR-SUE method, several temperature-sensitive points with the highest-influence weights on thermal error ware directly selected using the gray relation algorithm. A split unbiased estimation modeling algorithm was subsequently proposed to improve the MLR algorithm to inhibit the influence of collinearity on model prediction accuracy and robustness. The experimental results indicated that the GR-SUE method could significantly reduce the volatility of temperature-sensitive points and improve the prediction accuracy and robustness of the model. [PERSON] et al. [29] used the fuzzy c-means clustering algorithm to cluster ITPs and select key temperature-sensitive points.