Numerical control machining dynamic error compensation method and system based on space-time attention mechanism
Through the space-time attention mechanism and the dynamic error compensation method of CNC machining coupled with multi-physics field, the problems of insufficient intelligence of process planning, lack of dynamic response capabilities and poor real-time error compensation in CNC machining are solved, and high-precision and efficient CNC machining effects are achieved.
Patent Information
- Application Number
- CN202510370954.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-08-01
AI Technical Summary
The existing CNC machining technology has problems such as insufficient intelligence in process planning, lack of dynamic response capabilities and poor real-time error compensation, which leads to the prolonged preparation period of complex surface processing, increased scrap rate and surface corrugation defects that are difficult to suppress.
Synchronous acquisition of multi-source sensing data based on spatiotemporal attention mechanism, construction of spatiotemporal feature tensors and multi-error coupling weight calculation, combined with FPGA hardware accelerator to realize real-time compensation amount generation and closed-loop control, and extract spatial and temporal features through graph convolution network and causal convolution, generate dynamic error compensation amounts and perform hardware accelerated execution.
High-frequency vibration suppression, accurate thermal deformation compensation and tool slanting control are realized, which improves processing accuracy and efficiency, reduces energy consumption, and improves processing yield and equipment utilization.
Smart Images

Figure CN120406299A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field, and specifically to a dynamic error compensation method and system for numerical control machining based on a spatio-temporal attention mechanism. Background Art
[0002] As the core means of advanced manufacturing, the accuracy and efficiency of numerical control machining technology directly affect the performance of high-end equipment. The current mainstream numerical control systems face three major technical bottlenecks:
[0003] Insufficient intelligent process planning: The machining of complex curved surfaces relies on manual experience programming and requires repeated trial cuts for verification, resulting in a preparation cycle extension of more than 40% (taking the machining of aircraft structural parts as an example);
[0004] Lack of dynamic response ability: Fixed cutting parameters are difficult to adapt to time-varying factors such as tool wear and thermal deformation, resulting in a scrap rate increase of 15 - 20% (ISO 3685 standard test);
[0005] Poor real-time error compensation: Traditional PID compensation has a delay of more than 200 ms and cannot effectively suppress surface ripple defects (amplitude residue ≥ 5 μm) caused by high-frequency vibration (> 100 Hz).
[0006] Therefore, a dynamic error compensation method and system for numerical control machining based on a spatio-temporal attention mechanism are needed to solve the above problems. Summary of the Invention
[0007] In order to solve the problems of the prior art, the present invention provides a dynamic error compensation method and system for numerical control machining based on a spatio-temporal attention mechanism.
[0008] In order to solve the above technical problems, the present invention is realized through the following technical solutions: In the first aspect, a dynamic error compensation method for numerical control machining based on a spatio-temporal attention mechanism includes the following steps:
[0009] S1: Synchronous acquisition of multi-source sensing data:
[0010] Through a 9-axis MEMS vibration sensor array, an infrared thermal imager, and an acoustic emission sensor deployed on the machine tool spindle, guide rail, and tool clamping end, the vibration acceleration signal, temperature distribution field, and acoustic emission characteristics during the machining process are collected in real time;
[0011] S2: Construction of spatio-temporal feature tensors:
[0012] The vibration signal obtained in step S1 is decomposed by wavelet packet to extract 6 sub-band energy features. The temperature field data is used to generate a machine tool thermal deformation gradient matrix through bicubic interpolation. The root mean square value, kurtosis index, and impact count of the acoustic emission signal are extracted and fused into a three-dimensional spatio-temporal feature tensor;
[0013] S3: Multi-error coupling weight calculation:
[0014] Input the spatio-temporal feature tensor into the spatio-temporal attention network, which includes:
[0015] Spatial attention module: Use a graph convolutional network to establish a spatial position association model for the machine tool structural parts;
[0016] Temporal attention module: Extract the time-varying feature correlation through causal convolution;
[0017] Output the thermal deformation error weight matrix W_T(x, y, z, t), vibration error weight matrix W_V(x, y, z, t), and tool yaw weight matrix W_B(x, y, z, t), satisfying Σ(W_T + W_V + W_B) = 1;
[0018] S4: Dynamic compensation vector generation:
[0019] Calculate the real-time compensation amount according to the following formula:
[0020] δ_comp(x, y, z, t) = W_T·ΔT·α + W_V·(a_x, a_y, a_z)·β + W_B·θ_tool·γ;
[0021] Where α, β, and γ are the thermal expansion coefficient, vibration transfer function, and tool stiffness matrix respectively;
[0022] S5: Hardware-accelerated compensation execution:
[0023] Through the parallel pipeline architecture of the FPGA hardware accelerator, complete the mapping calculation of the compensation amount to the X / Y / Z axes of the machine tool coordinate system within 5 ms, generate the G-code correction instruction and write it into the CNC interpolator to form a closed-loop control.
[0024] In this application, specifically: Multi-source sensing data synchronous acquisition and preprocessing
[0025] ① Sensor array deployment:
[0026] Uniformly distribute 3 groups of three-axis MEMS vibration sensors (range ±50g, resonant frequency 32 kHz) circumferentially on the flange of the machine tool spindle
[0027] Install a dual-spectrum infrared thermal imager (temperature measurement range 0 - 200 °C, spatial resolution 640 × 480) on the side of the workbench guide rail
[0028] Install a broadband acoustic emission sensor (frequency response 50k - 1MHz) at 200 mm from the tool clamping end
[0029] ② Signal synchronous acquisition:
[0030] Multi - sensor data synchronization is achieved through the IEEE 1588 Precision Time Protocol, and the sampling parameters are as follows:
[0031] Vibration signal: Sampling rate of 50 kHz, 16 - bit ADC quantization;
[0032] Temperature field: Refresh rate of 10 Hz, resolution of 0.1 °C;
[0033] Acoustic emission: Sampling rate of 1 MHz, high - pass filter cut - off frequency of 80 kHz;
[0034] (2) Construction of spatio - temporal feature tensor
[0035] Define a three - dimensional spatio - temporal feature tensor \(T\in\mathbb{R}^{N\times M\times3}\), where:
[0036] \(N =\) Length of the time series (taking a sliding window of 0.1 s corresponding to 5000 points);
[0037] \(M =\) Number of spatial nodes (divided into 12 key regions according to the machine tool structure);
[0038] Channel dimension: Vibration energy feature (reconstructed after 6 - layer wavelet packet decomposition), temperature gradient \(\Delta T_{x,y,z}\), RMS value of acoustic emission;
[0039] (3) Calculation of multi - error coupling weights
[0040] The spatio - temporal attention network consists of the following sub - modules:
[0041] ① Spatial attention branch:
[0042] Adopt a graph convolutional network (GCN), and the node feature update formula is:
[0043] \(h_i^{(l + 1)}=\sigma(\sum_{j\in N(i)}
[0044] W^{(l)}\cdot[h_i^{(l)}||h_j^{(l)}||e_{ij}])
[0045] where \(e_{ij}\) is the element of the stiffness correlation matrix between machine tool structural parts \(i\) and \(j\)
[0046] ② Temporal attention branch:
[0047] The causal convolution layer extracts temporal features, and the attention weight calculation is:
[0048] \(\alpha_t=\text{softmax}(QK^T / \sqrt{d})\);
[0049] where \(Q\) is the feature at the current moment, \(K\) is the feature at the historical moment, and \(d\) is the feature dimension;
[0050] ③ Weight fusion:
[0051] Fusing Spatial and Temporal Weights through a Gating Mechanism:
[0052] W_T = σ(W_s·W_{space}+W_t·W_{time}+b);
[0053] where W_s and W_t are learnable parameters, and σ is the sigmoid activation function;
[0054] (4) Dynamic Compensation Vector Generation
[0055] Real-time compensation amount calculation formula:
[0056] δ_comp(x,y,z,t) = (W_T⊙ΔT)·α+(W_V⊙a)·β+(W_B⊙θ)·γ
[0057] where:
[0058] - ⊙ represents the Hadamard product
[0059] - α = [α_x,α_y,α_z]^T is the thermal expansion coefficient matrix, obtained by querying the material library
[0060] - β = diag(β_xx,β_yy,β_zz) is the vibration transfer matrix, calibrated by the hammering method modal experiment
[0061] - γ = [γ_1,γ_2,γ_3] is the tool stiffness vector, matched according to the tool model database
[0062] (5) Hardware-accelerated Compensation Execution
[0063] FPGA implementation architecture:
[0064] Parallel pipeline design: Simultaneously process the compensation amount calculations for the X / Y / Z axes;
[0065] Computing core configuration:
[0066] Floating-point arithmetic unit: 32-bit single precision, 6-stage pipeline;
[0067] Clock frequency: 200 MHz;
[0068] Compensation period: 5 ms (corresponding to 2.4×10^6 multiply-accumulate operations per cycle);
[0069] Compensation instruction generation: Convert δ_comp to G-code correction instructions (format: G01X[Δx]Y[Δy]Z[Δz]F[feedrate]).
[0070] In a specific implementation manner of the first aspect, in step S3, the spatio-temporal attention network adopts a physical constraint training strategy:
[0071] Introduce the cutting dynamics equation into the network loss function:
[0072] L_total = L_pred + λ·(F_cut - K_t·f_z·a_p)^2
[0073] Where F_cut is the predicted cutting force, K_t is the material property coefficient, f_z is the feed per tooth, a_p is the cutting depth, and λ is the constraint weight coefficient.
[0074] In a specific implementation, the generation of the compensation vector in step (4) includes the modification of the machine tool structure mode:
[0075] Superimpose the machine tool modal transfer function H(ω) on the vibration error term:
[0076] β = β_0·|H(ω)|, where ω is the frequency point corresponding to the current spindle speed extracted by FFT.
[0077] In a second aspect, a dynamic error compensation system for implementing the method according to any one of claims 1-3 includes:
[0078] Multi-source sensing module: including a 9-axis vibration sensor array, an infrared thermal imager, and an acoustic emission sensor arranged according to the machine tool dynamics characteristics;
[0079] Edge computing unit: integrating an FPGA chip and a DDR4 memory, and configured with a spatio-temporal attention network hardware acceleration IP core;
[0080] Compensation execution module: including a CNC instruction correction interface and a servo drive parameter real-time adjustment unit;
[0081] Cloud platform: deploying a digital twin model and an LSTM-Transformer hybrid prediction algorithm for parameter update of the spatio-temporal attention network.
[0082] In a specific implementation of the second aspect, the edge computing unit adopts a heterogeneous computing architecture:
[0083] The FPGA is responsible for the forward inference calculation of the spatio-temporal attention network;
[0084] The ARM Cortex-A53 processor is responsible for sensor data preprocessing and communication protocol conversion;
[0085] The two perform high-speed data interaction at 8GB / s through the AXI-Stream bus.
[0086] In a specific implementation of the second aspect, the arrangement of the multi-source sensing module satisfies:
[0087] Vibration sensors are distributed at equal ratio sequence intervals along the X / Y / Z axes of the machine tool. The thermal imager is focused on the spindle-guide contact area. The acoustic emission sensor is fixed within a range of 200 mm from the tool clamping end through a magnetic adsorption device.
[0088] The beneficial effects of the present invention are as follows:
[0089] 1. Through the deep integration of the spatio-temporal attention mechanism and the multi-physical field coupling compensation technology, the present invention has pioneered the construction of an "awareness - decision - execution" integrated intelligent compensation system, achieving a breakthrough innovation in both technical performance and industrial application dimensions. At the technical level, based on the 5ms-level closed-loop compensation accelerated by FPGA hardware (40 times faster than traditional methods) and the dynamic weight allocation of the spatio-temporal attention network, the collaborative problems of high-frequency vibration suppression (amplitude reduced by 65%), precise thermal deformation compensation (0.1μm / °C), and tool yaw control (error < 3μm) have been overcome. The machining profile accuracy of titanium alloy thin-walled parts has been improved to ±2.3μm, and the surface roughness Ra has reached 0.28μm (ISO 4288). At the same time, relying on the physics-informed neural network (PINN), the dynamic optimization of cutting parameters at the 10Hz level has been realized, with a 22% increase in machining efficiency and a 15% reduction in energy consumption.
[0090] 2. This technology promotes a deep transformation of the manufacturing process chain: in the aerospace field, the manual grinding time of titanium alloy structural parts is reduced by 83%, and the cost per piece is saved by more than $2,200; in the automotive mold manufacturing, the mating clearance of the parting surface is compressed to ±3μm, and the mold life is increased by 3 times; moreover, through the transformation mode of "old machine tool + intelligent edge node" (the transformation cost is only 15% of the cost of newly purchased equipment), the machining accuracy of ordinary machine tools is comparable to that of international high-end equipment (the error difference < 0.5μm), providing a quantifiable and replicable new paradigm for precision manufacturing in strategic fields such as semiconductor lithography machine guides and rocket engine turbine disks. Verified by 10 leading enterprises, this technology has promoted the yield rate to leap from 78% to 98% in the mass production of 36 types of complex parts, with significant economic benefits and value in reconstructing industry standards. [[ID=??]] Description of the Drawings
[0091] Figure 1 is a schematic diagram of the present invention.
[0092] Figure 2 is a block diagram of the system architecture of the present invention.
[0093] Figure 3 is a schematic diagram of the method flow of the present invention.
[0094] Figure 4 is a schematic diagram of the spatio-temporal attention network structure of the present invention.
[0095] Figure 5 is a schematic diagram of the compensation execution process of the present invention. Note: There seems to be an error in the original text where "??" is used instead of "10" in the "ID" for the line starting with "2. This technology promotes a deep transformation of the manufacturing process chain...". It has been left as is in the translation for the sake of following the instructions precisely, but it should be noted for the original text.
[0096] Figures 1 to 5 Among them: 110, multi-source sensing module; 120, edge computing unit; 130, compensation execution module; 140, cloud platform. Specific implementation manner
[0097] Next, in combination with the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0098] As Figures 1 to 5 shown, a numerical control machining dynamic error compensation method and system based on a spatio-temporal attention mechanism.
[0099] 1. Implementation environment configuration
[0100] 1.1 Hardware platform
[0101] Implement this solution on a DMG MORI NHX5000 five-axis machining center, and the specific configuration is as follows:
[0102] Sensor array:
[0103] Install three groups of ADI ADXL1002 three-axis vibration sensors (range ±50g, bandwidth 11kHz) on the spindle flange
[0104] Deploy a FLIR A655sc infrared thermal imager (frame rate 10Hz, thermal sensitivity 0.03°C) on the side of the guide rail
[0105] Install a WD type acoustic emission sensor (resonant frequency 150kHz) of Physical Acoustics Corporation on the tool holder
[0106] Edge computing unit:
[0107] Xilinx Zynq UltraScale+ XCZU19EG FPGA chip
[0108] 4×8GB DDR4-2400 ECC memory, 256GB NVMe solid-state storage
[0109] Real-time operating system: Wind River VxWorks 7
[0110] Actuator:
[0111] Siemens 840D CNC system
[0112] Servo drive module (maximum feed speed 60m / min)
[0113] 1.2 Software Configuration
[0114] Algorithm Framework:
[0115] Spatio-temporal Attention Network: PyTorch 1.10 + FPGA Acceleration Library Vitis AI 2.5
[0116] Digital Twin Model: Construct a multi-body dynamics model of the machine tool based on Adams 2022
[0117] Database:
[0118] Coefficient Library of Thermal Expansion of Materials (including TC4 Titanium Alloy α = 8.6×10 -6 / ℃)
[0119] Tool Stiffness Database (Sandvik Coromant Tool Catalog)
[0120] 2. Method Examples
[0121] 2.1 Data Acquisition and Feature Construction
[0122] Step 1: Synchronous Acquisition of Multi-source Signals
[0123] Realize time synchronization through the IEEE 1588 protocol, parameter settings:
[0124] Vibration signal: Sampling at 50kHz, 4th-order Butterworth filter (1 - 20kHz) Temperature field: Refreshing at 10Hz, bicubic interpolation to generate a 0.1mm grid Acoustic emission: Sampling at 1MHz, 80kHz high-pass filter
[0125] Step 2: Generation of Spatio-temporal Feature Tensor
[0126] Construct a three-dimensional tensor T ∈ R^{5000×12×3}:
[0127] Time dimension: 5000 points (corresponding to a 0.1s time window)
[0128] Spatial nodes: 12 key regions (including spindle bearings, X / Y / Z guide rail sliders) Feature channels:
[0129] Vibration energy: Proportion of sub-band energy in the 1.5 - 20kHz band after 6-layer wavelet packet decomposition Temperature gradient: (Calculation step 0.5mm)
[0130] Acoustic emission feature: RMS value (window length 100μs), kurtosis index K > 4 alarm 2.2 Spatio-temporal Attention Network Training
[0131] Network Structure:
[0132]
[0133]
[0134] Training strategy:
[0135] Loss function: L_total = MSE(δ_pred, δ_true) + 0.5·||F_cut - 2400·f_z·a_p||2
[0136] Data augmentation: Add Gaussian noise with SNR = 35dB to simulate 20 - 80% tool wear
[0137] Training results: Trained for 200 epochs on NVIDIA A100, validation set MAE = 0.82μm
[0138] 2.3 Real - time compensation execution
[0139] FPGA logic design:
[0140] 3. Experimental verification
[0141] 3.1 Test conditions
[0142] Specimen: TC4 titanium alloy aerospace structural part (profile tolerance requirement ±5μm)
[0143] Machining parameters:
[0144] Spindle speed: 8000rpm
[0145] Cutting depth: 0.3mm
[0146] Feed rate: 4000mm / min
[0147] Comparison scheme:
[0148] Traditional PID compensation (built - in FANUC system)
[0149] Laser interferometer off - line compensation.
[0150] 3.2 Performance indicators
[0151]
[0152] 3.3 Key data sources
[0153] Vibration suppression effect: By analyzing the spindle vibration spectrum through FFT, the amplitude at 200Hz decreases from 15.2μm to 5.3μm (a 65% reduction);
[0154] Thermal deformation compensation: The spindle temperature rise ΔT = 8.5℃ measured by an infrared thermal imager, and the axial elongation error decreases from 7.2μm to 0.8μm after compensation;
[0155] Energy consumption comparison: The energy consumption for processing the same workpiece is reduced by 15% (measured by the Fluke 1738 power meter).
[0156] 4. Typical application scenarios
[0157] 4.1 Machining of thin-walled parts in aerospace
[0158] In the machining of wing ribs of Boeing 787:
[0159] Implementation effect:
[0160] The manual polishing man-hour is reduced by 83% (originally 4 hours per piece)
[0161] Avoid material scrap caused by deformation out of tolerance (cost savings of $2200 per piece).
[0162] 4.2 Precision die manufacturing
[0163] Applied to the machining of automotive panel dies:
[0164] Process parameters:
[0165] Material: NAK80 die steel (HRC 40 - 42)
[0166] Tool: φ6mm ball-end milling cutter
[0167] Effect:
[0168] The edge clarity is improved to IT4 level (originally IT6)
[0169] The fit clearance of the parting surface ≤ 3μm.
[0170] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A dynamic error compensation method for numerical control machining based on spatio-temporal attention mechanism, characterized in that, It includes the following steps: S1: Synchronous acquisition of multi-source sensing data: Through a 9-axis MEMS vibration sensor array, an infrared thermal imager, and an acoustic emission sensor deployed on the machine tool spindle, guide rail, and tool clamping end, the vibration acceleration signal, temperature distribution field, and acoustic emission characteristics during the machining process are collected in real time; S2: Construction of spatio-temporal feature tensor: The vibration signal obtained in step S1 is decomposed by wavelet packet to extract 6 sub-band energy features. The temperature field data generates a machine tool thermal deformation gradient matrix through bicubic interpolation. The root mean square value, kurtosis index, and impact count are extracted from the acoustic emission signal and fused into a three-dimensional spatio-temporal feature tensor; S3: Calculation of multi-error coupling weights: Input the spatio-temporal feature tensor into the spatio-temporal attention network, and the network includes: Spatial attention module: Use a graph convolutional network to establish a spatial position correlation model of the machine tool structural parts; Temporal attention module: Extract the time-varying feature correlation through causal convolution; Output the thermal deformation error weight matrix W_T(x,y,z,t), vibration error weight matrix W_V(x,y,z,t), and tool yaw weight matrix W_B(x,y,z,t), satisfying Σ(W_T+W_V+W_B)=1; S4: Generation of dynamic compensation vector: Calculate the real-time compensation amount according to the following formula: δ_comp(x,y,z,t)=W_T·ΔT·α+W_V·(a_x,a_y,a_z)·β+W_B·θ_tool·γ; Where α, β, and γ are the thermal expansion coefficient, vibration transfer function, and tool stiffness matrix respectively; S5: Hardware-accelerated compensation execution: Through the parallel pipeline architecture of the FPGA hardware accelerator, the mapping calculation of the compensation amount to the X / Y / Z axes of the machine tool coordinate system is completed within 5 ms, generating a G-code correction instruction and writing it into the CNC interpolator to form a closed-loop control.
2. The method according to claim 1, wherein In step S3, the spatio-temporal attention network adopts a physical constraint training strategy: Introduce the cutting dynamics equation into the network loss function: L_total = L_pred + λ·(F_cut - K_t·f_z·a_p)^2 Where F_cut is the predicted cutting force, K_t is the material property coefficient, f_z is the feed per tooth, a_p is the cutting depth, and λ is the constraint weight coefficient.
3. The method according to claim 1, wherein In step (4), the generation of the compensation vector includes the modification of the machine tool structure mode: Superimpose the machine tool modal transfer function H(ω) on the vibration error term: β = β_0·|H(ω)|, where ω is the frequency point corresponding to the current spindle speed extracted by FFT.
4. A dynamic error compensation system for implementing the method according to any one of claims 1-3, characterized in that, It includes: Multi-source sensing module (110): Includes a 9-axis vibration sensor array, an infrared thermal imager, and an acoustic emission sensor arranged according to the machine tool dynamics characteristics; Edge computing unit (120): Integrates an FPGA chip and DDR4 memory, and is configured with a spatio-temporal attention network hardware acceleration IP core; Compensation execution module (130): Includes a CNC instruction correction interface and a servo drive parameter real-time adjustment unit; Cloud platform (140): Deploys a digital twin model and an LSTM-Transformer hybrid prediction algorithm for parameter update of the spatio-temporal attention network.
5. The system according to claim 4, characterized in that, The edge computing unit (120) adopts a heterogeneous computing architecture: The FPGA is responsible for the forward inference calculation of the spatio-temporal attention network; The ARM Cortex-A53 processor is responsible for sensor data preprocessing and communication protocol conversion; The two perform high-speed data interaction at 8 GB / s through the AXI-Stream bus.
6. The system according to claim 4, wherein The arrangement of the multi-source sensing module (110) satisfies: Vibration sensors are distributed at equal ratio series intervals along the X / Y / Z axes of the machine tool, the thermal imager is focused on the spindle-guide contact area, and the acoustic emission sensor is fixed within a range of 200 mm from the tool holder through a magnetic attraction device.
Citation Information
Cited By
Precise compensation method of composite numerical control machine tool
CN120972769A
Cutter position detection system and intelligent adjusting system of gantry forming grinding machine
CN121199836A
A tool position detection system and intelligent adjustment system of a gantry forming grinding machine
CN121199836B
Dynamic error compensation and control method and system in multi-axis linkage tool machining
CN122194845A