Numerical control machine tool spindle thermal error modeling method based on coolant temperature

By arranging temperature sensors in the coolant pipeline at the rear of the CNC machine tool, a high-precision thermal error model based on coolant temperature is constructed, which solves the problem of temperature measurement being easily interfered with in traditional methods and achieves more robust and accurate thermal error prediction.

CN122151710BActive Publication Date: 2026-07-14IND TECH RES INST OF YIBIN SICHUAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
IND TECH RES INST OF YIBIN SICHUAN UNIV
Filing Date
2026-05-08
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Traditional spindle thermal error modeling methods rely on measuring the temperature of the spindle front surface, which is easily affected by cutting fluid and chips, resulting in high noise in the temperature data and reducing the prediction accuracy and robustness of the thermal error model.

Method used

The temperature measurement points were moved from the front end of the spindle to the inlet and outlet of the coolant pipeline at the rear of the machine tool. A parallel dual-branch temperature feature extraction layer was constructed using a one-layer temporal convolutional network and two layers of long short-term memory networks connected by viewing holes. Combined with a gated attention layer and a composite loss function, a high-precision coolant temperature feature model was constructed.

Benefits of technology

It improves the model's anti-interference ability and prediction robustness, simplifies sensor layout, enhances the reliability of thermal error compensation, and improves prediction accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122151710B_ABST
    Figure CN122151710B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on cooling liquid temperature's numerical control machine tool spindle thermal error modeling method, belong to numerical control machine tool error compensation technical field;The method is collected temperature data by temperature sensor arranged at the entrance and exit of spindle cooling liquid pipeline, and synchronous measurement spindle thermal displacement;Based on the temperature of entrance and exit, two key temperature features are constructed;TCN-PeepholeLSTM parallel double-branch temperature feature extraction layer is constructed, and global feature and complex dependence of temperature time sequence are extracted respectively;After the double-branch feature is spliced, the time sequence modeling capability is enhanced by gate attention layer;Finally, the thermal error prediction value is output through nonlinear activation layer and fully connected layer.The temperature measuring point is moved from the front end of spindle which is easy to be disturbed to the rear cooling liquid pipeline, the sensor is arranged simply, the signal noise is low, and the anti-interference ability and prediction robustness of the model are effectively improved;Reliable and easy-to-implement technical foundation is laid for numerical control machine tool thermal error compensation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of CNC machine tool error compensation, specifically relating to a method for modeling the thermal error of CNC machine tool spindle based on coolant temperature. Background Technology

[0002] CNC machine tools are the cornerstone equipment of modern industrial systems, and their machining accuracy directly affects product performance and quality. Thermal error is a major source of error affecting the accuracy and stability of CNC machine tools. Thermal error compensation is an important technology for effectively reducing thermal error and improving machining accuracy, and establishing an accurate thermal error model is a prerequisite for effective compensation. Traditional spindle thermal error modeling methods usually rely on temperature data measurement at key points on the spindle front surface. However, in actual machining processes, these measurement points are easily affected by cutting fluid, chips, and spindle rotation, making temperature sensor installation difficult and resulting in significant noise in the collected temperature data, thus reducing the prediction accuracy and robustness of the thermal error model. There is a strong correlation between the temperature change of the spindle front surface and the temperature change of the coolant flowing through the outer surface of the cooling jacket. When the heat generation of the internal heat source of the spindle increases, the coolant temperature rises rapidly in response. At the same time, heat is conducted to cause the spindle front temperature to rise slowly, and the two show a highly consistent trend over time. Therefore, there is an urgent need for a CNC machine tool spindle thermal error modeling method based on coolant temperature. Summary of the Invention

[0003] The purpose of this invention is to provide a method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature. This method moves the temperature measurement point from the easily disturbed front end of the spindle to the inlet and outlet of the coolant pipeline at the rear of the machine tool. Only a small number of temperature sensors are needed to obtain stable, low-noise coolant temperature time-series data. By constructing a high-precision and robust thermal error prediction model and implementing compensation, accurate prediction of the thermal error of the machine tool spindle can be achieved, which is convenient for engineering applications.

[0004] To achieve the above objectives, the present invention adopts the following technical solution:

[0005] A method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature includes the following steps:

[0006] Step 1: Collect temperature data and thermal error data;

[0007] Temperature sensors are installed at the inlet and outlet of the machine tool spindle coolant pipeline to collect time-series temperature data of the coolant inlet and outlet; at the same time, displacement sensors are used to synchronously measure the thermal error data of the spindle.

