Dynamic error compensation method and system for main shaft of gantry machining center
By using multi-source data fusion and federated learning technology, real-time and dynamic compensation for the dynamic error of CNC machine tool spindles is achieved, solving the problem that the interaction of error factors is not considered in the existing technology, and improving machining accuracy and production efficiency.
Patent Information
- Application Number
- CN202511425660.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Existing CNC machine tool spindle dynamic error compensation methods fail to fully consider the interaction and influence of multiple error factors, lack real-time and dynamic capabilities, and are difficult to meet the needs of modern high-precision machining.
By employing multi-source data fusion, federated learning, dynamic risk assessment, and strategy optimization techniques, this method collects real-time sensor data from multiple sources, generates prediction error vectors and uncertainty metrics, utilizes a federated network to generate a globally shared model, calculates real-time risk field strength, and synthesizes the optimal compensation strategy to achieve real-time and dynamic compensation for the dynamic error of the main axis.
It improved the machining accuracy and production efficiency of machine tools, reduced the scrap rate, and enhanced the pertinence and effectiveness of compensation.
Smart Images

Figure CN121028678A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine tool processing technology, and in particular to a method and system for dynamic error compensation of the spindle of a gantry machining center. Background Technology
[0002] With the rapid development of the manufacturing industry, CNC machine tools, as key equipment for precision machining, play an irreplaceable role in many industrial fields. Their performance directly affects the quality of machined parts and production efficiency. Among the various components of a CNC machine tool, the spindle, as the core component, plays a decisive role in the overall machining capability of the machine tool due to its operating status and accuracy.
[0003] The magnitude of the dynamic error of a CNC machine tool spindle directly affects the machining accuracy and stability of the machine tool. Spindle dynamic error refers to the error that occurs during the operation of the machine tool spindle, caused by the combined effects of various complex factors, such as mechanical vibration, bearing wear, and thermal deformation, leading to a deviation of the spindle's rotation axis from its ideal position. This error has many adverse effects on machined parts, specifically manifested as decreased dimensional accuracy, shape distortion, and positional deviation, thus seriously affecting the overall machining quality, reducing product yield, and increasing production costs.
[0004] The dynamic errors of CNC machine tool spindles mainly include radial error and axial error. Radial error refers to the error caused by the movement of the spindle's rotation center line along the radial direction. This error will cause deviations in the radial dimensions of the machined parts, resulting in the parts failing to meet shape accuracy requirements such as roundness and cylindricity. Axial error refers to the error caused by the movement of the spindle's rotation center line along the axial direction. It affects the axial dimensional accuracy of the parts and positional accuracy such as the perpendicularity of the end faces.
[0005] Currently, while some research has been conducted on compensation methods for dynamic errors of CNC machine tool spindles, most methods have limitations. Some traditional methods compensate for errors based on only a single factor, failing to fully consider the interaction and influence of multiple error factors, resulting in unsatisfactory compensation effects. Other methods lack real-time and dynamic capabilities, failing to adjust compensation strategies promptly according to real-time changes in the spindle's operating state, thus failing to meet the demands of modern high-precision machining.
[0006] Therefore, it is necessary to provide a method and system for dynamic error compensation of the spindle of a gantry machining center to solve the above-mentioned technical problems. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method and system for dynamic error compensation of the spindle in a gantry machining center. Through innovative technologies such as multi-source data fusion, federated learning, dynamic risk assessment, and strategy optimization, it achieves real-time and dynamic compensation for spindle dynamic errors, thereby improving the machining accuracy and production efficiency of the machine tool.
[0008] This invention provides a method for dynamic error compensation of a gantry machining center spindle, the method comprising the following steps: Collect multi-source real-time sensor data of the current machine tool node spindle system and input it into the pre-built local uncertainty quantification model to generate the first uncertainty feature tuple containing the prediction error vector and uncertainty measure; Receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization; Based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence, the real-time risk field strength is calculated. The real-time risk field strength and the historical compensation effectiveness data read from the local database are input into the dynamic strategy generator to synthesize the optimal compensation strategy. The optimal compensation strategy is collaboratively optimized based on the predicted error vector to generate compensation instructions, which are then sent to the CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
[0009] Preferably, the step of acquiring multi-source real-time sensor data of the current machine tool node spindle system and inputting it into a pre-built local uncertainty quantification model to generate a first uncertainty feature tuple containing a prediction error vector and an uncertainty measure includes: The multi-source real-time sensing data is composed of real-time data collected from eddy current displacement sensors, spindle servo drives, temperature sensors, and vibration sensors. The multi-source real-time sensing data is input into the pre-built local uncertainty quantification model for uncertainty quantification processing; The prediction error vector, which includes radial prediction error and axial prediction error, and the corresponding uncertainty metric output by the local uncertainty quantification model together constitute the first uncertainty feature tuple.
[0010] Preferably, the step of receiving the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generating a globally shared model through federated aggregation optimization, includes: Extract the prediction error vector and uncertainty measure contained in each second uncertainty feature tuple, and form a training sample set with the corresponding measured error label; Based on the training sample set, the weight parameters of the pre-trained global shared model are updated by the federated averaging algorithm aggregation process, wherein the federated averaging algorithm aggregation process includes: calculating the weighted average of the local model weight parameters of each machine tool node, wherein the weight coefficients are dynamically allocated according to the magnitude of the uncertainty metric of each node. Output the globally shared model with updated weight parameters.
[0011] Preferably, the calculation of the real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence includes: Obtain the uncertainty measure and historical uncertainty data sequence of the current machine tool node; Calculate the moving average and moving standard deviation of the historical uncertainty data series; Based on the ratio of the moving standard deviation to the moving average, a risk sensitivity coefficient is generated in real time using a preset adaptive mapping function; The real-time risk field strength is calculated based on the uncertainty metric of the current machine tool node, the moving average value, and the risk sensitivity coefficient, wherein the formula for calculating the real-time risk field strength is: in Indicates the real-time risk field strength. Indicates the risk sensitivity coefficient. This represents a measure of the uncertainty at the current machine tool node. This represents the moving standard deviation.
[0012] Preferably, the step of inputting the real-time risk field strength and historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy includes: Historical compensation energy efficiency data is read from the local database, where each historical compensation energy efficiency data includes historical risk field strength, historical compensation strategy and compensation energy efficiency index; The similarity weights of each historical compensation energy efficiency data are calculated based on the real-time risk field strength and each historical risk field strength. The formula for calculating the similarity weights is as follows: in Indicates the first Similarity weights of historical compensation energy efficiency data Indicates the first The risk field strength of historical energy efficiency compensation data This indicates the preset bandwidth parameter. Represents an exponential function; The optimization score of each historical energy efficiency data point is calculated based on the aforementioned energy efficiency compensation index, wherein the formula for calculating the optimization score is as follows: in and They represent the first The optimality score and compensation efficiency index of historical compensation energy efficiency data. and These represent the maximum and minimum values of all historical energy efficiency compensation data, respectively. The fusion weight of each historical compensation strategy is calculated based on the similarity weight and the preference score, wherein the formula for calculating the fusion weight is: in Indicates the first The fusion weight of historical compensation energy efficiency data; The historical compensation strategies are weighted and averaged according to the aforementioned fusion weights to synthesize the optimal compensation strategy. The synthesis formula for the optimal compensation strategy is as follows: in This represents the optimal compensation strategy.
[0013] Preferably, the step of collaboratively optimizing the optimal compensation strategy based on the predicted error vector, generating compensation instructions, and sending the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error includes: The radial prediction error and axial prediction error in the prediction error vector are respectively correlated with the corresponding compensation components in the optimal compensation strategy to determine the potential influence coefficient of each prediction error component on the compensation effect. Based on the potential impact coefficient, the compensation component in the optimal compensation strategy is dynamically adjusted to generate a preliminary optimized compensation strategy. Extract the variation characteristics of each error component in the prediction error vector, combine them with the preliminary optimization compensation strategy, and fine-tune the model through the preset compensation strategy to generate the final optimization compensation strategy. The final optimized compensation strategy is converted into a compensation instruction format that can be recognized by the machine tool CNC system, a compensation instruction is generated, and the compensation instruction is sent to the machine tool CNC system of the current machine tool node for execution to compensate for the dynamic error of the spindle.
[0014] The present invention also provides a dynamic error compensation system for a gantry machining center spindle, used to execute a dynamic error compensation method for a gantry machining center spindle, the compensation system comprising: The data acquisition and modeling module is used to acquire multi-source real-time sensor data of the current machine tool node spindle system and input it into the pre-built local uncertainty quantification model to generate the first uncertainty feature tuple containing the prediction error vector and uncertainty measure. The federated aggregation optimization module is used to receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization. The risk field strength calculation module is used to calculate the real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence. The strategy synthesis and generation module is used to input the real-time risk field strength and the historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy. The strategy optimization execution module is used to perform collaborative optimization of the optimal compensation strategy based on the predicted error vector, generate compensation instructions, and send the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
[0015] Compared with related technologies, the dynamic error compensation method and system for the spindle of a gantry machining center provided by the present invention has the following beneficial effects: This invention first collects multi-source real-time sensor data from the current machine tool node's spindle system and inputs it into a pre-constructed local uncertainty quantification model. This allows for comprehensive and accurate acquisition of various information during spindle operation, generating a first uncertainty feature tuple containing the prediction error vector and uncertainty measurement, providing a precise data foundation for subsequent error compensation. Secondly, it utilizes a federated network to receive data from other machine tool nodes and generates a globally shared model through federated aggregation optimization. This achieves data sharing and collaborative optimization among multiple machine tool nodes, fully leveraging collective intelligence and improving the model's generalization ability and accuracy. Furthermore, based on the uncertainty measurement of the current machine tool node and historical data, it calculates the real-time risk field strength and synthesizes the optimal compensation strategy by combining it with historical compensation effectiveness data. This allows for dynamic adjustment of the compensation strategy according to the real-time operating status of the spindle, enhancing the targeting and effectiveness of compensation. Finally, it collaboratively optimizes the optimal compensation strategy based on the prediction error vector, generates compensation instructions, and sends them to the machine tool's CNC system for execution. This achieves real-time and accurate compensation for the spindle's dynamic errors, effectively improving the machining accuracy and stability of the gantry machining center, reducing the scrap rate, and increasing production efficiency. Attached Figure Description
[0016] Figure 1 A flowchart of a dynamic error compensation method for a gantry machining center spindle provided by the present invention; Figure 2 This invention provides a schematic diagram of the module structure of a dynamic error compensation system for a gantry machining center spindle. Detailed Implementation
[0017] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the drawings, not all structures. Moreover, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0018] It should also be noted that, for ease of description, the accompanying drawings show only the parts relevant to the invention and not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but it may also have additional steps not included in the drawings. The process may correspond to a method, function, procedure, subroutine, subroutine, etc.
[0019] Example 1 This invention provides a method for dynamic error compensation of a gantry machining center spindle, with reference to... Figure 1 As shown, the compensation method includes the following steps: S1: Collect multi-source real-time sensor data of the current machine tool node spindle system and input it into the pre-built local uncertainty quantification model to generate the first uncertainty feature tuple containing the prediction error vector and uncertainty measure.
[0020] Specifically, step S1 includes the following steps: S11: Collect real-time data measured by eddy current displacement sensor, spindle servo driver, temperature sensor and vibration sensor to form the multi-source real-time sensing data.
[0021] In practical implementation, an eddy current displacement sensor is installed in each of the X and Y directions, which are radially perpendicular to each other, on the front bearing housing of the spindle to measure the radial displacement of the spindle; an eddy current displacement sensor is installed in the Z direction on the spindle end face to measure the axial movement of the spindle; the torque current percentage and actual speed data of the spindle servo drive are read in real time through the OPCUA interface of the machine tool CNC system; PT100 temperature sensors are installed on the outer walls of the front and rear bearing housings of the spindle to collect bearing temperature rise data; an ICP-type vibration acceleration sensor is installed at the joint surface between the spindle box and the column to collect spindle vibration spectrum data. All sensor data are collected through a distributed IO module, synchronized using the IEEE 1588 precise time protocol, and transmitted to the industrial control computer in real time at a sampling frequency of 1kHz, forming a multi-source real-time sensing data stream containing multiple physical quantities such as displacement, force, heat, and vibration.
[0022] S12: Input the multi-source real-time sensing data into the pre-built local uncertainty quantification model for uncertainty quantification processing.
[0023] In practice, this local uncertainty quantification model is constructed using a Bayesian neural network based on Monte Carlo Dropout. Its input layer contains six neurons corresponding to X / Y / Z-axis displacement, spindle torque, bearing temperature, and vibration acceleration data, respectively. The hidden layer employs a three-layer fully connected structure with 128 neurons per layer and a Dropout rate of 0.2. The output layer contains four neurons. During data processing, the input data is first standardized to eliminate the influence of dimensions. Then, the processed data is input into the Bayesian neural network for forward propagation calculation. By repeatedly executing the forward propagation 500 times and activating Dropout, the probability distribution of the prediction results is obtained. Finally, based on this distribution, the confidence interval of the predicted value is calculated, completing the transformation from deterministic prediction to uncertainty quantification.
[0024] S13: The prediction error vector containing radial prediction error and axial prediction error, and the corresponding uncertainty metric, output by the local uncertainty quantification model together constitute the first uncertainty feature tuple.
[0025] In practice, the first two neurons of the model's output layer output prediction error values in the radial (X) and Y directions, respectively, and the third neuron outputs the prediction error value in the axial (Z) direction. These three values together constitute the prediction error vector. The fourth neuron outputs a comprehensive uncertainty metric. This value is obtained by calculating the standard deviation of 500 forward propagation results, and represents the confidence level of the current prediction. Finally, the prediction error vector and uncertainty measure are encapsulated into a JSON format data tuple, containing a timestamp, device ID, and data validity flag, forming a complete second uncertainty feature tuple, which is then transmitted to the federated learning aggregation server.
[0026] S2: Receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization.
[0027] Specifically, step S2 includes the following steps: S21: Extract the prediction error vector and uncertainty measure contained in each second uncertainty feature tuple, and form a training sample set with the corresponding measured error label.
[0028] In practice, the second uncertainty feature tuple is received from other machine tool nodes through the encrypted communication channel of the federated learning platform. Each tuple is protected by AES-256 encryption. Upon receiving the data, the local node first decrypts and verifies it using its private key, extracting the prediction error vector contained within. and uncertainty measure Simultaneously, the measured error data of the laser interferometer for the corresponding time period is obtained from the local quality inspection system as a label, including the radial error value. and axial error value Using the three components of the prediction error vector as input features and the measured error values as output labels, a model of the form is constructed. The training sample pairs are then aggregated from all nodes to form a distributed training sample set containing multiple devices and operating conditions, which is used for subsequent model aggregation and optimization.
[0029] S22: Based on the training sample set, update the weight parameters of the pre-trained global shared model through federated averaging algorithm aggregation processing, wherein the federated averaging algorithm aggregation processing includes: calculating the weighted average of the local model weight parameters of each machine tool node, wherein the weight coefficients are dynamically allocated according to the magnitude of the uncertainty metric of each node.
[0030] In practice, the global shared model is architecturally identical to the local uncertainty quantification model constructed in step S12, i.e., it also uses a Bayesian neural network based on Monte Carlo Dropout, with the same neuron structure and number in its input, hidden, and output layers. The federated aggregation process does not change the model architecture, but rather performs weighted fusion of the weight parameters of the local models at each node to generate a better next-generation global model weight.
[0031] The implementation employs a federated averaging algorithm with uncertainty weighting. First, a global model with the same structure as the local uncertainty quantification model is initialized. Then, the aggregation weight is calculated for each participating node, using the following formula: ,in For the first The uncertainty metric of each node is used, and this weighting strategy ensures that nodes with lower uncertainty (more reliable predictions) have a larger weight in the aggregation. Then, based on the local model weights of each node and the calculated aggregation weights, the weighted average of the global model is calculated. Finally, a moving average strategy is used to update the global model parameters, with the update formula as follows: in The momentum factor was set to 0.9 to ensure the stability of model updates. This represents the total number of nodes participating in the aggregation. Indicates the number of update iterations. Indicates the first The node at the th Local model parameters for the next iteration Indicates the global model at the 1st The parameters for the next iteration Indicates the global model at the 1st The parameters are updated in the next iteration.
[0032] S23: Output the globally shared model after updating the weight parameters.
[0033] In practice, the aggregated and updated global model parameters are serialized into binary format, and a model fingerprint is generated using the SHA-256 algorithm for integrity verification. The updated model parameter package is then distributed to all machine tool nodes in the network via the federated learning platform's distribution mechanism. Upon receiving the new global model, each node first verifies the validity of the model fingerprint, then loads it locally to replace the original model, while retaining the previous version as a rollback backup. After the model update is complete, the node sends a confirmation signal to the federated learning platform. The platform records the model version number, update time, and information of the participating nodes, completing one full federated learning aggregation cycle.
[0034] S3: Calculate the real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence.
[0035] Specifically, step S3 includes the following steps: S31: Obtain the uncertainty measure of the current machine tool node and the historical uncertainty data sequence.
[0036] In practice, the latest uncertainty metric value generated in step S13 is read in real time through the local data management interface. This value is stored as a floating-point number in the shared memory area. Simultaneously, historical uncertainty measurement data sequences for the most recent 24 hours are retrieved from a time-series database (using InfluxDB), acquiring a total of 86,400 data points at 1-second sampling intervals to form the historical uncertainty data sequence. CRC32 verification is used during data acquisition to ensure data integrity and accuracy. Outliers (such as those exceeding ±3) are flagged. Data points within a certain range are removed and then filled in using linear interpolation to form a complete and continuous historical data sequence for subsequent statistical analysis.
[0037] S32: Calculate the moving average and moving standard deviation of the historical uncertainty data series.
[0038] In practice, a sliding window method is used to calculate statistical characteristics, with the window size set to 3600 data points (i.e., 1 hour of data). First, the historical data series is smoothed, and the moving average μ_hist is calculated using the Exponentially Weighted Moving Average (EWMA) algorithm. The calculation formula is as follows: in The smoothing coefficient is set to 0.2, which controls the weighting of current data and historical data. The smaller the value, the greater the weight of historical data. It represents the moving average at the current moment, characterizing the trend center of historical uncertainty, and is calculated based on exponential weighting; The uncertainty metric at the current moment is real-time uncertainty data read from a time-series database; This represents the moving average value at the previous time point; Then, the moving standard deviation is calculated based on the moving average. The standard deviation is updated in real time using the Welford online algorithm, and the calculation formula is as follows: Where SSD is the weighted sum of squared deviations. This represents the number of valid data points within the window.
[0039] S33: Based on the ratio of the moving standard deviation to the moving average, a risk sensitivity coefficient is generated in real time using a preset adaptive mapping function.
[0040] In practice, the ratio of the moving standard deviation to the moving mean is first calculated. This ratio characterizes the relative volatility of historical uncertainty; subsequently, a risk sensitivity coefficient is generated using a piecewise linear mapping function. The mapping rule is: when When ≤0.1, =1.0; when 0.1 < When ≤0.3, =1.0+2.5×( -0.1); when When >0.3, =1.5 + 1.0 × (η - 0.3). This mapping function ensures a conservative strategy is adopted when fluctuations are small. ≈1), When volatility increases, appropriately increase risk sensitivity ( Increase), adopt aggressive strategies during extreme fluctuations ( >2.5), the mapping output is limited to Within the range.
[0041] S34: Calculate the real-time risk field strength based on the uncertainty metric of the current machine tool node, the moving average value, and the risk sensitivity coefficient, wherein the calculation formula for the real-time risk field strength is: in Indicates the real-time risk field strength. Indicates the risk sensitivity coefficient. This represents a measure of the uncertainty at the current machine tool node. This represents the moving standard deviation.
[0042] In practice, the current uncertainty measure is first read. and the moving average calculated in step S32 Calculate the relative uncertainty ratio The risk sensitivity coefficient generated in step S33 will then be used. As an exponential term, the real-time risk field strength R is calculated using an exponential function. The calculation process employs the IEEE 754 standard mathematical operation library and utilizes a fast exponential algorithm (such as the Schraudolph algorithm) to optimize computational efficiency, ensuring that all calculations are completed within 1 ms. The final output risk field strength R is a dimensionless index with a value range of [range missing]. The higher the value, the higher the current risk level of the system.
[0043] Furthermore, this formula uses relative ratios rather than absolute values to eliminate benchmark differences under different equipment and operating conditions. Current uncertainty measurement It only reflects the instantaneous absolute error of the prediction, while dividing by the historical moving average transforms it into the degree of deviation relative to the equipment's own historical normal level. This allows a high-performance new machine tool and an old machine tool to obtain comparable risk assessments at the same ratio, achieving standardization of risk assessment.
[0044] Secondly, the formula introduces an exponential term. This is to capture the nonlinear characteristics of risk growth. In real-world industrial scenarios, system performance deterioration is often not linear: when uncertainty slightly exceeds the normal range, risk increases slowly; however, when it deviates significantly, it often signifies the occurrence of a failure or severe disturbance, and the risk should rise sharply. The exponential function precisely characterizes this "accelerated deterioration" effect. When the value is greater than 1, any ratio greater than 1 will be amplified, causing the R value to increase significantly, thus sending a strong signal of a high-risk state.
[0045] Most importantly, the formula's dynamic adaptive capability is achieved through... This is achieved in conjunction with the preceding step S33. Risk sensitivity coefficient. It is not a fixed value, but rather adjusted in real time based on the volatility of historical uncertainty sequences. When historical data is stable ( When the uncertainty is small, the system is in a high-precision state. At this point, even a slight increase in uncertainty could indicate the onset of anomalies, therefore a larger [precision level] is assigned. This value enhances sensitivity and enables early warning. Conversely, when historical data fluctuates significantly ( When the value is large, it indicates that the equipment itself is in an unstable state, and large uncertainties and fluctuations have become the "new normal." Therefore, a smaller value should be used. This design reduces sensitivity and avoids false alarms. It enables the system to intelligently distinguish between "minor anomalies in precision equipment" and "normal fluctuations in older equipment," significantly improving alarm accuracy.
[0046] S4: Input the real-time risk field strength and the historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy.
[0047] Specifically, step S4 includes the following steps: S41: Read historical compensation energy efficiency data from the local database, where each piece of historical compensation energy efficiency data includes historical risk field strength, historical compensation strategy and compensation energy efficiency index.
[0048] In practice, historical compensation records are retrieved from the local MySQL database via an SQL query interface. The query criteria are historical data within ±100 rpm of the current spindle speed, and the time range is the most recent 30 days. Each record contains three core fields: historical risk field strength (FLOAT type, from the historical calculation results in step S34), historical compensation strategy (BLOB type, stored as a set of compensation parameters in JSON format, including radial compensation gain and axial compensation gain), and compensation effectiveness index (FLOAT type, calculated based on the contour accuracy measurement value of the workpiece after this compensation; the higher the accuracy, the larger the value). After data retrieval, the Protobuf protocol is used for serialization and transmission to ensure the integrity of the data structure and transmission efficiency.
[0049] S42: Calculate the similarity weight of each historical compensation energy efficiency data based on the real-time risk field strength and each historical risk field strength. The formula for calculating the similarity weight is as follows: in Indicates the first Similarity weights of historical compensation energy efficiency data Indicates the first The risk field strength of historical energy efficiency compensation data This indicates the preset bandwidth parameter. This represents an exponential function.
[0050] In practice, the real-time risk field strength R calculated in step S34 is first read, along with the risk field strengths of each historical record obtained from the database. Then, similarity weights are calculated based on the Gaussian kernel function, where the bandwidth parameter... The standard deviation of historical risk field strength is dynamically set to 0.15, which controls the tolerance of similarity judgment. During calculation, the current risk field strength is calculated for each historical record. With historical risk field strength The squared Euclidean distance is substituted into the formula, and the similarity weight between 0 and 1 is obtained through the exp function. The closer the weight value is to 1, the more similar the risk situation of that historical record is to the current situation.
[0051] S43: Calculate the optimization score for each historical optimization energy efficiency data based on the aforementioned optimization energy efficiency index, wherein the optimization score is calculated using the following formula: in and They represent the first The optimality score and compensation efficiency index of historical compensation energy efficiency data. and These represent the maximum and minimum values of all historical compensation energy efficiency data, respectively.
[0052] In practice, the first step is to iterate through all retrieved historical records and find the maximum value of the compensation efficiency index Ei. and minimum value Then, the compensation performance index for each historical record. Perform min-max normalization to linearly map it to... The interval. The preference score. It intuitively reflects the effectiveness level of historical compensation strategies. =1 indicates that the historical strategy achieved the best compensation effect at that time. =0 indicates the worst performance. Normalization eliminates the dimensional differences in performance indicators under different operating conditions, making the strategy effects at different times comparable.
[0053] S44: Calculate the fusion weight of each historical compensation strategy based on the similarity weight and the preference score, wherein the formula for calculating the fusion weight is: in Indicates the first The fusion weight of historical compensation energy efficiency data.
[0054] In practice, for each historical record, its similarity weight is calculated. With preference score Multiply the results to obtain the original fusion weights for that record. Then sum the original weights of all records and normalize the original weights of each record to ensure that all fusion weights are equal. The sum is 1. This calculation method takes into account both the contextual similarity of the strategies ( ), and also considered the absolute effectiveness level of the strategy ( ), which makes the final overall weight It can balance the two dimensions of "current applicability" and "historical validity".
[0055] S45: The historical compensation strategies are weighted and averaged according to the aforementioned fusion weights to synthesize the optimal compensation strategy. The synthesis formula for the optimal compensation strategy is as follows: in This represents the optimal compensation strategy.
[0056] In practice, the first step is to analyze each historical compensation strategy. Specific parameters (including radial compensation gain) , and axial compensation gain Then, according to the calculated fusion weights... The corresponding parameters of all historical strategies are weighted and summed: The obtained optimal compensation strategy includes a set of optimized compensation parameters. These parameters combine the advantages of multiple historical strategies, adapting to the current risk situation while incorporating historical best practices, providing a precise parameter basis for continuous real-time compensation.
[0057] S5: Based on the predicted error vector, the optimal compensation strategy is collaboratively optimized to generate a compensation instruction, and the compensation instruction is sent to the CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
[0058] Specifically, step S5 includes the following steps: S51: Correlation analysis is performed on the radial prediction error and axial prediction error in the prediction error vector with the corresponding compensation components in the optimal compensation strategy to determine the potential influence coefficient of each prediction error component on the compensation effect.
[0059] In practice, the Pearson correlation coefficient analysis method is used to establish the prediction error components. With the optimal compensation strategy parameters The correlation model is used to determine the influence coefficient vector by calculating the correlation coefficient matrix between each error component in historical data and the compensated residual error. The formulas for calculating each influence coefficient vector are as follows: in, , and Representing radial ( The influence coefficients of the axial (z) error component and the axial (z) error component. , and These represent the prediction errors in the radial and axial directions, respectively. This indicates the calculation of covariance. To compensate for the residual error, , and These represent the variances of each error component. The calculation process uses a sliding window method, with the window size being the most recent 1000 data sets, to ensure the timeliness of the influence coefficients.
[0060] S52: Based on the potential impact coefficient, dynamically adjust the compensation component in the optimal compensation strategy to generate a preliminary optimized compensation strategy.
[0061] In this embodiment, a weighted adjustment algorithm is used to dynamically scale each compensation gain parameter according to the influence coefficient vector: in , and This indicates the adjusted compensation gain. To adjust the sensitivity coefficient, the default setting is 0.5. During the adjustment process, parameter boundary constraints are set to ensure that the adjusted gain parameter remains within a reasonable range. Simultaneously, a momentum term is introduced, retaining 20% of the weight of the previous adjustment direction to avoid drastic parameter fluctuations and ensure system stability.
[0062] S53: Extract the variation characteristics of each error component in the prediction error vector, combine them with the preliminary optimization compensation strategy, and fine-tune the model through the preset compensation strategy to generate the final optimization compensation strategy.
[0063] In practice, the temporal features (mean, variance, peak value) and frequency features (major frequency components, energy distribution) of the prediction error vector are first extracted, and then input into a pre-trained deep reinforcement learning fine-tuning model. This model employs an Actor-Critic architecture, where the Actor network takes the feature vector and initial policy parameters as input and outputs the policy adjustment amount. The Critic network evaluates the effectiveness of the adjusted policy. Through iterative optimization using the policy gradient algorithm, the finely adjusted compensation parameters are finally output. Depend on The final optimized compensation strategy is then formulated.
[0064] S54: Convert the final optimized compensation strategy into a compensation instruction format that can be recognized by the machine tool CNC system, generate compensation instructions, and send the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
[0065] In practice, the optimized compensation parameters are first encoded according to the FANUC CNC system's custom G-code format to generate an instruction sequence. Then, a secure connection is established with the CNC system via the OPC UA protocol, and SHA-256 digital signatures are used to ensure instruction integrity. Instruction transmission utilizes a real-time priority data transmission channel to ensure that compensation instructions reach the CNC system kernel for execution within 1ms. The system simultaneously monitors the instruction execution status; if an execution anomaly is detected, a rollback mechanism is immediately initiated to restore the system to the previous stable configuration, ensuring a safe and reliable machining process.
[0066] Example 2 This invention also provides a dynamic error compensation system for a gantry machining center spindle, used to execute a dynamic error compensation method for a gantry machining center spindle, with reference to... Figure 2 As shown, the compensation system includes: The data acquisition and modeling module 100 is used to acquire multi-source real-time sensor data of the current machine tool node spindle system and input it into a pre-built local uncertainty quantification model to generate a first uncertainty feature tuple containing a prediction error vector and uncertainty measurement.
[0067] The federated aggregation optimization module 200 is used to receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization.
[0068] The risk field strength calculation module 300 is used to calculate the real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence.
[0069] The strategy synthesis and generation module 400 is used to input the real-time risk field strength and the historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy.
[0070] The strategy optimization execution module 500 is used to perform collaborative optimization of the optimal compensation strategy based on the predicted error vector, generate compensation instructions, and send the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
[0071] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0072] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0073] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
Claims
1. A method for dynamic error compensation of a gantry machining center spindle, characterized in that, The compensation method includes the following steps: Collect multi-source real-time sensor data of the current machine tool node spindle system and input it into the pre-built local uncertainty quantification model to generate the first uncertainty feature tuple containing the prediction error vector and uncertainty measure; Receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization; Based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence, the real-time risk field strength is calculated. The real-time risk field strength and the historical compensation effectiveness data read from the local database are input into the dynamic strategy generator to synthesize the optimal compensation strategy. The optimal compensation strategy is collaboratively optimized based on the predicted error vector to generate a compensation instruction, which is then sent to the CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
2. The method for dynamic error compensation of a gantry machining center spindle according to claim 1, characterized in that, The process involves acquiring multi-source real-time sensor data from the current machine tool node spindle system and inputting it into a pre-built local uncertainty quantification model to generate a first uncertainty feature tuple containing a prediction error vector and uncertainty measurement, including: The multi-source real-time sensing data is composed of real-time data collected from eddy current displacement sensors, spindle servo drives, temperature sensors, and vibration sensors. The multi-source real-time sensing data is input into the pre-built local uncertainty quantification model for uncertainty quantification processing; The prediction error vector, which includes radial prediction error and axial prediction error, and the corresponding uncertainty metric output by the local uncertainty quantification model together constitute the first uncertainty feature tuple.
3. The method for dynamic error compensation of a gantry machining center spindle according to claim 2, characterized in that, The step of receiving the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generating a globally shared model through federated aggregation optimization, includes: Extract the prediction error vector and uncertainty measure contained in each second uncertainty feature tuple, and form a training sample set with the corresponding measured error label; Based on the training sample set, the weight parameters of the pre-trained global shared model are updated by the federated averaging algorithm aggregation process, wherein the federated averaging algorithm aggregation process includes: calculating the weighted average of the local model weight parameters of each machine tool node, wherein the weight coefficients are dynamically allocated according to the magnitude of the uncertainty metric of each node. Output the globally shared model with updated weight parameters.
4. The method for dynamic error compensation of a gantry machining center spindle according to claim 3, characterized in that, The calculation of real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence includes: Obtain the uncertainty measure and historical uncertainty data sequence of the current machine tool node; Calculate the moving average and moving standard deviation of the historical uncertainty data series; Based on the ratio of the moving standard deviation to the moving average, a risk sensitivity coefficient is generated in real time using a preset adaptive mapping function; The real-time risk field strength is calculated based on the uncertainty metric of the current machine tool node, the moving average value, and the risk sensitivity coefficient, wherein the calculation formula for the real-time risk field strength is: in Indicates the real-time risk field strength. Indicates the risk sensitivity coefficient. This represents a measure of the uncertainty at the current machine tool node. This represents the moving standard deviation.
5. The method for dynamic error compensation of a gantry machining center spindle according to claim 4, characterized in that, The step of inputting the real-time risk field strength and historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy includes: Historical compensation energy efficiency data is read from the local database, where each historical compensation energy efficiency data includes historical risk field strength, historical compensation strategy and compensation energy efficiency index; The similarity weights of each historical compensation energy efficiency data are calculated based on the real-time risk field strength and each historical risk field strength. The formula for calculating the similarity weights is as follows: in Indicates the first Similarity weights of historical compensation energy efficiency data Indicates the first The risk field strength of historical energy efficiency compensation data This indicates the preset bandwidth parameter. Represents an exponential function; The optimization score of each historical energy efficiency data point is calculated based on the aforementioned energy efficiency compensation index, wherein the formula for calculating the optimization score is as follows: in and They represent the first The optimality score and compensation efficiency index of historical compensation energy efficiency data. and These represent the maximum and minimum values of all historical energy efficiency compensation data, respectively. The fusion weight of each historical compensation strategy is calculated based on the similarity weight and the preference score, wherein the formula for calculating the fusion weight is: in Indicates the first The fusion weight of historical compensation energy efficiency data; The historical compensation strategies are weighted and averaged according to the aforementioned fusion weights to synthesize the optimal compensation strategy. The synthesis formula for the optimal compensation strategy is as follows: in This represents the optimal compensation strategy.
6. The method for dynamic error compensation of a gantry machining center spindle according to claim 5, characterized in that, The step of collaboratively optimizing the optimal compensation strategy based on the predicted error vector, generating compensation instructions, and sending the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error includes: The radial prediction error and axial prediction error in the prediction error vector are respectively correlated with the corresponding compensation components in the optimal compensation strategy to determine the potential influence coefficient of each prediction error component on the compensation effect. Based on the potential impact coefficient, the compensation component in the optimal compensation strategy is dynamically adjusted to generate a preliminary optimized compensation strategy. Extract the variation characteristics of each error component in the prediction error vector, combine them with the preliminary optimization compensation strategy, and fine-tune the model through the preset compensation strategy to generate the final optimization compensation strategy. The final optimized compensation strategy is converted into a compensation instruction format that can be recognized by the machine tool CNC system, a compensation instruction is generated, and the compensation instruction is sent to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
7. A dynamic error compensation system for a gantry machining center spindle, used to execute the dynamic error compensation method for a gantry machining center spindle as described in any one of claims 1 to 6, characterized in that, The compensation system includes: The data acquisition and modeling module is used to acquire multi-source real-time sensor data of the current machine tool node spindle system and input it into the pre-built local uncertainty quantification model to generate the first uncertainty feature tuple containing the prediction error vector and uncertainty measure. The federated aggregation optimization module is used to receive the second uncertainty feature tuple and its corresponding measured error label from other machine tool nodes in the federated network, and generate a globally shared model through federated aggregation optimization. The risk field strength calculation module is used to calculate the real-time risk field strength based on the uncertainty measure of the current machine tool node and the statistical characteristics of the acquired historical uncertainty data sequence. The strategy synthesis and generation module is used to input the real-time risk field strength and the historical compensation effectiveness data read from the local database into the dynamic strategy generator to synthesize the optimal compensation strategy. The strategy optimization execution module is used to perform collaborative optimization of the optimal compensation strategy based on the predicted error vector, generate compensation instructions, and send the compensation instructions to the machine tool CNC system of the current machine tool node for execution to compensate for the spindle dynamic error.
Citation Information
Patent Citations
CNN-BIGRU-A-based gantry machine tool overall real-time thermal error compensation method
CN119472503A
Situation awareness method and system for campus information system
CN119599841A
Portal frame milling machine error compensation system and method for achieving high-precision machining
CN120134064A
Precision machine tool thermal error compensation system based on MSIFN network
CN120406302A
Five-axis linkage numerical control machining dynamic error compensation system based on industrial control system
CN120491550A
Cited By
Machine tool dynamic error accurate compensation control method adaptive to complex cutting working conditions
CN121857525A