Machine tool spindle thermal error prediction method and system based on regional division thermal image

By dividing thermal images into regions and combining local attention, channel attention and residual connection, the problem of insufficient utilization of spatial information in the thermal error prediction model of CNC machine tools is solved, higher prediction accuracy and robustness are achieved, and support is provided for real-time thermal error compensation.

CN120802832APending Publication Date: 2025-10-17SHAANXI IND VOCATIONAL & TECH COLLEGE

Patent Information

Application Number
CN202510892025.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the existing technology, the thermal error prediction model of CNC machine tools does not fully utilize the spatial information in thermal images, resulting in poor accuracy and robustness of thermal error prediction and a lack of basis for real-time thermal error compensation.

Method used

A machine tool spindle thermal error prediction method based on region partitioned thermal images is adopted. A region partitioned thermal image model is constructed through thermal image region grid partitioning, local attention, channel attention and residual connection, which effectively utilizes the spatial information in thermal images and improves the prediction accuracy and robustness.

Benefits of technology

The accuracy and robustness of thermal error prediction are improved, which provides a basis for real-time thermal error compensation, reduces the model calculation burden, and enhances the accuracy and stability of thermal error prediction of machine tool spindles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120802832A_ABST
    Figure CN120802832A_ABST
Patent Text Reader

Abstract

The invention discloses a machine tool spindle thermal error prediction method and system based on regional division thermal images, and relates to the technical field of numerical control machine tool thermal error prediction, and the method comprises the following steps: collecting thermal images of a machine tool spindle under different working conditions and corresponding spindle thermal error data, and generating a training set, a verification set and a test set; constructing a region division thermal image model based on thermal image region grid division, local attention, channel attention and residual connection; training and verifying the regional division thermal image model to obtain a machine tool spindle thermal error prediction model; and applying the machine tool spindle thermal error prediction model to actual machine tool spindle thermal error prediction and compensation. According to the thermal error prediction method and device, by combining thermal image area grid division, local attention, channel attention and residual connection, the spatial information in the thermal image is effectively utilized, the accuracy and robustness of thermal error prediction are improved, and a basis is provided for real-time thermal error compensation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of numerical control machine tool thermal error prediction, in particular to a machine tool spindle thermal error prediction method and system based on regionally divided thermal images. BACKGROUND

[0002] In modern manufacturing, the machining accuracy of numerical control machine tools directly affects product quality, and machine tool spindle thermal error is one of the main factors leading to a decline in machining accuracy, accounting for about 40%-70% of total machining error. Traditional thermal error prediction models are mainly based on temperature data measured by thermocouples, and predict by establishing a mathematical relationship between temperature and thermal error. However, thermocouple measurement has problems such as complex measurement point arrangement, reliance on human experience, safety hazards in the acquisition process, and can only obtain temperature information at discrete points, and cannot fully reflect the temperature distribution of the machine tool. With the development of computer image technology, thermal imaging cameras can obtain machine tool global temperature distribution images, providing a new perspective for thermal error modeling. However, when using complete thermal images as model input, there are problems such as unclear image differentiation and excessive redundant information, increasing the model's computational burden, interfering with key information extraction, and affecting prediction accuracy. Therefore, how to effectively use the spatial information in the thermal image to improve the accuracy and robustness of thermal error prediction is a technical problem that needs to be solved in the field.

[0003] In the prior art, Chinese patent CN119670530A discloses a machine tool spindle thermal deformation prediction method based on a GCN-Transformer model, including the following steps: constructing a sensor network for the machine tool; generating a spatio-temporal graph dataset when the three-dimensional model of the machine tool is generated, and the spatial characteristics of the sensor network are represented by an adjacency matrix; constructing 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; extracting spatial features through GCN, extracting time features through Transformer, and using an adjacency matrix and sensor data as input to predict thermal error.

[0004] However, the above prior art does not address or solve the above problems, and the use of spatial information in the thermal image is insufficient, the accuracy and robustness of thermal error prediction are poor, and there is a lack of real-time thermal error compensation basis. SUMMARY

[0005] The present application provides a machine tool spindle thermal error prediction method and system based on regionally divided thermal images to solve the problem of insufficient use of spatial information in thermal images in existing numerical control machine tool thermal error prediction technology, poor accuracy and robustness of thermal error prediction, and lack of real-time thermal error compensation basis.

[0006] On the one hand, the present application provides a method for predicting thermal errors of a machine tool spindle based on a region-divided thermal image, comprising the following steps:

[0007] Step 1: Collect thermal images of the machine tool spindle under different working conditions and the corresponding spindle thermal error data to generate training sets, validation sets, and test sets.

[0008] Step 2: Construct a region division thermal image model based on thermal image region grid division, local attention, channel attention, and residual connection.