[0008] Step 2: Construct coolant temperature characteristics;

[0009] Based on the time-series temperature data collected in step 1, key temperature feature one and key temperature feature two are constructed. Key temperature feature one is the change value of coolant inlet and outlet temperature, which is used to characterize heat dissipation intensity. Key temperature feature two is a combination feature consisting of coolant outlet temperature change value and the first-order difference of outlet temperature, which is used to characterize the cumulative thermal state and its dynamic trend.

[0010] Step 3: Construct a coolant temperature feature extraction layer;

[0011] A parallel dual-branch temperature feature extraction layer is constructed using a one-layer temporal convolutional network and two layers of long short-term memory networks connected by peepholes. Temporal features are extracted from the first key temperature feature and the second key temperature feature respectively, resulting in the hidden state matrix of the two branches.

[0012] Step 4: Construct the coolant feature fusion layer and the gated attention layer;

[0013] The hidden state matrices of the two branches obtained in step 3 are concatenated to obtain the fused features; then, through a gated attention layer, the attention score is calculated based on the query, key, and value attention functions, and the gate coefficient matrix is ​​calculated. The two are then subjected to a Hadamard product operation to obtain the enhanced temporal features.

[0014] Step 5: Construct the nonlinear layer and the output layer;

[0015] The temporal features of the last time step are extracted from the temporal features, and then passed through the ELU activation layer and the fully connected layer in sequence to output the predicted value of the spindle thermal error.

[0016] Step 6: Design a composite loss function that incorporates the correlation between coolant temperature and overall temperature;

[0017] Composite loss function ,in, , , , , These represent the composite loss function, Huber loss term weight parameters, Huber loss term function, correlation coefficient loss term weight parameters, and correlation coefficient loss term function, respectively.

[0018] Huber loss term function Where Y is the experimentally measured value of the spindle thermal error. This is the thermal error fitting value. It is the threshold parameter of the residual;

[0019] Correlation coefficient loss term function ,in, , This represents the correlation coefficient between the thermal error fitting value and the coolant outlet temperature. It is the thermal error fitting value at time i. T is the average thermal error, where n is the total number of time steps; out,i It is the coolant outlet temperature at time i. It is the average temperature of the coolant outlet;

[0020] Step 7: Model hyperparameter optimization based on the social spider algorithm.

[0021] Furthermore, in step 3, the temporal convolutional network adopts a causal convolution and dilated convolution structure and introduces residual connections.

[0022] Furthermore, in step 3, the long short-term memory network with peephole connections introduces cell states as peephole connections in the input gate, forget gate, and output gate.

[0023] Further, in step 4, the gated attention layer includes: calculating an attention score using query, key, and value attention functions. , Where S is the fusion feature, and Q, K, and V are the query matrix, key matrix, and value matrix, respectively; , , Let d be a learnable weight matrix. k The attention space dimension is represented by softmax, which is the weight calculation function.

[0024] Gating coefficient matrix ,in, It is a learnable weight matrix; b g It is a bias; It is the Sigmoid activation function; G is the gating coefficient matrix;

[0025] The enhanced temporal features are obtained by performing a Hadamard product operation between the gating coefficient matrix G and the attention scores. .

[0026] The beneficial effects of this invention are as follows: By moving the temperature measurement point from the front surface of the spindle to the inlet and outlet of the coolant pipeline at the rear of the machine tool, traditional front-mounted sensors are easily interfered with by cutting fluid, chips, and moving parts, resulting in difficult sensor placement and high noise in the acquired temperature signals. In contrast, the coolant temperature measurement environment is stable and has low signal noise, fundamentally improving the model's anti-interference capability and prediction robustness. This invention simplifies sensor placement, enhances the long-term reliability of the model, and provides a more feasible solution for the industrial application of thermal error compensation technology. Based on the coolant inlet and outlet temperatures, two types of key temperature features are constructed. A TCN-PeepholeLSTM parallel dual-branch temperature feature extraction layer is used to process the two types of temperature features separately. The two types of high-dimensional features are fused, and a gated attention mechanism is introduced to adaptively enhance key temporal features, improving the model's prediction accuracy and robustness, providing core technical support for subsequent thermal error compensation. A composite loss function is constructed to address the temporal variation characteristics of coolant temperature. The SSA algorithm is used to optimize the network's key hyperparameters, improving the model's prediction capability. Attached Figure Description

