Machine tool spindle thermal deformation prediction method based on GCN-Transform model
By using the GCN-Transformer model in the thermal deformation prediction of machine tool spindles, combining the spatial feature extraction of GCN and the temporal feature extraction of Transformer, the problem of difficulty in utilizing sensor network space information in the prior art is solved, and more accurate and robust thermal error prediction is achieved.
Patent Information
- Application Number
- CN202411569369.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, when predicting thermal deformation of the machine spindle, it is difficult to fully utilize the spatial information of the sensor network, resulting in weak prediction performance and stability.
Using the method based on the GCN-Transformer model, the spatial features in the sensor topology space are captured through GCN, and the time features are captured by the Transformer model to achieve spatial and temporal prediction of thermal errors.
This method not only accurately captures the temporal characteristics of thermal error, but also makes full use of the spatial information of the sensor, improving the accuracy and robustness of the prediction results.
Smart Images

Figure CN119670530A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of thermal deformation prediction of machine tool spindles, and in particular to a method for predicting thermal deformation of machine tool spindles based on a GCN-Transformer model. Background Art
[0002] Thermal error and thermal deformation of machine tools are inevitable. Thermal error caused by thermal deformation is one of the factors affecting machining accuracy. Thermal error modeling and compensation is one of the most effective ways to improve machining accuracy. Therefore, reducing the impact of thermal error is of great significance to improving the machining accuracy of CNC machine tools. With the joint efforts of researchers at home and abroad for many years, the modeling methods of thermal errors of CNC machine tools have mainly developed into two categories: mechanism analysis method and data-driven method. Although the mechanism analysis method predicts the influence of tool tip motion by analyzing the mechanism of heat generation, transfer and deformation, it is difficult to build a high-precision model due to the complexity of actual machining conditions. Therefore, the research focus has gradually shifted to the data-driven method. Traditional empirical models mainly rely on statistical methods, cannot reveal potential relationships, and lack effective data feature extraction capabilities. Recently, some studies have begun to build empirical models based on machine learning technology. For example, thermal imaging data were collected and used as the input of convolutional neural networks (CNNs) to establish thermal error models; temperature rise data were used as the input of gray neural networks to build thermal error models. However, these models have limited interpretability and cannot fully reflect the generation mechanism of thermal errors, so their prediction performance and stability are weak. Based on the mechanism of thermal error generation, a memory performance prediction model is proposed. Different from the traditional empirical model, the model takes the error mechanism into account. The research results show that the thermal error is related to the running time, and the long short-term memory network (LSTM) with strong memory capacity is adopted. The results show that LSTM is an excellent model, and this conclusion is also verified in the thermal error modeling of heavy machine tools; by using LSTM for error prediction, a high prediction accuracy is achieved. However, the existing empirical model mainly focuses on the temporal characteristics of sensor measurement and ignores the spatial information of the sensor, so that the thermal error data cannot fully utilize the advantages of the sensor network. In fact, the spatial information of temperature and displacement sensors is equally important for accurate prediction. Therefore, in the process of predictive modeling, the spatial characteristics of the sensor and the temporal characteristics of the thermal error should be considered comprehensively. In the actual processing process, sensors are distributed at various positions of the machine tool. The reasonably arranged sensors form a sensor network, which generates a spatiotemporal graph over time.
[0003] In order to capture the spatial features of sensors based on time series prediction, the researchers used a combination of convolutional neural networks (CNN) and long short-term memory networks (LSTM). CNN is used to capture the spatial dependencies between sensors, while LSTM is used to capture the temporal dependencies of the data collected by the sensors. However, CNN is not suitable when dealing with topological structures. Summary of the invention
[0004] The purpose of the present invention is to provide a method for predicting thermal deformation of a machine tool spindle based on a GCN-Transformer model. The model is a spatiotemporal prediction method. The Transformer model is used to capture temporal features, and GCN is used to capture spatial features in the sensor topological space. This can not only accurately capture the temporal features of thermal errors, but also make full use of the spatial information of the sensor, making the prediction results more accurate and robust.
[0005] In order to achieve the above objectives, the technical solution adopted by the present invention is: a method for predicting thermal deformation of a machine tool spindle based on a GCN-Transformer model, comprising the following steps:
[0006] Step 1: Build a sensor network for machine tools;
[0007] Step 2: Generate a spatiotemporal graph dataset based on the three-dimensional model of the machine tool, and the spatial characteristics of the sensor network are characterized by the adjacency matrix;
[0008] Step 3: Build a GCN-Transformer model, which includes an input layer, a one-dimensional convolution component, a multi-head self-attention mechanism, a feedforward neural network layer, an addition and normalization layer, and an output layer;
[0009] Step 4: Prediction, extract spatial features through GCN, extract temporal features through Transformer, adjacency matrix, and sensor data as input for thermal error.
[0010] Preferably, a machine tool sensor network is described by a graph, denoted as G = (V, E), where V is a set of N sensor nodes, and E is a set of physical connections between nodes; the neighborhood relationship between physical connections is represented by an adjacency matrix A. If the i-th sensor and the j-th sensor are connected, A i,j =0, otherwise 0;
[0011] The set of node features in a sequence is represented as For each element X t It can be expressed as a feature tensor X t ∈R N×C ,in It is represented as the C-dimensional feature vector of node i at time t in the entire T frame; therefore, the neighborhood connection relationship between sensors is described in structure using the connection matrix A, and in terms of the characteristics of the node elements, X is used to describe;
[0012] On the sensor network input defined by the feature X and the graph structure A, the layer-by-layer update rule of GCN is transformed on the features at time t, as shown in the formula:
[0013]
[0014] in, is a sensor diagram with self-loops added for consistency, is a matrix The degree matrix of σ(·) is the activation function. It can be interpreted as the approximate spatial average feature aggregation of the direct neighborhood, which is then transformed by the activated linear layer. Represents the learnable weight matrix of the lth layer of the network.
[0015] Preferably, the GCN-Transformer model embeds the input layer in time series and encodes the cutting position. The thermal error position encoding adopts absolute coordinate encoding. The position encoding corresponding to the thermal error time step [i∈[1,t]] is (i-1)∈[0,t-1]. At the same time, the main function of normalization is to normalize the features of each layer; the data is fed into the activation function to convert it into data with mean 1 and variance 0 to avoid the data falling into the saturation area of the activation function and reduce the problem of gradient disappearance. The normalization method selected in the model is the layer normal, which is as follows:
[0016]
[0017] Where E(x) represents the average value, represents the variance, ε is a very small amount to prevent the denominator from being zero; α and β are two trainable parameters.
[0018] Preferably, a one-dimensional convolution component is integrated at the input end of the GCN-Transformer model, and the query and key vectors are generated through this mechanism; in specific implementation, by embedding a one-dimensional convolution kernel (1×k), the model converts the feature vector of the input data into a query and a key.
[0019] Preferably, in multi-head attention, the calculation formula for the scaled dot product of the output vector of the self-attention mechanism can be defined as follows:
[0020]
[0021] Among them, Q represents the query matrix, and its dimension is K represents the key matrix, with dimension V represents the value matrix, with dimension N and M represent the length of query and key respectively, D k and D v Represent the dimensions of keys and values respectively;
[0022] In the multi-head attention mechanism, different head groups of Q, K and V are calculated separately to reduce the dot product attention, and then the final output is obtained through matrix concatenation and linear transformation. Each group of matrices has different thermal error features to pay attention to. Feature extraction and representation are achieved through multiple attention processing. The multi-head attention mechanism can be expressed as:
[0023] MultiHeadAttention(Q,K,V)=Concat(Head1,Head2,…,Head H-1 ,Head H )W O
[0024] Head n The definition is as follows:
[0025]
[0026] Preferably, the feedforward neural network layer is a point-by-point feedforward network, and its calculation formula is defined as follows:
[0027]
[0028] in, represents the output of the previous feed-forward neural network (FFN) layer, The ReLU transformation function represents the modified linear activation function. As shown in the formula, the ReLU transformation function is a nonlinear function that allows learning complex relationships in data. In the Transformer layer module, the Add&Norm layer consists of two parts: Add and Norm. Add means that the residual connection allows the network to focus only on the current difference to prevent network degradation. Norm means Layer Normalization, which normalizes the network. The activation value of each layer speeds up the convergence speed. The residual connection module can be defined as follows:
[0029]
[0030]
[0031] Among them, self Attention(X) represents the self-attention processing, and LayerNorm(·) represents the layer normal processing, which is a method of normalizing data. It calculates the mean and variance of each sample i. Its calculation formula is shown as follows:
[0032]
[0033] Preferably, the regression loss function is selected as the basis for error measurement, and the Adam optimization algorithm is used to optimize the loss function.
[0034] The formula for Adam optimization is as follows:
[0035]
[0036] m t =β1m t-1 +(1-β1)g t
[0037]
[0038]
[0039] Where t represents the number of update steps, θ represents the continuously updated parameters, f(θ) represents the loss function, and g t represents the gradient obtained from the derivative of the loss function, m t Yes t The first moment of v t Yes t The second-order original moment, β1 represents the attenuation coefficient of the first-order moment, and β2 represents the second-order original moment. 1. Comprehensive consideration of spatiotemporal features: A new GCN-Transformer model is proposed. Compared with other traditional sequence processing algorithms, such as RNN or LSTM, it shows significant advantages. The multi-head attention mechanism is especially used in tasks with spatiotemporal complexity such as processing machine tool temperature data. Transformer can simultaneously focus on all time points in the sequence and directly evaluate the dependencies between the various parts. Transformer can process multiple time points in the sequence at the same time, significantly speeding up data processing.
[0040] 2. Construction and use of time-space graph: By rationally arranging temperature sensors, a multi-sensor network is constructed to ensure that the thermal field data of the machine tool is fully acquired. The adjacency matrix is used to reflect the relative spatial information between sensors, thereby achieving accurate modeling of the time-space characteristics of thermal errors.
[0041] 3. Application of GCN model in sensor network topology: The GCN model can effectively process the topology of the sensor network and fully explore the spatial dependencies between sensors. This end-to-end model constructs a graph model of all temperature sensors, comprehensively considers the interactions between multiple sensors, effectively integrates the temperature characteristics of different spatial locations, and avoids the tedious process of screening temperature sensitive points.
[0042] Attenuation coefficient, represents the first moment of the bias correction, represents the second-order raw moment of bias correction, and α represents the learning rate.
[0043] 1. Comprehensive consideration of spatiotemporal features: A new GCN-Transformer model is proposed, which shows significant advantages over other traditional sequence processing algorithms, such as RNN or LSTM. The multi-head attention mechanism can focus on all time points in the sequence at the same time, and directly evaluate the dependencies between each part, especially in processing tasks with spatiotemporal complexity such as machine tool temperature data. Transformer can process multiple time points in the sequence at the same time, significantly speeding up data processing.
[0044] 2. Construction and use of space-time graph: By rationally arranging temperature sensors, a multi-sensor network is constructed to ensure that the thermal field data of the machine tool is fully acquired. The adjacency matrix is used to reflect the relative spatial information between sensors, thereby achieving accurate modeling of the space-time characteristics of thermal errors.
[0045] 3. Application of GCN model in sensor network topology: The GCN model can effectively process the topology of the sensor network and fully explore the spatial dependencies between sensors. This end-to-end model constructs a graph model of all temperature sensors, comprehensively considers the interactions between multiple sensors, effectively integrates the temperature characteristics of different spatial locations, and avoids the tedious process of screening temperature sensitive points. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 Schematic diagram of thermal deformation process.
[0047] Figure 2 This is a diagram of the graph convolutional layer neural network architecture.
[0048] Figure 3 This is the sensor network architecture diagram for drilling machine tools.
[0049] Figure 4 This is the Transformer architecture diagram.
[0050] Figure 5 A schematic diagram of the adjacency matrix.
[0051] Figure 6 This is a diagram of the temperature sensor installation location.
[0052] Figure 7 This is a diagram of the spatiotemporal prediction framework for thermal errors. DETAILED DESCRIPTION
[0053] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings. The description in this part is only exemplary and explanatory and should not have any limiting effect on the protection scope of the present invention.
[0054] 1. Temporal and spatial behavior
[0055] The machine tool spindle is simplified into a one-dimensional slender axis, such as Figure 1 As shown, the left end of the spindle is free and the right end is fixed and heated by a constant heat flow.
[0056] The thermal differential equation for the one-dimensional principal axis is:
[0057]
[0058] Where c represents specific heat capacity, ρ represents density, and k represents thermal conductivity; is the Laplace operator; t is the time; l is the length of the axis.
[0059] The initial conditions for the thermal differential equation are as follows:
[0060] T(x,0)=T t #(2)
[0061] Where T t represents the ambient temperature. For convenience, the origin of the coordinate system is set at the free end, so the boundary condition is
[0062] T(0,t)=0#(3)
[0063]
[0064] where h is a positive constant. Then the temperature T is discretized as
[0065] T(x,t)=X(x)T ime (t)#(5)
[0066] Substituting (5) into (1),
[0067]
[0068] Equation (6) is reasonable only when it is equal to a constant.
[0069]
[0070] Afterwards
[0071]
[0072] According to the initial condition equation (2), then T = T t e -wt . According to the characteristic equation of X, the solution is According to the boundary condition equation (3), then A = 0. Then, according to the boundary condition equation (4), we get: To avoid the general solution, we get the equation:
[0073] If then: This equation has infinitely many solutions and satisfies (k - 1 / 2)π < v k < k. Then we get: k = 1, 2,.... Therefore, the particular solution is:
[0074]
[0075] where B k is a constant
[0076] So the thermal deformation is:
[0077]
[0078] Equation (10) is not conducive to directly solving the thermal error, and it shows that the spatio-temporal behavior of the thermal error data is of great significance for guiding the selection of empirical models.
[0079] To further understand the spatio-temporal characteristics of the thermal error, the heat conduction model is discretized into n nodes. The mathematical expression of heat conduction is as follows:
[0080]
[0081] where, T = [T1, T2, T3, …, T n T Denotes the Laplace matrix, and L = DA, where A denotes the adjacency matrix and D denotes the degree matrix. Obviously, equation (11) is similar to equation (1). In the following sections, GCN uses the Laplace matrix to extract spatial features. The Laplace matrix used in the feature extraction process is consistent with that in the heat conduction process. The heat diffusion law is consistent with the diffusion feature law in GCN. Therefore, GCN can describe the characteristics of heat conduction in space and is used to extract the spatial characteristics of thermal errors. In addition, Transformer can mine temporal features. Therefore, the proposed GCN-Transformer can capture the spatiotemporal characteristics of thermal errors.
[0082] 2. Modeling based on GCN-Transformer
[0083] 2.1 Introduction to graph network
[0084] In the prediction of thermal errors of machine tool spindles, the machine tool sensor network can be regarded as a series of static states arranged in order in the time dimension. There are two kinds of relationships in the space-time graph, one is the spatial relationship formed by the physical connection of sensors, and the other is the temporal relationship formed by the same sensor in different time frames. A machine tool sensor network is described by a graph, which can be recorded as G = (V, E), where V is a set of N sensor nodes and E represents the set of physical connections between nodes. In order to record the neighborhood relationship between these physical connections, an adjacency matrix A is used to represent it. If the i-th sensor and the j-th sensor are connected, A i,j =0, otherwise it is 0.
[0085] Furthermore, the set of node features in a sequence is represented as For each element X t It can be expressed as a feature tensor X t ∈R N×C ,in It is represented as the C-dimensional feature vector of node i at time t in the entire T frame. Therefore, the neighborhood connection relationship between sensors is described in structure using the connection matrix A and in the characteristics of the node elements using X.
[0086] On the sensor network input defined by the feature X and the graph structure A, the layer-by-layer update rule of GCN can be transformed on the features at time t, as shown in the formula:
[0087]
[0088] in, is a sensor diagram with self-loops added for consistency, is a matrix The degree matrix of σ(·) is the activation function. It can be interpreted as an approximate spatial average feature aggregation of the direct neighborhood, which is then transformed by an activated linear layer. Represents the learnable weight matrix of the lth layer of the network.
[0089] GCN shows significant advantages in processing graph-structured data. It aggregates neighbor node information and performs feature transformation through graph convolution operations in each layer, thereby capturing spatial dependencies in sensor networks. This mechanism allows the model to effectively extract the spatiotemporal features of sensors and significantly improve the accuracy of thermal error prediction. The workflow of the graph convolutional network (GCN) is detailed in Figure 2 The deep conversion process from raw graph data to advanced feature representation reflects its powerful data processing capabilities. The input of GCN is a graph structure containing nodes and edges, and each node is accompanied by a feature vector. These vectors constitute the input feature matrix X t The data flow passes through multiple graph convolutional layers, each of which aggregates the neighbor features of nodes through specific adjacency relationships. This process is achieved through convolution operations defined on the graph, effectively capturing the local structural information between nodes and their neighbors. The aggregated features pass through a linear transformation layer, which uses a learnable weight matrix to perform weighted combinations of features and capture the interactions between different feature dimensions. Next, a nonlinear activation function is applied to the transformed features, introducing nonlinear factors to enhance the expressiveness of the model.
[0090] The weight matrix in GCN is learned through optimization algorithms such as back propagation and gradient descent during the training process. It not only defines the rules of feature transformation, but also implicitly encodes the structural information of the graph, enabling GCN to recognize complex patterns in graph data. As data is transmitted layer by layer and features are transformed layer by layer, GCN gradually extracts more abstract and advanced feature representations. The final output feature matrix X t+1 It contains rich node feature information, which is extremely valuable when performing tasks such as node classification, graph classification, or link prediction.
[0091] 2.2 Transformer and Multi-Head Attention
[0092] In this study, we selected the Transformer model as the core framework for extracting the time series features of the spindle thermal error. This model is known for its excellent forward propagation efficiency, simplified structural design, and efficient feature extraction capabilities, especially when processing sequence data tasks such as natural language, it has shown excellent performance
[17] . The Transformer architecture integrates complex information through multi-level stacked encoder modules, each of which contains: a LayerNormalization layer for stabilizing the training process, a multi-head attention mechanism (Multi-Head Attention) layer to capture the dependencies between elements in the sequence, and an MLP (Multi-Layer Perceptron) block consisting of a fully connected layer, a dropout layer, and a nonlinear activation function to further refine the time series features. Figure 4 The construction details of this encoder assembly are shown in detail.
[0093] The architecture of the proposed Transformer model is as follows Figure 4 As shown in the figure. The model architecture consists of multiple parts, including input layer, one-dimensional time series convolution processing component, multi-head self-attention mechanism, feedforward neural network layer, addition and normalization layer, and output layer. For the prediction of thermal deformation of machine tool spindle, the thermal deformation of machine tool spindle can be accurately predicted.
[0094] 2.2.1 Time Series Embedding and Cut Position Encoding
[0095] In order to capture the sequential sequence, the Transformer model needs to add a position embedding component. For the thermal error time series data, the Transformer's position encoding method is improved to adapt to the thermal error signal. Different from the common position encoding method of Transformer, the thermal error position encoding uses absolute coordinate encoding. The position encoding corresponding to the thermal error time step [i∈[1,t]] is (i-1)∈[0,t-1]. At the same time, the main function of normalization is to normalize the features of each layer. Feed the data into the activation function and convert it into data with a mean of 1 and a variance of 0. It can prevent the data from falling into the saturation region of the activation function and reduce the problem of gradient vanishing. The normalization method selected in the model is the layer normal. The form is as follows:
[0096]
[0097] Where E(x) represents the average value, represents the variance. ε is a very small amount to prevent the denominator from being zero. α and β are two trainable parameters.
[0098] 2.2.2 Causal Convolution and Multi-Head Attention
[0099] In the field of precision machining of machine tools, the thermal deformation phenomenon of the spindle significantly shows a cumulative effect in the time series, and its deformation is closely related to the historical temperature change data in the past, reflecting a strong time series correlation. Specifically, the temperature changes in the previous stages have a direct and continuous impact on the subsequent thermal deformation state of the spindle, and this impact follows the causal logic in time. In view of this sequential characteristic of thermal deformation, the current thermal deformation state can be regarded as the result of the cumulative effect of the past state, reflecting a clear causal relationship.
[0100] In the toolbox of time series analysis, one-dimensional causal convolution is an effective means. Its characteristic is that the output at the current moment strictly depends on the information in the past. This property is highly consistent with the time series characteristics of the thermal deformation of the spindle. The GCN-Transformer model proposed in this paper innovatively integrates a one-dimensional convolution component at its input, aiming to more accurately capture the change trajectory from the past time point to the current time point through the query and key vectors generated by this mechanism, and thus deeply understand the contextual dependencies in the thermal deformation process.
[0101] In terms of specific implementation, by embedding a one-dimensional convolution kernel (1×k), the model converts the feature vector of the input data into a query and a key. This process not only strengthens the model's ability to capture key contextual information in the thermal deformation time series, but also enables the model to learn and use these contextual dependencies for prediction and inference. This ensures the consistency of the time sequence and effectively avoids the Transformer layer from repeatedly learning short-term contextual dependencies, thereby improving the efficiency and accuracy of the model.
[0102] It is worth noting that the application of this method does not impose strict hard constraints on the model, but rather adapts to the characteristics of machine tool processing time series data in a more flexible form of soft physical constraints. In the multi-head attention mechanism, the output vector of the self-attention layer is calculated according to the scaled dot product attention calculation formula. This design further enhances the model's expressiveness and generalization ability when processing complex time series data.
[0103] In multi-head attention, the calculation formula for the scaled dot product of the output vector of the self-attention mechanism can be defined as follows:
[0104]
[0105] Among them, Q represents the query matrix, and its dimension is K represents the key matrix, with dimension V represents the value matrix, with dimension N and M represent the length of query and key respectively, D k and D v Represents the dimensions of keys and values respectively.
[0106] In the multi-head attention mechanism, different head groups of Q, K, and V are calculated separately to reduce the dot product attention. Then the final output is obtained by matrix concatenation and linear transformation. Each group of matrices has different thermal error features to pay attention to. Feature extraction and representation can be achieved through multi-attention processing. Then the multi-head attention mechanism can be expressed as:
[0107] MultiHeadAttention(Q,K,V)=Concat(Head1,Head2,…,Head H-1 ,Head H )W O #(16)
[0108] nHead n The definition is as follows:
[0109]
[0110] 2.2.3 Feedforward and Residual Modules
[0111] The calculation formula of the point-by-point feedforward network can be defined as follows
[0112]
[0113] in, Represents the output of the previous feed-forward neural network (FFN) layer. The ReLU transformation function represents the rectified linear activation function, as shown in the formula. The ReLU transformation function is a nonlinear function that allows learning complex relationships in the data. Figure 4 In the Transformer layer module, the Add&Norm layer consists of two parts: Add and Norm, where Add means that the residual connection allows the network to focus only on the current difference to prevent network degradation, and Norm means Layer Normalization, which normalizes the network. The activation value of each layer speeds up the convergence speed. The residual connection module can be defined as follows:
[0114]
[0115]
[0116] Among them, self Attention(X) represents the self-attention processing, and LayerNorm(·) represents the layer normal processing, which is a method of normalizing data. It calculates the mean and variance of each sample i. Its calculation formula is shown as follows:
[0117]
[0118] 2.2.4 Optimization
[0119] In the field of deep learning, the loss function plays a vital role. It quantifies the difference between the predicted output of the training sample and the true label value, thereby evaluating the degree of deviation of the model's prediction performance. The core goal of the optimization process is to reduce this training error to improve the prediction accuracy of the model. Given that the thermal error prediction task focuses on the prediction of continuous variables, this paper carefully selects the regression loss function as the benchmark for error measurement to more accurately reflect the deviation between the predicted value and the true value. To minimize the loss function, this paper uses the Adam optimization algorithm, which is widely praised in the field of deep learning optimization for its efficiency and adaptability. The Adam algorithm dynamically adjusts the learning rate of each parameter by combining the first-order moment estimation and the second-order moment estimation, thereby accelerating the convergence process and reducing oscillation. It embodies the intelligent integration and utilization of gradient information and provides a solid mathematical foundation for the optimization process.
[0120] The main formula of Adam optimization is as follows:
[0121]
[0122] m t =β1m t-1 +(1-β1)g t #(twenty two
[0123]
[0124]
[0125] Where t represents the number of update steps, θ represents the continuously updated parameters, f(θ) represents the loss function, and g t represents the gradient obtained from the derivative of the loss function, m t Yes t The first moment of v t Yes t The second-order original moment, β1 represents the attenuation coefficient of the first-order moment, β2 represents the attenuation coefficient of the second-order original moment, represents the first moment of the bias correction, represents the second-order raw moment of bias correction, and α represents the learning rate.
[0126] Based on the above discussion, the GCN-Transformer modeling process of this application is as follows:
[0127] Thermal error spatiotemporal prediction framework Figure 7 As shown in the figure, it is divided into four steps: sensor network construction, spatiotemporal graph dataset generation, GCN-Transformer model construction, and thermal error prediction.
[0128] 1. Construct a sensor network for drilling and tapping machines: Drawing on the experience of experts, we constructed a sensor network that integrates six temperature measurement points and one displacement measurement point to ensure the comprehensiveness and accuracy of monitoring. The temperature sensors are arranged under the screw (T1), the spindle (T2), above the screw (T3), the middle of the column (T4), the base (T5) and the environment (T6) according to the main heat source, effectively capturing the temperature changes during the operation of the drilling and tapping machine. The real-time data of these measurement points fully reflects the temperature status of the key parts of the machine tool, supporting the in-depth analysis of the relationship between temperature and thermal error. At the same time, the displacement sensor is used to monitor the accuracy of the machine tool, and the intrinsic relationship between temperature and displacement changes is explored through the spatiotemporal prediction model, which provides a basis for improving the processing accuracy and stability of the drilling and tapping machine. The sensor network and its analysis method in this study provide strong support for subsequent error compensation and performance optimization.
[0129] 2. Generation of spatiotemporal graph dataset of the 3D model of drilling and tapping machine: Marking sensor nodes. According to the assumption of spatiotemporal graph, predicting the thermal error of the current node requires two conditions, namely (1) the historical thermal error signal of the measurement point and (2) the position and historical signal of the adjacent sensors. Figure 3 It is a schematic diagram reflecting the distance. The spatial characteristics of the sensor network are characterized by the adjacency matrix. The thermal conductivity of different parts of the heat conduction channel is different along the material direction. Therefore, the adjacency matrix should be weighted according to the thermal conductivity. In order to simplify the model, only the straight-line distance in the material direction is considered, and the adjacency matrix is calculated:
[0130]
[0131] where w i,j represents the edge weight, which is related to the position of node i and node j; δ represents the control w i,j The threshold of the distribution; d i,j represents the distance between node i and node j, which is measured on the 3D model of the machine tool spindle, as shown in Table 1. δ uses the mean μ and standard deviation σ:
[0132] δ=μ+kσ#(14)
[0133] k is an adjustment parameter, and the cross-validation method is used to evaluate the performance of the model under different k values. The adjacency matrix can be obtained from the three-dimensional structure diagram of the sensor network and the equation. When discussing the optimization strategy of the thermal error model, it is not a necessary step to introduce a clustering algorithm to reduce the critical temperature set. This paper innovatively proposes a method to map these key temperature points into the form of an adjacency matrix, which is then fed as input to the GCN-Transformer model. This processing method effectively avoids the potential limitations of traditional clustering methods in temperature feature selection and directly utilizes the powerful representation ability of graph structure data. Table 1 shows the distance between nodes. The thermal error measured by the displacement sensor is significantly affected by the physical distance between the heat source and it. The closer the distance, the more significant the interference effect of the heat source on the displacement sensor. This finding is achieved through Figure 5 The adjacency matrix diagram of the model is intuitively displayed, which further verifies the effectiveness and rationality of using the GCN module to replace the traditional clustering process. The introduction of GCN not only simplifies the complexity of model preprocessing, but also enhances the model's ability to capture complex spatial relationships, especially when processing data such as temperature fields that naturally have graph structure characteristics, showing unique advantages.
[0134] 3. Hardware and software conditions involved in building the GCN-Transformer model: The training efficiency of the model depends on the hardware and software environment used. This study uses Windows 11 as the operating system, and the computing resources are the 14th generation Intel Core i7 processor and 16GB of memory. The model development is carried out in the Python language environment, using PyCharm Community Edition 2020.2.5 as the development tool, and Anaconda is used to manage software packages. In addition, the Pytorch framework is used for the development and implementation of the machine learning model to optimize the model building and iteration process.
[0135] 4. Prediction sequence: GCN is used to extract spatial features, Transformer is used to extract temporal features, and the adjacency matrix and sensor data are used as input to predict thermal error conditions. The prediction results will be described in Chapter 5.
[0136] Table 1. Distance between nodes (unit: m)
[0137]
[0138] It should be noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or apparatus.
[0139] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the methods and core ideas of the present invention. The above is only a preferred implementation of the present invention. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the protection scope of the present invention.
Claims
1. A method for predicting thermal deformation of a machine tool spindle based on the GCN-Transformer model, characterized in that: The steps include: Step 1: Build a sensor network for machine tools; Step 2: Generate a spatiotemporal graph dataset based on the three-dimensional model of the machine tool, and the spatial characteristics of the sensor network are characterized by the adjacency matrix; Step 3: Build a GCN-Transformer model, which includes an input layer, a one-dimensional convolution component, a multi-head self-attention mechanism, a feedforward neural network layer, an addition and normalization layer, and an output layer; Step 4: Prediction, extract spatial features through GCN, extract temporal features through Transformer, adjacency matrix, and sensor data as input for thermal error.
2. The method for predicting thermal deformation of a machine tool spindle based on the GCN-Transformer model according to claim 1 is characterized in that: A machine tool sensor network is described by a graph, denoted as G = (V, E), where V is a set of N sensor nodes and E is a set of physical connections between nodes. The neighborhood relationship between physical connections is represented by an adjacency matrix A. If the i-th sensor and the j-th sensor are connected, A i,j =0, otherwise 0; The set of node features in a sequence is represented as For each element X t It can be expressed as a feature tensor X t ∈R N×C ,in It is represented as the C-dimensional feature vector of node i at time t in the entire T frame; therefore, the neighborhood connection relationship between sensors is described in structure using the connection matrix A, and in terms of the characteristics of the node elements, X is used to describe; On the sensor network input defined by the feature X and the graph structure A, the layer-by-layer update rule of GCN is transformed on the features at time t, as shown in the formula: in, is a sensor diagram with self-loops added for consistency, is a matrix The degree matrix of σ(·) is the activation function. It can be interpreted as the approximate spatial average feature aggregation of the direct neighborhood, which is then transformed by the activated linear layer. Represents the learnable weight matrix of the lth layer of the network.
3. The method for predicting thermal deformation of a machine tool spindle based on the GCN-Transformer model according to claim 2 is characterized in that: The GCN-Transformer model embeds the input layer in time series and encodes the cutting position. The thermal error position encoding uses absolute coordinate encoding. The position encoding corresponding to the thermal error time step [i∈[1,t]] is (i-1)∈[0,t-1]. At the same time, the main function of normalization is to normalize the features of each layer; feed the data into the activation function and convert it into data with mean 1 and variance 0 to avoid the data falling into the saturation area of the activation function and reduce the problem of gradient disappearance. The normalization method selected in the model is the layer normal, which is as follows: Where E(x) represents the average value, represents the variance, ε is a very small amount to prevent the denominator from being zero; α and β are two trainable parameters.
4. The method for predicting thermal deformation of a machine tool spindle based on a GCN-Transformer model according to claim 3 is characterized in that: A one-dimensional convolution component is integrated at the input of the GCN-Transformer model, and the query and key vectors are generated through this mechanism. In specific implementation, by embedding a one-dimensional convolution kernel (1×k), the model converts the feature vector of the input data into a query and a key.
5. The method for predicting thermal deformation of a machine tool spindle based on a GCN-Transformer model according to claim 4 is characterized in that: In multi-head attention, the calculation formula for the scaled dot product of the output vector of the self-attention mechanism can be defined as follows: Among them, Q represents the query matrix, and its dimension is K represents the key matrix, with dimension V represents the value matrix, with dimension N and M represent the length of query and key respectively, D k and D v Represent the dimensions of keys and values respectively; In the multi-head attention mechanism, different head groups of Q, K and V are calculated separately to reduce the dot product attention, and then the final output is obtained through matrix concatenation and linear transformation. Each group of matrices has different thermal error features to pay attention to. Feature extraction and representation are achieved through multiple attention processing. The multi-head attention mechanism can be expressed as: MultiHeadAttention(Q,K,V)=Concat(Head1,Head2,…,Head H-1 ,Head H )W O Head n The definition is as follows:
6. The method for predicting thermal deformation of a machine tool spindle based on the GCN-Transformer model according to claim 5 is characterized in that: The feedforward neural network layer is a point-by-point feedforward network, and its calculation formula is defined as follows in, represents the output of the previous feed-forward neural network (FFN) layer, The ReLU transformation function represents the modified linear activation function. As shown in the formula, the ReLU transformation function is a nonlinear function that allows learning complex relationships in data. In the Transformer layer module, the Add&Norm layer consists of two parts: Add and Norm. Add means that the residual connection allows the network to focus only on the current difference to prevent network degradation. Norm means Layer Normalization, which normalizes the network. The activation value of each layer speeds up the convergence speed. The residual connection module can be defined as follows: Among them, self Attention(X) represents the self-attention processing, and LayerNorm(·) represents the layer normal processing, which is a method of normalizing data. It calculates the mean and variance of each sample i. Its calculation formula is shown as follows:
7. The method for predicting thermal deformation of a machine tool spindle based on a GCN-Transformer model according to claim 6, characterized in that: The regression loss function was selected as the benchmark for error measurement, and the Adam optimization algorithm was used to optimize the loss function. The formula for Adam optimization is as follows: m t =β1m t-1 +(1-β1)g t Where t represents the number of update steps, θ represents the continuously updated parameters, f(θ) represents the loss function, and g t represents the gradient obtained from the derivative of the loss function, m t Yes t The first moment of v t Yes t The second-order original moment, β1 represents the attenuation coefficient of the first-order moment, β2 represents the attenuation coefficient of the second-order original moment, represents the first moment of the bias correction, represents the second-order raw moment of bias correction, and α represents the learning rate.
Citation Information
Cited By
Textile production quality control method
CN120634381A
Machine tool spindle thermal error prediction method and system based on regional division thermal image
CN120802832A
Intelligent prediction method based on graph neural network and Transform
CN121725939A
Intelligent prediction method based on graph neural network and transformer
CN121725939B