Next Article in Journal
Sensorless Payload Estimation of Serial Robots Using an Improved Disturbance Kalman Filter with a Variable-Parameter Noise Model
Previous Article in Journal
Fault Detection and Diagnosis for Human-Centric Robotic Actuation in Healthcare: Methods, Failure Modes, and a Validation Framework
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Research on Machine Tool Thermal Error Compensation Based on an Optimized LSTM Model

1
School of Maritime and Transportation, Ningbo University, Ningbo 315211, China
2
College of Liberal Arts and Sciences, University of Illinois Urbana-Champaign, Champaign, IL 61820, USA
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Actuators 2025, 14(12), 567; https://doi.org/10.3390/act14120567 (registering DOI)
Submission received: 22 September 2025 / Revised: 14 November 2025 / Accepted: 19 November 2025 / Published: 23 November 2025
(This article belongs to the Section Actuators for Manufacturing Systems)

Abstract

Thermal error is a significant factor affecting the machining accuracy of machine tools, and error compensation is an economical and effective method to improve machine tool accuracy. However, traditional modeling methods face challenges such as insufficient nonlinear mapping capability and difficulty in parameter optimization when processing time-series data. This paper establishes a thermal error model using a Long Short-Term Memory (LSTM) neural network optimized by the Particle Swarm Optimization (PSO) algorithm (PSO-LSTM). Through thermal characteristic experiments, thermal error data and temperature rise data at various points of the T55II-500 CNC machine tool during actual machining were collected. First, fuzzy clustering and global sensitivity analysis were employed to identify the temperature-sensitive points of the machine tool. Using the temperature rise data of these sensitive points and the thermal errors of machined workpieces as data samples and optimizing the LSTM prediction model with the PSO algorithm, a PSO-LSTM thermal error prediction model was established. To verify its superiority and practicality, this paper conducts a comparative analysis with traditional thermal error prediction models based on Backpropagation (BP) neural network, Long Short-Term Memory (LSTM) network, Multiple Linear Regression (MLR), and Multivariate Nonlinear Regression (MNR). The results show that the PSO-LSTM model outperforms the other models in terms of relative error, average residual, maximum residual, and mean squared error. On this basis, a real-time thermal error compensation system was developed. Under the conditions of near-constant temperature (19.34–20.36 °C), warm natural ventilation (20.63–22.13 °C), and a wider variable temperature range (18.64–28.24 °C), the compensated thermal errors converge from 52 μm, 57 μm, and 67 μm to 4–12 μm, 6–11 μm, and 5–9 μm, respectively, with precision improved by 86%, 88%, and 86%. This effectively reduces the impact of thermal errors and improves the machining accuracy of the machine tool.

1. Introduction

Computer Numerical Control (CNC) machine tools are a key indicator of the development level of a country’s or region’s equipment manufacturing industry. They serve as essential processing equipment in aerospace, defense, automotive, electronic information, and other high-end manufacturing sectors, and have long constituted a crucial domain of national competition. The principal performance metric for CNC machine tools is machining accuracy, which directly determines the quality of the finished workpiece. Thermal-induced errors account for 70% of the total machining error in CNC machine tools [1,2]. Therefore, effectively reducing or eliminating thermal errors in CNC machine tools can markedly improve the machining accuracy of parts. Consequently, research on machine tool thermal errors has become a highly active and focused field in recent years.
Thermal error refers to the machining error resulting from the relative displacement between the workpiece and the cutting tool caused by thermal expansion of machine tool components [3]. At present, two primary strategies are employed to reduce thermal error: error avoidance and error compensation [4]. As the design and manufacturing precision of machine tool components improve, the impact of intrinsic error sources on the system diminishes; thereafter, strict measures such as temperature regulation, vibration isolation, airflow disturbance management, and environmental condition control are implemented to eliminate or mitigate the influence of external error sources on the machine tool. Although these approaches can reduce inherent errors, they remain fundamentally limited by the achievable precision of machine tool fabrication and installation. When machining accuracy requirements exceed a certain threshold, the cost of error avoidance rises exponentially, rendering it prohibitively expensive. Consequently, when error avoidance methods reach the limit of practical application, researchers turn their attention to other approaches [5].
The thermal-characteristics optimization approach is also commonly employed by researchers, focusing on the analysis and optimization of the thermal and dynamic behavior of Computer Numerical Control (CNC) machine tools. This encompasses a wide range of topics—from CNC machine-tool thermal models [6,7] and thermal–structural coupling analyses [8,9], to studies on contact thermal resistance [10,11] and optimization of component assembly [12], as well as fluid dynamic analyses of machine tools [13], contact stiffness at tool–holder interfaces [14], and modeling of accuracy loss [15]. Although thermal-characteristics analysis can partially reveal the temperature distribution and thermal deformation features of CNC machine tools, accurately determining the power density of internal heat sources and the convective boundary conditions is extremely challenging due to the pronounced nonlinearity between the temperature field and structural deformation, which inevitably compromises model accuracy. Moreover, because numerical simulations require extensive computational resources, the resulting delay in obtaining analysis outcomes hinders their timely application in error-compensation control, limiting the method’s practical adoption in engineering.
Error compensation has attracted considerable attention and rapid development over the past decades due to its ability to significantly reduce thermal-induced errors at relatively low cost. Its principal workflow comprises thermal-error measurement, identification, modeling, and compensation, with the thermal-error model—characterized by high predictive accuracy and strong robustness—being the cornerstone of this approach. In contemporary CNC machine-tool thermal-error compensation research, common modeling techniques include multiple linear regression [16,17], time-series analysis (TS) [18,19], genetic algorithms (GA) [20,21], support vector machines (SVM) [22,23], and artificial neural networks (ANN) [24]. Yang et al. [25] demonstrated that thermal-error pattern analysis combined with robust regression modeling substantially simplified sensor configurations while improving compensation performance. Liu et al. [6] improved predictive accuracy (residual standard deviation ≈ 10 μm) and cross-seasonal robustness by selecting temperature-sensitive points via correlation analysis and employing ridge regression to suppress collinearity. Wei et al. [26] significantly enhanced predictive precision (residual standard deviation ≈ 3.5 μm) and cross-condition robustness by integrating Gaussian Process Regression (GPR) with adaptive temperature-sensitive point selection and interval prediction modeling. Yang et al. [27] proposed an adaptive model-estimation method based on a recursive dynamic modeling strategy, integrating intermittent process detection and Kalman-filter parameter estimation to dynamically update and compensate the thermal-error model. Under rapidly changing manufacturing conditions (e.g., small-batch production), this approach achieved high precision (error reduction > 80%) and strong robustness, offering a generalizable dynamic modeling framework for real-time thermal-error compensation. Pu-Ling Liu’s team at Shanghai Jiao Tong University [28] introduced a BiLSTM-based deep learning method for thermal-error modeling of CNC machine tools. Using a four-layer network architecture and optimization algorithms, their experiments demonstrated that the mean depth error of workpieces decreased from 50 μm to below 2 μm after compensation, with maximum error reductions exceeding 85%, thereby markedly improving machining accuracy. Ma et al. [20] addressed the slow convergence and local-optimum issues of traditional neural-network models in thermal-error compensation by proposing an optimized model that combines Genetic Algorithms (GA) with Backpropagation Neural Networks (BPNN). They also used gray clustering and statistical correlation analysis to select thermal-sensitive variables, establishing a three-axis compensation strategy for axial thermal elongation and radial tilt in high-speed spindle systems. Li et al. [29] proposed a measurement and modeling methodology for spindle thermal error in CNC machines, comprising a five-point measurement technique, a temperature-sensitive point selection strategy based on partial correlation analysis, and a Weighted Least-Squares Support Vector Machine (WLS-SVM) model optimized via Gene Expression Programming (GEP-WLSSVM). On an i5M1 machining center, this achieved a modeling accuracy of 0.7664 μm for spindle axial thermal error and a prediction accuracy of 0.8168 μm under varying conditions. Ma et al. [30] developed a high-speed spindle thermal-error compensation method based on an improved BP neural network integrated with Genetic Algorithm (GA) and Particle Swarm Optimization (PSO). By optimizing temperature-variable grouping through fuzzy clustering and correlation analysis, and validating model adaptability under varying conditions, their experiments showed that the GA-BP and PSO-BP models improved machining accuracy to 78% and 89%, respectively. However, the complex and variable operating conditions of machine tools necessitate further validation and improvement of these models’ robustness and generalizability. Moreover, most existing models rely on manual hyperparameter tuning, making it difficult to identify the optimal parameter combinations precisely. For long-sequence data from high-precision machine tools, methods capable of effectively capturing extended temporal dependencies remain underexplored. Thermal-error models that cannot learn the long-term impact of temperature variations and tend to forget historical information—such as certain GA- and ANN-based models—face significant limitations in practical application.
Long Short-Term Memory (LSTM) networks exhibit both short-term correlation and long-term dependency characteristics, enabling them to model temporal dependencies and predict trends in time-series data [28]. Nevertheless, LSTM networks have several limitations in thermal-error prediction. First, LSTM performance is highly dependent on manually tuned hyperparameters (e.g., learning rate, number of hidden units, and batch size), making it challenging to efficiently identify the optimal parameter set. Second, LSTM’s reliance on gradient-based optimizers (such as Adam and SGD) makes it prone to local optima, thereby limiting predictive accuracy. However, studies on using LSTM networks specifically for machine-tool thermal-error prediction are scarce.
To address these issues and achieve more accurate and effective thermal-error compensation, this study adopts a Particle Swarm Optimization (PSO)-enhanced LSTM approach, termed PSO-LSTM. First, an LSTM model is developed to predict the thermal-error time series of a CNC machine tool. To establish an accurate, time-varying mapping between the temperature field and thermal error, the PSO algorithm is employed to optimize the LSTM network’s hyperparameters and enhance model performance. In addition, the PSO-LSTM model’s effectiveness is validated using experimental data and applied to a T55II-500 CNC machine tool. Finally, the performance of the proposed model is compared with that of traditional methods to verify its robustness. The remainder of this paper is organized as follows: Section 2 details the theoretical foundation and methodology of the PSO-LSTM model; Section 3 describes the thermal-characteristics experiments; Section 4 applies the PSO-LSTM model to practical machine-tool thermal-error compensation and presents a comparative analysis with traditional methods to demonstrate its effectiveness and superiority; finally, Section 5 concludes the study and outlines future research directions.