[0027] Figure 1 This is a schematic diagram of the structure of the CTDSTEM model constructed in this invention.

[0028] Figure 2 This is a comparison chart of the thermal error prediction results of the CTDSTEM model and the comparative models (LSTM, BPNN, MLR) of this invention.

[0029] Figure 3 This is a distribution diagram of the predicted residuals of the CTDSTEM model of this invention.

[0030] Figure 4 A bar chart comparing the prediction performance metrics (MAE and RMSE) of each model. Detailed Implementation

[0031] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0032] This embodiment discloses a method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature, including the following steps:

[0033] Step 1: Collect temperature data and thermal error data;

[0034] PT100 temperature sensors were installed at the inlet and outlet of the spindle coolant pipeline at the rear of the machine tool. An experimental speed spectrum was designed and the machine tool was run accordingly. A set of time-series temperature data of the coolant inlet and outlet was collected every 30 seconds. A laser displacement sensor was used to synchronously measure and record the spindle thermal error, providing experimental data support for subsequent thermal error modeling.

[0035] Step 2: Construct coolant temperature characteristics;

[0036] To effectively characterize the spindle's thermal state and reduce reliance on multi-point temperature sensors, two types of key temperature features are constructed based on time-series temperature data from the coolant inlet and outlet.

[0037] One key temperature characteristic is the change in coolant inlet and outlet temperatures. , As a key temperature feature, This is the time-series temperature data for the coolant outlet. This is the time-series temperature data for the coolant inlet.

[0038] According to the fundamental thermodynamic equations ,in To exchange heat, For specific heat capacity, For quality flow, Assuming the coolant's physical properties and flow rate remain essentially constant, the heat removed from the spindle system by the coolant per unit time (i.e., heat dissipation power) is linearly related to the coolant temperature change. This heat dissipation power is determined by both the internal thermal load of the spindle and the heat storage / dissipation of the spindle structure. Therefore, the temperature change at the coolant inlet and outlet effectively characterizes the heat dissipation intensity of the spindle system through forced convection heat transfer, and is a key process variable reflecting the heat dissipation status of the spindle system.

[0039] The second key temperature feature is a combination of the coolant outlet temperature variation and the first-order difference of the outlet temperature. , The second key temperature feature at time t. This provides the time-series temperature data at time t of the coolant outlet. This is the initial time-series temperature data at the coolant outlet. For time intervals; , The second key temperature feature is w, where w is the length of the time window.

[0040] The coolant flows over the outer surface of the cooling jacket and removes heat through continuous convection with the wall. The change in outlet temperature is a direct result of forced convection heat transfer between the spindle system and the coolant, and is closely related to the thermal state of the spindle region. It is a key variable characterizing the overall thermal state of the spindle. In order to capture the dynamic change information of the thermal state at the same time, the first-order difference of the outlet temperature is introduced to represent its rate of change and evolution trend.

[0041] The two types of key temperature features mentioned above can be obtained simply by placing temperature sensors at the inlet and outlet of the coolant pipeline. Key temperature feature one directly characterizes the time-series characteristics of heat dissipation intensity, while key temperature feature two comprehensively characterizes the cumulative thermal state and its dynamic trend. Both have clear physical meaning and engineering simplicity, providing complementary and effective input data for the subsequent construction of an efficient and robust thermal error model.

[0042] Step 3: Construct a coolant temperature feature extraction layer;

[0043] A parallel dual-branch temperature feature extraction layer (TCN-PeepholeLSTM) combining a Temporal Convolutional Network (TCN) and a Long Short-Term Memory Network with peephole connections is constructed to effectively capture the complex nonlinear temporal dependencies, long-term global trends and thermal hysteresis characteristics in temperature data.

[0044] Temperature characteristics of the two types of coolants , The inputs to the parallel dual branches of TCN-PeepholeLSTM are respectively used as inputs. TCN is a time series data modeling method based on one-dimensional convolution. It has the characteristics of causal convolution, dilated convolution and residual connection. By stacking multiple layers of dilated convolution, the receptive field can be expanded without significantly increasing the number of parameters, and the long-term global change trend in temperature series can be effectively captured.

[0045] TCN employs causal convolution, where the output at time t depends only on the current time and historical inputs, for a one-dimensional input sequence. The output of the causal convolution at time t ,in, This represents the input at time tk, where K is the kernel length. b and b are the kernel weights and biases, respectively. This is the activation function.