[0009] Step three: using the training set and the validation set to train and validate the region division thermal image model, respectively, to obtain a machine tool spindle thermal error prediction model.

[0010] Step 4: Use the test set to test the machine tool spindle thermal error prediction model, and use the machine tool spindle thermal error prediction model for actual machine tool spindle thermal error prediction and compensation.

[0011] In a possible implementation, in step 2, the grid division of the thermal image region includes:

[0012] The original input image is rearranged in blocks to obtain a rearranged feature map.

[0013] A position encoding is added to the rearranged feature map to obtain a position encoding feature map.

[0014] In a possible implementation, in step 2, the block-wise rearrangement of the input image includes:

[0015] The original input image is divided into independent local grid regions.

[0016] The local grid area is rearranged to obtain a rearranged feature map.

[0017] In one possible implementation, in step 2, the local attention includes:

[0018] The position encoding feature map is input into the block convolution module to obtain the feature representation of each position encoding feature map.

[0019] The feature representation is subjected to weighted convolution processing to obtain a region importance weight representation.

[0020] The region importance weight representation is element-wise weighted multiplied with the feature representation to output a spatial local attention feature map.

[0021] In one possible implementation, in step 2, the channel attention includes:

[0022] A compression operation is performed on the feature representation to generate a channel descriptor.

[0023] The channel descriptor is stimulated to obtain a channel weight representation.

[0024] The channel weight representation is element-wise weighted multiplied with the feature representation to output a channel attention feature map.

[0025] In a possible implementation, in step two, the output of the local attention and the output of the channel attention are fused to generate a fused attention feature map.

[0026] In a possible implementation, in step two, the residual connection includes:

[0027] The original input image is residual convolution to obtain a residual convolution feature representation.

[0028] The residual convolution feature representation is block-rearranged in the same way as the thermal image region grid division to obtain a rearranged residual feature representation.

[0029] The rearranged residual feature representation is fused with the fused attention feature map to obtain a residual feature map.

[0030] The residual feature map is restored to the original layout to obtain the output of the region-divided thermal image model, i.e., a thermal error prediction result.

[0031] In a possible implementation, in step three, the training process of the region-divided thermal image model includes:

[0032] Data division, model initialization, definition of loss function and optimizer, optimization of learning rate, and updating of model parameters.

[0033] In a possible implementation, in step four, using the machine tool spindle thermal error prediction model for actual machine tool spindle thermal error prediction and compensation includes:

[0034] The actual thermal image of the machine tool spindle is input into the machine tool spindle thermal error prediction model to output a thermal error prediction result, the thermal error of the machine tool spindle under different working conditions is predicted, and thermal error compensation is performed according to the thermal error prediction result.

[0035] On the other hand, the present application provides a machine tool spindle thermal error compensation system, which uses the above-mentioned machine tool spindle thermal error prediction method based on region-divided thermal image to obtain a thermal error prediction result, and performs thermal error compensation according to the thermal error prediction result.

[0036] The machine tool spindle thermal error compensation system includes a thermal imager, an eddy current sensor, a data acquisition PLC, a computer device, a machine tool numerical control system, a data transmission network cable, a machine tool spindle, and a machine tool workbench.

[0037] The thermal imager is installed in front of the machine tool spindle.

[0038] The eddy current sensor is installed on the machine tool worktable and directly below the machine tool spindle.

[0039] The output end of the eddy current sensor is connected with the data acquisition PLC.

[0040] The computer device is connected with the thermal imager and the data acquisition PLC respectively.

[0041] The computer device is connected with the machine tool numerical control system through the data transmission network cable.

[0042] The computer device is installed with a program running the machine tool spindle thermal error prediction method based on regionally divided thermal images, for constructing, training and verifying the regionally divided thermal image model, obtaining the machine tool spindle thermal error prediction model, processing the thermal error prediction result output by the machine tool spindle thermal error prediction model into real-time compensation value according to the compensation strategy, and sending the real-time compensation value to the machine tool numerical control system.

[0043] The machine tool numerical control system is used to run the machining G code with the real-time compensation value, and to perform thermal error compensation on the machine tool spindle.

[0044] The machine tool spindle thermal error prediction method and system based on regionally divided thermal images in the present application have the following advantages:

[0045] By combining thermal image region grid division, local attention, channel attention and residual connection, the spatial information in the thermal image is effectively utilized, the accuracy and robustness of thermal error prediction are improved, and the basis for real-time thermal error compensation is provided.

[0046] The original input image is divided and rearranged to obtain a rearranged feature map, and position encoding is added to the rearranged feature map to obtain a position encoding feature map, which retains the spatial context information and makes up for the lack of spatial correlation in the traditional block method.