2. Thermal-Error Prediction Method Based on PSO-LSTM

The thermal-error prediction model proposed in this paper (hereafter referred to as the PSO-LSTM model) consists of a Particle Swarm Optimization (PSO) algorithm and a Long Short-Term Memory (LSTM) prediction network. Benefiting from its simple structure and strong global search capability, the PSO algorithm is used to identify the optimal combination of LSTM hyperparameters—including the number of hidden units, initial learning rate, temporal window size, and regularization coefficient—in order to enhance the model’s predictive accuracy. The optimization workflow is illustrated in Figure 1.

2.1. Temperature-Sensitive Point Selection

To establish an accurate regression mapping between thermal error and temperature sensors, reduce multicollinearity among measurement points, and improve model accuracy, fuzzy clustering analysis and global sensitivity analysis are employed to select temperature-sensitive points on the machine tool. In this study, the 19 temperature measurement points on the machine tool are grouped into two clusters via fuzzy clustering. The main theoretical formulations are as follows:
(1) Let represent a set of key monitoring variables and represent the observations of variable. The correlation coefficient between the monitoring variables is expressed as
r i j = k = 1 n X i k X ¯ i X j k X ¯ j k = 1 n ( X i k X ¯ i ) 2 k = 1 n ( X j k X ¯ j ) 2 ,
where
X ¯ i = 1 n k = 1 n X i k ,
X ¯ j = 1 n k = 1 n X j k .
Construct the fuzzy similarity matrix R from r i j and apply the square-mean transitive closure to obtain the fuzzy-equivalence matrix t ( R ) , defined as t(R) = R^(2^k).
(2) Determine the threshold λ , and classify the monitoring variables using the fuzzy equivalence matrix t ( R ) . For λ [ 0 ,   1 ] , define
r i j > λ ; r i j = 1 r i j λ ; r i j = 0 .
Let R ¯ = ( r ¯ i j ) N × N be the cut matrix of t ( R ) at the λ level. Therefore, R ¯ = ( r ¯ i j ) N × N , where r ¯ i j = 1 indicates that variables X i and X j belong to the same class.
Next, global sensitivity analysis is used to calculate the correlation between the two temperature measurement points obtained from fuzzy clustering analysis and the thermal error. The temperature measurement point with the highest correlation in each class is identified as the temperature-sensitive point for that class. Ultimately, two temperature-sensitive points for the machine tool are selected. The global sensitivity index calculation formula is as follows:
β i = k = 1 l β i , k l ,
β i , k = η i , k η i , k .
In the formula, β i represents the global sensitivity index of the I temperature measurement point, β i , k represents the instantaneous sensitivity coefficient of the I temperature measurement point at the K sample, and l represents the length of the time window. Based on Equation (3), the global sensitivity index of the dependent variable Y with respect to different input variable X can be sequentially calculated, thereby analyzing the importance of different input variables X ( X 1 , X 2 , , X i , , X n ) to the dependent variable X .

2.2. Long Short-Term Memory (LSTM) Network

Long Short-Term Memory (LSTM) networks are a specialized form of Recurrent Neural Networks (RNNs). Traditional RNNs often encounter vanishing or exploding gradient problems when processing long sequences, which can prevent successful training and impair learning. LSTM networks resolve these gradient issues by incorporating gated structures and memory cells that precisely regulate information flow, thereby maintaining effective gradient propagation [31]. The core of an LSTM cell is its cell state, depicted as a horizontal “conveyor belt” running through the cell with minimal branching. Three gates—the forget gate, input gate, and output gate—control the retention, updating, and output of information within the cell state. Consequently, an LSTM can preserve complete information over extended sequences and update that information to sustain memory across time steps. Leveraging these features, LSTMs can handle variable-length time series, capture long-term dependencies, and dynamically retain pa3t information while learning new patterns.
Figure 2 illustrates the structure of an LSTM cell. As shown, upon receiving input, the cell first removes unimportant information via the forget gate, which is computed as follows:
f t = σ W f h t 1 , x t + b f .
Here, f t represents the forget gate, σ is the activation function, W f is the weight matrix of the forget gate, h t 1 is the output from the previous time step t 1 , x t is the current input, and b f is the bias vector.
Next, the input gate selects valuable information and adds it to the network while generating new cell information to be filtered. This process can be represented as follows:
i t = σ W i h t 1 , x t + b i ,
C ~ t = tanh W C h t 1 , x t + b C ,
where i t and C ~ t are the intermediate values during the input gate and calculation process, W i and W C are the weight matrices for the input gate and internal state, and b i and b C are the biases for the input gate and internal state.
After processing through the forget gate and input gate, the cell state information is updated. The updated cell state C t can be represented as follows:
C t = f t C t 1 + i t C ~ t .
Here, C t and C t 1 represent the cell states at the current time step t and the previous time step t 1 , respectively.
The updated cell state is passed through the output gate to generate the network output. First, the output gate activation o t is computed using the activation function σ to determine which information to emit. Next, the cell state C t is processed by the tanh activation function and multiplied by the output weight matrix o t to produce the final output h t . The corresponding equations are as follows:
o t = σ W o h t 1 , x t + b o ,
h t = o t tanh C t .
These equations reveal the internal computation of an LSTM cell, where each time-step output depends on prior inputs and cell states, enabling the network to handle variable-length sequences and capture long-term dependencies when forecasting future values.
This paper selects the mean squared error as the evaluation function of the neural network model, and its formula is as follows:
E = 1 i = 1 p ( y i t i ) 2 .
In the formula, yi is the predicted output result of the network model; ti is the expected output result of the network model; and p is the number of samples.

