A machine tool spindle thermal error modeling method based on simulation data and transfer learning

CN122528569APending Publication Date: 2026-08-07IND TECH RES INST OF YIBIN SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0005]本申请的主要目的在于提供一种基于仿真数据与迁移学习的机床主轴热误差建模方法,旨在解决由于真实数据稀缺导致的热误差模型预测能力不足的问题

Benefits of technology

[0016]本申请提出的基于仿真数据与迁移学习的机床主轴热误差建模方法,通过将仿真数据引入热误差建模流程,采用“仿真预训练+域对齐+目标微调”的三阶段迁移学习策略,在仅需少量实测数据的条件下,充分发挥仿真数据易获取和迁移学习可解决数据特征分布差异的优势,构建出泛化能力强的热误差模型,解决了由于真实数据稀缺导致的热误差模型预测能力不足的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528569A_ABST
    Figure CN122528569A_ABST
Patent Text Reader

Abstract

The application discloses a machine tool spindle thermal error modeling method based on simulation data and migration learning, and relates to the technical field of numerical control machine tool thermal error modeling and intelligent compensation. The method firstly constructs a thermal-structure coupling finite element simulation model of a spindle system, and generates a multi-working-condition simulation data set; temperature sensitive points are screened through clustering and correlation analysis. Then, a prediction model is constructed by fusing a time sequence Kolmogorov-Arnold neural network and a non-parametric attention module, the simulation data is used as a source domain for pre-training, a related alignment (CORAL) strategy in migration learning is adopted to adapt the deep feature distribution, and finally, the network parameters are fine-tuned by using target domain measured data. The method guarantees the modeling accuracy when the measured sample is limited, relieves the distribution deviation between simulation and measured data, improves the generalization and adaptation ability of the model under actual working conditions, and provides reliable technical support for thermal error compensation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of thermal error modeling and intelligent compensation technology for CNC machine tools, and in particular to a method for modeling thermal errors of machine tool spindles based on simulation data and transfer learning. Background Technology

[0002] Spindle thermal error is one of the biggest sources of error affecting the accuracy and stability of machine tools. Thermal error compensation is an effective measure to address thermal errors, and thermal error modeling is the prerequisite and foundation for compensation. To obtain a thermal error model with strong generalization ability, it is often necessary to collect a large amount of temperature and thermal displacement data under real operating conditions. However, due to the long data acquisition cycle and high cost, it is difficult to obtain sufficient training data for thermal error models. This leads to insufficient predictive ability or even failure of thermal error models built based on sparse real data, making it difficult to meet the high requirements of actual compensation. Numerical simulation technology can easily generate a large number of training samples, alleviating the pain point of insufficient real data to some extent. However, due to deviations between material parameters, boundary conditions, contact thermal resistance, etc., and reality, there are differences between simulation data and real data. Thermal error models trained based on simulation data are prone to a significant decrease in predictive ability or even failure, exhibiting domain shift problems.

[0003] Therefore, there is an urgent need to invent a thermal error modeling method that can make full use of simulation data to achieve stable and reliable domain migration, so as to solve the problem of insufficient predictive ability of thermal error models under sparse real data.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a method for modeling the thermal error of machine tool spindles based on simulation data and transfer learning, which aims to solve the problem of insufficient predictive ability of thermal error models due to the scarcity of real data.

[0006] To achieve the above objectives, this application proposes a method for modeling the thermal error of machine tool spindles based on simulation data and transfer learning. The method includes: A transient thermo-structural coupled finite element simulation model of the machine tool spindle system is established. Thermal boundary conditions are applied to the finite element simulation model, and simulation temperature data and simulation thermal displacement data under different working conditions are obtained through numerical simulation. Based on the simulated temperature data and the simulated thermal displacement data, cluster analysis and mutual information correlation measurement are used to screen temperature sensitive points; actual temperature data and actual thermal displacement data of the actual machine tool spindle system under real operating conditions are collected, and the actual temperature measurement location points are consistent with the temperature sensitive points in the simulation. A neural network thermal error model is constructed, comprising a TKAN network layer, a SimAM attention layer, and a thermal error output layer. The neural network thermal error model is pre-trained using the simulated temperature data as input and the simulated thermal displacement data as labels to obtain a pre-trained model. The TKAN network layer and SimAM attention layer in the pre-trained model are used as a shared feature mapping function. The simulated temperature data and the measured temperature data are respectively input into the shared feature mapping function to extract the source domain feature matrix and the target domain feature matrix. By calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, the feature distributions of the simulated domain and the measured domain are aligned to obtain the domain-adapted model. Using the measured temperature data as input and the measured thermal displacement data as labels, the domain-adapted model is fine-tuned to obtain the final thermal error prediction model.

[0007] In one embodiment, applying thermal boundary conditions to the finite element simulation model includes: calculating the spindle bearing heat generation rate based on the spindle speed and the total bearing friction torque, wherein the total bearing friction torque includes the lubricant viscous friction torque and the external load friction torque; calculating the motor heat generation rate based on the motor output torque and motor efficiency; for the forced circulation region of the coolant, calculating the convective heat transfer coefficient according to the empirical formula for forced convection in the pipe; for the natural convection region between the fixed outer surface of the spindle system and the air, taking an empirical value for the heat dissipation coefficient; and applying the spindle bearing heat generation rate, the motor heat generation rate, the convective heat transfer coefficient, and the heat dissipation coefficient as the thermal boundary conditions to different surfaces of the finite element simulation model.

[0008] In one embodiment, the construction of the TKAN network layer includes: defining the activation function of the KAN edge in the TKAN as a weighted combination of the base activation function and the B-spline function; introducing a recursive memory mechanism into each network layer to construct an RKAN layer, such that the activation of the KAN edge depends on both the current input and the historical memory state; constructing TKAN cells using an LSTM gating framework, replacing the calculation of the output gate of the TKAN cell with the mapping of the deep RKAN network, and maintaining the linear transformation form of the calculation of the forget gate, input gate, and candidate memory; stacking multiple TKAN cells along the time step to form the TKAN network layer; wherein, the TKAN network layer takes a sliding window temperature sequence composed of the simulated temperature data as input and outputs a feature matrix that fuses time-dependent features.