[0047] The position encoding feature map is input into the block convolution module to obtain the feature representation of each position encoding feature map, the feature representation is processed by weight convolution to obtain the region importance weight representation, the region importance weight representation and the feature representation are weighted and multiplied element by element to output the spatial local attention feature map, and the local attention is used to suppress noise.

[0048] The proposed compression operation is performed on the feature representation, a channel descriptor is generated, an excitation operation is performed on the channel descriptor, a channel weight representation is obtained, the channel weight representation is element-wise multiplied with the feature representation, and a channel attention feature map is output. The discriminative features are focused by adjusting the dynamic channel weight.

[0049] The proposed output of local attention and output of channel attention are fused to generate a fusion attention feature map. The feature complementation and synergistic enhancement are realized through additive fusion operation.

[0050] The proposed residual convolution is performed on the original input image to obtain a residual convolution feature representation. The residual convolution feature representation is rearranged by the same block division as the heat image region grid division to obtain a rearranged residual feature representation. The rearranged residual feature representation is fused with the fusion attention feature map to obtain a residual feature map. The effective gradient propagation is ensured while reducing the number of parameters, the degradation problem of the deep network is alleviated, and the representation ability of the model is further enhanced. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application. Those skilled in the art can obtain other drawings according to these drawings without creating any inventive labor.

[0052] Figure 1 The flowchart of the machine tool spindle thermal error prediction method based on region-divided heat image provided by the embodiments of the present application is shown.

[0053] Figure 2 The network structure diagram of the region-divided heat image model provided by the embodiments of the present application is shown.

[0054] Figure 3 The network structure diagram of the region-divided heat image model provided by the embodiments of the present application is shown.

[0055] Figure 4 The network structure diagram of the local attention provided by the embodiments of the present application is shown.

[0056] Figure 5 The network structure diagram of the channel attention provided by the embodiments of the present application is shown.

[0057] Figure 6 The flowchart of the machine tool spindle thermal error prediction model obtained by training and verifying the region-divided heat image model provided by the embodiments of the present application is shown.

[0058] Figure 7A flowchart of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure.

[0059] Figure 8 A structural diagram of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure.

[0060] Figure 9 A field diagram of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure.

[0061] Figure 10 Thermal images of a machine tool at different times provided by the embodiment of the present application are shown in the figure.

[0062] Figure 11 Effect diagrams after 10 rounds of training of different size region division provided by the embodiment of the present application are shown in the figure.

[0063] Figure 12 Root mean square errors of training set and validation set in the training process under the condition of 3000 revolutions per minute provided by the embodiment of the present application are shown in the figure.

[0064] Figure 13 Actual displacement and predicted displacement of the model of the machine tool spindle thermal error under the condition of 3000 revolutions per minute provided by the embodiment of the present application are shown in the figure.

[0065] Explanation of reference signs:

[0066] 1-thermal imager, 2-electric eddy current sensor, 3-data acquisition PLC, 4-computer device, 5-machine tool numerical control system, 6-data transmission network cable, 7-machine tool spindle, 8-machine tool workbench. DETAILED DESCRIPTION

[0067] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0068] As shown in Figure 1 , Figure 2 and Figure 6 , the embodiment of the present application provides a machine tool spindle thermal error prediction method based on region division thermal image, including the following steps:

[0069] Step one, collect thermal images and corresponding spindle thermal error data of the machine tool spindle under different working conditions, and generate training set, validation set and test set.

[0070] Step two, construct a region division thermal image model based on thermal image region grid division, local attention, channel attention and residual connection.

[0071] Step three, respectively using the training set, the validation set, the region division thermal image model is trained, verified, get machine tool spindle thermal error prediction model.

[0072] Step four, using the test set to test the machine tool spindle thermal error prediction model, the machine tool spindle thermal error prediction model is used for actual machine tool spindle thermal error prediction and compensation.

[0073] As Figure 3 shown, exemplarily, in step two, the thermal image region grid division includes:

[0074] The original input image is rearranged to obtain a rearranged feature map.

[0075] The rearranged feature map is added with position coding to obtain a position coding feature map.

[0076] Exemplarily, in step two, the input image is rearranged to obtain a rearranged feature map.

[0077] The original input image is divided into independent local grid regions.

[0078] The local grid region is rearranged to obtain a rearranged feature map.

[0079] Specifically, in this embodiment, the original input image is divided into N=(Hψ) 2 Independent local grid regions with size ψ, as shown in equation (1):

[0080]

[0081] Where X is the original input image; F unfold is the segmentation function; X ψ represents the local grid region after the block operation. Then, the local grid region X ψ after the block operation is rearranged to obtain a rearranged feature map, as shown in equation (2):

[0082]