2.3. PSO-Based Hyperparameter Optimization for LSTM

This study employs Particle Swarm Optimization (PSO) to tune LSTM hyperparameters, specifically the learning rate and the number of hidden-layer neurons. In the PSO algorithm, each particle encodes three attributes—fitness, position, and velocity—where the position denotes a candidate solution’s coordinates in the search space, the velocity indicates its search direction and magnitude, and the fitness value evaluates the solution’s quality. During optimization, particles explore the search space from randomly assigned initial positions and velocities, each representing a possible solution. Thereafter, particles share their personal bests and the swarm’s global best to iteratively update their states, ultimately converging to the global optimum [32].
Let n particles form a swarm X   ( X 1 ,   X 2 ,   ,   X n ) in a d dimensional search space. The position and velocity of the i particle are denoted by X i   ( X i 1 ,   X i 2 ,   ,   X i d ) ,   i   =   1 ,   2 ,   ,   n and V i   ( V i 1 ,   V i 2 ,   ,   V i d ) ,   i   =   1 ,   2 ,   ,   n , respectively. Based on fitness evaluations, the personal best position of the i particle is pbes t i   ( pbes t i 1 ,   pbes t i 2 ,   ,   pbes t id ) ,   i   =   1 ,   2 ,   ,   n , and the global best position of the swarm is gbes t i   ( gbes t i 1 ,   gbes t i 2 ,   ,   gbes t id ) ,   i   =   1 ,   2 ,   ,   n . The update equations for the i particle’s velocity and position at iteration t are given by
v id k + 1 = ω v id k + c 1 r 1 pbes t id k x id k + c 2 r 2 gbes t id k x id k ,
x id k + 1 =   x id k + v id k + 1 .
In the formula, k represents the algorithm’s iteration count; ω is the inertia weight, which determines the relationship between the particle’s velocity at the next time step and its current velocity; c 1 and c 2 are learning factors, primarily used to adjust the particle’s search capability; r 1 and r 2 are random numbers between 0 and 1, primarily used to enhance the particle’s random search ability. The search process of the algorithm is summarized in Figure 3 [33].
To ensure equivalence and homogeneity among various factors, the sample data must be processed into dimensionless normalized form. Therefore, this study employs the Z-score method to uniformly normalize the model data:
x ¯ = 1 n i = 1 n x i ,
S = 1 n - 1 i = 1 n x i x ¯ 2 ,
x i = x i x ¯ S ,
where x i and x ¯ represent the sample data and its mean, S and x i denote the standard deviation and the normalized value, respectively, and n is the number of samples.

2.4. Error Compensation Implementation Methods

2.4.1. Origin Translation Method

In the specific implementation process of real-time error compensation for machine tools, the feedback interruption method and the origin translation method are currently the two main compensation implementation methods. The compensation method used in this paper is based on the origin translation method. Using Figure 4 as an example, the error compensation process based on the origin translation method is explained. Poin O is the fixed reference point of the machine tool, also known as the mechanical origin. The coordinate system oxyz with point O as the origin is referred to as the mechanical reference coordinate system. During the initial stage of machining, the coordinate system O 0 - X 0 Y 0 Z 0 with point O 0 as the origin is referred to as the original machining coordinate system.
In the original coordinate system O 0 - X 0 Y 0 Z 0 the initial position of the cutting tool is at point A . After receiving the machining program instructions, the tool will move to point C according to the machining instructions. However, due to machining errors, the cutting tool actually moves to point B . Thus, | BC | can represent the machining error of the machine tool before compensation. In order to reduce machining errors, the machine tool’s CNC system uses the origin translation method to perform a reverse shift in the origin coordinates. The shifted coordinate system origin moves from point O 0 to point O 1 , and the coordinate system O 1 - X 1 Y 1 Z 1 with point O 1 as the origin is referred to as the new compensated machining coordinate system. In the new coordinate system O 1 - X 1 Y 1 Z 1 , the actual position where the machine tool moves changes from point B to point B . The machine tool’s compensated actual machining error is reduced from | BC | to | B C | , thus achieving the precision compensation effect of the machine tool.

2.4.2. Application Process of the CNC System Temperature Compensation Function

To make the thermal error prediction model applicable to real-world scenarios, this paper developed a standalone temperature acquisition and thermal error compensation system. This system, implemented on an industrial computer, communicates with and feeds compensation data directly to the SINUMERIK 828D CNC system. The following section introduces the application process of the temperature compensation function of the SINUMERIK 828D CNC system.
Figure 5 shows the positioning error curve of the CNC machine tool’s X-axis at temperature T . In the figure, P 0 represents a reference point at a specific location on the X-axis. When the temperature changes to T, the displacement error of reference point P 0 is measured as K 0 ( T ) . The displacement error Δ K x at other points P x during temperature changes can be calculated based on the slope TAN at temperature T, the position of reference point P 0 , and the displacement error K 0 ( T ) :
Δ K x   =   K 0 T   +   t a n β T P X P 0 .
In the equation, P 0 is the reference point; P X is the actual position point on the X feed axis; Δ K x is the temperature compensation value at the reference point P x ; K 0 ( T ) is the error value at reference point P 0 at temperature T; tan β ( T ) is the temperature compensation coefficient, obtained from the slope of the error curve.
t a n β T = T T 0 T K max T max T 0
In the equation, T 0 is the initial temperature at the relevant position point; T max is the highest temperature variation at the relevant position point; T K max is the maximum temperature coefficient.

3. Thermal Characteristic Experiment of the CNC Machine Tool

3.1. Experimental Design

In this study, the machining process of a standard workpiece was defined as the actual test operating condition for the machine tool. The experiment was conducted on a T55II 500 CNC machine tool sourced from Ningbo Haideman Co., Ltd. in Ningbo, China. The workpiece material used in this experiment is 45# steel, and the cutting tools employed include external rough turning tools, external finish turning tools, face centering drills, face drills, and parting tools. The workpiece is shown in Figure 6, and the testing conditions are summarized in Table 1.
During the machine–tool test, a micrometer was used to measure the outer diameter of the workpiece in order to collect radial machining error data. The micrometer’s measurement range was 25–50 mm, with an instrument accuracy of ±1 μm. Simultaneously, a Toprie TP9000 multi—channel data recorder and a PT100 resistive temperature sensor were employed for temperature data collection. The temperature sensor has a temperature application range of −50 °C to + 200 °C, a sensitivity of 20/°C, and an accuracy of approximately ±0.3 °C. All tests were carried out inside a temperature—controlled chamber, and the ambient temperature varied between 18.67 °C and 20.16 °C. The test setup is shown in Figure 7.

3.2. Experimental Data Acquisition

