A physical-guided data-driven method and system for spindle thermal error prediction of machine tools
Patent Information
- Application Number
- CN202611507321.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-10-30
AI Technical Summary
早期物理建模方法依赖精确的材料参数与边界条件,在变工况场景下参数标定困难,预测鲁棒性不足
在本发明中,通过空间编码器与时序编码器并行的时空双分支特征提取架构,同时挖掘多测点温度的空间热传导关联与时序演化依赖规律,实现了两类异质特征的优势互补,显著提升了模型对热误差时空耦合特性的表征能力;损失函数包括预测回归损失、高阶统计域对齐损失和热膨胀物理先验损失,采用高阶统计域对齐损失,突破二阶统计对齐的局限,更充分地匹配不同工况的特征分布,无需目标域标注数据即可实现模型的有效迁移,有效缓解了跨转速工况下域偏移导致的性能衰减;热膨胀物理先验损失同时作用于双域,从物理规律层面约束预测结果的合理性,与域适应机制形成协同增强效应,提升了大跨度工况与小样本场景下预测结果的可靠性与泛化鲁棒性。
Smart Images

Figure CN123013722A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine tool control technology, and in particular relates to a method and system for predicting the thermal error of a machine tool spindle driven by physical guidance data. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] In high-speed machining, thermal error is one of the dominant factors affecting the machining accuracy of CNC machine tools, accounting for 40% to 70% of the total machine tool error. Achieving accurate prediction and real-time compensation of thermal error is a key means to improve workpiece dimensional accuracy and ensure production efficiency. While thermal error can be obtained through direct measurement and modeling prediction, high-precision direct measurement of thermal error relies on specialized displacement sensors and stringent experimental conditions, resulting in high measurement costs and poor adaptability to operating conditions, making it difficult to apply on a large scale in actual production scenarios. Therefore, indirect prediction of thermal error based on temperature signals is more in line with the needs of industrial environments.
[0004] Research on thermal error modeling, both domestically and internationally, has evolved from physical mechanism modeling to data-driven modeling, gradually forming a relatively complete technical system. Early physical modeling methods relied on precise material parameters and boundary conditions, which made parameter calibration difficult under varying operating conditions and resulted in insufficient prediction robustness.
[0005] With the development of deep learning technology, data-driven models have become the mainstream of research due to their powerful nonlinear fitting capabilities. However, most existing models are trained and validated under fixed operating conditions. When operating conditions such as rotation speed and cooling conditions change, the data distribution shift will cause the model's predictive performance to degrade sharply. Summary of the Invention
[0006] To overcome the shortcomings of the prior art, this invention provides a physical-guided data-driven method and system for predicting thermal errors of machine tool spindles. By constructing a spatiotemporal dual-branch feature extraction architecture to mine the spatiotemporal coupling characteristics of temperature sequences, an unsupervised domain distribution alignment mechanism is introduced to reduce the differences in feature distribution between operating conditions, and the physical rationality of the prediction results is superimposed by the physical prior constraint of thermal expansion. Under the condition that there is no labeled data in the target domain, high-precision advance prediction of thermal errors under different speed operating conditions is achieved.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for predicting the thermal error of a machine tool spindle driven by physical guidance data, comprising: The collected multi-point temperature time-series signals of the electric spindle are input into the thermal error prediction model. The spatial encoder is used to capture the global spatial coupling correlation between multiple temperature measurement points. The long-term and short-term time-series dependence patterns of the temperature sequence are extracted by the time encoder. The extracted features are fused and mapped to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
[0008] Secondly, the present invention provides a physically guided data-driven machine tool spindle thermal error prediction system, comprising: The prediction module is configured to: input the collected multi-point temperature time-series signals of the electric spindle into the thermal error prediction model; use a spatial encoder to capture the global spatial coupling correlation between multiple temperature measurement points; extract the long-term and short-term time-series dependence patterns of the temperature sequence through a time-series encoder; and fuse and map the extracted features to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
[0009] Thirdly, the present invention provides an electronic device including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, perform the method described in the first aspect.
[0010] Fourthly, the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, perform the method described in the first aspect.
[0011] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.
[0012] The above one or more technical solutions have the following beneficial effects: In this invention, a spatiotemporal dual-branch feature extraction architecture that combines spatial and temporal encoders simultaneously mines the spatial thermal conduction correlation and temporal evolution dependence of temperatures at multiple measurement points. This achieves complementary advantages between the two types of heterogeneous features, significantly improving the model's ability to characterize the spatiotemporal coupling characteristics of thermal errors. The loss function includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss overcomes the limitations of second-order statistical alignment, more fully matching the feature distribution of different operating conditions. Effective model transfer can be achieved without target domain labeled data, effectively mitigating the performance degradation caused by domain shift under cross-speed operating conditions. The thermal expansion physical prior loss acts on both domains simultaneously, constraining the rationality of prediction results from the perspective of physical laws. It forms a synergistic enhancement effect with the domain adaptation mechanism, improving the reliability and generalization robustness of prediction results under large-span operating conditions and small sample scenarios.
[0013] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0014] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0015] Figure 1 This is a schematic diagram of the overall framework of the physical guidance data-driven machine tool spindle thermal error prediction method in an embodiment of the present invention; Figure 2 This is a structural diagram of the thermal error prediction model in an embodiment of the present invention; Figure 3 The above is a gray relational heatmap of temperature measurement points and thermal error in an embodiment of the present invention, where (a) to (d) correspond to rotational speeds of 8000 r / min, 10000 r / min, 12000 r / min, and 14000 r / min, respectively. Figure 4 This is a 3D visualization diagram of fuzzy C-means clustering of temperature measurement points in an embodiment of the present invention, where (a)~(d) correspond to rotational speeds of 8000 r / min, 10000 r / min, 12000 r / min, and 14000 r / min, respectively. Figure 5This is a comparison chart of thermal error prediction results across operating conditions in an embodiment of the present invention. (a) to (l) correspond to the following operating conditions in sequence: 8000 r / min→10000 r / min, 8000 r / min→12000 r / min, 8000 r / min→14000 r / min, 10000 r / min→8000 r / min, 10000 r / min→12000 r / min, 10000 r / min→14000 r / min, 12000 r / min→8000 r / min, 12000 r / min→10000 r / min, 12000 r / min→14000 r / min, 14000 r / min→8000 r / min, 14000 r / min→10000 r / min, and 14000 r / min→12000 r / min. Detailed Implementation
[0016] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0017] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations of the present invention.
[0018] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0019] Example 1 This embodiment discloses a physically guided data-driven method for predicting the thermal error of a machine tool spindle, including: The collected multi-point temperature time-series signals of the electric spindle are input into the thermal error prediction model. The global spatial coupling correlation between multiple temperature measurement points is captured by the LACVIN-based spatial encoder. The long and short-term time-series dependency features of the temperature sequence are extracted by the BTGF-Net time-series encoder. The extracted features are then fused and mapped to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
[0020] This embodiment employs a parallel spatiotemporal dual-branch feature extraction architecture, simultaneously mining the spatial thermal conduction correlation and temporal evolution dependence of temperatures at multiple measurement points. This achieves complementary advantages between two types of heterogeneous features, significantly improving the model's ability to characterize the spatiotemporal coupling characteristics of thermal errors. The loss function uses a high-order statistical domain alignment loss, overcoming the limitations of second-order statistical alignment and further reducing the distribution differences between operating conditions. This more fully matches the feature distributions of different operating conditions, enabling effective model transfer without the need for labeled data in the target domain, effectively mitigating performance degradation caused by domain shifts across speed operating conditions. The thermal expansion physical prior loss acts simultaneously on both domains, constraining the rationality of prediction results from a physical law perspective. This synergistic enhancement effect with the domain adaptation mechanism improves the reliability and generalization robustness of prediction results under large-span operating conditions and small-sample scenarios. Even without labeled data in the target domain, it achieves high-precision advance prediction of thermal errors under different speed operating conditions.
[0021] The following is combined with Figures 1-2 This embodiment provides a detailed description of a physical-guided data-driven method for predicting the thermal error of a machine tool electric spindle, including the following steps: Step 1: Data Acquisition and Preprocessing.
[0022] Temperature and displacement sensors are arranged at different positions on the high-speed electric spindle to simultaneously collect multi-point temperature time-series signals and spindle axial thermal error signals under multiple speed conditions. The original signals are denoised, temperature-sensitive points are screened, and sliding window samples are constructed to complete the dataset partitioning and standardization, eliminate dimensional differences, and improve the model training convergence speed and prediction accuracy.
[0023] As a specific implementation method, the temperature signal is acquired using a Pt100 platinum resistance contact temperature sensor, and the thermal error signal is acquired using an eddy current non-contact displacement sensor. The sampling frequencies of the two types of signals are kept consistent to ensure time synchronization. The experiment sets up multiple speed conditions, and each set of conditions covers the complete process of the spindle from cold start to thermal equilibrium.
[0024] As a specific implementation method, the Savitzky-Golay smoothing filtering algorithm is used to denoise the original signal; a two-stage method combining grey relational analysis and fuzzy C-means clustering is used to screen temperature-sensitive points, and 3-5 key temperature measurement points are retained after screening; a sliding window method is used to construct time-series supervised samples, with the input sequence length and prediction lead step size set according to the response delay of the compensation system, and the sliding step size set to 10-100 sampling points; the Z-score normalization method is used to normalize the temperature and thermal error data respectively.
[0025] Step 2: Spatiotemporal dual-branch feature extraction and fusion.
[0026] The preprocessed temperature sequence is input into the thermal error prediction model, which employs a parallel dual-branch feature extraction network. This model constructs a spatiotemporal dual-branch feature extraction architecture consisting of a spatial encoding branch of a Learnable Aggregation Cross-Variable Interaction Network (LACVIN) and a temporal encoding branch of a Bidirectional Temporal Gating Fusion Network (BTGF-Net). This architecture mines the spatiotemporal coupling characteristics of the temperature sequence, concatenating and fusing the two types of heterogeneous features to obtain a spatiotemporal fusion feature vector. The spatiotemporal fusion feature vector is then mapped through a hierarchical fully connected regression layer to output the predicted thermal error value, which is simultaneously projected onto the domain feature space for distribution alignment calculation.
[0027] As a specific implementation, the LACVIN spatial encoder treats each temperature measurement variable as an independent token, performs multi-head differential attention operations on the variable dimension, and explicitly models the spatial heat conduction relationship between measurement points. It introduces learnable variable embedding to inject prior information of measurement points, inserts GLU gating between layers to achieve feature selection, and adopts learnable query cross-attention aggregation to replace global average pooling, adaptively aggregating spatial features.
[0028] The LACVIN spatial encoding branch takes variable-to-token projection as input, superimposes learnable variable embeddings to inject prior information of measurement points, and extracts spatial correlation features layer by layer through stacked differential Transformer layers. Finally, it outputs global spatial features through learnable query cross-attention aggregation. Its core calculation process is as follows: First, the input temperature sequence is transformed by a dimensionality transformation. By projecting variables to tokens, the complete time series of each measurement point is mapped to a set feature dimension through linear projection, and then learnable variable embeddings are superimposed. :
[0029] in, The input is a temperature sequence, where L is the sequence length and N is the number of temperature measurement points. d represents the projected variable features, where d is the feature dimension. This is the learning variable embedding matrix, where the superscript T indicates transpose.
[0030] The projected variable features were then... X varFeature extraction is performed on stacked differential Transformer layers. Each differential Transformer layer contains layer normalization, multi-head differential attention mechanism, Dropout, feedforward network and residual connection structure in sequence; GLU gating is added between layers to enhance nonlinear filtering capability.
[0031] Among them, the multi-head differential attention mechanism highlights the differential association patterns between variables and suppresses redundant association interference through the differential operation of dual-path attention weights. Its calculation process is as follows: The multi-head differential attention mechanism performs independent linear projections on the input features to obtain a dual-path query and a key vector: Q1= XW Q1 K1= XW K1 Q2 = XW Q2 K2 = XW K2 Where X is the input feature matrix of the current multi-head differential attention; W Q1 W K1 These are the linear projection weight matrices corresponding to the first query vector and the key vector, respectively; W Q2 W K Q1 and K1 are the linear projection weight matrices corresponding to the second-path query vector and key vector, respectively; Q2 and K2 are the query vector and key vector obtained from the first-path projection, respectively; Q2 and K2 are the query vector and key vector obtained from the second-path projection, respectively.
[0032] Calculate the attention weights for both paths separately and perform Softmax normalization:
[0033]
[0034] in, d k The feature dimension of the key vector is used to scale the attention score to avoid excessively large inner product values that could cause gradient saturation in the Softmax function. Att 1. Att 2 represents the attention weight matrices after Softmax normalization for the two paths, with values ranging from 0 to 1, representing the correlation strength between each temperature measurement point.
[0035] By element-wise subtraction and differential attention fusion coefficient λ diff After adjustment, the differential attention weights are obtained by weighted summation:
[0036] in, λ diffThe differential attention fusion coefficient is used to adjust the differential ratio between the two attention paths. It is automatically searched and determined within a preset range through a hyperparameter optimization algorithm. Att diff It is a differential attention weight matrix, which strengthens differentiated associations and suppresses redundant associations through differential operations.
[0037] Finally, the differential attention weights are multiplied by the value vector to obtain the attention output:
[0038] in, W V The linear projection weight matrix corresponding to the value vector; Output These are the output features of the differential attention module.
[0039] The output of the multi-head differential attention mechanism is randomly discarded by Dropout, then connected to the input residual of the multi-head differential attention mechanism, and then fed into the feedforward network for nonlinear transformation after layer normalization to output the encoded features of that layer.
[0040] After multi-layer differential Transformer encoding, learnable query cross-attention aggregation is used instead of traditional global average pooling. It adaptively learns the importance weights of different temperature measurement points, dynamically aggregates the spatial features of each measurement point, and outputs global spatial features:
[0041] in, The learnable aggregate query vector is randomly initialized using a small-variance Gaussian distribution and optimized together with the model training. f space This is the output spatial feature vector. Among them, the learnable aggregate query vector... It is used to replace traditional global average pooling, adaptively learn the importance weights of different temperature measurement points, and dynamically aggregate spatial features; the initialization method is to use small variance Gaussian distribution for random initialization; the optimization method is to update end-to-end through backpropagation as the model is trained, without the need for manual preset of fixed values.
[0042] In this embodiment, the BTGF-Net temporal encoder is based on bidirectional LSTM, combined with temporal attention pooling, gated fusion, residual connections and layer normalization, and integrates forward and reverse temporal context information to enhance the long-term global representation capability.
[0043] The complete calculation process is as follows: First, input the temperature sequence. X seq The input is processed through a BiLSTM layer, which captures the long-short-term dependencies of the temperature sequence and extracts the basic temporal features. Simultaneously, residual projection is introduced to preserve the mean features of the input temporal sequence.
[0044] in, It is a fully time-series hidden state. h The hidden dimension is a unidirectional LSTM; The final hidden state is the forward and backward orientation. c n The final cell state is obtained by concatenating the forward and backward hidden states. .
[0045] Secondly, temporal attention pooling is performed on the temporal features output by BiLSTM, and temporal attention weights are calculated using learnable query vectors to aggregate the global context.
[0046]
[0047] in, The learnable time query vector is randomly initialized using a small-variance Gaussian distribution and optimized together with the model training. α t The attention weights at each time step; h context These are global context features. Among them, the learnable temporal query vector... It replaces time pooling with fixed weights, adaptively learns the importance of different time steps, and aggregates long-term global context information; initialization method: random initialization using a small-variance Gaussian distribution; optimization method: end-to-end update through backpropagation during overall model training, without the need for manual preset of fixed values.
[0048] Simultaneously, the last-layer hidden state is extracted from the temporal features output by BiLSTM to obtain the forward and backward hidden state representations at the final time step. The forward and backward hidden states are then concatenated to obtain the final hidden features.
[0049] The global context features output from temporal attention pooling and the final time-step features extracted from the last hidden state are fed together into the sigmoid-gated fusion module, where the two features are adaptively fused using sigmoid-gated weights.
[0050]
[0051] Where g is the gating weight; h fused is the temporal feature after gating and fusion; Linear is the linear layer.
[0052] Finally, residual connections and layer normalization are added to output global temporal features:
[0053] in, x mean The mean feature of the input time series is used for residual connections; f time This is the output time-series feature vector.
[0054] The global spatial features and global temporal features output above are fed into the feature concatenation module for dimensional concatenation to obtain the global spatiotemporal fusion feature vector: f fusion = [ f space ; f time ] Global spatiotemporal fusion features are used in a regression predictor composed of hierarchical fully connected regression layers. The mapping outputs the final predicted thermal error value. On the other hand, the latitude projection layer Mapped to a low-dimensional domain feature space for calculating domain alignment loss:
[0055]
[0056] The thermal error prediction model employs a dual-input training architecture of source and target domains. The source and target domain datasets are input into a shared spatiotemporal encoder E with shared weights, outputting source and target domain features respectively. These features are then input into independent regression predictors to obtain corresponding prediction results, which are subsequently mapped through domain projection layers to obtain source and target domain projected features. The acquisition process can be represented as follows: The network mapping function of the shared spatiotemporal encoder E is denoted as follows: F θ It consists of an LACVIN spatial encoder, a BTGF-Net temporal encoder, and a feature fusion layer. θ Extract all trainable parameters for the feature extraction network. For the th feature in the source domain... i One input temperature time series sample X s,i The feature extraction network outputs the corresponding source domain feature vector:
[0057] in, n s This represents the total number of samples within the source domain batch. f s,i For the source domain iThe domain feature vectors of each sample are used to calculate the subsequent domain distribution alignment loss and regression loss.
[0058] For the first in the target domain i One input temperature time series sample X t,i The feature extraction network with the same shared weights outputs the corresponding target domain feature vector:
[0059] in, n t The total number of samples within the target domain batch; f t,i For the target domain i The domain feature vectors of each sample are used only for calculating the domain distribution alignment loss and are not included in the calculation of the regression supervision loss.
[0060] The multi-objective joint loss function for training the thermal error prediction model is composed of a weighted sum of the source domain prediction regression loss, the higher-order statistical domain alignment loss, and the thermal expansion physical prior loss. The three types of losses are weighted and summed by the total loss merging module to obtain the final total loss. The construction process is as follows: First, determine the source domain prediction regression loss with mean squared error as the core. L 1. As a basic supervision term for training the thermal error prediction model; Secondly, a higher-order statistical domain alignment loss is introduced. L 2. Align high-order statistics of deep features between the source and target domains to reduce the difference in feature distribution between the source and target domains; Secondly, we introduce the prior physical loss due to thermal expansion. L 3. It acts on both the source and target domains simultaneously to constrain the prediction results to conform to the laws of thermophysics; Finally, the three types of losses are weighted and summed to obtain the total loss function:
[0061] in, L The total loss function for model training; L 1 represents the mean squared error regression loss of the source domain prediction, which serves as the basic supervision term for training the thermal error prediction model and is used to measure the deviation between the predicted value and the true value on the labeled data in the source domain. λ 1 is the weighting coefficient for the higher-order statistical domain alignment loss, used to adjust the proportion of domain alignment loss in the total loss; L 2 represents the higher-order statistical domain alignment loss, used to constrain the feature distribution differences between the source and target domains, thereby achieving unsupervised domain adaptation; λ 2 is the weighting coefficient for the physical prior loss of thermal expansion, used to adjust the proportion of physical prior loss in the total loss; L3 represents the prior physical loss due to thermal expansion, used to constrain the rationality of the prediction results from the perspective of physical laws.
[0062] A High-order Statistical Domain Alignment (HOSDA) mechanism is introduced. The HOSDA loss is a weighted combination of the Multi-kernel Maximum Mean Discrepancy (MK-MMD) loss and the Central Moment Discrepancy (CMD) loss, which simultaneously matches the kernel space difference and the explicit high-order moment difference of the distribution.
[0063] in, α cmd This is the weighting coefficient for the central moment difference loss, used to balance the proportions of MK-MMD loss and CMD loss. In this embodiment, the value is 0.1. For the loss due to the difference in central moments; This represents the loss due to the maximum mean difference across multiple cores.
[0064] The difference in the distribution of features between the source and target domains is measured by using a multi-scale Gaussian kernel in the reproducing kernel Hilbert space. The calculation process is as follows: First, define the Gaussian kernel function. :
[0065] in, σ This represents the Gaussian kernel bandwidth.
[0066] MMD is calculated using multiple Gaussian kernels with different bandwidths:
[0067] in, K The number of Gaussian kernels; n s , n t These represent the number of samples in the source domain and the target domain, respectively. f s,i For the source domain i Domain feature vectors of each sample; n t The total number of samples within the target domain batch; f t,i For the target domain i Domain feature vectors of each sample; This is the Gaussian kernel function.
[0068] The calculation process for explicitly aligning the first to third order central moments of features in the source and target domains is as follows: First, calculate the difference in the first moment (mean):
[0069] in, μ s Let be the mean vector of the features of the source domain. μ t The mean vector of the features in the target domain; subscript s Indicates the source domain, subscript t Indicates the target domain; Let L2 norm be denoted, and its squared form represents the mean square distance between two mean vectors.
[0070]
[0071] Next, calculate the difference in higher-order central moments:
[0072] in, M The highest order of alignment is 3 in this embodiment; , Features of the source domain and target domain respectively m Order central moment:
[0073]
[0074] Total CMD loss for:
[0075] The prior loss of thermal expansion is constructed based on a first-order inertial thermal response model. The predicted results are constrained to conform to the physical laws of thermal expansion in a differentiable form, simulating the hysteresis characteristics of thermal deformation. It can be expressed as: First, the average of the input multi-point temperature series along the variable dimension is taken to obtain a scalar time series representing the overall temperature level. ; Secondly, based on the first-order inertial filter model, the smoothed theoretical thermal response sequence is calculated. :
[0076] in, y t for t The theoretical thermal response value at time t. β The inertia coefficient characterizes the degree of thermal hysteresis; y t-1 for tTheoretical thermal response value at time -1; u t for t The average temperature value at multiple measurement points at any given time.
[0077] Furthermore, the theoretical predicted value is derived by combining the prediction lead step size τ:
[0078] in, for t+τ Theoretical thermal response value at time.
[0079] Finally, after normalizing the model predictions and theoretical predictions, the mean squared residuals are calculated to obtain the physical prior loss constraints:
[0080] in, N This represents the total length of the time series samples. These are the normalized model predictions. τ To predict the leading step length.
[0081] Model Training and Optimization: The preprocessed dataset is divided into a source domain training set, a validation set, and a target domain test set. Joint training is performed using labeled data from the source domain and unlabeled data from the target domain. A progressive warm-up training strategy is designed to dynamically adjust the weights of the domain loss and physical loss. The network parameters are iteratively updated through optimization algorithms to minimize the joint loss function. During training, the validation set is used for early stopping control to prevent overfitting and improve the model's generalization ability across different operating conditions.
[0082] The progressive warm-up training strategy follows the principle of learning from easy to difficult, balancing the timing of the application of each loss term. In the early stages of training, the model's feature extraction capabilities are not yet mature. Directly applying full-strength domain distribution constraints and physical constraints can easily interfere with the learning of the mapping relationship between the source domain's base temperature and thermal error, leading to slow convergence or even performance degradation. As training progresses and the model gradually establishes basic regression patterns, the constraint strength is gradually increased to guide the feature space towards domain invariance, while simultaneously constraining the physical rationality of the output results.
[0083] During the warm-up phase, the weights λ1 for the higher-order statistical domain distribution alignment loss and λ2 for the thermal expansion physical prior loss increase linearly from 0 with the number of training rounds, reaching their preset maximum values at the end of the warm-up phase. After the warm-up phase ends, both weights remain constant.
[0084] The formula for dynamic weight adjustment is as follows:
[0085]
[0086] in, e This is the current training round. λ 1,max Set the maximum weight value for the alignment loss of the higher-order statistical domain. λ 2,max The maximum weighting value is set for the physical prior loss due to thermal expansion. This represents the total number of preheating cycles.
[0087] The optimization algorithm uses the Adam optimizer, the learning rate is dynamically adjusted using a cosine annealing strategy, and the gradient clipping threshold is set to 5.0 to prevent gradient explosion. The number of warm-up rounds is set to 1 / 15 of the total number of training rounds, and the weights of the domain loss and physical loss during the warm-up phase increase linearly from 0 to the set maximum value.
[0088] The model is built on the PyTorch deep learning framework and adopts a leave-one-out cross-validation strategy to construct a cross-condition prediction task. The source domain data is divided into training and validation sets in an 8:2 ratio, and all target domain data is used for testing.
[0089] To avoid the subjective bias of manual parameter tuning and to fully improve the model's prediction accuracy and generalization performance across different operating conditions, the Optuna automatic hyperparameter optimization framework is adopted to systematically and globally optimize network structure parameters, training configuration parameters, and constraint weight parameters. This framework integrates a tree-structured Parzen estimator sampler and a median pruning strategy: the TPE sampler constructs a probabilistic surrogate model of the parameter space and iteratively updates the posterior distribution of parameters based on historical experiments, enabling efficient global search in a non-convex high-dimensional parameter space; the median pruning strategy can terminate poorly performing experiments early, effectively reducing computational overhead, and is configured with 3 start-up experiments and 10 warm-up steps.
[0090] The hyperparameter search space encompasses three main categories: network structure, training configuration, and constraint weights. Specific settings are shown in Table 1 below. The number of multi-head attention heads is fixed at 4 to ensure that the dimensions of each feature subspace of the differential attention are integers. The number of encoder layers is limited to 1-2 layers to avoid overfitting in small-sample industrial data scenarios.
[0091] Table 1: Hyperparameter Search Space Configuration
[0092] Independent hyperparameter optimization was performed on 12 groups of cross-speed migration tasks. Each task group underwent 15 search trials, with a fixed global random seed of 42 to ensure reproducibility. Taking the migration task from 10000 r / min to 14000 r / min as an example, the optimal hyperparameter combination obtained is shown in Table 2 below.
[0093] Table 2: Optimal hyperparameters for migration tasks at 10000 r / min-14000 r / min
[0094] Optimization results show that a larger batch size and a moderate learning rate can balance the model's convergence speed and fitting accuracy; the differential attention coefficient is biased towards 0.7, indicating that the configuration of strengthening the first path's attention dominance and the second path's redundancy suppression is more conducive to extracting the differential heat conduction features between measurement points; the physical prior loss weight is at a medium-high level, which can effectively constrain the physical consistency of the prediction results.
[0095] Based on the optimal hyperparameter configuration, the complete hierarchical structure and output dimensions of the constructed physical-guided data-driven thermal error prediction model are shown in Table 3 below.
[0096] Table 3: Detailed structural parameters of the thermal error prediction model
[0097] After the model training converges, the temperature sequence of the target working condition is input into the trained prediction model, and the corresponding thermal error prediction value is output. After the prediction accuracy meets the requirements, the model can be integrated into the machine tool thermal error compensation system to realize real-time compensation of spindle thermal error under varying working conditions.
[0098] The thermal error prediction model is implemented through the following steps: Step 1: First, a multi-rotational spindle thermal characteristic experiment was designed, collecting multi-channel temperature and thermal error data. The data was preprocessed, including Savitzky-Golay smoothing and noise reduction, Z-score normalization, and dataset partitioning. Temperature-sensitive points were screened using grey relational analysis combined with fuzzy C-means clustering, retaining core temperature measurement points and configuring corresponding weight coefficients to characterize the differences in thermal contribution at different locations. A spatial feature extraction network composed of LACVIN was designed, injecting prior information about the measurement points through learnable variable embedding, stacking differential Transformer encoding layers to model the differential thermal conduction correlations between measurement points, inserting GLU gating between layers to achieve feature selection, and finally aggregating global spatial features through learnable query cross-attention to extract the spatial coupling correlations between multiple measurement points. After extracting the spatial features, they were fused with the temporal features extracted by BTGF-Net. This temporal network is based on bidirectional LSTM, combined with temporal attention pooling, gating fusion mechanisms, residual connections, and layer normalization structures to capture the long- and short-term temporal dependencies of the temperature sequence. The two types of heterogeneous features were concatenated to form a spatiotemporal fusion feature dataset for subsequent model training, testing, and validation.
[0099] Step 2: A physical-guided cross-domain prediction model based on LACVIN and BTGF-Net was constructed. The model adopts a parallel spatiotemporal dual-branch feature extraction structure. The spatial branch is configured with an LACVIN spatial encoder, and the temporal branch is configured with a BTGF-Net temporal encoder. The fused spatiotemporal features are output as thermal error prediction values through a hierarchical fully connected regression layer on the one hand, and mapped to a low-dimensional domain feature space through a domain projection layer on the other hand for distribution alignment calculation. The thermal error prediction model first extracts the spatiotemporal features of multimodal temperature signals through a dual-branch network. During the training phase, HOSDA loss is introduced to constrain the feature distribution differences under different operating conditions. This loss is composed of MK-MMD and CMD weights. By matching the distribution differences in the regenerating kernel Hilbert space with multi-scale Gaussian kernels and explicitly aligning the first to third order central moments, the feature distribution offset between operating conditions is reduced, achieving unsupervised domain adaptation. The model's physical consistency and generalization ability are improved by combining the thermal expansion physical prior loss. This loss is based on the first-order inertial thermal response model and acts on both source and target domain samples, constraining the rationality of the predicted output from the perspective of physical laws. During the training process, a progressive warm-up strategy is used to dynamically adjust the weight coefficients of the two constraint losses. Combined with the Adam optimizer and cosine annealing learning rate strategy, along with gradient pruning and validation set early stopping mechanism, the model training stability and cross-operating condition generalization performance are improved.
[0100] Step 3: The model's thermal error prediction results are output through a hierarchical fully connected regression layer and compared with the actual thermal error.
[0101] To verify the effectiveness of this embodiment, a cosine annealing learning rate was used to adjust the learning rate during the training process of the thermal error prediction model. The loss function during training and the comparison between the model's prediction results and actual values were plotted. Four evaluation metrics—root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and coefficient of determination (R²)—were used to measure the prediction error. The model was compared with other models to verify its effectiveness and superiority. The calculation formulas for the four performance evaluation metrics are shown below:
[0102]
[0103]
[0104]
[0105] Where N represents the number of sampling points, y i Represents the true thermal error value. This represents the predicted thermal error value. This represents the average value of the actual thermal error.
[0106] To comprehensively verify the model's performance, spindle thermal characteristic experiments were conducted under various speed conditions. The CNC machine tool used in the experiments was a VB63F5 cradle five-axis linkage machining center. In this experiment, 11 channels of Pt100 platinum resistance temperature sensors were deployed, and a DH904 eddy current displacement sensor was used to measure the spindle's Z-axis thermal error. Data was acquired using a Donghua DH5922 multi-channel testing system, and its accompanying software was used for real-time display and storage. Temperature and thermal error signals were simultaneously acquired during the experiments, with both signals sampled at a frequency of 10Hz. Four sets of experiments under different speed conditions were conducted to verify the model's generalization ability.
[0107] The rotational speed parameters for the four sets of experiments are shown in Table 4. The 3D visualization of fuzzy C-means clustering of temperature measurement points is shown in Table 4. Figure 4 As shown in (a)~(d), the gray relational heatmap of temperature measurement points and thermal error is as follows: Figure 3 As shown in (a) to (d).
[0108] Table 4: Speed Operating Condition Parameter Settings
[0109] The evaluation indexes for the thermal error prediction results across 12 sets of cross-condition migration tasks are shown in Table 5, and the comparison chart of the cross-condition thermal error prediction results is shown in the figure below. Figure 5 As shown in (a)~(l).
[0110] Table 5: Evaluation metrics for thermal error prediction results in cross-condition migration tasks:
[0111] Each experimental dataset was divided into training and test sets in an 8:2 ratio. The comparison of prediction results shows that the model's predicted values are very close to the actual values, and the model achieved the best performance among all compared models. These results demonstrate that the thermal error prediction model proposed in this invention is easy to train, exhibits good convergence and stability, and can accurately predict thermal errors.
[0112] Example 2 The purpose of this embodiment is to provide a physically guided, data-driven machine tool spindle thermal error prediction system, including: The prediction module is configured to: input the collected multi-point temperature time-series signals of the electric spindle into the thermal error prediction model; use a spatial encoder to capture the global spatial coupling correlation between multiple temperature measurement points; extract the long-term and short-term time-series dependence patterns of the temperature sequence through a time-series encoder; and fuse and map the extracted features to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
[0113] In further embodiments, the following is also provided: An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor. When executed by the processor, the computer instructions perform the method described in Embodiment 1. For brevity, further details are omitted here.
[0114] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0115] Memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of memory may also include non-volatile random access memory. For example, memory may also store information about the device type.
[0116] A computer-readable storage medium for storing computer instructions, which, when executed by a processor, perform the method described in Embodiment 1.
[0117] The method in Embodiment 1 can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules can reside in readily available storage media in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not provided here.
[0118] A computer program product includes a computer program that, when executed by a processor, implements the method described in Embodiment 1.
[0119] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which execute in a device on a target real or virtual processor to perform the processes / methods described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided among program modules as needed. The machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside in both local and remote storage media.
[0120] The computer program code used to implement the methods of the present invention may be written in one or more programming languages. This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the computer or other programmable data processing device, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, as a stand-alone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.
[0121] In the context of this invention, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like. Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.
[0122] Those skilled in the art will recognize that the units and algorithm steps described in conjunction with the embodiments herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0123] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A physically guided, data-driven method for predicting the thermal error of a machine tool spindle, characterized in that, include: The collected multi-point temperature time-series signals of the electric spindle are input into the thermal error prediction model. The spatial encoder is used to capture the global spatial coupling correlation between multiple temperature measurement points. The long-term and short-term time-series dependence patterns of the temperature sequence are extracted by the time encoder. The extracted features are fused and mapped to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
2. The method for predicting machine tool spindle thermal errors based on physical guidance data as described in claim 1, characterized in that, The spatial encoder is used to capture the global spatial coupling correlation between multiple temperature measurement points, specifically: Each temperature measurement variable is treated as an independent token, and multi-head differential attention operation is performed on the variable dimension to explicitly model the spatial heat conduction relationship between measurement points; We introduce learnable variable embedding to inject prior information of measurement points, insert GLU gating between layers to achieve feature selection, and use learnable query cross-attention aggregation to replace global average pooling to adaptively aggregate spatial features.
3. The method for predicting machine tool spindle thermal errors based on physical guidance data as described in claim 1, characterized in that, The long- and short-term temporal dependencies of the temperature sequence are extracted using a time-series encoder, specifically as follows: Basic temporal features of temperature sequences were extracted using a bidirectional long short-term memory network. Based on fundamental temporal features, temporal attention weights are calculated using learnable query vectors to aggregate global context. By fusing the final hidden state with the global context through a gating mechanism, the temporal features after gating fusion are obtained; Global time series features are obtained by connecting the mean features of the input temperature sequence and the time series features after gated fusion through residual connections.
4. The method for predicting machine tool spindle thermal errors based on physical guidance data as described in claim 1, characterized in that, The theoretical thermal response sequence calculated based on the first-order inertial thermal response model is as follows: The average of the input multi-point temperature series along the variable dimension is used to obtain a scalar time series representing the overall temperature level. The smoothed theoretical thermal response sequence is calculated based on scalar time series using a first-order inertial filtering model. The theoretical predicted value is derived based on the smoothed theoretical thermal response sequence and the prediction lead step size.
5. The method for predicting machine tool spindle thermal errors based on physical guidance data as described in claim 1, characterized in that, The higher-order statistical domain alignment loss Specifically: in, α cmd The weighting coefficient for the central moment difference loss; For the loss due to the difference in central moments; This represents the maximum mean difference loss across multiple cores. K The number of Gaussian kernels; n t The total number of samples within the target domain batch; n s This represents the total number of samples within the source domain batch. f s,i For the source domain i Domain feature vectors of each sample; n t The total number of samples within the target domain batch; f t,i For the target domain i Domain feature vectors of each sample; This is the Gaussian kernel function.
6. The method for predicting machine tool spindle thermal errors based on physical guidance data as described in claim 1, characterized in that, A progressive warm-up training strategy is adopted to dynamically adjust the weight coefficients of the higher-order statistical domain alignment loss and the thermal expansion physical prior loss, specifically as follows: Where e represents the current training round; λ 1,max Set the maximum weight value for the domain distribution alignment loss; λ 2,max The maximum weighting value is set for the physical prior loss due to thermal expansion. λ represents the total number of preheating rounds; λ1 is the weighting coefficient of the alignment loss in the higher-order statistical domain; λ 2 represents the weighting coefficient for the prior physical loss due to thermal expansion.
7. A physically guided, data-driven machine tool spindle thermal error prediction system, characterized in that, include: The prediction module is configured to: input the collected multi-point temperature time-series signals of the electric spindle into the thermal error prediction model; use a spatial encoder to capture the global spatial coupling correlation between multiple temperature measurement points; extract the long-term and short-term time-series dependence patterns of the temperature sequence through a time-series encoder; and fuse and map the extracted features to obtain the thermal error prediction value. The loss function for training the thermal error prediction model includes prediction regression loss, higher-order statistical domain alignment loss, and thermal expansion physical prior loss. The higher-order statistical domain alignment loss is composed of a weighted average of the multi-kernel maximum mean difference loss and the central moment difference loss, which is used to constrain the differences in the higher-order statistical distribution of the features of the source domain and the target domain. The thermal expansion physical prior loss is determined by the theoretical thermal response sequence calculated based on the first-order inertial thermal response model and the thermal error prediction value, and is applied to both the source domain and the target domain samples to constrain the prediction results to conform to the laws of thermophysics.
8. An electronic device, characterized in that, It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, perform the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, perform the method described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the method described in any one of claims 1-6.