[0083] In the formula: U ψ is the rearranged feature map.

[0084] The rearranged feature map is added with position coding to obtain a position coding feature map, as shown in equation (3):

[0085]

[0086] In the formula: U posThe position coding feature map is input into a block convolution module to obtain a feature representation of each position coding feature map.

[0087] As shown in Figure 4 illustratively, in step two, the local attention includes:

[0088] The position coding feature map is input into a block convolution module to obtain a feature representation of each position coding feature map.

[0089] The feature representation is subjected to weight convolution processing to obtain a region importance weight representation.

[0090] The region importance weight representation is element-wise weighted multiplied with the feature representation to output a spatial local attention feature map.

[0091] Specifically, in this embodiment, local attention is a key step for modeling detailed features. The local attention can retain only spatial information on the basis of compressing channel information, so as to feature-weight local spatial features within each position coding feature map and effectively extract spatial local information. Specifically as follows:

[0092] Block convolution module: the position coding feature map U pos Input into the block convolution module, so that the model can sufficiently mine detailed information contained in the feature map from more angles. The channel dimension of the feature representation is raised to dim in the calculation process, as shown in equation (4):

[0093]

[0094] In the equation: F C→dim is a convolution layer with an input channel of C and an output channel of dim; BN is a batch normalization layer; GELU represents a Gaussian error function activation function; is a feature representation of each position coding feature map.

[0095] Weight convolution processing: the local attention is directed to the feature representation of each position coding feature map Through two layers of convolution and a nonlinear activation function, the channel of the feature representation is compressed to 1, and then a region importance weight representation is obtained through a Sigmoid gating mechanism, as shown in equation (5):

[0096]

[0097] In the equation: is a convolution layer 1 that reduces the channel from dim to dim / 4 while further modeling the feature representation; GELU is a Gaussian error linear unit (GeLU) activation function; is the channel attention mechanism, and S is the channel weight representation. LA The region importance weight representation S is obtained,

[0098] Local weighted output: the region importance weight representation S is multiplied with the feature representation F element by element to obtain the spatial local attention feature map, as shown in equation (6): LA with the feature representation element by element, and the spatial local attention feature map is output, as shown in equation (6):

[0099]

[0100] In the equation: is the spatial local attention feature map.

[0101] As shown in equation (5), in step two, the channel attention includes: Figure 5

[0102] The feature representation is compressed to generate a channel descriptor.

[0103] The channel descriptor is excited to obtain a channel weight representation.

[0104] The channel weight representation is multiplied with the feature representation element by element to output a channel attention feature map.

[0105] Specifically, in this embodiment, the channel attention mechanism can effectively model the objects represented by different channels in the feature representation, and by explicitly constructing the mutual dependence between channels, the network can adaptively learn the importance of each channel, which can significantly improve the accuracy and robustness of target detection. The operation is as follows:

[0106] Compression operation: the feature representation F is compressed to generate a channel descriptor Z, as shown in equation (7): The channel descriptor Z contains the global feature representation in the spatial dimension ψxψ, which is generated by aggregating features in the spatial dimension through the compression operation, as shown in equation (7):

[0107]

[0108] In the equation: AvgPool represents the adaptive pooling operation; Z represents the channel descriptor,

[0109] Excitation operation: the channel descriptor Z is excited through two fully connected layers and a ReLU function, and the corresponding channel weight representation is obtained through a gating mechanism, as shown in equation (8):

[0110] S SE ​= σ (FC2 (ReLU (FC1 (Z)))) (8)

[0111] wherein FC1 and FC2 represent the first and second full connection operations respectively, r represents the channel compression ratio, FC1 compresses the channel from C to C / r, and FC2 activates the channel from C / r to C; σ represents the Sigmoid gating function; and ReLU represents the rectified linear unit (ReLU) activation function. is the channel weight representation.

[0112] Channel weighted output: the channel weight representation S SE is the feature representation. Element-wise weighted multiplication is performed, and the output channel attention feature map is output, as shown in equation (9):

[0113]

[0114] wherein: is the output channel attention map.

[0115] In step two, the output of the local attention and the output of the channel attention are fused to generate a fused attention feature map.

[0116] Specifically, in this embodiment, the output of the local attention (i.e., the spatial local attention feature map ) and the output of the channel attention (i.e., the channel attention map ) are fused, as shown in equation (10):

[0117]

[0118] wherein: is the fused attention feature map.

[0119] In step two, the residual connection includes:

[0120] The original input image is subjected to residual convolution to obtain a residual convolution feature representation.

[0121] The residual convolution feature representation is subjected to the same block rearrangement as the thermal image region grid division to obtain a rearranged residual feature representation.

[0122] The rearranged residual feature representation is fused with the fused attention feature map to obtain a residual feature map.