During the thermal characteristic experiment, the positions of temperature monitoring points were determined. Based on the spatial distribution of the main components of the T55II 500 CNC machine tool, a total of 19 monitoring points were selected. Table 2 lists the sensor numbers corresponding to each monitoring point in the machine tool structure, and Figure 8 shows the distribution diagram of each monitoring point in the machine tool structure and different colors represent different structural modules of the machine tool.
Figure 9a shows the temperature test data of each monitoring point. From the test results, it can be seen that the temperature at each monitoring point of the CNC machine tool had an obvious upward trend within the first 180 min; during the period from 180 min to 240 min, as the machine tool stopped running for 60 min, the temperature at each monitoring point began to drop; and in the subsequent 240 min, with the machine tool restarting and running, the temperature at each monitoring point rose again. The highest temperature was at the T15 monitoring point in the spindle motor area, reaching 27.6 °C. It is noteworthy that this coherent and informative dataset (420 samples in total) was not acquired randomly. Instead, the experiment was designed based on our prior in-depth studies of the machine tool’s thermal characteristics [34,35]. Guided by finite-element and computational fluid dynamics models, temperature sensors were strategically placed at thermally critical regions, and the testing regimen was engineered to capture the complete thermal dynamic process (start-up, steady-state, and cooling). This ensures that the collected samples are of high information density, providing a solid foundation for robust model development with a limited number of samples.
In addition, this paper collected machining error data by measuring the outer diameter of the workpiece. Figure 9b shows the error change curves of the middle diameter and small diameter of the machined part during the test. The test results show that during the machining process of the CNC machine tool from cold state to hot state, the machining error curve of the workpiece has an obvious upward trend. Within the first 180 min, the machining error of the machine tool continued to increase, with the maximum error reaching 46 μm; after the machine tool was shut down for 60 min, through the natural cooling of the machine tool, the machining error decreased to 41 μm; and in the subsequent 240 min, as the machine tool started running again, the machining error of the machine tool continued to increase and finally reached 63 μm.
According to the above test results, it can be concluded that the CNC machine tool has an obvious temperature rise trend during operation; the machining error of the machine tool will increase with the rise in temperature, and its change trend is basically consistent with the temperature change, which indicates that the thermal characteristics of the machine tool are an important factor affecting the machining accuracy.

4. PSO-LSTM-Based Thermal Error Prediction for the T55II-500

4.1. Identification and Optimization of Temperature Monitoring Point

Temperature sensitive points not only accurately characterize the machine tool’s thermal behavior but also reduce data redundancy and mitigate collinearity among measurement points, thereby improving modeling efficiency and prediction accuracy. In this study, fuzzy clustering analysis and global sensitivity analysis were applied to the temperature rise and thermal error datasets to identify the most temperature sensitive points.
Table 3 presents the fuzzy equivalence matrix for all 19 monitoring points. Using the F test, the F statistic corresponding to each λ value was computed; the results are shown in Table 4. The results indicate that at λ = 0.946, the F statistic reaches its maximum, yielding the optimal clustering. Based on this threshold, the 19 temperature monitoring points were divided into two clusters, as shown in Table 5.
To determine the optimal point within each cluster, a global sensitivity analysis was performed on all 19 monitoring points. The procedure was as follows: based on the thermal characteristic test data, a dataset of 200 samples was constructed, using each point’s temperature and its increment as inputs and the relative increment of thermal error as the output (180 samples for training and 20 for validation). Prior to training, both inputs (temperature and increment) and outputs (relative thermal error increment) were normalized to eliminate scale and unit discrepancies. A neural network model was then trained on these samples; as shown in Figure 10, the resulting models achieved R squared values exceeding 95%, indicating high accuracy and effectively capturing the mapping between thermal error and temperature measurements. These models serve to quantify each point’s influence on thermal error and support the selection of optimal monitoring points.
To identify the best point in each cluster, the sample data were further processed using global sensitivity analysis. Specifically, for each monitoring point, its input-variable increment was set to zero—thereby nullifying its perturbation effect—to generate a new sample set for that point. After processing, the modified samples were input into the trained neural network to produce outputs η i , k Defining β i , k as the baseline output, the change β i , k = η i , k η i , k ( i = 1 ,   2 ,   3 ,   ,   200 ) was computed, and according to Equation (3), the global sensitivity index β i for each temperature point was calculated. The global sensitivity indices for the 19 monitoring points on the T55II-500 are presented in Table 6. The optimal point in the first cluster was T18 (index = 0.8681), and in the second cluster T2 (index = 0.9670). Consequently, points T2 and T18 were selected as the key monitoring locations for thermal-error modeling.

4.2. Thermal-Error Modeling of the T55II-500 CNC Machine Tool

The PSO LSTM thermal error prediction model comprises two main components: a Particle Swarm Optimization (PSO) algorithm for hyperparameter optimization and a Long Short-Term Memory (LSTM) network dedicated to thermal error prediction.
For the PSO LSTM network, temperature readings from points 2 and 18 served as inputs, and the predicted thermal error as the output. The input layer comprised three nodes, while both the output layer and the single hidden layer each contained one node. Of the 420 collected samples of machine tool temperatures and thermal errors, the first 360 were used for training and the remaining 60 for testing and validation. To enhance predictive performance, input and output datasets were normalized according to Equations (13)–(15). During LSTM training, the maximum number of iterations was set to 200, Mean Squared Error (MSE) was adopted as the evaluation metric, and the Adam optimizer was employed. The PSO algorithm was used to globally optimize the learning rate and hidden layer size. The swarm size was set to 40; the learning rate ranged from 0.01 to 0.15; the hidden layer neurons ranged from 1 to 200; acceleration coefficients c1 and c2 were both set to 2; the inertia weight linearly decreased from 1.2 to 0.8 over 30 iterations.
This study performed thermal error modeling of the T55II 500 CNC machine using a PSO LSTM network, with all model training conducted on the MATLAB R2023b platform. PSO yielded an optimal learning rate of 0.0941 and a hidden-layer size of 45 neurons. Figure 11 depicts the iterative evolution of the optimal particle in the PSO algorithm.
To evaluate the optimization effect of the Particle Swarm Optimization (PSO) algorithm on the LSTM neural network, this paper conducts thermal error modeling and training on the basic LSTM neural network using the same sample dataset, network architecture, and parameter settings, aiming to compare and analyze the differences in prediction performance of the thermal error models before and after hyperparameter optimization.
Figure 12 shows the training convergence curves of the PSO-LSTM and LSTM neural network thermal error prediction models. It can be seen from the figure that as the number of iterations increases, the training accuracy of both the PSO-LSTM and LSTM neural network models continues to improve, and the PSO-LSTM model has a higher convergence accuracy. This indicates that the PSO-LSTM model has good learning ability and can effectively extract feature information and data patterns from the training samples.

4.3. Result Analysis and Comparison