[0046] To expand the receptive field without significantly increasing the number of parameters, TCN introduces dilated convolution. Given a dilation factor d, the dilated convolution output at position s... ,in, For filters, This represents the dilated convolution operation between the input sequence x and the filter f. This represents the filter weight index, where k is the filter size. It indicates the past direction. When the dilation factor d=1, the dilated convolution degenerates into a regular convolution. A larger d allows higher-level neurons to obtain a larger receptive field, and the higher-level output can represent a wider range of inputs, effectively capturing long-term dependencies in the input sequence.

[0047] Furthermore, TCN employs residual connections to enhance network training stability. For each layer, the input sequence x is coupled with the layer's output y. t Add them together to get the final output. .

[0048] PeepholeLSTM is a variant of the Long Short-Term Memory (LSTM) network. By introducing peephole connections into the gating mechanism, it enables the input gate, forget gate, and output gate to directly access cell state information, thereby enhancing the ability to model complex temporal dynamics.

[0049] PeepholeLSTM neurons consist of five parts: cell state, hidden state, input gate, forget gate, and output gate. The input gate, forget gate, and output gate are computed not only based on the current input X. t Compared to the hidden state h in the previous moment t-1 It also introduced the cell state C from the previous moment. t-1 (For input gate and forget gate) or current cell state C t (For the output gate) as an additional input.

[0050] The formula for calculating its neurons is as follows:

[0051] ,

[0052] ,

[0053] ,

[0054] ,

[0055] ,

[0056] ;

[0057] In the formula, i t f t o t , C t h t These are the current input gate, forget gate, output gate, candidate cell state, cell state, and hidden state; ht-1 C t-1 It refers to the hidden state or cell state of the previous moment; W xi W xf W xo W xc W hi W hf W ho W hc Both are weight parameter matrices; W ci W cf W co b is the weight parameter matrix for the peephole connection; i b f b o b c It is a vector of deviation parameters; Use the Sigmoid activation function; This represents the Hadamard product operation.

[0058] In this embodiment, a parallel dual-branch temperature feature extraction layer TCN-PeepholeLSTM is constructed using one TCN layer and two PeepholeLSTM layers. Temporal feature extraction is performed on the two types of temperature features to obtain the hidden state matrices of the two branches.

[0059] Step 4: Construct the coolant feature fusion layer and attention layer;

[0060] The coolant temperature features within the time window t-w+1 to t are extracted through the two branches of the temperature feature extraction layer, resulting in the hidden state matrix of the two branches. , Where w represents the time window length. H1 and H2 are then stitched together: S represents the fusion feature.

[0061] We construct a gated attention layer to enhance the model's temporal modeling capability for temperature sequence features, and calculate the attention score using query, key, and value attention functions: , Where S is the fusion feature, and Q, K, and V are the query matrix, key matrix, and value matrix, respectively; , , Let d be a learnable weight matrix. k is the dimension of the attention space; softmax is the weight calculation function.

[0062] Gating coefficient matrix ,in, It is a learnable weight matrix; b g It is a bias; G is the sigmoid activation function; G is the gating coefficient matrix.

[0063] The enhanced temporal features are obtained by performing a Hadamard product operation between the gating coefficient matrix G and the attention scores. .

[0064] Step 5: Construct the nonlinear layer and the output layer;

[0065] Extract the last time step of the gated attention layer output as the temporal feature Z at time t. t First, an exponential linear unit (ELU) activation layer is passed through, which maintains linear output in the positive range and provides smooth exponential saturation characteristics in the negative range.

[0066] ,in This is a hyperparameter, usually set to 1. ELU activation can effectively alleviate the vanishing gradient problem, and its near-zero output mean helps accelerate model training convergence. It also has an adaptive suppression effect on noise input that may exist in hot error data.