[0123] The residual feature map is restored to the original layout to obtain the output of the region division thermal image model, i.e., the thermal error prediction result.

[0124] Specifically, in the present embodiment, in order to introduce the original feature map information, in order to avoid the problem of gradient explosion or gradient attenuation caused by network hierarchy, a residual connection is introduced, and the specific calculation process is as follows:

[0125] Residual convolution: in order to realize channel alignment, a 1x1 convolution layer is constructed to output the original input image X as a feature representation with channel number dim, as shown in equation (11):

[0126]

[0127] In the formula: is a 1x1 convolution layer, which is used to raise the channel of the original input image X to dim to realize channel alignment and complete the residual connection; X res is a residual convolution feature representation,

[0128] Block rearrangement: the residual convolution feature representation X res is subjected to the same block rearrangement operation as the grid division of the thermal image region, that is, the residual convolution feature representation X res is first divided into N=(Hψ) 2 square blocks with size ψ, as shown in equation (12):

[0129]

[0130] In the formula: is the residual convolution feature representation after block operation. Then, U res is rearranged to form a rearranged residual feature representation

[0131] Residual connection: the rearranged residual feature representation is fused with the fused attention feature map to obtain a residual feature map, as shown in equation (13):

[0132]

[0133] In the formula: is a residual feature map,

[0134] Shape recovery: the residual feature map is recovered to the original layout to obtain the output of the region division thermal image model, that is, the thermal error prediction result.

[0135] Exemplarily, in step three, the training process of the region division thermal image model includes:

[0136] data division, initialization of the model, definition of the loss function and the optimizer, optimization of the learning rate, and updating of the model parameters.

[0137] Specifically, in the present embodiment, the time series information of the training set in step one is used to train the region division thermal image model. In the training process of the region division thermal image model, data division, model initialization, loss function definition and optimizer are all adopted in the prior art, the learning rate is optimized by using the cosine annealing algorithm, and the model parameters are updated by back propagation.

[0138] Exemplarily, in step four, the machine tool spindle thermal error prediction model is used for actual machine tool spindle thermal error prediction and compensation, which includes:

[0139] The actual thermal image of the machine tool spindle is input into the machine tool spindle thermal error prediction model, and the thermal error prediction result is output to predict the thermal error of the machine tool spindle under different working conditions, and the thermal error compensation is performed according to the thermal error prediction result.

[0140] Figure 7 A flowchart of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure, Figure 8 A structure diagram of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure, Figure 9 A site diagram of a machine tool spindle thermal error compensation system provided by the embodiment of the present application is shown in the figure, Figure 10 A machine tool thermal image at different time provided by the embodiment of the present application is shown in the figure. The embodiment of the present application also provides a machine tool spindle thermal error compensation system, which adopts the above-mentioned machine tool spindle thermal error prediction method based on region division thermal image to obtain the thermal error prediction result, and performs thermal error compensation according to the thermal error prediction result.

[0141] The machine tool spindle thermal error compensation system includes a thermal imager 1, an eddy current sensor 2, a data acquisition PLC 3, a computer device 4, a machine tool numerical control system 5, a data transmission network cable 6, a machine tool spindle 7, and a machine tool workbench 8.

[0142] The thermal imager 1 is installed in front of the machine tool spindle 7.

[0143] The eddy current sensor 2 is installed on the machine tool workbench 8 and is directly below the machine tool spindle 7.

[0144] The output end of the eddy current sensor 2 is connected with the data acquisition PLC 3.

[0145] The computer device 4 is connected with the thermal imager 1 and the data acquisition PLC 3 respectively.

[0146] The computer device 4 is connected with the machine tool numerical control system 5 through the data transmission network cable 6.

[0147] The computer device 4 is installed with a program running the machine tool spindle thermal error prediction method based on region division thermal image, for constructing, training, and verifying the region division thermal image model, obtaining the machine tool spindle thermal error prediction model, processing the thermal error prediction result output by the machine tool spindle thermal error prediction model into real-time compensation value according to the compensation strategy, and sending the real-time compensation value to the machine tool numerical control system 5.

[0148] The machine tool numerical control system 5 is used for running the machining G code with the real-time compensation value, and performing thermal error compensation on the machine tool spindle 7.