The trained thermal-error models were validated using the test set. Figure 13 shows the prediction comparison results and residual curves of the PSO-LSTM and LSTM neural network thermal error models. The PSO-LSTM predictions align almost perfectly with the measurements—particularly in the 10–45 min interval, where fluctuations are minimal and the fit is more consistent. Although the basic LSTM can predict thermal error reasonably well, it exhibits large deviations in several time segments. PSO-LSTM residuals largely remain within ±3 μm and fluctuate smoothly, whereas the LSTM model displays pronounced deviations and even sustained high errors in certain intervals. These comparisons indicate that the unoptimized LSTM is overly sensitive to operating-condition changes and lacks robustness, while PSO-LSTM offers greater stability across varying temperature-rise profiles. The underlying reason is that conventional LSTM models often rely on manual tuning or grid search for hyperparameters, making them prone to local optima, and their predictive performance heavily depends on hyperparameter choice. Integrating PSO enhances hyperparameter optimization by using swarm intelligence to explore the global solution space, facilitating the discovery of parameter sets that minimize error and maximize generalization. Moreover, because thermal error accumulates slowly, exhibits nonlinear trends, and is susceptible to early-stage temperature disturbances, an LSTM without proper tuning struggles to capture long-term dependencies; PSO-optimized LSTM, however, exhibits improved modeling of both long-sequence dependencies and nonlinear behaviors.
To validate the effectiveness and robustness of the proposed model and compare its performance with other models in this study, the data from Section 3.2 were normalized and input into the models. The first 80% of the data were used as the training set, and the remaining 20% as the test set. The PSO results yielded a time window size of 5, a learning rate of 0.0941, and 45 units. For a fair comparison, the remaining three models were configured with the same structure. The prediction result curves of each model are shown in Figure 14.
Error analysis metrics for five thermal-error models are summarized in Table 7. Among the established models, the MLR thermal-error model had a relative error of 10.67%, while the other models had relative errors below 10%, indicating that all thermal-error models possess some predictive capability. Among the models, the PSO-LSTM thermal-error model performed the best, with a relative error of 2.22%, demonstrating high prediction accuracy. The LSTM and BP thermal-error models followed, with relative errors of 4.29% and 3.84%, respectively, while the MNR and MLR models had relative errors of 9.68% and 10.67%. Regarding residual data, the average and maximum residuals of all models were kept within 15 μm, with the PSO-LSTM model showing the best residual performance: an average residual of 1.39 μm and a maximum residual of 2.55 μm. This indicates that its predictions not only exhibit low bias but also have minimal fluctuation, with the error distribution being more concentrated and stable. The PSO LSTM thermal error model’s mean squared error (MSE) was 2.52 μm, indicating minimal error fluctuations throughout the prediction process. The model output was smooth and stable, demonstrating good engineering applicability and robustness.
The reasons behind these results can be summarized as follows:
(1)
Compared to static models like MLR and MNR, the LSTM and PSO-LSTM thermal error prediction models can effectively capture long-term dependencies in time series, making them especially suitable for dynamic problems like CNC machine tool thermal error, which evolves slowly over time. This significantly enhances their ability to model the evolution of thermal error.
(2)
While BP can handle nonlinearity, it cannot model time dependencies, and its training is influenced by initial weights, often falling into local optima. In contrast, PSO’s global search capability allows LSTM to avoid such issues.
(3)
MLR is a purely linear model, and MNR is a weakly nonlinear model, making them inadequate for modeling the complex nonlinear and dynamic characteristics of thermal error evolution. PSO-LSTM combines both time series modeling and nonlinear modeling, fundamentally overcoming the modeling capability bottleneck.
Therefore, the PSO-LSTM model combines LSTM’s ability to handle time series data with PSO’s advantages in hyperparameter optimization, improving the model’s ability to capture the nonlinear and dynamic characteristics of machine tool thermal error. It shows strong potential for engineering applications.

4.4. Thermal-Error Compensation System Based on the SINUMERIK 828D CNC

Error compensation technology is implemented by establishing a dedicated error compensation control system for machine tools. This system predicts the thermal errors of the machine tool in real time and transmits compensation signals to the servo drives, thereby controlling each axis to execute the required corrective movements. To meet the needs of practical applications, this study has developed temperature acquisition and thermal error compensation software on the SINUMERIK 828D CNC platform. Figure 15 shows the implementation schematic diagram of the thermal error compensation system based on SINUMERIK 828D. During the compensation process, temperature data are first acquired from the machine tool’s monitoring points through sensors and data acquisition cards; then, the data are sent to the compensation software via the Modbus TCP protocol to calculate the required correction values; finally, these correction values are written into the PLC (Programmable Logic Controller) through the OPC UA server, and then forwarded by the PLC to the CNC system to trigger its built-in thermal compensation program.
Figure 16 shows the specific compensation implementation process of the SINUMERIK 828D thermal error compensation system. The data transmission process in the SINUMERIK 828D based thermal error compensation system comprises three modules:
(1)
The temperature acquisition module, using sensors placed at critical points on the machine, monitors temperature changes in real time and transmits this data via Modbus TCP to the error compensation module for further processing and analysis.
(2)
Under the Visual Studio environment, a C# program was developed to communicate with the CNC machine’s PLC over Modbus TCP. The error compensation module uses the established thermal error model and relevant inputs to compute compensation values in real time. These values are then standardized—converting units and data types—via the PLC control program. Finally, the processed compensation values are written into the NC system through the OPC UA server interface.
(3)
Using the PLC Programming Tool as the development environment, the CNC machine’s PLC program was written and debugged. Data exchange with the CNC system is handled via FB2 and FB3 function blocks: FB2 reads system variables and drive parameters, while FB3 writes them. The PLC then writes the compensation values into register SD43900 to invoke the built in temperature compensation feature. During compensation, the CNC system adds the correction value to its setpoint, causing the servo to drive the feed axis in the opposite direction (a positive compensation value yields a negative feed motion).
To validate the compensation effect of the thermal error compensation system, error compensation tests were conducted on the T55II-500 CNC machine tool. To verify the stability of the thermal error compensation system, three different environmental temperature conditions were designed in this study, including: a near-constant temperature condition (19.34–20.36 °C), a warm natural ventilation condition (20.63–22.13 °C), and a variable temperature condition with a wider range (18.64–28.24 °C). These conditions were designed to validate the compensation system’s stability under different thermal loads and environmental fluctuations. Table 8 shows the environmental temperature conditions. Table 9 shows the machining conditions of the machine tool.
Through thermal error compensation tests, machining error data for the CNC machine tool before and after the activation of the thermal error compensation system were measured. Table 10 presents the verification results of the CNC machine tool’s thermal error compensation system under three temperature conditions. Figure 17 shows the thermal error compensation effectiveness of the CNC machine tools under different temperature conditions. The test results show that the environmental temperature has a significant impact on the machine tool’s thermal error. Under temperature variation conditions, the machine tool’s thermal error reached a maximum of 67 μm. Under three different environmental temperature conditions, the machining errors after system compensation were all controlled within 10 μm, and the machine tool’s machining precision was improved by up to 88%. This indicates that the thermal error compensation system for the SINUMERIK 828D CNC machine tool, designed in this paper, significantly improves the machining precision, demonstrating excellent practical application results.

5. Conclusions and Future Work