[0009] In one embodiment, the functions of each gate in the TKAN cell are defined as follows: the forget gate controls the degree of discarding of the cell state at the previous time step, and it is calculated using the hidden state at the previous time step and the input temperature sequence at the current time step as inputs; the input gate controls the degree to which new information at the current time step is written into the cell state; the candidate memory fuses the input temperature sequence at the current time step and the hidden state at the previous time step, and generates candidate cell states through a hyperbolic tangent activation function; the output gate is obtained by mapping the input temperature sequence at the current time step and the historical memory through a deep RKAN network, replacing the linear transformation calculation method of the output gate in the traditional LSTM; the cell state update of the TKAN cell is: the element-wise product of the forget gate and the cell state at the previous time step, plus the element-wise product of the input gate and the candidate memory; the hidden state update is: the element-wise product of the output gate and the current cell state after processing by the hyperbolic tangent activation function.

[0010] In one embodiment, the SimAM attention layer processes the feature matrix output by the TKAN network layer, including: calculating an energy function value for each neuron in the feature matrix output by the TKAN network layer based on the mean and variance of the channel in which the neuron is located; taking the reciprocal of the energy function value and normalizing it using the Sigmoid function to obtain the attention weight corresponding to each neuron; and multiplying the attention weight element-wise with the feature matrix output by the TKAN network layer to obtain the enhanced feature matrix.

[0011] In one embodiment, pre-training the neural network thermal error model includes: inputting the simulated temperature data into the TKAN network layer, where the TKAN network layer extracts long-term dependence and nonlinear thermal dynamic features of the temperature sequence and outputs a feature matrix that fuses temporal dependence; inputting the feature matrix that fuses temporal dependence into the SimAM attention layer, where the SimAM attention layer calculates the energy function value for each neuron in the feature matrix that fuses temporal dependence and obtains the attention weight; and multiplying the attention weights element-wise with the feature matrix that fuses temporal dependence to obtain the enhanced feature matrix. The enhanced feature matrix is ​​input into the thermal error output layer, which performs global average pooling on the enhanced feature matrix along the time step dimension to obtain a global feature vector. The global feature vector is then mapped through a linear layer to obtain the predicted thermal error value. The mean square error loss between the predicted thermal error value and the simulated thermal displacement data is calculated. The Adam optimizer is used to iteratively update all learnable parameters of the TKAN network layer, SimAM attention layer, and thermal error output layer in the neural network thermal error model through backpropagation until the mean square error loss converges, thus obtaining the pre-trained model.

[0012] In one embodiment, the processing of the thermal error output layer includes: performing global average pooling on the enhanced feature matrix along the time step dimension, averaging the feature vectors of each time step element by element to obtain a global feature vector; and mapping the global feature vector through a linear layer that multiplies it with a learnable weight matrix and adds a bias term to obtain the predicted thermal error value.

[0013] In one embodiment, the TKAN network layer and SimAM attention layer in the pre-trained model are used as a shared feature mapping function. The simulated temperature data and the measured temperature data are respectively input into the shared feature mapping function to extract the source domain feature matrix and the target domain feature matrix. By calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, the feature distributions of the simulated domain and the measured domain are aligned to obtain the domain-adapted model. The steps include: inputting the simulated temperature data into the shared feature mapping function to obtain the source domain feature matrix; inputting the measured temperature data into the... A shared feature mapping function is used to obtain the target domain feature matrix. The covariance matrices of the source domain feature matrix and the target domain feature matrix are calculated respectively. The squared Frobenius norm of the difference between the covariance matrices of the source domain feature matrix and the target domain feature matrix is ​​calculated as the CORAL loss. The CORAL loss is weighted and summed with the thermal error prediction loss calculated based on simulation data to obtain the total loss. The total loss is minimized through backpropagation, and the parameters of the shared feature mapping function are updated to align the simulated domain feature distribution with the measured domain feature distribution, thus obtaining the domain-adapted model.

[0014] In one embodiment, the weighted summation is performed as follows: a balancing hyperparameter is set to control the domain alignment strength; the thermal error prediction loss calculated based on simulation data is used as the main task loss, and the CORAL loss is used as the auxiliary loss; the main task loss and the auxiliary loss are weighted and summed to obtain the total loss, wherein the weight of the main task loss is 1, and the weight of the auxiliary loss is the balancing hyperparameter; the total loss is minimized through backpropagation, and the parameters of the shared feature mapping function are updated so that the covariance matrix of the source domain feature matrix approximates the covariance matrix of the target domain feature matrix, thereby achieving second-order statistical alignment.

[0015] In one embodiment, the steps of fine-tuning the domain-adapted model to obtain the final thermal error prediction model, using the measured temperature data as input and the measured thermal displacement data as labels, include: fixing the bottom-level parameters of the TKAN network layer and the SimAM attention layer in the domain-adapted model; using the measured temperature data as input and the measured thermal displacement data as labels, calculating the mean squared error loss between the predicted thermal error value output by the domain-adapted model and the measured thermal displacement data; and using the Adam optimizer, with a learning rate lower than that used in the pre-training stage, iteratively updating the output layer parameters and some high-level parameters in the domain-adapted model that have not been fixed, until convergence, to obtain the final thermal error prediction model.

[0016] The proposed method for modeling machine tool spindle thermal errors based on simulation data and transfer learning introduces simulation data into the thermal error modeling process. It adopts a three-stage transfer learning strategy of "simulation pre-training + domain alignment + target fine-tuning". Under the condition of only requiring a small amount of measured data, it gives full play to the advantages of easy acquisition of simulation data and the ability of transfer learning to solve the differences in data feature distribution, and constructs a thermal error model with strong generalization ability, thus solving the problem of insufficient predictive ability of thermal error models due to the scarcity of real data. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating an embodiment of the machine tool spindle thermal error modeling method based on simulation data and transfer learning provided in this application. Figure 2 This is a comparison chart showing the fitting performance of different models on the training set.