[0149] Specifically, in the embodiment, the machine tool spindle thermal error compensation system acquires the thermal image of the machine tool spindle 7 through the thermal imager 1, acquires the corresponding spindle thermal error data through the eddy current sensor 2, and obtains the real-time thermal error prediction result through the program of the machine tool spindle thermal error prediction method based on region division thermal image installed in the computer device 4. The programmed operation controller 4 and the machine tool numerical control system 5 are connected through the secondary development interface with the data transmission network cable 6, the real-time error compensation value is sent to the corresponding communication register G36 register of the numerical control system through the interface, the machine tool numerical control system 5 will modify the movement instructions of each axis of the machine tool according to the compensation value in the G36 register during the interpolation operation, and has a compensation value speed limit control to ensure the safety of the machine tool, so that the actual movement trajectory of the machine tool is closer to the ideal trajectory, thereby reducing the influence of thermal error on the machining precision. For example, when it is detected that the machine tool spindle 7 produces thermal elongation due to temperature rise, resulting in tool position deviation, the machine tool spindle thermal error compensation system calculates the corresponding real-time compensation value and writes it into the G36 register, and the machine tool numerical control system 5 reads the value and adjusts the spindle movement in the subsequent machining movement, ensuring the accuracy of the machining size.

[0150] In the embodiment, the process of installing the machine tool spindle thermal error compensation system and constructing, training, and verifying the region division thermal image model to obtain the machine tool spindle thermal error prediction model is as follows:

[0151] Start and check the numerical control machine tool equipment, make it in normal state; install the thermal imager 1, the thermal imager 1 is installed in the front of the machine tool main shaft 7 through the adjustable height support, for shooting the thermal image data of the machine tool main shaft 7; install the eddy current sensor 2, the eddy current sensor 2 is installed on the machine tool workbench 9 and is located directly below the machine tool main shaft 7, and the probe is vertically upward, towards the front end face of the machine tool main shaft 7, the distance between the probe of the eddy current sensor 2 and the front end face of the machine tool main shaft 7 is <1mm, for measuring the thermal displacement data of the machine tool main shaft 7, that is, the thermal deformation of the machine tool main shaft 7 in the axial direction of the end face; the output end of the eddy current sensor 2 is connected with the data acquisition PLC 3, the computer equipment 4 is connected with the thermal imager 1 and the data acquisition PLC 3 respectively, and the computer equipment 4 is installed with the program running the machine tool main shaft thermal error prediction method based on the region division thermal image, for constructing, training and verifying the region division thermal image model, to obtain the machine tool main shaft thermal error prediction model; start and adjust the thermal imager 1, the eddy current sensor 2, the data acquisition PLC 3 and the computer equipment 4; set the machine tool running condition parameters and input the machine tool running condition program code, the machine tool main shaft 8 keeps idling state, set the collection mode, collection channel and sampling frequency of the data acquisition PLC 3, and the working mode, sampling frequency and temperature range of the thermal imager 1 in the thermal error test software, as well as the storage location and storage file format of the experimental collected data; in the machine tool running process, the thermal image of the machine tool main shaft 7 is collected by the thermal imager 1 at fixed time intervals, the thermal displacement data of the machine tool main shaft 7 is collected by the eddy current sensor 2 and the data acquisition PLC 3, and is displayed in the program interface of the computer equipment 4; after the data collection is completed, the thermal image of the machine tool main shaft 7 collected at each moment in the machine tool running process and the thermal displacement data of the machine tool main shaft 7 are used to train and update the main shaft thermal error model, the difference between the mapping value and the standard value is calculated through the MSE index, the RMSE index and the MAE index, the weight of each layer is updated, and the training of the overall model is realized. After the training and updating are completed, the machine tool main shaft thermal error prediction model is obtained, and the numerical control machine tool can normally process the workpiece, and the machine tool thermal error is compensated in the process of processing the workpiece. In this process, the eddy current sensor 2 and the data acquisition PLC 3 are not needed.

[0152] In the embodiment, the machine tool main shaft thermal error compensation system processes the workpiece as follows during the thermal error compensation:

[0153] Start and check the numerical control machine tool equipment, the thermal imager 1, the computer equipment 4, make it in normal state;During the operation of the machine tool, the thermal imager 1 real-time shooting collects the thermal image of the machine tool main shaft 7, and inputs the machine tool main shaft thermal error prediction model in the computer equipment 4, obtains the thermal error prediction result of the machine tool main shaft 7;The thermal error prediction result of the machine tool main shaft 7 is processed into real-time compensation value according to the compensation strategy, and the real-time compensation value is sent to the corresponding communication register G36 register of the machine tool numerical control system 5;When the machine tool numerical control system 5 runs the processing G code, the real-time compensation value is read and transmitted to the reserved parameter, and the machine tool numerical control system 5 runs the processing G code with the real-time compensation value to control the movement of the machine tool main shaft 7, and completes the thermal error compensation.

[0154] In a possible embodiment, the thermal image data collection is as follows: an experiment is carried out on a VMC450 machine tool, and the main shaft is idled at 3000 rpm for 3 hours from cold start. A FLIR E4 thermal imager (resolution 320x240, thermal sensitivity 0.06℃) is used to collect thermal images every 20 seconds, while the K-9000 eddy current displacement sensor is used to collect the main shaft axial thermal error data.