This paper proposes a data-driven thermal error prediction model for the T55II-500 CNC machine tool based on Particle Swarm Optimization—Long Short-Term Memory Network (PSO-LSTM). This method can accurately predict the thermal errors of CNC machine tools, providing a basis for thermal error compensation and helping to improve machining accuracy. By using experimentally obtained thermal error data and comparing the performance of different thermal error prediction models under various working environments, the effectiveness and robustness of the proposed model are verified. The main conclusions are as follows:
(1)
A thermal error model for the T55II-500 CNC machine based on PSO-LSTM was proposed and validated through thermal characteristic experiments. The comparison between the PSO-LSTM model and experimental results shows that the model can accurately predict the thermal error of the T55II-500 CNC machine, laying the foundation for thermal error compensation. Further verification of the model’s robustness was carried out through experiments in random and controlled-temperature environments. Comparison of the predicted and experimental results shows that the PSO-LSTM model not only predicts thermal errors accurately but also maintains stable and satisfactory robustness under complex operating conditions.
(2)
A comparison between the proposed model and traditional models was made. In this study on the thermal-error prediction model for the T55II-500 CNC machine, the PSO-LSTM model demonstrated higher accuracy and lower error compared to the backpropagation neural network (BP), multiple linear regression (MLR), long short-term memory (LSTM) network, and polynomial nonlinear regression (MNR) models. The PSO-LSTM model showed the smallest relative error, average residual, mean square error, and maximum residual values, indicating superior performance.
Although the thermal error prediction model proposed in this paper has been established and applied to high-precision machine tools, the performance of the model in relation to the machine tool under different work intensities and spindle speeds has not yet been tested.
Future research will utilize the established model to conduct thermal error compensation experiments under varying working intensities and spindle speeds, systematically validating the method’s effectiveness. As current validation was limited to a single platform (T55II-500 equipped with SINUMERIK 828D), subsequent work needs to verify the model’s generalizability across different machine tool architectures and CNC systems. Furthermore, we will develop enhanced models that explicitly integrate multi-source information, incorporating not only temperature variables but also critical process parameters including coolant flow rates, spindle loads, and tool wear conditions. This comprehensive approach will significantly improve model adaptability in complex working conditions.
To ensure robust performance in practical industrial environments, we will incorporate dedicated anomaly detection modules to handle severe data abnormalities arising from sensor failures or unexpected operational conditions. Additionally, we will investigate adaptive mechanisms specifically designed to counteract performance degradation in dynamic manufacturing scenarios.
Due to experimental cycle limitations, the model’s adaptability to long-term machine tool aging effects remains unverified. Follow-up studies will implement long-term tracking experiments combined with online model update algorithms to systematically investigate the impact of time-varying factors on model performance. The development of these adaptive mechanisms will be crucial for maintaining model accuracy throughout the machine tool’s lifecycle. Simultaneously, to address the lack of uncertainty quantification in the current deterministic prediction approach, advanced methods such as Bayesian neural networks or Monte Carlo Dropout will be introduced to establish reliable confidence intervals for predictions, thereby enhancing decision-support capabilities in risk-sensitive scenarios.

Author Contributions

X.Z.: Conceptualization, methodology, supervision, project administration, writing—original draft. Z.H.: Software, formal analysis, data curation, visualization, writing—original draft. J.T.: Investigation, resources, validation. Z.C.: Writing—review and editing, funding acquisition. All authors have read and agreed to the published version of the manuscript.

Funding

We would like to thank the Healthy & Intelligent Kitchen Engineering Research Center of Zhejiang Province (ZFGGJ2021-389), the Digital Simulation Design for High-End Equipment Manufacturing of Shijiazhuang Science and Technology Bureau (248790037A), and the National “111” Centre on Safety and Intelligent Operation of Sea Bridges (D21013) for supporting this research.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets or material used or analyzed during the current study are available from the corresponding author on reasonable request.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Liu, W.; Zhang, S.; Lin, J.; Xia, Y.; Wang, J.; Sun, Y. Advancements in accuracy decline mechanisms and accuracy retention approaches of CNC machine tools: A review. Int. J. Adv. Manuf. Technol. 2022, 121, 7087–7115. [Google Scholar] [CrossRef]
  2. Cao, W.; Li, H.; Li, Q. A method of thermal error prediction modeling for CNC machine tool spindle system based on linear correlation. Int. J. Adv. Manuf. Technol. 2021, 118, 3079–3090. [Google Scholar] [CrossRef]
  3. Pan, S.W. Summary of Research Status on Thermal Error Robust Modeling of NC Lathe. Tool. Eng. 2007, 41, 10–14. [Google Scholar]
  4. Ni, J. CNC machine accuracy enhancement through real-time error compenstation. J. Manuf. Sci. Eng. 1997, 119, 717–725. [Google Scholar] [CrossRef]
  5. Liu, J.; Ma, C.; Wang, S. Data-driven thermally-induced error compensation method of high-speed and precision five-axis machine tools. Mech. Syst. Signal Process 2020, 138, 106538. [Google Scholar] [CrossRef]
  6. Liu, H.; Miao, E.M.; Wei, X.Y.; Zhuang, X.D. Robust modeling method for thermal error of CNC machine tools based on ridge regression algorithm. Int. J. Mach. Tools Manuf. 2017, 113, 35–48. [Google Scholar] [CrossRef]
  7. Li, T.J.; Zhao, C.Y.; Zhang, Y.M. Adaptive real-time model on thermal error of ball screw feed drive systems of CNC machine tools. Int. J. Adv. Manuf. Technol. 2018, 94, 3853–3861. [Google Scholar] [CrossRef]
  8. Liu, S.; Lin, M. Bionic optimization design for a CNC turntable based on thermal–mechanical coupling effect. J. Braz. Soc. Mech. Sci. Eng. 2020, 42, 253. [Google Scholar] [CrossRef]
  9. Li, Y.; Zhang, Y.; Zhao, Y.; Shi, X. Thermal-mechanical coupling calculation method for deformation error of motorized spindle of machine tool. Eng. Fail. Anal. 2021, 128, 105597. [Google Scholar] [CrossRef]
  10. Kara, F.; Aslantas, K.; Cicek, A. Prediction of cutting temperature in orthogonal machining of AISI 316L using artificial neural network. Appl. Soft Comput. 2016, 38, 64–74. [Google Scholar] [CrossRef]
  11. Ji, J.; Hong, R.; Sun, F.; Huang, X. Thermal characteristic analysis of Z-axis guideway based on thermal contact resistance. Adv. Mech. Eng. 2018, 10, 1687814018805321. [Google Scholar] [CrossRef]
  12. Sweet, A.L.; Tu, J.F. Tolerance design for the fit between bore and shaft for precision assemblies with significant error-scaling problems. Int. J. Prod. Res. 2007, 45, 5223–5241. [Google Scholar] [CrossRef]
  13. Brunton, S.L.; Noack, B.R.; Koumoutsakos, P. Machine Learning for Fluid Mechanics. Annu. Rev. Fluid. Mech. 2020, 52, 477–508. [Google Scholar] [CrossRef]
  14. Liu, J.; Ma, C.; Wang, S.; Wang, S.; Yang, B. Contact stiffness of spindle-tool holder based on fractal theory and multi-scale contact mechanics model, Mech. Syst. Sig. Process. 2019, 119, 363–379. [Google Scholar] [CrossRef]
  15. Liu, J.; Ma, C.; Wang, S. Precision loss modeling method of ball screw pair. Mech. Syst. Sig. Process. 2020, 135, 106397. [Google Scholar] [CrossRef]
  16. Chen, J. A study of thermally induced machine tool errors in real cutting conditions. Int. J. Mach. ToolsManuf. 1996, 36, 1401–1411. [Google Scholar] [CrossRef]
  17. Peng, L.; Cheng, L.; Cheng, L.; Chen, Z. Research on Thermal Characteristics Modeling of CNC Machine Tools Based on Submodel Method. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2024, 239, 977–985. [Google Scholar] [CrossRef]
  18. Hojati, F.; Azarhoushang, B.; Daneshi, A.; Khiabani, R.H. Prediction of Machining Condition Using Time Series Imaging and Deep Learning in Slot Milling of Titanium Alloy. J. Manuf. Mater. Process 2022, 6, 145. [Google Scholar] [CrossRef]
  19. Moura, M.C.; Zio, E.; Lins, I.D.; Droguett, E. Failure and reliability prediction by support vector machines regression of time series data. Reliab. Eng. Syst. Saf. 2011, 96, 1527–1534. [Google Scholar] [CrossRef]
  20. Ma, C.; Zhao, L.; Mei, X.; Shi, H.; Yang, J. Thermal error compensation based on genetic algorithm and artificial neural network of the shaft in the high-speed spindle system. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2017, 231, 753–767. [Google Scholar] [CrossRef]
  21. Hou, R.S.; Yan, Z.Z.; Du, H.Y.; Chen, T.; Tao, T.; Mei, X. The Application of Multi-objective Genetic Algorithm in the Modeling of Thermal Error of NC Lathe. Procedia CIRP 2018, 67, 332–337. [Google Scholar] [CrossRef]
  22. Yang, J.; Shi, H.; Feng, B.; Zhao, L.; Ma, C.; Mei, X. Thermal error modeling and compensation for a high-speed motorized spindle. Int. J. Adv. Manuf. Technol. 2015, 77, 1005–1017. [Google Scholar] [CrossRef]
  23. Zhao, C.L.; Wang, Y.Q.; Guan, X.S. The thermal error prediction of NC machine tool based on LS-SVM and grey theory. Appl. Mech. Mater. 2009, 16–19, 410–414. [Google Scholar] [CrossRef]
  24. Yang, S.; Yuan, J.; Ni, J. The improvement of thermal error modeling and compensation on machine tools by CMAC neural network. Int. J. Mach. ToolsManuf. 1996, 36, 527–537. [Google Scholar] [CrossRef]
  25. Yang, J.; Yuan, J.; Ni, J. Thermal error mode analysis and robust modeling for error compensation on a CNC turning center. Int. J. Mach. ToolsManuf. 1999, 39, 1367–1381. [Google Scholar] [CrossRef]
  26. Wei, X.; Ye, H.; Miao, E.; Pan, Q. Thermal error modeling and compensation based on Gaussian process regression for CNC machine tools. Precis. Eng. 2022, 77, 65–76. [Google Scholar] [CrossRef]
  27. Yang, H.; Ni, J. Adaptive model estimation of machine-tool thermal errors based on recursive dynamic modeling strategy. Int. J. Mach. ToolsManuf. 2005, 45, 1–11. [Google Scholar] [CrossRef]
  28. Liu, P.L.; Du, Z.C.; Li, H.M.; Deng, M.; Feng, X.B.; Yang, J.G. Thermal error modeling based on BiLSTM deep learning for CNC machine tool. Adv. Manuf. 2021, 9, 235–249. [Google Scholar] [CrossRef]
  29. Li, Q.; Li, H. A general method for thermal error measurement and modeling in CNC machine tools’ spindle. Int. J. Adv. Manuf. Technol. 2019, 103, 2739–2749. [Google Scholar] [CrossRef]
  30. Ma, C.; Zhao, L.; Mei, X.; Shi, H.; Yang, J. Thermal error compensation of high-speed spindle system based on a modified BP neural network. Int. J. Adv. Manuf. Technol. 2017, 89, 3071–3085. [Google Scholar] [CrossRef]
  31. Ahmed, S.F.; Alam, M.S.B.; Hassan, M.; Rozbu, M.R.; Ishtiak, T.; Rafa, N.; Mofijur, M.; Ali, A.B.M.S.; Gandomi, A.H. Deep learning modelling techniques: Current progress, applications, advantages, and challenges. Artif. Intell. Rev. 2023, 56, 13521–13617. [Google Scholar] [CrossRef]
  32. Van, H.G.; Mosquera, C.; Napoles, G. A review on the long short-term memory model. Artif. Intell. Rev. An. Int. Sci. Eng. J. 2020, 53, 5929–5955. [Google Scholar]
  33. Gao, X.; Guo, Y.; Hanson, D.A.; Liu, Z.; Wang, M.; Zan, T. Thermal error prediction of ball screws based on PSO-LSTM. Int. J. Adv. Manuf. Technol. 2021, 116, 1721–1735. [Google Scholar] [CrossRef]
  34. Peng, L.; Chen, Z.; Cheng, L. Research on thermal characteristics modeling for feed system of CNC machine tool considering thermal parameter correction. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2025, 239, 291–301. [Google Scholar] [CrossRef]
  35. Peng, L.; Chen, Z.; Cheng, L.; Wang, C. Research on optimal multivariate thermal error modeling based on finite-element analysis. Proc. Inst. Mech. Eng. Part E J. Process Mech. Eng. 2023, 237, 1792–1799. [Google Scholar] [CrossRef]