[0020] Figure 3 This is a comparison chart showing the prediction performance of different models on the test set.

[0021] Figure 4 The chart shows the comparison of MAE and RMSE for each model on the test set.

[0022] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0023] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0024] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0025] This application provides a method for modeling the thermal error of a machine tool spindle based on simulation data and transfer learning, referring to... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the machine tool spindle thermal error modeling method based on simulation data and transfer learning according to this application. The machine tool spindle thermal error modeling method based on simulation data and transfer learning includes steps S100~S500: Step S100: Establish a transient thermal-structural coupled finite element simulation model of the machine tool spindle system, apply thermal boundary conditions to the finite element simulation model, and obtain simulation temperature data and simulation thermal displacement data under different working conditions through numerical simulation. Step S200: Based on the simulated temperature data and the simulated thermal displacement data, cluster analysis and mutual information correlation measurement are used to screen temperature sensitive points; the actual temperature data and actual thermal displacement data of the actual machine tool spindle system under real operating conditions are collected, and the actual temperature measurement location points are consistent with the temperature sensitive points in the simulation. Step S300: Construct a neural network thermal error model including a TKAN network layer, a SimAM attention layer, and a thermal error output layer; use the simulated temperature data as input and the simulated thermal displacement data as labels to pre-train the neural network thermal error model to obtain a pre-trained model; Step S400: The TKAN network layer and SimAM attention layer in the pre-trained model are used as a shared feature mapping function. The simulated temperature data and the measured temperature data are respectively input into the shared feature mapping function to extract the source domain feature matrix and the target domain feature matrix. By calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, the feature distributions of the simulated domain and the measured domain are aligned to obtain the domain-adapted model. Step S500: Using the measured temperature data as input and the measured thermal displacement data as labels, fine-tune the domain-adapted model to obtain the final thermal error prediction model.

[0026] To address the problems of insufficient predictive ability in existing thermal error modeling due to the scarcity of real data and model failure caused by domain offset between simulation and real data, this application proposes a machine tool spindle thermal error modeling method based on simulation data and transfer learning. The core innovation of this method lies in introducing simulation data into the thermal error modeling process. Through a three-stage transfer learning strategy of "simulation pre-training + domain alignment + target fine-tuning", a high-precision and highly generalizable prediction model can be obtained with only a small amount of measured data.

[0027] Step S100 is used to acquire simulation data. First, a transient thermo-structural coupled finite element simulation model of the spindle system is constructed: small geometric features with minimal impact on heat conduction in the spindle system are deleted, a finite element mesh is generated, and the mesh quality is checked; material properties such as density, specific heat capacity, coefficient of thermal expansion, and thermal conductivity of each component are set; the heat generation rate of the spindle bearings and motor, as well as the heat dissipation rate of each surface, are calculated and applied as thermal boundary conditions to different surfaces of the finite element simulation model. By changing operating parameters such as spindle speed, simulation temperature data and simulation thermal displacement data covering multiple operating conditions are generated in batches. The specific calculation and application methods of the thermal boundary conditions will be described in detail in subsequent embodiments.

[0028] Step S200 is used to screen temperature-sensitive points and collect measured data. First, temperature-sensitive points are screened based on simulated temperature data and simulated thermal displacement data. If too many temperature variables are directly used as model input, it not only increases network complexity but also leads to strong collinearity among variables, easily causing overfitting and a decrease in generalization ability. Therefore, this application first performs cluster analysis on the simulated temperature data, using the fuzzy C-means (FCM) method for clustering, with the objective function being: ; In the formula, distance metric , indicating sample With cluster center Weighted distance between them; Let be the objective function. This represents the total number of samples in the dataset; The set number of clusters; Let represent the cluster center vector of the i-th cluster; Then it represents the j-th data sample; membership degree Indicates sample The degree to which it belongs to the i-th cluster. u kj Indicates sample x j Belongs to the k The degree of clustering, where m is the fuzziness index. It is a unit norm matrix, generating Euclidean distance and spherical clustering. The optimal clustering result is obtained by iteratively updating membership degrees and cluster centers until convergence. The number of clusters, c, is determined based on a comprehensive evaluation using the elbow rule and silhouette coefficient.

[0029] To identify the key temperature points most strongly correlated with thermal errors within each cluster, mutual information (MI) between temperature and thermal error is used as a correlation metric. Mutual information can capture nonlinear dependencies between variables and is suitable for analyzing complex correlations between temperature and thermal errors in thermodynamic systems. Given a temperature measurement point X and a thermal error Y, its mutual information is defined as: ; In the formula, Indication of measurement points thermal error Mutual information between them Let be the joint probability distribution function. , These are the marginal probability distribution functions.

[0030] The temperature measurement point with the largest mutual information in each cluster is selected as the representative temperature sensitive point of that cluster, thus achieving effective compression of the input dimension.

[0031] After determining the location of the temperature-sensitive point, temperature sensors are placed at the corresponding locations in the simulation model, and displacement sensors are placed along the axial direction. A spindle rotation speed spectrum is designed, and physical experiments on thermal characteristics are conducted. Simultaneously, measured temperature and thermal displacement data of the machine tool under actual operating conditions are collected. Since the actual temperature measurement location coincides with the temperature-sensitive point in the simulation, the collected measured temperature data represents the temperature data at the temperature-sensitive point location and is used for subsequent domain adaptation and model fine-tuning.

[0032] Step S300 is used to construct a neural network thermal error model and perform pre-training. This application constructs a neural network thermal error model comprising a TKAN network layer, a SimAM attention layer, and a thermal error output layer. The TKAN network layer is used to extract long-term dependence and nonlinear thermal dynamic features of the temperature sequence; the SimAM attention layer is used to perform parameterless attention enhancement on the features output by the TKAN network layer; and the thermal error output layer is used to map the enhanced features to predicted thermal error values. During the pre-training stage, the model is trained end-to-end using a simulation dataset, enabling the model to learn the basic mapping law between the temperature field and thermal deformation from the simulation data. The specific construction method of the TKAN network layer, the specific processing method of the SimAM attention layer, the specific processing method of the thermal error output layer, and the specific pre-training process will be described in detail in subsequent embodiments.

[0033] Step S400 is used for unsupervised domain transfer adaptation of temperature features. To reduce the difference in feature distribution between simulated data and measured temperature field data and solve the domain offset problem, this application introduces an unsupervised domain adaptation method based on Correlation Alignment (CORAL). The feature extraction parts (TKAN layer and SimAM layer) of the pre-trained model are used as a shared feature mapping function, and simulated temperature data and measured temperature data (used as unlabeled measured data at this time) are input respectively to extract their deep feature representations; the squared Frobenius norm of the difference between the covariance matrices of the two domain features is calculated as the CORAL loss, and it is jointly optimized with the thermal error prediction loss in a weighted manner. The parameters of the shared feature mapping function are updated by backpropagation, so that the feature distribution of the simulated domain is aligned with the feature distribution of the measured domain. After the domain alignment is completed, the domain-adapted model is obtained, which provides a better initial feature space for subsequent fine-tuning. The specific calculation process and weighted summation method of CORAL domain alignment will be described in detail in subsequent embodiments.

[0034] Step S500 is used for fine-tuning the thermal error model parameters. Based on the domain-adapted model, the network is fine-tuned using a small amount of measured temperature data and measured thermal displacement data collected in step S200 (measured temperature data as input and measured thermal displacement data as labels). During fine-tuning, the bottom-level parameters of the feature extractors (TKAN and SimAM layers) are fixed, and only the learnable parameters of the output layer and some higher layers are updated to avoid overfitting under small sample sizes. An iterative update is performed using a learning rate lower than that used in the pre-training stage. After fine-tuning, the model integrates simulation prior knowledge and actual working condition characteristics, enabling high-precision thermal error prediction under limited label conditions, and exhibiting good generalization and robustness. The specific fine-tuning process will be described in detail in subsequent embodiments.

[0035] In one feasible implementation, applying thermal boundary conditions to the finite element simulation model includes: calculating the spindle bearing heat generation rate based on the spindle speed and the total bearing friction torque, wherein the total bearing friction torque includes the lubricant viscous friction torque and the external load friction torque; calculating the motor heat generation rate based on the motor output torque and motor efficiency; for the forced circulation region of the coolant, calculating the convective heat transfer coefficient according to the empirical formula for forced convection in the pipe; for the natural convection region between the fixed outer surface of the spindle system and the air, taking an empirical value for the heat dissipation coefficient; and applying the spindle bearing heat generation rate, the motor heat generation rate, the convective heat transfer coefficient, and the heat dissipation coefficient as the thermal boundary conditions to different surfaces of the finite element simulation model.

[0036] In this embodiment, the calculation and application method of thermal load in the finite element simulation model is clarified by specifying the thermal boundary conditions in detail. Specifically, the heat generation rate of the spindle bearing originates from the heat generated by the viscous friction of the lubricant and the friction of the external load during the rotation of the spindle bearing, and the calculation formula is as follows: ; in, Bearing heat generation rate (W); Main spindle speed (rpm); The bearing's total frictional torque (N·mm) includes the viscous frictional torque of the lubricant. Frictional torque with external load ,Right now .

[0037] The heat generation rate of an electric motor originates from its internal losses, and the calculation formula is as follows: ; in, The heat generation rate of the motor (W); The output torque of the motor is (N·mm). This refers to the motor efficiency.

[0038] For the forced circulation area of ​​coolant, the convective heat transfer coefficient is calculated based on the empirical formula for forced convection inside the pipe: ; in, The convective heat transfer coefficient is... For Nusselt numbers; The thermal conductivity of the coolant; This is the equivalent diameter of the cooling channel. For natural convection between the fixed outer surface of the spindle system and the air, the heat dissipation coefficient is taken as an empirical value. ,in, This is the heat dissipation coefficient.

[0039] The heat generation rate of the spindle bearing, the heat generation rate of the motor, the heat dissipation rate corresponding to the convective heat transfer coefficient, and the natural convection heat dissipation coefficient are applied as thermal boundary conditions to different surfaces of the finite element simulation model to accurately simulate the heat transfer behavior between contact surfaces. High-fidelity temperature field and thermal displacement data are obtained through transient thermo-structural coupling simulation, providing sufficient and diverse training samples for subsequent pre-training. Unlike existing technologies that rely solely on measured data, by clearly defining the calculation and application methods of thermal boundary conditions, the simulation data can cover a wider range of operating conditions and has a good correspondence with real physical processes.

[0040] In one feasible implementation, the construction of the TKAN network layer includes: defining the activation function of the KAN edge in the TKAN as a weighted combination of the base activation function and the B-spline function; introducing a recursive memory mechanism into each network layer to construct an RKAN layer, such that the activation function of the KAN edge depends on both the current input and the historical memory state; constructing TKAN cells using an LSTM gating framework, replacing the calculation of the output gate of the TKAN cell with the mapping of the deep RKAN network, while maintaining the linear transformation form of the calculation of the forget gate, input gate, and candidate memory; stacking multiple TKAN cells along time steps to form the TKAN network layer; wherein, the TKAN network layer takes a sliding window temperature sequence composed of the simulated temperature data as input and outputs a feature matrix that fuses time-dependent features.

[0041] In this embodiment, the TKAN network layer effectively enhances the model's ability to express complex temporal features such as strong nonlinearity, long-term dependence, and thermal inertia hysteresis of machine tool spindle thermal errors by fusing the learnable edge activation function of KAN with the gated memory mechanism of LSTM. KAN replaces the fixed activation function at traditional network nodes with a learnable univariate function on the edges. For a single KAN edge, the activation function is defined as: ; in, For activation function, Use the base activation function to ensure training stability. for B-order spline basis functions, The learnable coefficient, For the number of grid points, and These are the learnable weights for the basis functions and spline functions, respectively. This design allows each edge to independently learn a nonlinear mapping that adapts to the local distribution of the data, giving the network stronger expressive power and interpretability.

[0042] RKAN introduces a recursive memory mechanism at each layer, making edge activation dependent on both the current input and the historical state. Let the... Layer The memory of a single neuron is The updated formula is as follows: ; in , These are learnable weights; for No. Layer At time step, one neuron The input value then becomes the output of the RKAN layer: ; in, For the first Layer The output value of each neuron; For the first The number of neurons in a layer; To connect the first Layer The first neuron and the second Layer The TKAN cell utilizes the edge activation function of each neuron. Based on the LSTM gating framework, the TKAN cell maintains the computation of the forget gate, input gate, and candidate memory in a linear transformation form to reduce computational complexity, while replacing the output gate with a deep RKAN network to enhance the expression of complex nonlinear processes. Compared to existing LSTM networks, TKAN maintains effective modeling of temporal dependencies and enhances nonlinear fitting capabilities through the learnable activation function of KAN.

[0043] In one feasible implementation, the functions of each gate in the TKAN cell are defined as follows: the forget gate controls the degree of discarding of the cell state at the previous time step, and it is calculated using the hidden state at the previous time step and the input temperature sequence at the current time step as inputs; the input gate controls the degree to which new information at the current time step is written into the cell state; the candidate memory fuses the input temperature sequence at the current time step and the hidden state at the previous time step, and generates candidate cell states through a hyperbolic tangent activation function; the output gate is obtained by mapping the input temperature sequence at the current time step and the historical memory through a deep RKAN network, replacing the linear transformation calculation method of the output gate in traditional LSTM; the cell state update of the TKAN cell is: the element-wise product of the forget gate and the cell state at the previous time step, plus the element-wise product of the input gate and the candidate memory; the hidden state update is: the element-wise product of the output gate and the current cell state after processing by the hyperbolic tangent activation function.