[0155] In a possible embodiment, the model establishment is as follows: the collected thermal images are cropped and adjusted to 224x224 pixels, and the thermal error data is processed by Z-score standardization. The data set is divided into training set, validation set and test set in the ratio of 6:2:2.

[0156] Block rearrangement: the input image is divided into square blocks of size ψ, Figure 11 The effect diagram after 10 rounds of training of different size region division provided by the embodiments of the application, and the comprehensive performance is optimal when ψ is 32. The feature map after block division is converted into a new sequence through the rearrangement operation.

[0157] Position encoding: add position encoding to each square block to retain spatial context information and make up for the lack of spatial correlation of traditional block methods.

[0158] Local attention: block convolution is performed on the position encoding feature map, the channel dimension is improved to dim=64, the region importance weight is obtained through two layers of convolution and Sigmoid gating mechanism, and the local spatial features are weighted.

[0159] Channel attention: channel descriptors are generated through adaptive pooling, two layers of full connection and ReLU activation, Sigmoid gating is used to generate channel weights, and the input features are weighted in the channel.

[0160] Feature fusion: the local attention feature map and the channel attention feature map are added and fused, residual connection is introduced, the number of parameters is reduced, and gradient propagation is ensured.

[0161] In one possible embodiment, model training is performed as follows: an AxialAttention-BiLSTM model is constructed with a batch size of 16 and an initial learning rate of 0.0001. The learning rate is optimized using the cosine annealing algorithm and the Adam optimizer. Training is performed for 75 epochs, each consisting of a training and validation phase. The root mean square error (RMSE) is used as the loss function, and parameters are updated via backpropagation.

[0162] The trained model is applied to the thermal error prediction under different working conditions. The pre-processed thermal image is input and the model outputs the spindle thermal error prediction value. Figure 12 and Figure 13 As shown, Figure 12 The train-RMSE in represents the root mean square error of the training set during the training process, and the val-RMSE represents the root mean square error of the validation set during the training process. Figure 12 and Figure 13 It can be seen that under the working condition of 3000 rpm, the model fitting degree R 2 The error is 0.98, the root mean square error is 2.39μm, and the real-time compensation error can control the spindle accuracy within 5μm.

[0163] In addition, under the working conditions of 2000 rpm and 4000 rpm, the RMSE indicators of the model are 2.53 μm and 4.30 μm, respectively, and the MAE indicators are 3.18 μm and 5.47 μm, respectively, showing good prediction performance and robustness.

[0164] The embodiments of the present application effectively utilize the spatial information in the thermal image by combining thermal image region grid division, local attention, channel attention, and residual connection, improve the accuracy and robustness of thermal error prediction, and provide a basis for real-time thermal error compensation.

[0165] The proposed method performs block rearrangement on the original input image to obtain a rearranged feature map, and adds position encoding to the rearranged feature map to obtain a position encoding feature map, which retains the spatial context information and makes up for the lack of spatial correlation in the traditional block method.

[0166] It is proposed to input the position encoding feature map into the block convolution module to obtain the feature representation of each position encoding feature map, perform weighted convolution on the feature representation to obtain the regional importance weight representation, perform element-by-element weighted multiplication of the regional importance weight representation and the feature representation, and output the spatial local attention feature map to suppress noise through local attention.

[0167] The proposed compression operation is performed on the feature representation to generate a channel descriptor, an excitation operation is performed on the channel descriptor to obtain a channel weight representation, the channel weight representation is element-wise multiplied with the feature representation by weighting, and a channel attention feature map is output. Discriminative features are focused on by adjusting the dynamic channel weight.

[0168] The proposed output of local attention and the output of channel attention are fused to generate a fused attention feature map, and feature complementation and synergistic enhancement are achieved by additive fusion operation.

[0169] The proposed residual convolution is performed on the original input image to obtain a residual convolution feature representation, the residual convolution feature representation is rearranged by block division in the same way as the heat image region grid division to obtain a rearranged residual feature representation, the rearranged residual feature representation is fused with the fused attention feature map to obtain a residual feature map, and the degradation problem of the deep network is alleviated by introducing the residual connection to ensure effective gradient propagation while reducing the number of parameters, thereby further enhancing the representation ability of the model.

[0170] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to the embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including all the preferred embodiments and all the changes and modifications falling within the scope of the present application.

[0171] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.

Claims