Figure 1. PSO Optimized LSTM Prediction Model Workflow.
Figure 1. PSO Optimized LSTM Prediction Model Workflow.
Actuators 14 00567 g001
Figure 2. Structure of the LSTM Neural Network Cell Unit.
Figure 2. Structure of the LSTM Neural Network Cell Unit.
Actuators 14 00567 g002
Figure 3. Particle search process of the PSO algorithm.
Figure 3. Particle search process of the PSO algorithm.
Actuators 14 00567 g003
Figure 4. Compensation principle of origin translation method.
Figure 4. Compensation principle of origin translation method.
Actuators 14 00567 g004
Figure 5. Positioning error curve of X-axis at T temperature.
Figure 5. Positioning error curve of X-axis at T temperature.
Actuators 14 00567 g005
Figure 6. Machined workpiece.
Figure 6. Machined workpiece.
Actuators 14 00567 g006
Figure 7. Machine tool thermal characteristic test: (a) Test platform; (b) machine tool structure distribution; (c) TP9000 Temperature Recorder; (d) PT100 Temperature Sensor.
Figure 7. Machine tool thermal characteristic test: (a) Test platform; (b) machine tool structure distribution; (c) TP9000 Temperature Recorder; (d) PT100 Temperature Sensor.
Actuators 14 00567 g007
Figure 8. Distribution of Monitoring Points.
Figure 8. Distribution of Monitoring Points.
Actuators 14 00567 g008
Figure 9. Thermal characteristic test results: (a) Temperature data; (b) processing error data.
Figure 9. Thermal characteristic test results: (a) Temperature data; (b) processing error data.
Actuators 14 00567 g009
Figure 10. Training Performance of the Neural Network Model.
Figure 10. Training Performance of the Neural Network Model.
Actuators 14 00567 g010
Figure 11. PSO Optimal Particle Evolution.
Figure 11. PSO Optimal Particle Evolution.
Actuators 14 00567 g011
Figure 12. Convergence curves (a) LSTM neural network; (b) PSO-LSTM neural network. (The solid blue line represents the training RMSE loss, the light blue line the validation RMSE loss, the dashed line the baseline performance, and black dots mark selected epochs on the dashed line for reference).
Figure 12. Convergence curves (a) LSTM neural network; (b) PSO-LSTM neural network. (The solid blue line represents the training RMSE loss, the light blue line the validation RMSE loss, the dashed line the baseline performance, and black dots mark selected epochs on the dashed line for reference).
Actuators 14 00567 g012
Figure 13. Prediction Results of PSO-LSTM versus LSTM Thermal-Error.
Figure 13. Prediction Results of PSO-LSTM versus LSTM Thermal-Error.
Actuators 14 00567 g013
Figure 14. The prediction performance of each model: (a) Predicted error values; (b) residual values of prediction results.
Figure 14. The prediction performance of each model: (a) Predicted error values; (b) residual values of prediction results.
Actuators 14 00567 g014
Figure 15. Implementation Principle of Thermal Error Compensation for CNC Machine Tools Based on SINUMERIK 828D System.
Figure 15. Implementation Principle of Thermal Error Compensation for CNC Machine Tools Based on SINUMERIK 828D System.
Actuators 14 00567 g015
Figure 16. Implementation process of thermal error compensation.
Figure 16. Implementation process of thermal error compensation.
Actuators 14 00567 g016
Figure 17. Thermal error compensation effectiveness of the CNC machine tools under different temperature conditions: (a) Near-constant temperature condition; (b) warm natural ventilation condition; (c) wide-range variable temperature condition.
Figure 17. Thermal error compensation effectiveness of the CNC machine tools under different temperature conditions: (a) Near-constant temperature condition; (b) warm natural ventilation condition; (c) wide-range variable temperature condition.
Actuators 14 00567 g017
Table 1. Standard machining conditions for CNC machine tools.
Table 1. Standard machining conditions for CNC machine tools.
TimeMachine Tool Working Status
0 ~ 180 minCutting the workpiece for 3 h
180 min ~ 240 minDowntime for 1 h
240 min ~ 480 minContinuous cutting of the workpiece for 4 h
Table 2. Temperature sensor distribution.
Table 2. Temperature sensor distribution.
PositionSensor NumberPositionSensor Number
Front side of spindleT1Lower part of spindleT11
Rear side of spindleT2External part of bedT12
Front Bearing Housing of the SpindleT3Rear part of guide railT13
Lower part of the motorT4Side part of sliderT14
Upper part of motorT5Cover plateT15
Front part of guide railT6Lower part of bedT16
Feed guide railT7Inner part of sliderT17
External part of sliderT8Bearing blockT18
Turret baseT9Bottom of the Spindle HousingT19
Rear part of sliderT10
Table 3. Fuzzy Equivalence Matrix.
Table 3. Fuzzy Equivalence Matrix.
12345678910111213141516171819
110.9760.9360.8360.9360.9790.8360.9790.9790.9790.9780.9790.9790.9790.9790.9790.9790.9790.979
20.97610.9360.8360.9360.9790.8360.9790.9790.9790.9780.9790.9790.9790.9790.9790.9790.9790.979
30.9360.93610.9360.9360.8360.8360.9360.9360.9360.9360.9360.9360.9360.9360.9360.9360.9360.936
40.8360.8360.93610.8360.8360.8360.8360.8360.8360.8360.8360.8360.8360.8360.8360.8360.8360.836
50.9360.9360.9360.83610.9360.8360.9360.9360.9360.9360.9360.9360.9360.9360.9360.9360.9360.936
60.9790.9790.8360.8360.97910.8360.8360.8360.8360.9790.8360.8360.8360.8360.8360.8360.8360.836
70.8360.8360.8360.8360.8360.83610.9360.9360.9360.8360.9360.9360.9360.9360.9360.9360.9360.936
80.9790.9790.9360.8360.9790.8360.97910.9360.9360.9790.8360.8360.8360.8360.8360.8360.8360.836
90.9790.9790.9360.8360.9790.8360.9790.93610.9360.9790.8360.8360.8360.8360.8360.8360.8360.836
100.9790.9790.9360.8360.9790.8360.9790.9360.93610.9790.8360.8360.8360.8360.8360.8360.8360.836
110.9780.9780.9360.8360.9360.9790.8360.9790.9790.97910.9790.9790.9790.9790.9790.9790.9790.979
120.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.97910.9360.9360.9360.9360.9360.9360.936
130.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.93610.9360.9360.9360.9360.9360.936
140.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.93610.9360.9360.9360.9360.936
150.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.9360.93610.9360.9360.9360.936
160.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.9360.9360.93610.9360.9360.936
170.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.9360.9360.9360.93610.9360.936
180.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.9360.9360.9360.9360.93610.936
190.9790.9790.9360.8360.9360.8360.9360.8360.8360.8360.9790.9360.9360.9360.9360.9360.9360.9361
Table 4. Threshold λ and F Statistics.
Table 4. Threshold λ and F Statistics.
λClassification NumberF
0.9981834.835
0.9961728.031
0.9931619.820
0.9921517.113
0.9901414.119
0.9891314.267
0.9881110.519
0.9861011.043
0.984812.550
0.98379.578
0.97969.461
0.978511.074
Table 5. Clustering Results of the Monitoring Points.
Table 5. Clustering Results of the Monitoring Points.
Clustering GroupsMonitoring PointsOptimal Monitoring Points
Group 11, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1918
Group 22, 3, 4, 5, 72
Table 6. Results of the Global Sensitivity Index Calculations.
Table 6. Results of the Global Sensitivity Index Calculations.
Measurement Points (Group 1) β 1 β 6 β 8 β 9 β 10 β 11 β 12
Sensitivity Index0.66310.79310.73370.31220.90490.58180.7367
Measurement Points (Group 1) β 13 β 14 β 15 β 16 β 17 β 18 β 19
Sensitivity Index0.63430.30720.77920.71950.85790.86810.6109
Measurement Points (Group 2) β 2 β 3 β 4 β 5 β 7 //
Sensitivity Index0.96700.94950.88810.90660.8966
Table 7. Thermal Error Model Fitting Results.
Table 7. Thermal Error Model Fitting Results.
Thermal Error ModelRelative Error/%Average Residual/μmMean Square Error/μmMaximum Residual/μm
MNR8.684.5919.786.80
MLR10.675.8339.4710.9
BP3.842.408.564.37
PSO-LSTM2.221.392.522.55
LSTM4.292.679.486.80
Table 8. The environmental temperature conditions for verifying the thermal error compensation system.
Table 8. The environmental temperature conditions for verifying the thermal error compensation system.
Working ConditionsEnvironmental Temperature
Working conditions1Constant temperature condition with an initial temperature of 20 °C
Working conditions2Natural ventilation condition with an initial temperature of 30 °C
Working conditions3Temperature variation conditions ranging from 17 °C to 27 °C
Table 9. The working conditions for verifying the thermal error compensation system.
Table 9. The working conditions for verifying the thermal error compensation system.
TimeMachine Tool Working Status
0 ~ 180 minCutting workpiece for 3 h
180 min ~ 240 minDowntime for 1 h
240 min ~ 360 minCutting workpiece for 2 h
360 min ~ 370 minAfter 10-min downtime, cut one workpiece
370 min ~ 420 minAfter 50-min shutdown, cut one workpiece
Table 10. The effect of thermal error compensation.
Table 10. The effect of thermal error compensation.
Working ConditionAmbient Temperature (°C)Thermal Error Before Compensation (μm)Thermal Error After Compensation (μm)Accuracy Improvement (%)
Working Condition119.34 ~ 20.360 ~ 522 ~ 786
Working Condition220.63 ~ 22.130 ~ 573 ~ 6.588
Working Condition18.64 ~ 28.240 ~ 675 ~ 986
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhao, X.; Hu, Z.; Tang, J.; Chen, Z. Research on Machine Tool Thermal Error Compensation Based on an Optimized LSTM Model. Actuators 2025, 14, 567. https://doi.org/10.3390/act14120567

AMA Style

Zhao X, Hu Z, Tang J, Chen Z. Research on Machine Tool Thermal Error Compensation Based on an Optimized LSTM Model. Actuators. 2025; 14(12):567. https://doi.org/10.3390/act14120567

Chicago/Turabian Style

Zhao, Xiangrui, Zhiwei Hu, Jonathan Tang, and Zhenlei Chen. 2025. "Research on Machine Tool Thermal Error Compensation Based on an Optimized LSTM Model" Actuators 14, no. 12: 567. https://doi.org/10.3390/act14120567

APA Style

Zhao, X., Hu, Z., Tang, J., & Chen, Z. (2025). Research on Machine Tool Thermal Error Compensation Based on an Optimized LSTM Model. Actuators, 14(12), 567. https://doi.org/10.3390/act14120567

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop