A thermal error compensation method for CNC machine tool spindle considering temperature sensor failure
Faulty sensors are identified through fuzzy C-means clustering and autoregressive integrated moving average model, and the temperature signal is reconstructed by combining graph attention convolution layer. A ridge regression thermal error model is constructed to solve the problem of decreased thermal error compensation accuracy caused by sensor failure, and achieve reliable thermal error compensation and accuracy improvement of CNC machine tools.
Patent Information
- Application Number
- CN202510961499.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-14
AI Technical Summary
The existing thermal error compensation method will significantly reduce the accuracy or fail when the temperature sensor fails, and cannot effectively compensate the spindle thermal error of CNC machine tools.
The fuzzy C-means clustering algorithm is used to screen temperature sensitive points, and the autoregressive integrated moving average model is combined to identify faulty sensors. The graph attention convolution layer is used to reconstruct the temperature signal, and the ridge regression thermal error model is constructed for compensation to achieve temperature signal repair and thermal error prediction.
In the event of a sensor failure, the reliability and accuracy of thermal error compensation are improved, significantly improving the thermal stability and machining accuracy of CNC machine tools.
Smart Images

Figure CN120469340B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of error compensation for numerically controlled machine tools, and in particular relates to a thermal error compensation method for a spindle of a numerically controlled machine tool taking temperature sensor failure into consideration. Background Art
[0002] CNC machine tools are core equipment in modern manufacturing, and their machining accuracy directly impacts product quality. Spindle thermal error is a key error source affecting machine tool accuracy and stability. Thermal error compensation is a key technology for addressing this issue. Temperature sensors, which collect temperature signals at key machine tool locations in real time, form the foundation for thermal error models and compensation. In real-world industrial scenarios, long-term effects such as machine tool vibration, oil contamination, and cutting fluid corrosion can easily lead to sensor failure, resulting in abnormal temperature data. Existing thermal error compensation methods are prone to significant reductions in compensation accuracy or even failure when temperature sensors fail. Summary of the Invention
[0003] The purpose of the present invention is to provide a CNC machine tool spindle thermal error compensation method taking into account temperature sensor failure, so that the thermal error compensation function is still effective when the temperature sensor fails, thereby improving the reliability of thermal error compensation.
[0004] To achieve the above object, the present invention adopts the following technical solutions:
[0005] A method for compensating a CNC machine tool spindle thermal error by taking temperature sensor failure into consideration comprises the following steps:
[0006] Step 1: Screening of temperature sensitive points;
[0007] The temperature data series of the machine tool spindle, spindle box, column and bed, as well as the spindle thermal error, are collected. The fuzzy C-means clustering algorithm is used to perform cluster analysis on the temperature data series. The mutual information between each cluster of data and the thermal error is obtained, and the temperature point with the largest mutual information in each cluster of temperature data is selected as the temperature sensitive point.
[0008] Step 2: Faulty sensor identification;
[0009] Based on the temperature sensitive points, the dynamic thermal change rate regression model is established using the autoregressive integrated moving average model. The dynamic thermal change rate is measured in real time. The cumulative deviation CDD is calculated using the measured dynamic thermal change rate and the predicted dynamic thermal change rate, and the threshold is set. ,when , then the temperature sensor is judged to be faulty; otherwise, the sensor is considered to be working normally;
[0010] Step 3: Temperature signal repair;
[0011] Four temperature prediction models with different parameters but the same network architecture were constructed. Using the temperature data of normal sensors as input, the temperature signals of faulty sensors were reconstructed to achieve temperature signal repair. The temperature prediction model used three sequentially connected graph attention convolutional layers.
[0012] Step 4: Construct a ridge regression thermal error model to predict thermal errors;
[0013] The Ridge Regression Thermal Error Model ,
[0014] Where, Indicates the thermal error of the machine tool spindle; is the model regression parameter; Indicates the increase in the collected temperature relative to the initial temperature.
[0015] Furthermore, in step 1, the temperature data sequence is obtained by collecting the temperature data once a minute using temperature sensors arranged on the spindle, spindle box, column and bed of the machine tool; the spindle thermal error is obtained by synchronous measurement using an eddy current displacement sensor.
[0016] Furthermore, the objective function of the fuzzy C-means clustering algorithm is:
[0017] ,
[0018] Where L is the objective function, n is the total number of samples in the data set; c is the number of clusters; is the cluster center vector of the i1th cluster; is the j1th temperature data sample; is the membership degree, representing the temperature data sample The degree of belonging to the i1-th cluster, m is the fuzzy index.
[0019] Furthermore, the mutual information is , where p(x,y) is the joint probability distribution function of the input temperature x and thermal error y, and p(x) and p(y) are the marginal probability distribution functions of temperature x and thermal error y, respectively.
[0020] Furthermore, the measured dynamic thermal change rate is ,in, is the dynamic thermal change rate at time t, and as well as They represent the temperature sensitive points of the machine tool measured by the sensor at time t, t-1 and the initial time respectively; is the sampling interval; is the weight coefficient.
[0021] Furthermore, the dynamic heat change rate regression model is established using the autoregressive integrated moving average model, and the predicted dynamic heat change rate is ,in, and are the autoregressive coefficient and the moving average coefficient respectively; is the error term at time t; p is the autoregressive order; q is the order of the moving average part, for The dynamic thermal rate of change at time, for The error term at time.
[0022] Furthermore, the cumulative deviation , where w(t) is a weight function that changes with time, is the number of time steps for calculating CDD.
[0023] Furthermore, a multi-head attention mechanism is introduced into the graph attention convolution layer of the temperature prediction model.
[0024] Furthermore, the loss function of the ridge regression thermal error model is:
[0025] ,
[0026] Where: N is the number of samples; is the thermal error measured at time i; is the increase in the current input temperature relative to the initial temperature; is a non-negative hyperparameter, is the regression parameter of the ridge regression thermal error model.
[0027] The present invention also provides a controller for implementing the method for compensating a machine tool spindle thermal error considering temperature sensor failure, characterized in that the controller includes a temperature acquisition module, a fault sensor identification module, a temperature signal repair module and a thermal error calculation module.
[0028] The temperature acquisition module is used to collect temperature data in real time from the spindle, spindle box, column and bed, and screen out temperature sensitive points;
[0029] The fault sensor identification module is used to predict the dynamic thermal change rate of each measuring point in real time based on the dynamic thermal change rate regression model and calculate the cumulative deviation. If the cumulative deviation exceeds the threshold δ, the temperature signal repair module is activated to repair the temperature signal;
[0030] The temperature signal repair module is used to predict the temperature value of the faulty temperature sensor by building a temperature prediction model based on the graph attention convolution layer to achieve temperature signal repair;
[0031] The thermal error calculation module is used to calculate the spindle thermal error in real time based on the ridge regression thermal error model, normal temperature data and repaired temperature data, and feed back the compensation value to the machine tool control system to complete thermal error compensation.
[0032] The beneficial effects of this invention include: screening sensitive temperature points through fuzzy C-means clustering and correlation analysis, designing a dynamic thermal rate of change algorithm combined with cumulative deviation calculation to identify faulty temperature sensors. A temperature signal repair model based on a graph attention neural network is constructed to replace abnormal data in real time. A ridge regression thermal error model is established by combining normal and repaired data, and a compensation system is designed that integrates data acquisition, faulty sensor identification, temperature repair, and thermal error calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is the overall structure diagram of the machine tool thermal error compensation controller.
[0034] Figure 2 This is a comparison chart of thermal error prediction effects. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0036] Example 1:
[0037] This embodiment discloses a method for compensating a CNC machine tool spindle thermal error by taking into account temperature sensor failure, comprising the following steps:
[0038] Step 1: Screening of temperature sensitive points;
[0039] PT100 temperature sensors are placed on the spindle, spindle box, column and bed of the machine tool to collect a set of temperature data every minute; and the spindle thermal error is synchronously measured using an eddy current displacement sensor.
[0040] In order to extract representative temperature change patterns from the temperature data, the fuzzy C-means clustering (FCM) algorithm is used to perform cluster analysis on the temperature series of each measuring point. , the heat generated by the spindle rotation is mainly transferred to the spindle, spindle box, column and bed, so the number of clusters c is set to 4, and the objective function of FCM is:
[0041] ,
[0042] Where L is the objective function, n is the total number of samples in the data set; c is the number of clusters; is the cluster center vector of the i1th cluster; is the j1th temperature data sample; is the membership degree, representing the temperature data sample The degree of belonging to the i1th cluster, m is the fuzzy index. Distance metric , represents the sample and cluster centers The weighted distance between them; A is the unit norm matrix.
[0043] Iteratively update the cluster center vector and membership degree to minimize the objective function. The cluster center vector update formula is: ; The update formula of membership degree is , k is the cluster index; Indicates the center position of the kth cluster.
[0044] Based on the correlation analysis, the temperature with the largest correlation is taken as the temperature sensitive point; the mutual information (MI) between temperature and thermal error is used to measure the correlation between temperature and thermal error.
[0045] Mutual information is , where p(x,y) is the joint probability distribution function of the input temperature x and thermal error y, and p(x) and p(y) are the marginal probability distribution functions of temperature x and thermal error y, respectively.
[0046] The mutual information between each cluster data obtained by cluster analysis and the thermal error is calculated, and the temperature point with the largest mutual information in each cluster temperature data is selected as the temperature sensitive point.
[0047] Step 2: Faulty sensor identification;
[0048] Based on the screening of temperature sensitive points, a dynamic thermal change rate regression model is established; based on the dynamic thermal change rate regression model, faulty temperature sensors are identified in real time.
[0049] The dynamic thermal change rate is ,in, is the dynamic thermal change rate at time t, and as well as They represent the temperature sensitive points of the machine tool measured by the sensor at time t, t-1 and the initial time respectively; is the sampling interval; is the weight coefficient, and the sum of the two is 1.
[0050] Since the temperature changes continuously, the dynamic heat change rate at time t can be predicted by the dynamic heat change rate of the historical time step. In this embodiment, the autoregressive integrated moving average model ARIMA is used to establish a dynamic heat change rate regression model. The predicted dynamic heat change rate is ,in, and are the autoregressive coefficient and the moving average coefficient respectively; is the error term at time t; p is the autoregressive order; q is the order of the moving average part, for The dynamic thermal rate of change at time, for The error term at time.
[0051] Based on dynamic thermal rate and predicted dynamic thermal rate of change , calculate the cumulative deviation CDD in real time as a fault judgment indicator;
[0052] ,
[0053] Where w(t) is a time-varying weight function used to emphasize the importance of recent data. is the number of time steps for calculating CDD.
[0054] Set thresholds based on historical residual standard deviations ,when If a fault is detected, the temperature sensor is considered faulty; otherwise, the sensor is considered to be operating normally. When a sensor fault is detected, the temperature prediction model predicts the temperature value at that point as an alternative input to ensure the accuracy and stability of subsequent thermal error modeling.
[0055] Step 3: Temperature signal repair;
[0056] Assume that a temperature sensor has a 25% chance of failure due to long-term adverse factors. For four temperature sensors, one will randomly fail. Using the temperature data from the remaining three functioning sensors as input, four temperature prediction models with different parameters but the same network architecture are established. These models reconstruct the temperature signal of the failed sensor and achieve real-time temperature signal repair.
[0057] The temperature prediction model consists of three layers of graph attention convolutional layers (GATs) connected in sequence, which are used to extract local features of input data, enhance feature expression, and output the final recognition result. , is a node set, is the edge set, the feature of each node i for:
[0058] ,
[0059] in, is the updated feature of node i in layer l, represents the feature of node j at the (l−1) layer, represents the weight matrix of layer l, represents the attention coefficient between node i and node j calculated at layer l; Represents the activation function, using SiLU function; .
[0060] Calculate the attention coefficient based on the features of node i and node j ; Obtain new features through linear transformation , ; Concatenate the transformed features and calculate the correlation score using the LeakyReLU scoring function , the scores of all neighbor nodes j Perform softmax normalization to obtain the attention coefficient .
[0061] To further enhance the model's expressiveness, GAT introduces a multi-head attention mechanism. In each layer, the model executes multiple independent attention mechanisms in parallel and concatenates or averages the results. Assuming there are K attention heads, the final feature of node i in layer l is:
[0062] ,
[0063] in, is the attention coefficient of the kth attention head, is the weight matrix, and ⨁ represents the concatenation operation.
[0064] The repaired temperature data is used to replace the abnormal temperature data in real time to complete the repair of the input temperature sequence information.
[0065] Step 4: Construct the ridge regression thermal error model;
[0066] Based on the normal temperature data and the repaired temperature data, a ridge regression thermal error model is constructed.
[0067] ,
[0068] Where, Indicates the thermal error of the machine tool spindle; is the model regression parameter; Indicates the increase in the collected temperature relative to the initial temperature.
[0069] Converted into matrix form ;
[0070] in, , , .
[0071] By performing L2 regularization on the model parameters, the differences between the solved model parameters are reduced, and the impact of collinearity between ambient temperature variables on the generalization ability of the model is reduced.
[0072] The loss function of the ridge regression thermal error model is: ,
[0073] Where: N is the number of samples; y (i) is the thermal error measured at time i; is the increase in the current input temperature relative to the initial temperature; is a non-negative hyperparameter.
[0074] Different It will form different , that is, the model parameters are Function:
[0075] ,
[0076] In the formula, I is the unit matrix. During the modeling process, the optimal model is selected by the ridge trace observation method. , that is, at this time Make the model regression parameters Relatively stable.
[0077] Example 2:
[0078] This embodiment is an integrated machine tool thermal error compensation controller constructed using the method of Example 1, which realizes real-time detection of sensor faults and temperature signal repair, and completes thermal error prediction and compensation.
[0079] The controller consists of four core modules: temperature acquisition module, fault sensor identification module, temperature signal repair module and thermal error calculation module. The overall structure is as follows: Figure 1 As shown in the figure, the temperature acquisition module is responsible for collecting real-time data from PT100 sensors located at key locations such as the spindle, spindle box, column, and bed. The fault sensor identification module uses a dynamic thermal change rate regression model to predict the dynamic thermal change rate of each measuring point in real time and calculate the cumulative deviation. If the cumulative deviation exceeds the threshold δ, the temperature signal repair module is activated to repair the temperature signal. The temperature signal repair module uses a graph attention neural network (GAT) to predict the temperature value of the faulty temperature sensor based on the data of the remaining normal sensors, thus achieving temperature signal repair. The thermal error calculation module uses a ridge regression thermal error model to calculate the spindle thermal error in real time based on the normal temperature data and the repaired temperature data, and feeds the compensation value back to the control system to complete the thermal error compensation.
[0080] The compensation controller realizes the complete control process from data acquisition, anomaly identification, signal repair to error compensation, significantly improving the thermal stability and processing accuracy of CNC machine tools under complex working conditions.
[0081] Taking a spindle temperature sensor failure as an example, the effectiveness of the proposed method was verified using collected experimental data. At the end of the 60th minute, a random fault temperature signal was constructed and judged using a dynamic thermal rate of change model. Upon detection of a fault, the spindle unit temperature signal, predicted using a graph convolutional neural network algorithm, immediately replaced the sensor's fault temperature signal as the input to the thermal error model.
[0082] The effect of using the repaired temperature signal and the fault temperature signal for prediction is as follows: Figure 2 When the faulty temperature signal is used as the input for the thermal error model, the model residual fluctuates from -33μm to +5μm, significantly reducing compensation accuracy and even increasing the error, worsening the compensation effect. Using the repaired temperature signal as input, the residual fluctuates from only -6μm to +3μm, significantly improving the model prediction accuracy and verifying the effectiveness of the proposed active repair method for the faulty temperature signal.
[0083] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for compensating thermal errors of a CNC machine tool spindle considering temperature sensor failure, characterized in that: The steps include: Step 1: Screening of temperature sensitive points; The temperature data series of the machine tool spindle, spindle box, column and bed, as well as the spindle thermal error, are collected. The fuzzy C-means clustering algorithm is used to perform cluster analysis on the temperature data series. The mutual information between each cluster of data and the thermal error is obtained, and the temperature point with the largest mutual information in each cluster of temperature data is selected as the temperature sensitive point. Step 2: Faulty sensor identification; Based on the temperature sensitive points, the dynamic thermal change rate regression model is established using the autoregressive integrated moving average model. The dynamic thermal change rate is measured in real time. The cumulative deviation CDD is calculated using the measured dynamic thermal change rate and the predicted dynamic thermal change rate, and the threshold is set. ,when , then the temperature sensor is judged to be faulty; otherwise, the sensor is considered to be working normally; Step 3: Temperature signal repair; Four temperature prediction models with different parameters but the same network architecture were constructed. Using the temperature data of normal sensors as input, the temperature signals of faulty sensors were reconstructed to achieve temperature signal repair. The temperature prediction model used three sequentially connected graph attention convolutional layers, in which a multi-head attention mechanism was introduced. Step 4: Construct a ridge regression thermal error model to predict thermal errors; The Ridge Regression Thermal Error Model , Where, Indicates the thermal error of the machine tool spindle; is the model regression parameter; Indicates the increase in the collected temperature relative to the initial temperature.
2. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 1, characterized in that: In step 1, the temperature data sequence is acquired once a minute by temperature sensors arranged on the spindle, spindle box, column and bed of the machine tool; the spindle thermal error is acquired by synchronous measurement using an eddy current displacement sensor.
3. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 1, characterized in that: The objective function of the fuzzy C-means clustering algorithm is: , Where L is the objective function, n is the total number of samples in the data set; c is the number of clusters; is the cluster center vector of the i1th cluster; is the j1th temperature data sample; is the membership degree, representing the temperature data sample The degree of belonging to the i1-th cluster, m is the fuzzy index.
4. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 1, characterized in that: The mutual information is , where p(x,y) is the joint probability distribution function of the input temperature x and thermal error y, and p(x) and p(y) are the marginal probability distribution functions of temperature x and thermal error y, respectively.
5. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 1, characterized in that: The measured dynamic thermal rate of change is ,in, is the dynamic thermal change rate at time t, and as well as They represent the temperature sensitive points of the machine tool measured by the sensor at time t, t-1 and the initial time respectively; is the sampling interval; is the weight coefficient.
6. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 5, characterized in that: The dynamic heat change rate regression model is established using the autoregressive integrated moving average model. The predicted dynamic heat change rate is ,in, and are the autoregressive coefficient and the moving average coefficient respectively; is the error term at time t; p is the autoregressive order; q is the order of the moving average part, for The dynamic thermal rate of change at time, for The error term at time.
7. A method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 6, characterized in that: The cumulative deviation , where w(t) is a weight function that changes with time, is the number of time steps for calculating CDD.
8. The method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to claim 1, characterized in that: The loss function of the ridge regression thermal error model is: , Where: N is the number of samples; is the thermal error measured at time i; is the increase in the current input temperature relative to the initial temperature; is a non-negative hyperparameter, is the regression parameter of the ridge regression thermal error model.
9. A controller for implementing the method for compensating a CNC machine tool spindle thermal error considering temperature sensor failure according to any one of claims 1 to 8, characterized in that: The controller includes a temperature acquisition module, a fault sensor identification module, a temperature signal repair module and a thermal error calculation module. The temperature acquisition module is used to collect temperature data in real time from the spindle, spindle box, column and bed, and screen out temperature sensitive points; The fault sensor identification module is used to predict the dynamic thermal change rate of each measuring point in real time based on the dynamic thermal change rate regression model and calculate the cumulative deviation. If the cumulative deviation exceeds the threshold δ, the temperature signal repair module is activated to repair the temperature signal; The temperature signal repair module is used to predict the temperature value of the faulty temperature sensor by building a temperature prediction model based on the graph attention convolution layer to achieve temperature signal repair; The thermal error calculation module is used to calculate the spindle thermal error in real time based on the ridge regression thermal error model, normal temperature data and repaired temperature data, and feed back the compensation value to the machine tool control system to complete thermal error compensation.
Citation Information
Patent Citations
Numerical control machine heat error compensation temperature point position determination method
CN101290266A
Numerically-controlled machine tool spindle thermal extension error real-time compensation method
CN106444628A