1. A method for predicting thermal errors of machine tool spindles based on regional division thermal images, characterized in that: The following steps are involved: Step 1: Collect thermal images of the machine tool spindle under different working conditions and the corresponding spindle thermal error data to generate training sets, validation sets, and test sets; Step 2: Construct a region division thermal image model based on thermal image region grid division, local attention, channel attention, and residual connection; Step 3: using the training set and the validation set to train and validate the region division thermal image model, respectively, to obtain a machine tool spindle thermal error prediction model; Step 4: Use the test set to test the machine tool spindle thermal error prediction model, and use the machine tool spindle thermal error prediction model for actual machine tool spindle thermal error prediction and compensation.

2. The method for predicting thermal errors of machine tool spindles based on region-divided thermal images according to claim 1, characterized in that: In step 2, the thermal image area grid division includes: Rearrange the original input image into blocks to obtain a rearranged feature map; A position encoding is added to the rearranged feature map to obtain a position encoding feature map.

3. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 2, wherein: In step 2, the input image is divided into blocks and rearranged, including: Divide the original input image into independent local grid regions; The local grid area is rearranged to obtain a rearranged feature map.

4. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 2, wherein: In step 2, the local attention includes: Inputting the position coding feature map into a block convolution module to obtain feature representations of each position coding feature map; Performing weighted convolution processing on the feature representation to obtain a region importance weight representation; The region importance weight representation is element-wise weighted multiplied with the feature representation to output a spatial local attention feature map.

5. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 4, characterized in that: In step 2, the channel attention includes: Performing a compression operation on the feature representation to generate a channel descriptor; Performing an excitation operation on the channel descriptor to obtain a channel weight representation; Perform element-wise weighted multiplication on the channel weight representation and the feature representation, and output a channel attention feature map.

6. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 2, wherein: In step 2, the output of the local attention and the output of the channel attention are fused to generate a fused attention feature map.

7. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 6, characterized in that: In step 2, the residual connection includes: Perform residual convolution on the original input image to obtain residual convolution feature representation; Performing a block rearrangement on the residual convolution feature representation in the same manner as the grid division of the thermal image region to obtain a rearranged residual feature representation; fusing the rearranged residual feature representation with the fused attention feature map to obtain a residual feature map; The residual feature map is restored to its original layout to obtain the output of the region partition thermal image model, that is, the thermal error prediction result.

8. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 1, characterized in that: In step 3, the training process of the region division thermal image model includes: Data partitioning, model initialization, definition of loss function and optimizer, optimization of learning rate, and update of model parameters.

9. The method for predicting thermal errors of a machine tool spindle based on region-divided thermal images according to claim 1, characterized in that: In step 4, applying the machine tool spindle thermal error prediction model to actual machine tool spindle thermal error prediction and compensation includes: The actual thermal image of the machine tool spindle is input into the machine tool spindle thermal error prediction model, and a thermal error prediction result is output to predict the thermal error of the machine tool spindle under different working conditions, and thermal error compensation is performed according to the thermal error prediction result.

10. The machine tool spindle thermal error compensation system is characterized by: A method for predicting a thermal error of a machine tool spindle based on a region-divided thermal image according to any one of claims 1 to 9 is used to obtain a thermal error prediction result, and thermal error compensation is performed according to the thermal error prediction result; The machine tool spindle thermal error compensation system includes: a thermal imager, an eddy current sensor, a data acquisition PLC, computer equipment, a machine tool numerical control system, a data transmission network cable, a machine tool spindle, and a machine tool workbench; The thermal imager is installed in front of the main spindle of the machine tool; The eddy current sensor is installed on the machine tool workbench and is directly below the machine tool spindle; The output end of the eddy current sensor is connected to the data acquisition PLC; The computer equipment is connected to the thermal imager and the data acquisition PLC respectively; The computer device is connected to the machine tool numerical control system via the data transmission network cable; The computer device is installed with a program for running the machine tool spindle thermal error prediction method based on region division thermal images, which is used to construct, train, and verify a region division thermal image model to obtain a machine tool spindle thermal error prediction model, process the thermal error prediction result output by the machine tool spindle thermal error prediction model into a real-time compensation value according to a compensation strategy, and send the real-time compensation value to the machine tool numerical control system; The machine tool numerical control system is used to run the machining G code with the real-time compensation value to perform thermal error compensation on the machine tool spindle.

Citation Information

Patent Citations

  • Machine tool spindle thermal deformation prediction method based on GCN-Transform model

    CN119670530A

  • Five-axis machine tool rotating shaft thermal error modeling method based on convolutional network

    CN111985149A

  • Numerical control machine tool thermal error compensation method and device based on thermal image

    CN117055474A

  • Double-branch change detection method based on hyperspectral space and spectral information

    CN118155082A

  • Machine tool thermal error modeling method fusing attention mechanism and residual network

    CN119089760A

Cited By

  • Failure error-combined precision optimization method and system for center-moving type numerical control lathe

    CN121300230A