[0067] The characteristic Z after ELU nonlinear transformation t =ELU(Z t The input is fed into a fully connected layer, and the output is the predicted value of the spindle thermal error at time t: In the formula, It is the output layer weight matrix. It is a bias; This represents the predicted thermal error value at time t.

[0068] Finally, a Coolant-Temperature-Driven Spindle Thermal Error Model (CTDSTEM) based on coolant temperature is established. Figure 1 As shown.

[0069] Step 6: Design a composite loss function that incorporates the correlation between coolant temperature and overall temperature;

[0070] The loss function is a key metric for measuring the difference between model predictions and experimental measurements, directly guiding the optimization of neural network parameters. For the task of modeling spindle thermal error, a composite loss function is constructed to ensure both model prediction accuracy and interpretability.

[0071] The Huber loss function is used as the primary loss metric, combining the advantages of mean squared error and mean absolute error. The Huber loss function offers high optimization efficiency, balancing overall fitting accuracy with robustness to outliers. The Huber loss employs a piecewise design: when the prediction error is below a preset threshold, a quadratic penalty is applied to ensure a smooth and continuous gradient near the optimal solution, promoting rapid model convergence; when the error exceeds the threshold, it switches to a linear growth mode, effectively suppressing the adverse effects of outliers caused by measurement noise or transient interference on model training.

[0072] Huber loss function Where Y is the experimentally measured value of the spindle thermal error. This is the thermal error fitting value. It is the threshold parameter of the residual.

[0073] The temporal variation of coolant outlet temperature exhibits a highly consistent evolutionary trend with the spindle thermal error. Therefore, a loss term based on the Pearson correlation coefficient is introduced as an auxiliary loss term to force the model to learn the positive correlation between thermal error and coolant outlet temperature.

[0074] Correlation coefficient loss term ,

[0075] The Pearson correlation coefficient r is calculated as follows: ,in This represents the correlation coefficient between the thermal error fitting value and the coolant outlet temperature. It is the thermal error fitting value at time i. T is the average thermal error, where n is the total number of time steps; out,i It is the coolant outlet temperature at time i. It is the average temperature at the coolant outlet.

[0076] Composite loss function ,

[0077] in, , , , , These represent the composite loss function, Huber loss term weight parameters, Huber loss term function, correlation coefficient loss term weight parameters, and correlation coefficient loss term function, respectively.

[0078] Step 7: Model hyperparameter optimization based on SSA algorithm;

[0079] Hyperparameter settings have a significant impact on the predictive performance of a model. The Social Spider Algorithm (SSA) is a metaheuristic optimization algorithm inspired by the foraging behavior of social spider groups in nature, capable of efficiently solving complex optimization problems. The SSA algorithm mimics the mechanism by which social spiders use web vibration signals to sense prey locations, transmit information, and coordinate group actions. By constructing "vibration" as a unique information exchange medium, it guides the search agent (spider) to conduct efficient global exploration and local development within the solution space.

[0080] In SSA, when spider s moves to a new location, it will be based on the current position P. s fitness f(P) s The intensity of the source vibration, , where C is a sufficiently small constant such that all possible fitness values ​​are greater than C.

[0081] Vibrations attenuate with distance as they propagate through a spider web. At position P a The vibrations produced by spider a are located at P b The intensity sensed by spider b. ,in, The Manhattan distance between the two spider positions. The mean of the standard deviations of the locations across all dimensions. Parameters used to control the attenuation rate.

[0082] Each spider selects the strongest vibration from the ones it senses. It will be compared with the target vibration stored in its own memory. Comparison. If To become stronger, one must renew. This vibration was recorded, along with its origin location. .

[0083] The spider determines the focus of its search by using a randomly changing binary dimension mask *m*. Based on the mask and the location of the target vibration source, a guide position is calculated. .

[0084] Spiders combine their own inertia, guiding position, and random factors to perform random walks to update their position: Where r is a random number and R is a random variable. This represents the Hadamard product operation.

[0085] The SSA algorithm was used to optimize the hyperparameters of the CTDSTEM model. The optimized hyperparameters included the time step T, the number of TCN hidden units N1, the kernel size K, and the number of PeepholeLSTM hidden units N2 and N3. The hyperparameter optimization range was set as follows: T∈[10,30], N1∈[40,60], K∈[2,4], N2∈[25,40], N3∈[10,25].

[0086] To verify the effectiveness and superiority of the CTDSTEM model designed in this embodiment, using the same coolant temperature data, comparative thermal error models were constructed based on traditional modeling methods: LSTM, BPNN (Back Propagation Neural Network), and MLR (Multiple Linear Regression). LSTM and BPNN models were two-layered, with the number of hidden units and time step size used as hyperparameters. Both were optimized using the SSA algorithm, and the hyperparameter optimization range remained consistent with that of the CTDSTEM model. The prediction results are as follows: Figure 2 As shown: The CTDSTEM thermal error model proposed in this embodiment exhibits the best predictive performance; the model's predicted residual value ranges from -1.37. Up to 1.67 ,like Figure 3 As shown; the MAE and RMSE of each model are as follows: Figure 4 As shown, the MAE of the CTDSTEM model, LSTM, BPNN, and MLR are 0.58μm, 0.72μm, 1.06μm, and 1.23μm, respectively, and the RMSE are 0.69μm, 0.92μm, 1.21μm, and 1.40μm, respectively. Compared with the LSTM, BPNN, and MLR models built based on traditional data modeling methods, the MAE of the CTDSTEM model is reduced by 19%, 45%, and 53%, respectively, and the RMSE is reduced by 25%, 43%, and 51%, respectively. This verifies that the thermal error modeling method based on coolant temperature proposed in this embodiment has good predictive performance. Furthermore, in this invention, the temperature sensor is conveniently arranged and is not easily affected by the actual processing, which is beneficial for complex on-site industrial applications later.

[0087] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature, characterized in that, Includes the following steps: Step 1: Collect temperature data and thermal error data; Temperature sensors are installed at the inlet and outlet of the machine tool spindle coolant pipeline to collect sequential temperature data of the coolant at the inlet and outlet; at the same time, displacement sensors are used to synchronously measure the thermal error data of the spindle. Step 2: Construct coolant temperature characteristics; Based on the time-series temperature data collected in step 1, key temperature feature one and key temperature feature two are constructed. Key temperature feature one is the change value of coolant inlet and outlet temperature, which is used to characterize heat dissipation intensity. Key temperature feature two is a combination feature consisting of coolant outlet temperature change value and the first-order difference of outlet temperature, which is used to characterize the cumulative thermal state and its dynamic trend. Step 3: Construct a coolant temperature feature extraction layer; A parallel dual-branch temperature feature extraction layer is constructed using a one-layer temporal convolutional network and two layers of long short-term memory networks connected by peepholes. Temporal features are extracted from the first key temperature feature and the second key temperature feature respectively, resulting in the hidden state matrix of the two branches. Step 4: Construct the coolant feature fusion layer and the gated attention layer; The hidden state matrices of the two branches obtained in step 3 are concatenated to obtain the fused features; Then, through a gated attention layer, the attention score is calculated based on the query, key, and value attention functions, and the gate coefficient matrix is ​​calculated. The two are then subjected to a Hadamard product operation to obtain the enhanced temporal features. Step 5: Construct the nonlinear layer and the output layer; The temporal features of the last time step are extracted from the temporal features, and then passed through the ELU activation layer and the fully connected layer in sequence to output the predicted value of the spindle thermal error. Step 6: Design a composite loss function that incorporates the correlation between coolant temperature and overall temperature; Composite loss function ,in, , , , , These represent the composite loss function, Huber loss term weight parameters, Huber loss term function, correlation coefficient loss term weight parameters, and correlation coefficient loss term function, respectively. Huber loss term function Where Y is the experimentally measured value of the spindle thermal error. This is the thermal error fitting value. It is the threshold parameter of the residual; Correlation coefficient loss term function ,in, , This represents the correlation coefficient between the thermal error fitting value and the coolant outlet temperature. It is the thermal error fitting value at time i. T is the average thermal error, where n is the total number of time steps; out,i It is the coolant outlet temperature at time i. It is the average temperature of the coolant outlet; Step 7: Model hyperparameter optimization based on the social spider algorithm.

2. The method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature according to claim 1, characterized in that, In step 3, the temporal convolutional network adopts a causal convolution and dilated convolution structure and introduces residual connections.

3. The method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature according to claim 1, characterized in that, In step 3, the long short-term memory network with peephole connections introduces cell states as peephole connections in the input gate, forget gate, and output gate.

4. The method for modeling the thermal error of a CNC machine tool spindle based on coolant temperature according to claim 1, characterized in that, In step 4, the gated attention layer includes: calculating the attention score using query, key, and value attention functions. , Where S is the fusion feature, and Q, K, and V are the query matrix, key matrix, and value matrix, respectively; , , Let d be a learnable weight matrix. k The attention space dimension is represented by softmax, which is the weight calculation function. Gating coefficient matrix ,in, It is a learnable weight matrix; b g It is a bias; It is the Sigmoid activation function; G is the gating coefficient matrix; The enhanced temporal features are obtained by performing a Hadamard product operation between the gating coefficient matrix G and the attention scores. .