A dynamic compensation model and system for thermal error of CNC machine tool spindle
By adopting a dynamic compensation model of thermal error based on LSTM neural network in CNC machine tools, combining time mode and self-attention mechanism, the thermal error of the spindle of CNC machine tools is predicted and compensated in real time, and the nonlinear characteristic of thermal error caused by spindle rotation motion is solved. , improves the accuracy and stability of the machine tool.
Patent Information
- Application Number
- CN202411449611.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-10-17
AI Technical Summary
Thermal error caused by the spindle rotation of CNC machine tools exhibits strong time-varying nonlinear characteristics, which are difficult to effectively compensate through the existing thermal error model, affecting the accuracy and stability of the machine tool.
Using the thermal error dynamic compensation model based on LSTM neural network, the temperature sequence feature extraction module, the feature extraction module, the feature fusion layer and the full connection layer are combined with the time mode attention and self-attention mechanism. , predict thermal errors in real time and control servo axis movement to achieve thermal error compensation.
It improves the machining accuracy and stability of the machine tool, enhances the generalization ability of the thermal error compensation model, reduces prediction errors, and achieves more efficient thermal error compensation.
Smart Images

Figure CN118963241B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of error compensation of numerically controlled machine tools, and in particular relates to a dynamic compensation model and system for thermal errors of a spindle of a numerically controlled machine tool. Background Art
[0002] CNC machine tools are high-end manufacturing equipment widely used in aviation, aerospace, shipbuilding, new energy vehicles and other industries; their spindle rotation speed is variable, which easily generates a large amount of dynamically changing heat. The spindle rotation motion causes non-uniform temperature fields and thermoelastic deformations in various machine tool components, changes the ideal position between the tool and the workpiece, forms dynamically changing spindle thermal errors, and reduces the accuracy of CNC machine tools.
[0003] Model-based thermal error compensation is a key technology to offset the impact of thermal errors and improve machine tool accuracy and stability. However, due to the variability of spindle rotation conditions, spindle thermal errors exhibit strong time-varying nonlinear characteristics, which poses great challenges to thermal error compensation. At the same time, due to the complexity of the thermal error model, it is difficult to deploy it directly in the machine tool CNC system. Summary of the invention
[0004] The purpose of the present invention is to provide a CNC machine tool spindle thermal error dynamic compensation model and system. The system takes the machine tool spindle thermal error dynamic compensation model as the core, realizes real-time prediction of thermal error compensation value, controls the corresponding servo axis of the machine tool to move in the opposite direction of the error, and realizes thermal error compensation.
[0005] To achieve the above object, the present invention adopts the following technical solution:
[0006] A CNC machine tool spindle thermal error dynamic compensation model, comprising a temperature sequence feature extraction module, a temperature feature extraction module in a historical time window, a temperature feature extraction module in a global time window, a feature fusion layer, a fully connected layer and a thermal error output layer;
[0007] The temperature sequence feature extraction module is used to extract the temperature hidden state features at the current moment , a two-layer LSTM neural network is used to construct the temperature series feature extraction module;
[0008] The temperature feature extraction module in the historical time window is used to extract the temperature hidden state features in the historical time window. , which includes a one-dimensional horizontal convolution layer, a temporal pattern attention layer, and a historical feature swish nonlinear activation layer connected in sequence;
[0009] The temperature feature extraction module in the global time window is used to extract the temperature hidden state feature in the global time window. , which includes a one-dimensional longitudinal convolution layer, a self-attention layer, and a global feature swish nonlinear activation layer connected in sequence;
[0010] The feature fusion layer uses a learnable parameter matrix to hide the temperature state features at the current moment. , Hidden state characteristics of temperature in historical time window and the temperature hidden state features in the global time window to integrate;
[0011] The fully connected layer is used to integrate the features output by the feature fusion layer;
[0012] The thermal error output layer is used to calculate the thermal error of the machine tool according to the features integrated by the fully connected layer.
[0013] Furthermore, the activation functions in the forget gate, input gate, and output gate of the LSTM neural network are Using hard-sigmoid activation function,
[0014] Activation Function ;
[0015] Activation functions for candidate cell states and hidden states Using LeakyRelu activation function,
[0016] Activation Function ; It is the input value of LSTM neural network.
[0017] Furthermore, the one-dimensional lateral convolution layer has Convolution kernel , , convolution kernel The length is equal to the length of the historical time window.
[0018] Furthermore, the temporal pattern attention layer uses a sigmoid function to calculate the attention weight.
[0019] Furthermore, the one-dimensional longitudinal convolution layer has Convolution kernel , , convolution kernel The length is equal to the number of hidden units in the second layer of LSTM neural network in the temperature series feature extraction module.
[0020] Furthermore, the self-attention layer uses a softmax function to calculate the attention weight.
[0021] Furthermore, the fully connected layer includes two layers.
[0022] The thermal error dynamic compensation model TEDCM constructed in the present invention is based on LSTM with a new activation function, introduces temporal pattern attention and self-attention mechanisms, can dynamically extract temperature features, enhance the generalization ability of the thermal error compensation model, and provide core technical support for improving the machining accuracy of machine tools.
[0023] The present invention provides a CNC machine tool spindle thermal error dynamic compensation system, comprising a thermal error dynamic compensation model, a temperature acquisition unit, a data transmission module and a cloud server; the thermal error dynamic compensation model TEDCM is deployed in the cloud server;
[0024] The temperature acquisition unit is used to collect temperature signals of key points of the CNC machine tool, including temperature sensors respectively arranged at the front bearing of the machine tool spindle, the rear of the spindle box, the center of the top of the column, the center of the bottom of the column, and the outside of the machine tool, and a temperature signal acquisition card connected to the temperature sensor;
[0025] The data transmission module is connected to the temperature signal acquisition card and the cloud server to transmit the temperature signal to the cloud server; the thermal error dynamic compensation model in the cloud server predicts the thermal error compensation value based on the temperature signal, and the thermal error compensation value is then transmitted to the CNC system of the machine tool by the data transmission module; the CNC system controls the corresponding servo axis to move in the opposite direction of the error to achieve thermal error compensation.
[0026] Furthermore, the temperature sensor adopts a high-precision magnetic pt100 platinum resistance temperature sensor.
[0027] Furthermore, the data transmission module adopts an industrial intelligent gateway.
[0028] The present invention deploys the established machine tool spindle thermal error dynamic compensation model TEDCM in the cloud server, establishes communication with the machine tool CNC system and the temperature signal acquisition card through the industrial intelligent gateway, and realizes intelligent machine tool error compensation. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of the dynamic compensation model of thermal error of the machine tool spindle of the present invention.
[0030] Figure 2 It is a schematic diagram of the system structure of the present invention.
[0031] Figure 3 It is a schematic diagram of the prediction results of the present invention and the comparative model.
[0032] Figure 4 Schematic diagram of prediction residuals of the present invention and the comparison model.
[0033] Figure 5 Schematic diagram of MAE and RMSE of the present invention and the comparison model. DETAILED DESCRIPTION
[0034] Embodiment 1:
[0035] This embodiment provides a CNC machine tool spindle thermal error dynamic compensation model TEDCM, which is based on a long short-term memory network LSTM with a new activation function, introduces temporal pattern attention and self-attention mechanisms, can dynamically extract temperature features, and enhance the generalization ability of the thermal error compensation model.
[0036] like Figure 1 As shown, the thermal error dynamic compensation model TEDCM includes a temperature sequence feature extraction module, a temperature feature extraction module in a historical time window, a temperature feature extraction module in a global time window, a feature fusion layer, a fully connected layer and a thermal error output layer.
[0037] The temperature sequence feature extraction module is used to extract the temperature hidden state features at the current moment In this embodiment, the number of hidden units is and The temperature sequence feature extraction module is constructed by a two-layer LSTM neural network. The LSTM neural network controls the flow of information within the sequence through a gate activation function, has memory ability, and can dynamically extract temperature hidden features. The LSTM neural network has an input gate, a forget gate, an output gate, candidate cell states, and a cell state mechanism. The activation function in the forget gate, input gate, and output gate is Designed as a hard-sigmoid activation function, the hard-sigmoid activation function has higher gradient stability and sparsity, can effectively solve the gradient vanishing problem, improve training stability, and generate sparse representation, improve the generalization ability of the model and reduce overfitting;
[0038] Activation Function , It is the input value of LSTM neural network.
[0039] The activation function of the candidate cell state and hidden state in the LSTM neural network Designed as LeakyRelu activation function, the LeakyRelu function can alleviate the gradient vanishing problem, improve computational efficiency, enhance model generalization ability, and improve training stability;
[0040] Activation Function , It is the input value of LSTM neural network.
[0041] The temperature feature extraction module in the historical time window is used to extract the temperature hidden state features in the historical time window. , which consists of a one-dimensional lateral convolution layer, a temporal pattern attention layer, and a historical feature swish nonlinear activation layer connected sequentially.
[0042] The one-dimensional horizontal convolution layer is used to horizontally convolve the hidden state of the historical time window, using the temperature sequence feature extraction module to extract to Temperature hidden state features within the time window to Forming the historical hidden state matrix , , is the number of hidden units in the second layer of LSTM neural network in the temperature series feature extraction module, is the length of the historical time window; construct Convolution kernel One-dimensional horizontal convolution layer, , convolution kernel The length is equal to the length of the historical time window.
[0043] One-dimensional horizontal convolution layer to the historical hidden state matrix Perform convolution to obtain the hidden state convolution result matrix in the historical time window ,
[0044] ,
[0045] In the formula, is the hidden state convolution result matrix in the historical time window The value in row m and column n, is the length of the historical time window, is the historical hidden state matrix The mth row Column value, is the lth parameter of the jth convolution kernel in the one-dimensional horizontal convolution layer.
[0046] The temporal pattern attention layer is used to calculate the hidden state content vector of the historical time window In this embodiment, the similarity scoring function is first used Evaluate the hidden state convolution result matrix in the historical time window and the temperature hidden state features at the current moment The correlation between them is then calculated using the sigmoid function to calculate the attention weight. ; Finally, calculate the hidden state content vector of the historical time window ;in, is the hidden state convolution result matrix in the historical time window The mth row vector in represents the result of different convolution kernels extracting hidden state features within the historical time window; is the parameter matrix; It is the hidden state feature of the temperature at the current moment extracted by the temperature sequence feature extraction module; is the attention weight.
[0047] The historical feature swish nonlinear activation layer is used to nonlinearize the hidden state content vector of the historical time window to obtain the temperature hidden state feature in the historical time window. .
[0048] The temperature feature extraction module in the global time window is used to extract the temperature hidden state feature in the global time window. , which consists of a one-dimensional longitudinal convolution layer, a self-attention layer, and a global feature swish nonlinear activation layer connected sequentially.
[0049] The one-dimensional longitudinal convolution layer is used to longitudinally convolve the hidden states of different time steps; this embodiment uses the temperature sequence feature extraction module to extract to Temperature hidden state features within the time window to Form the full time window hidden state matrix , , is the number of hidden units in the second layer of LSTM neural network in the temperature series feature extraction module, is the length of the historical time window; construct Convolution kernel The one-dimensional vertical convolution layer, , convolution kernel The length is equal to the number of hidden units in the second layer of LSTM neural network in the temperature series feature extraction module.
[0050] One-dimensional vertical convolution layer for the hidden state matrix of the full time window Convolution, get the hidden state convolution result matrix in the full time window ,
[0051] ,
[0052] In the formula, is the hidden state convolution result matrix in the full time window The value of the mth row and nth column; is the hidden state matrix for the full time window The value of the mth row and lth column in is the lth parameter of the jth convolution kernel of the one-dimensional longitudinal convolution.
[0053] The self-attention layer is used to enhance the temperature hidden state features, and extract the last column in the self-attention layer output sequence as the content vector at time t;
[0054] ,
[0055] In the formula, is the query matrix, ; is the key matrix, ; is the value matrix, ; , , is the parameter matrix; is the dimension of the key vector; softmax is the weight calculation function.
[0056] The global feature swish nonlinear activation layer nonlinearizes the content vector at time t to obtain the temperature hidden state feature in the global time window .
[0057] The feature fusion layer uses a learnable parameter matrix , , right , , Perform linear transformation and then add to obtain the fused feature vector ;
[0058] ,
[0059] In the formula, is the fused feature vector, , , is the parameter matrix, It is the hidden state feature of the temperature in the historical time window; is the hidden state feature of temperature in the full time window; It is the hidden state feature of the temperature at the current moment.
[0060] The fully connected layer includes two layers, and integrates the features output by the feature fusion layer using a learnable parameter matrix; , It is the feature vector integrated by the fully connected layer; and They are the weight parameter matrices of the two fully connected layers; and They are the bias matrices of the two fully connected layers respectively; is the fused feature vector.
[0061] The thermal error output layer is used to calculate the thermal error of the tool machine. , is the thermal error at time t; is the output layer weight matrix; It is the feature vector integrated by the fully connected layer; is the weight parameter matrix of the output layer.
[0062] Temperature signals and thermal error data are used to optimize the key hyperparameters based on the ZOA optimization algorithm, and the final optimal hyperparameter machine tool spindle thermal error dynamic compensation model TEDCM is obtained.
[0063] Embodiment 2:
[0064] like Figure 2 As shown, this embodiment provides a CNC machine tool spindle thermal error dynamic compensation system, including a temperature acquisition unit, a data transmission module and a cloud server.
[0065] The temperature acquisition unit is used to collect temperature signals of key points of the CNC machine tool. This embodiment adopts a high-precision magnetic pt100 platinum resistance temperature sensor to collect temperature signals. Temperature sensors are arranged at the front bearing of the machine tool spindle, the rear of the spindle box, the center of the top of the column, the center of the bottom of the column, and the outside of the machine tool. Then, the temperature sensor is connected to the temperature signal acquisition card using a three-wire system to perform analog-to-digital conversion to generate digital temperature signals at multiple key positions.
[0066] The data transmission module is used as a data transmission transfer station. This embodiment is implemented using an industrial intelligent gateway. The temperature signal acquisition card communicates with the industrial intelligent gateway through the TCP / IP protocol, and transmits the digital temperature signal to the industrial intelligent gateway in real time; the industrial intelligent gateway is connected to the cloud server through the MQTT protocol, and transmits the digital temperature signal to the cloud server for storage.
[0067] The cloud server is deployed with the thermal error dynamic compensation model TEDCM described in Example 1, and the digital temperature signal is input into the thermal error dynamic compensation model TEDCM to predict the thermal error compensation value. The thermal error compensation value is transmitted to the industrial intelligent gateway through the MQTT protocol, and then the industrial intelligent gateway transmits the thermal error compensation value to the machine tool CNC system; the CNC system controls the corresponding servo axis to move in the opposite direction of the error to achieve thermal error compensation.
[0068] To verify the effectiveness of this embodiment, under the new working condition, the convolutional neural network CNN, long short-term memory network LSTM, gated recurrent unit neural network GRU, back propagation neural network BPNN, and support vector regression SVR constructed by traditional modeling methods are compared; taking the axial thermal error prediction as an example, the prediction results of each model are as follows Figure 3 As shown in FIG. 1 , the TEDCM proposed in this embodiment has the best prediction effect, and the prediction residual is about ±3 μm. Figure 4 As shown. The mean absolute error MAE and root mean square error RMSE of each model are as follows Figure 5As shown; the results show that the MAE and RMSE of TEDCM are only 1.1μm and 1.4μm, which are 69%, 52%, 58%, 58%, and 78% less average absolute error and 71%, 65%, 66%, 57%, and 80% less root mean square error than CNN, LSTM, GRU, BPNN, and SVR models, respectively. This verifies the effectiveness and superiority of the thermal error dynamic compensation model TEDCM proposed in this embodiment, and provides important technical support for high-precision compensation of thermal errors of CNC machine tools in later industrial sites.
[0069] The above description is only a preferred implementation manner of the present invention, but the protection scope of the present invention is not limited thereto, and any modification and replacement based on the technical solution and inventive concept provided by the present invention should be included in the protection scope of the present invention.
Claims
1. A dynamic compensation model for thermal error of a CNC machine tool spindle, characterized by: It includes a temperature sequence feature extraction module, a temperature feature extraction module in a historical time window, a temperature feature extraction module in a global time window, a feature fusion layer, a fully connected layer, and a thermal error output layer; The temperature sequence feature extraction module is used to extract the temperature hidden state features at the current moment , a two-layer LSTM neural network is used to construct the temperature series feature extraction module; The temperature feature extraction module in the historical time window is used to extract the temperature hidden state features in the historical time window. , which includes a one-dimensional horizontal convolution layer, a temporal pattern attention layer, and a historical feature swish nonlinear activation layer connected in sequence; The temperature feature extraction module in the global time window is used to extract the temperature hidden state feature in the global time window. , which includes a one-dimensional longitudinal convolution layer, a self-attention layer, and a global feature swish nonlinear activation layer connected in sequence; The feature fusion layer uses a learnable parameter matrix to hide the temperature state features at the current moment. , Hidden state characteristics of temperature in historical time window and the temperature hidden state features in the global time window to integrate; The fully connected layer is used to integrate the features output by the feature fusion layer; The thermal error output layer is used to calculate the thermal error of the machine tool according to the features integrated by the fully connected layer; Among them, the thermal error dynamic compensation model predicts the thermal error compensation value according to the temperature signal, and the thermal error compensation value sends the thermal error compensation value to the numerical control system of the machine tool; The CNC system controls the corresponding servo axis to move in the opposite direction of the error to achieve thermal error compensation.
2. The CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The activation functions in the forget gate, input gate, and output gate of the LSTM neural network Using hard-sigmoid activation function, Activation Function ; Activation functions for candidate cell states and hidden states Using LeakyRelu activation function, Activation Function ; in, It is the input value of LSTM neural network.
3. The CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The one-dimensional lateral convolution layer has Convolution kernel , , convolution kernel The length is equal to the length of the historical time window.
4. The CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The temporal pattern attention layer uses a sigmoid function to calculate the attention weights.
5. The CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The one-dimensional longitudinal convolution layer has Convolution kernel , , convolution kernel The length is equal to the number of hidden units in the second layer of LSTM neural network in the temperature series feature extraction module.
6. A CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The self-attention layer uses a softmax function to calculate the attention weight.
7. The CNC machine tool spindle thermal error dynamic compensation model according to claim 1, characterized in that: The fully connected layer includes two layers.
8. A CNC machine tool spindle thermal error dynamic compensation system, comprising a temperature acquisition unit, a data transmission module and a cloud server; characterized in that: The cloud server is deployed with the thermal error dynamic compensation model described in any one of claims 1 to 7; The temperature acquisition unit is used to collect temperature signals of key points of the CNC machine tool, including temperature sensors respectively arranged at the front bearing of the machine tool spindle, the rear of the spindle box, the center of the top of the column, the center of the bottom of the column, and the outside of the machine tool, and a temperature signal acquisition card connected to the temperature sensor; The data transmission module is connected to the temperature signal acquisition card and the cloud server to transmit the temperature signal to the cloud server; the thermal error dynamic compensation model in the cloud server predicts the thermal error compensation value according to the temperature signal, and the thermal error compensation value is then transmitted to the numerical control system of the machine tool by the data transmission module; The CNC system controls the corresponding servo axis to move in the opposite direction of the error to achieve thermal error compensation.
9. A CNC machine tool spindle thermal error dynamic compensation system according to claim 8, characterized in that: The temperature sensor adopts a high-precision magnetic pt100 platinum resistance temperature sensor.
10. The CNC machine tool spindle thermal error dynamic compensation system according to claim 8, characterized in that: The data transmission module adopts an industrial intelligent gateway.
Citation Information
Patent Citations
Numerical control machine tool spindle thermal deformation prediction method and system
CN110039373A
Numerical control machine tool spindle axial thermal error physical modeling method
CN113126566A
Thermal error prediction system and thermal error compensation system based on Mist-edge-fog-cloud computing
CN113156822A
Video prediction method and system based on space-time decoupling and self-attention difference LSTM
CN116524419A
Productivity prediction and production scheduling method and system based on artificial intelligence
CN118114836A