[0044] In this embodiment, multiple RKAN layers are stacked to form a deep RKAN network. Let its relationship to the input sequence be denoted as... ( The number of temperature measuring points. The overall mapping of historical memory (as the length of the time window) is... Defined as: ; in, This indicates that the deep RKAN network is used for input sequences. ( The number of temperature measuring points. The overall mapping of historical memory (including the length of the time window); For the input layer (layer 0) At time step, one neuron The value of , For the input layer (layer 0) At time step, one neuron The historical memory state, z is the total number of layers in RKAN; For the first Layer connection The first neuron and the second The side activation function of a neuron, such as: Indicates the first Layer connection The first neuron and the second The edge activation function of each neuron. Indicates the first Layer connection The first neuron and the second The edge activation function of each neuron. Indicates the first Layer connection The first neuron and the second The edge activation function of each neuron.

[0045] By defining the detailed functions of each gate in TKAN cells, the essential difference between TKAN cells and traditional LSTM cells is clarified in the calculation method of the output gate. The calculation formulas for each gate in TKAN cells are as follows: ; ; ; ; ; ; in, These are the input gate, forget gate, output gate, candidate cell state, cell state, and hidden state at the current moment; Input the temperature sequence for the current moment; This refers to the cell state and hidden state at the previous moment. This is the weight parameter matrix for the corresponding gate; It is the bias vector; Use the Sigmoid activation function; It is the hyperbolic tangent activation function; This represents the Hadamard product operation.

[0046] Traditional LSTM output gates use linear transformations and sigmoid activation for gating, while this application replaces this with a mapping from a deep RKAN network. As a crucial step in controlling the transfer of cell states to hidden states, the output gate, using an RKAN network, can more precisely capture nonlinear patterns in temperature sequences, enabling the output hidden state to contain richer temporal features. Simultaneously, the forget gate and input gate maintain linear transformations, thus balancing computational efficiency.

[0047] In one feasible implementation, the SimAM attention layer processes the feature matrix output by the TKAN network layer, including: calculating an energy function value for each neuron in the feature matrix output by the TKAN network layer based on the mean and variance of the channel in which the neuron is located; taking the reciprocal of the energy function value and normalizing it using the Sigmoid function to obtain the attention weight corresponding to each neuron; and multiplying the attention weight element-wise with the feature matrix output by the TKAN network layer to obtain the enhanced feature matrix.

[0048] In this embodiment, the SimAM attention layer evaluates the importance of each neuron based on an energy function from neuroscience, without introducing additional learnable parameters. The temperature feature matrix output from the TKAN network layer is then used. As input (where T is the time step and D is the feature dimension), SimAM defines an energy function for each neuron: ; in Let be the energy function. and These are the mean and variance of the channel (feature dimension) where the neuron is located, respectively. This is the regularization coefficient. The lower the energy, the more linearly separable the neuron is from other neurons, and therefore the more important it is.

[0049] Attention weights are obtained by taking the reciprocal of the energy and passing it through the Sigmoid function: ; Attention weight Multiplying each element back into the original feature matrix yields the enhanced feature representation: ; in For the enhanced feature representation, This represents the Hadamard product operation. This is the weight matrix. This step adaptively enhances important spatiotemporal features and suppresses irrelevant features without introducing additional parameters. Compared to existing attention mechanisms such as SE and CBAM, which require the introduction of additional parameters, SimAM can avoid overfitting in sparse data scenarios while maintaining a lightweight model.

[0050] In one feasible implementation, pre-training the neural network thermal error model includes: inputting the simulated temperature data into the TKAN network layer, where the TKAN network layer extracts long-term dependence and nonlinear thermal dynamic features of the temperature sequence and outputs a feature matrix fused with temporal dependence; inputting the feature matrix fused with temporal dependence into the SimAM attention layer, where the SimAM attention layer calculates the energy function value for each neuron in the feature matrix fused with temporal dependence and obtains the attention weight; and multiplying the attention weights element-wise with the feature matrix fused with temporal dependence to obtain the enhanced features. The enhanced feature matrix is ​​input into the thermal error output layer. The thermal error output layer performs global average pooling on the enhanced feature matrix along the time step dimension to obtain a global feature vector. The global feature vector is then mapped through a linear layer to obtain the predicted thermal error value. The mean square error loss between the predicted thermal error value and the simulated thermal displacement data is calculated. The Adam optimizer is used to iteratively update all learnable parameters of the TKAN network layer, SimAM attention layer, and thermal error output layer in the neural network thermal error model through backpropagation until the mean square error loss converges, thus obtaining the pre-trained model.

[0051] In this embodiment, the pre-training phase utilizes a large amount of simulation data to train the model end-to-end.

[0052] ; in For simulation datasets, for Each measuring point is within the sliding window length Temperature time series within, This corresponds to the simulated thermal error value. This represents the total number of samples in the simulation dataset.

[0053] During training, data flows sequentially through the TKAN network layer (extracting long-term dependencies and nonlinear thermal dynamic features) → the SimAM attention layer (parametric attention enhancement) → the thermal error output layer (global average pooling + linear layer mapping to predicted values), and is then processed by the mean squared error loss function. Supervised optimization is performed. After pre-training, the model has learned the basic mapping law between temperature field and thermal deformation from simulation data. The pre-training weights are saved to provide initialization parameters for subsequent fine-tuning under actual working conditions, thereby achieving high-precision thermal error prediction under conditions with limited real data.

[0054] In one feasible implementation, the processing of the thermal error output layer includes: performing global average pooling on the enhanced feature matrix along the time step dimension, averaging the feature vectors of each time step element by element to obtain a global feature vector; and mapping the global feature vector through a linear layer that multiplies it with a learnable weight matrix and adds a bias term to obtain the predicted thermal error value.

[0055] In this embodiment, the thermal error output layer enhances the feature matrix. Processing steps: First, perform global average pooling along the time step dimension, averaging the feature vectors of each time step element by element to obtain the global feature vector. ; ; Then through the linear layer The predicted thermal error value is obtained, where For learnable weight matrix, This is the bias term. Compared to direct flattening or global max pooling, global average pooling can more smoothly preserve the temporal information of each time step, and has a simple structure and high computational efficiency.

[0056] In one feasible implementation, the TKAN network layer and SimAM attention layer in the pre-trained model are used as a shared feature mapping function. The simulated temperature data and the measured temperature data are respectively input into the shared feature mapping function to extract the source domain feature matrix and the target domain feature matrix. By calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, the feature distributions of the simulated domain and the measured domain are aligned to obtain the domain-adapted model. The steps include: inputting the simulated temperature data into the shared feature mapping function to obtain the source domain feature matrix; inputting the measured temperature data into the shared feature mapping function to obtain the source domain feature matrix; and inputting the measured temperature data into the shared feature mapping function to obtain the source domain feature matrix. The shared feature mapping function is input to obtain the target domain feature matrix; the covariance matrix of the source domain feature matrix and the covariance matrix of the target domain feature matrix are calculated respectively; the squared Frobenius norm of the difference between the covariance matrix of the source domain feature matrix and the covariance matrix of the target domain feature matrix is ​​calculated as the CORAL loss; the CORAL loss is weighted and summed with the thermal error prediction loss calculated based on simulation data to obtain the total loss; the total loss is minimized through backpropagation, and the parameters of the shared feature mapping function are updated to align the simulated domain feature distribution with the measured domain feature distribution, thus obtaining the domain-adapted model.

[0057] In this embodiment, CORAL domain alignment achieves the transfer of feature distributions between the simulation domain and the measured domain through alignment of second-order statistics (covariance matrix). The TKAN layer and SimAM layer in the pre-trained model, which have already learned the temperature field feature mapping law, are used as shared feature mapping functions. ( Let the characteristic matrix of the simulation domain (source domain) be... The feature matrix of the measured domain (target domain) is ,in This represents the number of unlabeled, real-world test data samples used for domain migration adaptation. For feature dimensions.

[0058] First, calculate the covariance matrix of the features from the two domains: ; ; in It is a column vector of all 1s. The CORAL loss is defined as the squared Frobenius norm of the difference between the two covariance matrices: , l CORAL The CORAL loss is used; then, the CORAL loss and the thermal error prediction loss calculated based on simulation data are weighted and jointly optimized. The total loss is minimized through backpropagation, the parameters of the shared feature mapping function are updated, and the difference in feature distribution between the two domains is gradually reduced. CORAL alignment is an unsupervised adaptive method. In this stage, only simulated temperature data and unlabeled measured temperature data are used, without the need for measured thermal displacement labels, which effectively reduces the dependence on measured labeled data.

[0059] In one feasible implementation, the weighted summation is performed as follows: a balancing hyperparameter is set to control the domain alignment strength; the thermal error prediction loss calculated based on simulation data is used as the main task loss, and the CORAL loss is used as the auxiliary loss; the main task loss and the auxiliary loss are weighted and summed to obtain the total loss, wherein the weight of the main task loss is 1, and the weight of the auxiliary loss is the balancing hyperparameter; the total loss is minimized through backpropagation, and the parameters of the shared feature mapping function are updated so that the covariance matrix of the source domain feature matrix approximates the covariance matrix of the target domain feature matrix, thereby achieving second-order statistical alignment.

[0060] In this embodiment, the total loss is calculated as follows: ; in For the total loss, λ3 represents the balancing hyperparameters. This design clarifies the weighting strategy for the primary task loss and auxiliary losses: thermal error prediction loss... l sim The main task loss has a fixed weight of 1; the CORAL loss... To assist the loss, the weights are determined by the balancing hyperparameters. Control. The training process takes thermal error prediction accuracy as the primary goal and domain distribution alignment as an auxiliary constraint. By adjusting the balancing hyperparameters, a balance can be achieved between model prediction accuracy and domain transfer performance.

[0061] In one feasible implementation, the steps of fine-tuning the domain-adapted model to obtain the final thermal error prediction model, using the measured temperature data as input and the measured thermal displacement data as labels, include: fixing the bottom-level parameters of the TKAN network layer and the SimAM attention layer in the domain-adapted model; using the measured temperature data as input and the measured thermal displacement data as labels, calculating the mean squared error loss between the predicted thermal error value output by the domain-adapted model and the measured thermal displacement data; and using the Adam optimizer, with a learning rate lower than that used in the pre-training stage, iteratively updating the output layer parameters and some high-level parameters in the domain-adapted model that have not been fixed until convergence, to obtain the final thermal error prediction model.

[0062] In this embodiment, the measured labeled dataset used in the fine-tuning stage ;in, The measured temperature data were collected at the temperature-sensitive point. For the corresponding measured thermal displacement data, M r To determine the total number of samples in the actual labeled dataset, fine-tuning was performed on the domain-adapted model. During fine-tuning, the low-level parameters of the TKAN and SimAM layers were kept fixed to preserve the general feature extraction capabilities learned during the pre-training and domain alignment phases. Only the output layer and some higher-level parameters were updated to avoid overfitting on small samples. An Adam optimizer with a learning rate smaller than that used in the pre-training phase was employed for fine-tuning with a small update step size. The loss function used was the mean squared error from the actual data. After fine-tuning, the model integrates prior simulation knowledge with actual operating conditions, enabling high-precision thermal error prediction with a small number of labels, and exhibiting good generalization and robustness. The final model is referred to as SD-TLE (Simulation Data and Transfer Learning Enhanced Model).

[0063] To verify the effectiveness and superiority of the SD-TLE model constructed in this application, sparse data collected from experiments under the same working conditions were used for training. Three comparative thermal error models—TKAN-SimAM, LSTM (Long Short-Term Memory), and BPNN (Backpropagation Neural Network)—were constructed based on traditional modeling methods without transfer learning. Using the machine tool thermal characteristic experiment method in step S200, temperature and thermal error data different from the modeling conditions were re-collected to verify the predictive capabilities of SD-TLE and the comparative models. The fitting performance of different models on the training set is referenced. Figure 2 As shown, all algorithms can effectively fit the training data; the prediction performance of different models on the test set is referenced. Figure 3 As shown, the SD-TLE thermal error model has the best prediction performance, with prediction residuals around -1 to 5 μm. The MAE (Mean Absolute Error) and RMSE (Root Mean Square Error) of each model on the test set are referenced. Figure 4 As shown in the figure. The results show that the MAE and RMSE of the SD-TLE model are 1.45μm and 1.77μm, respectively. Compared with the TKAN-SimAM, LSTM, and BPNN models built solely based on sparse real data and without transfer learning, the MAE is reduced by 42%, 44%, and 55%, and the RMSE is reduced by 32%, 37%, and 47%, respectively, thus verifying the effectiveness and superiority of the modeling method proposed in this application.

[0064] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the machine tool spindle thermal error modeling method based on simulation data and transfer learning in this application. Any simple transformations based on this technical concept are within the protection scope of this application.

[0065] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0066] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. All equivalent structural transformations made under the technical concept of this application using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included within the scope of patent protection of this application.

Claims

1. A method for modeling the thermal error of a machine tool spindle based on simulation data and transfer learning, characterized in that, The method includes: A transient thermo-structural coupled finite element simulation model of the machine tool spindle system is established. Thermal boundary conditions are applied to the finite element simulation model, and simulation temperature data and simulation thermal displacement data under different working conditions are obtained through numerical simulation. Based on the simulated temperature data and the simulated thermal displacement data, cluster analysis and mutual information correlation measurement are used to screen temperature sensitive points; actual temperature data and actual thermal displacement data of the actual machine tool spindle system under real operating conditions are collected, and the actual temperature measurement location points are consistent with the temperature sensitive points in the simulation. A neural network thermal error model is constructed, comprising a TKAN network layer, a SimAM attention layer, and a thermal error output layer. The neural network thermal error model is pre-trained using the simulated temperature data as input and the simulated thermal displacement data as labels to obtain a pre-trained model. The TKAN network layer and SimAM attention layer in the pre-trained model are used as a shared feature mapping function. The simulated temperature data and the measured temperature data are respectively input into the shared feature mapping function to extract the source domain feature matrix and the target domain feature matrix. By calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, the feature distributions of the simulated domain and the measured domain are aligned to obtain the domain-adapted model. Using the measured temperature data as input and the measured thermal displacement data as labels, the domain-adapted model is fine-tuned to obtain the final thermal error prediction model.

2. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, Applying thermal boundary conditions to the finite element simulation model includes: The spindle bearing heat generation rate is calculated based on the spindle speed and the total bearing friction torque, wherein the total bearing friction torque includes the lubricant viscous friction torque and the external load friction torque. Calculate the motor heat generation rate based on motor output torque and motor efficiency; For the area where the coolant is forced to circulate, the convective heat transfer coefficient is calculated based on the empirical formula for forced convection inside the pipe; for the area where the spindle system's fixed outer surface is in natural convection with the air, the heat dissipation coefficient is taken as an empirical value. The heat generation rate of the spindle bearing, the heat generation rate of the motor, the convective heat transfer coefficient, and the heat dissipation coefficient are applied as thermal boundary conditions to different surfaces of the finite element simulation model.

3. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, The construction of the TKAN network layer includes: The activation function of the KAN edge in TKAN is defined as a weighted combination of the basis activation function and the B-spline function; A recursive memory mechanism is introduced into each network layer to construct an RKAN layer, so that the activation function of the KAN edge depends on both the current input and the historical memory state. TKAN cells are constructed using an LSTM gating framework. The calculation of the output gate of the TKAN cell is replaced by the mapping of a deep RKAN network. The calculation of the forget gate, input gate and candidate memory maintains a linear transformation form. Multiple TKAN cells are stacked along time steps to form the TKAN network layer; wherein the TKAN network layer takes a sliding window temperature sequence composed of the simulated temperature data as input and outputs a fused time-dependent feature matrix.

4. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 3, characterized in that, The functional definitions of each gate in the TKAN cell are as follows: The forget gate controls the degree of discarding of the cell state at the previous moment, and it is calculated by taking the hidden state at the previous moment and the input temperature sequence at the current moment as input; The input gate controls the degree to which new information is written into the cell state at the current moment; The candidate memory is fused with the current input temperature sequence and the hidden state of the previous time, and then generated as a candidate cell state through the hyperbolic tangent activation function. The output gate is obtained by mapping the current input temperature sequence with historical memory through a deep RKAN network, replacing the linear transformation calculation method of the output gate in the traditional LSTM. The cell state of the TKAN cell is updated as follows: the element-wise product of the forget gate and the cell state at the previous time step, plus the element-wise product of the input gate and the candidate memory; the hidden state is updated as follows: the element-wise product of the output gate and the current cell state after processing by the hyperbolic tangent activation function.

5. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, The SimAM attention layer processes the feature matrix output by the TKAN network layer, including: For each neuron in the feature matrix output by the TKAN network layer, the energy function value is calculated based on the mean and variance of the channel in which the neuron is located; The reciprocal of the energy function value is taken and normalized using the Sigmoid function to obtain the attention weight corresponding to each neuron; The attention weights are multiplied element-wise with the feature matrix output by the TKAN network layer to obtain the enhanced feature matrix.

6. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, Pre-training the neural network thermal error model includes: The simulated temperature data is input into the TKAN network layer, which extracts the long-term dependence and nonlinear thermal dynamic features of the temperature sequence and outputs a feature matrix that fuses the time-series dependence. The fusion temporal dependency feature matrix is ​​input into the SimAM attention layer. The SimAM attention layer calculates the energy function value for each neuron in the fusion temporal dependency feature matrix and obtains the attention weight. The attention weight is then multiplied element-wise with the fusion temporal dependency feature matrix to obtain the enhanced feature matrix. The enhanced feature matrix is ​​input into the thermal error output layer, and the thermal error output layer performs global average pooling on the enhanced feature matrix along the time step dimension to obtain a global feature vector. The global feature vector is then mapped through a linear layer to obtain the predicted thermal error value. Calculate the mean square error loss between the predicted thermal error value and the simulated thermal displacement data; The Adam optimizer is used to iteratively update all learnable parameters of the TKAN network layer, SimAM attention layer and thermal error output layer in the neural network thermal error model through backpropagation until the mean squared error loss converges, thus obtaining the pre-trained model.

7. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 6, characterized in that, The processing of the thermal error output layer includes: The enhanced feature matrix is ​​subjected to global average pooling along the time step dimension, and the feature vectors of each time step are averaged element by element to obtain the global feature vector. The predicted thermal error value is obtained by multiplying the global feature vector by the learnable weight matrix and adding a bias term through a linear layer mapping.

8. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, The steps of using the TKAN network layer and SimAM attention layer in the pre-trained model as a shared feature mapping function, inputting the simulated temperature data and the measured temperature data into the shared feature mapping function respectively, extracting the source domain feature matrix and the target domain feature matrix, calculating the covariance matrix of the source domain feature matrix and the target domain feature matrix and minimizing the difference between the covariance matrices, aligning the feature distributions of the simulated domain and the measured domain, and obtaining the domain-adapted model include: The simulated temperature data is input into the shared feature mapping function to obtain the source domain feature matrix; the measured temperature data is input into the shared feature mapping function to obtain the target domain feature matrix. Calculate the covariance matrix of the source domain feature matrix and the covariance matrix of the target domain feature matrix, respectively. The squared Frobenius norm of the difference between the covariance matrix of the source domain feature matrix and the covariance matrix of the target domain feature matrix is ​​used as the CORAL loss. The CORAL loss is weighted and summed with the thermal error prediction loss calculated based on simulation data to obtain the total loss. The total loss is minimized through backpropagation, and the parameters of the shared feature mapping function are updated to align the feature distribution of the simulation domain with the feature distribution of the measured domain, thus obtaining the domain-adapted model.

9. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 8, characterized in that, The weighted summation method is as follows: Set a balancing hyperparameter, which is used to control the domain alignment strength; The thermal error prediction loss calculated based on simulation data is used as the main task loss, and the CORAL loss is used as the auxiliary loss. The main task loss and the auxiliary loss are weighted and summed to obtain the total loss, wherein the weight of the main task loss is 1, and the weight of the auxiliary loss is the balance hyperparameter. By minimizing the total loss through backpropagation, the parameters of the shared feature mapping function are updated, making the covariance matrix of the source domain feature matrix approximate the covariance matrix of the target domain feature matrix, thereby achieving second-order statistical alignment.

10. The machine tool spindle thermal error modeling method based on simulation data and transfer learning as described in claim 1, characterized in that, The steps for fine-tuning the domain-adapted model to obtain the final thermal error prediction model, using the measured temperature data as input and the measured thermal displacement data as labels, include: Fix the underlying parameters of the TKAN network layer and the SimAM attention layer in the domain-adapted model; Using the measured temperature data as input and the measured thermal displacement data as labels, the mean square error loss between the predicted thermal error value of the domain-adapted model output and the measured thermal displacement data is calculated. The Adam optimizer is used to iteratively update the output layer parameters and some high-level parameters in the domain-adapted model with a learning rate lower than that used in the pre-training stage until convergence, thus obtaining the final thermal error prediction model.