Digital-twin-based data acquisition system for numerical control machining center
Patent Information
- Application Number
- CN202611140994.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-13
AI Technical Summary
[0005]本发明提供一种基于数字孪生的数控加工中心数据采集系统,解决相关技术中数控内部工艺事件缺乏可信时刻导致高频信号在程序段切换过渡瞬间错标归属、多源异构时间轴无法在物理约束下统一对齐,以及现场丢包后缺失段波形补全与切削物理不一致的技术问题
[0038]解决了数控内部工艺事件缺乏可信时刻导致高频信号在程序段切换过渡瞬间错标归属的问题。通过孪生运动学正向解算生成各程序段切换的挂钟窗口先验与过渡形态参数,以形态参数合成参数化模板作为交叉注意力的query引导双分支卷积网络在窗口内精定位内生锚点,再联合数控粗锚点与孪生预测时刻在物理可行间隔约束下经三源带约束动态规划对齐建立工艺时间轴映射,使过渡瞬间的高频样本能够被准确归属到真实所属程序段,消除因程序段切换时刻不可知导致的数据错标;
Smart Images

Figure CN122902409A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC center data acquisition and digital twin technology, and more specifically, to a CNC machining center data acquisition system based on digital twin. Background Technology
[0002] CNC machining centers are widely used in the milling of high-precision parts in aerospace, automotive, and other fields. With the promotion of digital twin technology, industrial sites need to input vibration, current, temperature, and the internal status of the CNC machine into the digital twin in real time, so that the twin can realize chatter early warning, tool wear assessment, and thermal error compensation. The premise for realizing the above functions is that the multi-source acquired data can be accurately attributed to the corresponding program segment and tool position conditions; otherwise, the diagnostic conclusions of the digital twin will be based on misaligned causal relationships.
[0003] Existing CNC machining centers generally face the problem of two misaligned clocks: the edge acquisition card timestamps the signals of each channel using a high-frequency crystal oscillator, while the internal clock of the CNC system is only exposed externally in a polling and answering manner. The interface only returns the program segment line number at the current query time, not the actual time when the line number switch occurs. Existing solutions include introducing a precise time protocol for clock synchronization, linear interpolation of the CNC status, and using servo current template matching to detect switching events. However, none of these methods can obtain the actual time of occurrence of internal CNC process events, and the problem of mislabeling of high-frequency signals still exists during the transition between program segments.
[0004] To address the aforementioned issues, this invention proposes a data acquisition system for CNC machining centers based on digital twins. This system generates prior and transitional morphological parameters of a clock window for anticipated events through forward computation of twin kinematics. Endogenous anchor points are detected via cross-attention detection using a dual-branch convolutional network and twin morphological templates. Finally, a process timeline mapping is established through three-source constrained dynamic programming alignment, achieving accurate correlation between multi-source data and the process phase of the program segment. Summary of the Invention
[0005] This invention provides a data acquisition system for CNC machining centers based on digital twins, which solves the technical problems in related technologies, such as the lack of reliable moments of internal process events in CNC, resulting in mislabeling of high-frequency signals during program segment switching transitions, the inability to uniformly align multi-source heterogeneous time axes under physical constraints, and the inconsistency between waveform completion of missing segments and cutting physics after packet loss on site.
[0006] This invention provides a data acquisition system for CNC machining centers based on digital twins, comprising:
[0007] The signal input module collects vibration, current, temperature and internal state signals of the CNC machining center, and outputs a multi-channel data stream with acquisition time and a CNC state sequence with confidence label after edge timestamp annotation and channel buffering.
[0008] The kinematics calculation module feeds the CNC program text and CNC state sequence into the digital twin kinematics model for forward calculation, predicts the process timing and transition parameters of each switch, and outputs the expected event sequence, the clock window prior, the feasible interval of the process interval, and the machining criticality.
[0009] The anchor point detection and alignment module detects endogenous anchor points from the multi-channel data stream through a dual-branch anchor point detection network and twin morphology template cross-attention under the prior constraints of the wall clock window. It then aligns the CNC coarse anchor points through dynamic programming with three-source band constraints, and outputs the process time axis mapping and sample-by-sample phase assignment.
[0010] The hierarchical compression module performs hierarchical retention and thinning compression on the multi-channel data stream based on the sample-by-sample phase assignment and processing criticality, and outputs a simplified data stream.
[0011] The completion and calibration module uses a twin cutting force physical model to generate the expected envelope as the physical baseline for the missing segments of the simplified data stream. The missing waveform is reconstructed and the virtual-real deviation is calibrated under the constraints of the physical feasible region through a physical constraint residual completion network, and the completion data and deviation amount are output.
[0012] The closed-loop module writes the completed data and deviation into the twin program segment slot according to the process phase, and uses the deviation to make bounded corrections to the twin parameters, outputting twin state data consistent with the physical processing process.
[0013] In a preferred embodiment, in the signal access module, the polling thread synchronously records the sending time and the response completion time for each CNC interface request, and the difference between the two is used as the response time.
[0014] The average of all response times over a period of time, plus a preset multiple of the standard deviation, is used as the threshold for judging response anomalies. Records exceeding the corresponding threshold are marked as having weak time credibility, so that the anchor point detection and alignment module can adjust the weight of the corresponding record when constraining alignment.
[0015] In a preferred embodiment, the coarse anchoring in the kinematics calculation module is performed as follows: extract two adjacent records whose row numbers change from the CNC state sequence, and take the midpoint of the reading time of the two records as the CNC coarse anchor point of the switch.
[0016] After filtering out records whose response time exceeds the response anomaly judgment threshold, the process relative time corresponding to the retained CNC coarse anchor point is fitted with the clock midpoint time using least squares linear fitting. This linear mapping is used to project the process relative time of each expected switch onto the clock axis as the prior center of the clock window.
[0017] The a priori width of the clock window is determined by adding the inverse term of the instruction feed rate near the switch to the uncertain term determined by the CNC polling cycle and the standard deviation of the historical response time, and a lower limit is set that is not less than a preset multiple of the polling cycle.
[0018] In a preferred embodiment, the input of the dual-branch anchor point detection network in the anchor point detection and alignment module is a four-channel short sequence extracted from the prior corresponding interval of the clock window, wherein the four channels are the main shaft current, the synthetic feed current, the vibration envelope, and the vibration kurtosis, respectively.
[0019] The network includes a current branch and a vibration branch. The current branch receives the spindle current and the synthesized feed current, and then performs multi-layer convolution with stride to progressively reduce the time dimension and expand the channel dimension. The vibration branch receives the vibration envelope and vibration kurtosis, and after being processed by convolution with fewer layers than the current branch, the time dimension and channel dimension are aligned with the current branch through channel-level convolution and stride convolution.
[0020] After alignment, the fused tensor is obtained by adaptive gating and weighted summation. The gating value is obtained by mapping the sliding mean of the kurtosis channel of the vibration branch to Sigmoid. The stronger the flutter, the lower the weight of the vibration branch.
[0021] In a preferred embodiment, the fused tensor is enhanced by a twin morphological template cross-attention module before being fed into the output head;
[0022] The corresponding module discretizes the current step amplitude, rise time and overshoot ratio in the transition mode parameters into a parameterized template sequence according to the servo equivalent second-order underdamped step response, and uses it as a query through linear projection and fuses the tensor as the key and value.
[0023] The query and key are used to perform a dot product attention calculation in the time dimension to obtain the attention weight distribution. The attention output is added to the fusion tensor residual to obtain the enhanced feature. The index of the maximum attention weight in the time regression head of the output header is multiplied by the sampling interval to obtain the coarse time base address. The fine offset relative to the coarse time base address is superimposed to obtain the final anchor time.
[0024] In a preferred embodiment, in the three-source band constrained dynamic programming alignment, the clock time is solved for each expected event, and the optimization objective includes three distance terms: the signal term calculates the Huber loss of the difference between the time to be determined and the anchor point time, the twin term calculates the Huber loss of the difference between the time to be determined and the prior center of the clock window, and the numerical control term calculates the Huber loss of the difference between the time to be determined and the numerical control coarse anchor point.
[0025] The signal item weight is taken as the confidence value of the corresponding anchor point, and it degenerates to zero when the confidence value is lower than the preset threshold; the CNC item weight is automatically reduced for records whose response time exceeds the threshold; the solution satisfies two hard constraints: the events are ordered, and the interval between adjacent events falls within the feasible range of the process interval.
[0026] In a preferred embodiment, in the hierarchical compression module, the high-criticality segment retains all original sampling points and performs near-lossless compression, the medium-criticality segment is thinned at equal intervals by integer multiple factors and then compressed by quantization bit width truncation, and the low-criticality segment is thinned by a larger integer multiple factor and only retains summary information.
[0027] The thinning factor of different phase intervals within the same program segment is adjusted accordingly with the phase change of the thin-wall overhang factor in the processing criticality; a transition buffer is set at the junction of adjacent segments, and the buffer length is a preset multiple of the rise time of the switching event at the junction.
[0028] In a preferred embodiment, in the completion and calibration module, the low criticality segment is compressed in stages and only the summative amount is retained. The packet loss in the corresponding segment is directly filled with the expected average value of twin cutting force and does not enter the waveform reconstruction process.
[0029] When the missing length does not exceed the preset ratio threshold, the real samples at both ends of the missing length are used as boundary conditions. The objective function consists of three terms: the second penalty for smooth connection between the reconstructed waveform and the boundary, the second-order difference square accumulation smoothing term, and the point-by-point second penalty for the part that deviates from the physical feasible region. The constrained spline reconstruction is solved by ADMM iteration.
[0030] When the missing length exceeds a preset ratio threshold, a physical constraint residual completion network based on a bidirectional Mamba encoding and decoding structure is activated. The network prediction target is the residual of the real waveform relative to the physical baseline, and the final completed waveform is the sum of the expected envelope and the network output residual.
[0031] In a preferred embodiment, the loss function of the physical constraint residual completion network consists of three weighted terms in the residual space: the reconstruction loss is accumulated point by point according to Huber loss for the difference between the network output residual and the true residual;
[0032] The physical consistency loss is achieved by adding the network output residual back to the expected envelope and then accumulating the samples that deviate from the upper and lower bounds of the physical feasible region point by point according to the square of the out-of-bounds amount.
[0033] The smoothing loss is accumulated by the second-order difference squared of the network output residuals; the network ends by applying tanh activation to the residuals and multiplying them by a scalar of the learnable magnitude upper bound to force the residual magnitude to be bounded.
[0034] In a preferred embodiment, in the closed-loop writing module, each piece of data, along with the program segment affiliation, intra-segment phase, tool number, and process parameters, is written into the corresponding program segment slot of the twin.
[0035] Temperature data is mapped to the corresponding process phase via the process time axis and then written into the thermal state slot of the twin; a confidence label is added to weak anchor points or completed data.
[0036] During closed-loop correction, the deviation is aggregated according to the program segment and tool number, and a single-step bounded correction is performed on the kinematic solution parameters and cutting force model parameters. After correction, the parameters are fed back to the kinematic solution module for the next round of solution.
[0037] The beneficial effects of this invention are as follows:
[0038] This invention addresses the problem of mislabeling of high-frequency signals during program segment transitions due to the lack of reliable timing for internal CNC process events. It generates prior clock windows and transition morphological parameters for each program segment transition through forward computation of twin kinematics. A parameterized template synthesized from these morphological parameters serves as the query for cross-attention, guiding a dual-branch convolutional network to precisely locate intrinsic anchor points within the window. Then, by combining the CNC coarse anchor points with the twin predicted timing under physically feasible interval constraints and through dynamic programming with three-source-band constraints, a process timeline mapping is established. This ensures that high-frequency samples during transitions can be accurately assigned to their true program segments, eliminating data mislabeling caused by the unknowable timing of program segment transitions.
[0039] This solution addresses the issue of physical inconsistencies in waveform completion caused by packet loss during on-site processing. A twin cutting force physical model is used to calculate the expected envelopes of current and vibration phase-by-phase according to the operating conditions, serving as the physical baseline. The target for missing segment reconstruction is set as the residual of the actual waveform relative to the physical baseline. The residual prediction network completes the reconstruction under the constraints of the physical feasible region and calibrates the virtual-real deviation based on subsequent recovered data, ensuring physical consistency and traceability of the completion results. The completed data and deviation are written into the twin after bounded closed-loop correction, guaranteeing continuous self-correction of twin parameters according to the machining status. Attached Figure Description
[0040] Figure 1 This is a block diagram of a CNC machining center data acquisition system based on digital twins according to the present invention;
[0041] Figure 2 This is a flowchart of a CNC machining center data acquisition system based on digital twins according to the present invention. Detailed Implementation
[0042] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, some features described in the examples may be combined in other examples.
[0043] At least one embodiment of this invention discloses a data acquisition system for CNC machining centers based on digital twins. The system can be summarized as follows: first, establish the axis; then, use the axis. The axis establishment step is the core: the signal access module completes synchronous access and edge buffering of multi-source signals; the kinematics calculation module uses the twin to perform forward kinematics deduction to provide the expected event sequence and window priors; the anchor point detection and alignment module detects endogenous anchor points in high-frequency signals under window constraints and completes three-source band constraint alignment, outputting the process time axis. The axis use step unfolds accordingly: the hierarchical compression module performs adaptive sampling and compression according to the process phase and twin criticality; the completion and calibration module performs physical consistency completion and calibrates twin parameters using the twin cutting force expectation envelope; and the closed-loop writing module writes to the twin according to the process phase and updates the twin model through edge-cloud collaborative closed-loop updates. This chain mechanism blocks the source of mislabeling in the transition zone and pushes the twin from a passive visualization role to an active participant in data acquisition. Figures 1 to 2 As shown, it includes:
[0044] The signal input module collects vibration, current, temperature and internal state signals of the CNC machining center, and outputs a multi-channel data stream with acquisition time and a CNC state sequence with confidence label after edge timestamp annotation and channel buffering.
[0045] In one embodiment of the present invention, all signals from the machine tool are uniformly received, and the acquisition time is marked and then buffered. Specifically, the inputs are divided into three categories: the first category is external sensor signals, including the output of a three-axis accelerometer arranged on the spindle housing, as well as the spindle current, X / Y / Z feed axis current and power taken from the servo bus of the servo driver or the analog port of the driver; the second category is slowly changing temperature, taken from the temperature measurement modules at the spindle bearing, servo motor winding, lead screw nut and environment; the third category is the internal state of the CNC, which is read by polling from the open CNC interface, including the line number of the currently executed program segment, tool number, spindle speed, feed command value and coordinates of each axis.
[0046] Access is distributed based on channel bandwidth characteristics. High-frequency channels use hardware sampling via the acquisition card, with vibration sampled at the highest sampling rate. Current channels are sampled from the same source as vibration or at integer multiples thereof, with timestamps uniformly printed by the acquisition card's crystal oscillator to avoid software jitter. Slow-changing temperature samples via a low-speed ADC channel. The internal state of the CNC is periodically invoked by a separate polling thread, and the moment a record is read is immediately recorded using the gateway's local clock. For example, in this embodiment, the default value for the vibration sampling rate is tens of thousands of times per second, the default value for the temperature sampling rate is once per second, and the default value for the CNC status polling cycle is a fixed value between several milliseconds and tens of milliseconds. It is important to emphasize that all clock timestamps only represent the instant the sample reaches the edge, not the actual moment the internal CNC event occurs. This distinction is the starting point for all subsequent processing.
[0047] In one embodiment of the invention, the buffer employs a channel-partitioned circular buffer, with higher-frequency channels allocated a deeper buffer depth to absorb burst processing delays, and slower channels allocated a shallower buffer. Each data block includes a channel identifier, a sampling rate identifier, and the block's start clock time; the CNC status sequence is organized according to the reading order, and each record contains seven fields: row number, tool number, speed, feed, coordinates, reading completion time, and response time. This block + sequence dual-track buffer takes into account both the continuity of the high-frequency stream and preserves the discrete event characteristics of the CNC status.
[0048] Considering that workshop networks are prone to sudden congestion during heavy cutting periods, leading to irregularly large response delays in CNC status polling, this invention synchronously records the time of each request being sent and the time of the response completion in the polling thread. The difference between the two is archived as the response time for that record. This response time is not judged by a fixed threshold, but rather by adding several times the standard deviation to the average of all response times over a period of time as the threshold for judging response anomalies. Records exceeding the threshold are marked as having weak time reliability, allowing the anchor point detection and alignment module to reduce their weight in the objective function during the constraint alignment stage. In this way, an occasional network jitter will not be recorded as a real process rhythm in the timeline;
[0049] The signal access module outputs two sets of raw data before alignment: one is a multi-channel high-frequency data stream and a low-frequency temperature stream with original acquisition time and sampling rate identifiers; the other is a numerical control state sequence with read time, response time, and confidence level labels. These two sets of data are then fed into the kinematics calculation module and the anchor point detection and alignment module, respectively, for twin prediction and signal anchor point detection.
[0050] The kinematics calculation module feeds the CNC program text and CNC state sequence into the digital twin kinematics model for forward calculation, predicts the process timing and transition parameters of each switch, and outputs the expected event sequence, the clock window prior, the feasible interval of the process interval, and the machining criticality.
[0051] The kinematics calculation module provides prior information about the vertical axis, which is the first manifestation of this invention allowing the digital twin to substantially participate in data acquisition. Its inputs are the CNC program text being processed and the CNC state sequence from the signal access module. The output is a sequence of expected events and a corresponding clock window prior. Each event includes the relative time of the process, the event type, the expected signal transition parameters, and the feasible interval between the process and the next event. The kinematics calculation module does not interact with the original signal; it only performs deterministic kinematic deductions on the twin side. Its purpose is to first determine when and in what form each program segment switch should occur.
[0052] In one embodiment of the invention, the deduction is performed in three layers: the geometry and interpolation layer reads the CNC program and reconstructs the tool center trajectory segment by segment. Linear interpolation is performed on straight segments, and circular interpolation is performed on arc segments according to the commanded center radius. In the five-axis linkage scenario, the changes in the rotational axis angle and the changes in the translational axis displacement are combined onto the tool center trajectory to obtain a segmented spatial geometric description of the toolpath. The feed and acceleration / deceleration layer, based on the commanded feed for each segment, the machine tool's S-shaped or trapezoidal acceleration / deceleration parameter table, and the corner deceleration strategy, deduces the change in feed speed with the phase within the segment along the toolpath, identifies the feed change pattern at each switching point, including the change in direction from straight to circular, corner deceleration and then acceleration, and sudden changes in axial movement such as tool lifting and lowering, and outputs the relative process time for each switching. The event classification and morphology prediction layer categorizes switching events into several event types based on kinematic characteristics. Then, based on the equivalent second-order dynamic response of the standard three loops (position loop, velocity loop, and current loop) of the machine tool servo, it calculates the transition morphology parameters of this type of switching in the spindle current and vibration envelope, including the current step amplitude, rise time, overshoot ratio, and the instantaneous jump and settling time of the vibration envelope. These parameters, known as the expected morphology template, are passed to the anchor point detection and alignment module for matching.
[0053] In one embodiment of the present invention, the expected process time is only a relative quantity, and coarse anchoring is required to define the clock window. The coarse anchoring of the present invention utilizes the interval constraint provided by the row number jump in the numerical control state sequence: when the row number read in a certain poll jumps from the previous segment to the next segment, it can be determined that the switch occurs between the current reading time and the previous reading time; under the reasonable assumption that the switching time is evenly distributed in the polling interval, the midpoint of the two reading times is taken as the numerical control coarse anchor point of the switch, and its uncertainty is half a polling interval. The present invention extracts the numerical control coarse anchor points at all row number jumps from the numerical control state sequence of the signal access module, filters out records whose response time exceeds the abnormal judgment threshold to eliminate network jitter interference, and then performs least squares linear fitting on the paired data (process relative time, clock midpoint time) corresponding to the retained coarse anchor points to obtain a preliminary linear mapping from the process relative time to the clock time. This mapping is used to project the process relative time of each expected switch onto the clock axis as the window center;
[0054] The window width is determined as follows: First, the feed rate of the instruction near the switch is taken. The faster the feed, the narrower the window, and vice versa, because a faster feed means less possible drift on the clock axis at the moment of switch. Then, an uncertainty term determined by the CNC polling cycle and the standard deviation of historical response time is added as a jitter margin for the timestamp itself. The two terms are added together and a minimum width limit is set to prevent the window from being compressed to the point of being unable to accommodate network jitter under extremely high-speed feed. For example, in this embodiment, the default value of the window width limit is twice the CNC polling cycle.
[0055] To address the issue that in five-axis machining, where rotary axes are involved in interpolation and simple linear axis derivation can miss transitions caused by rotary axis reversals, twin kinematics calculations incorporate the angular velocity and angular acceleration of the rotary axes into the feed synthesis. A separate type of rotary transition event is marked at the rotary axis reversal point, and its characteristic shape in the servo current is predicted based on the decoupling relationship between the current of each feed axis and the current of the rotary motor. This allows the rotary transition event to obtain corresponding expected windows and shape templates during the anchor point detection and alignment module's anchor point detection stage, preventing missed detections of transitions under five-axis linkage. For situations where adjacent program segments are too short and the expected windows of two transitions may overlap, the twin performs a minimum interval check on adjacent expected moments when generating the window prior. When two windows overlap, they are not forcibly split but merged into a composite window containing two expected anchor points, and their internal order is marked. The task of distinguishing two adjacent transitions is then handled by the precise positioning and constraint alignment of the anchor point detection and alignment module.
[0056] In one embodiment of the present invention, the kinematics calculation module simultaneously outputs the feasible interval of the process interval and the machining criticality evaluation results of each program segment. The feasible interval of the process interval refers to the lower bound of the shortest time between each pair of adjacent switches, which is determined by the physical time required for the servo to decelerate from the highest feed to the corner feed, and the upper bound of the longest time, which is calculated by the toolpath length and the lowest feed rate of that segment. This interval is calculated by the mechanism model rather than set empirically, and constitutes the hard constraint for the constraint solution of the anchor point detection and alignment module.
[0057] The assessment of machining criticality is based on the geometric characteristics, cutting load, and thin-wall overhang state of each program segment, providing a comprehensive score. The specific method is as follows: First, calculate the geometric curvature factor, which is the reciprocal of the ratio of the minimum curvature radius of the toolpath to the machine tool's recommended corner radius, after saturation processing; the smaller the radius, the larger the factor. Next, calculate the cutting load factor, which is the normalized value of the product of the depth of cut, width of cut, and feed per tooth relative to the upper limit of the recommended tool conditions. Then, calculate the thin-wall overhang factor, introducing an intra-segment phase variable to make it continuously change with the phase; the longer the overhang and the thinner the wall thickness, the closer the factor is to the full value. The three factors are weighted and summed according to the weights configurable by the process engineer, with the weights and constraints being equal (default is equal weighting). The weighted result is mapped to a range of zero to one as the comprehensive criticality. A comprehensive criticality falling into the lower range is classified as low criticality, in the middle as medium criticality, and higher as high criticality, with the boundaries given by two thresholds configurable by the process engineer. This criticality assessment result is directly fed to the hierarchical compression module as the basis for adaptive sampling.
[0058] In one embodiment of the present invention, the kinematics calculation module also maintains a twin cutting force physical model within the twin. This model takes the process parameters (depth of cut, width of cut, feed per tooth, rotational speed, and tool geometry) output from the kinematics calculation stage as input. Based on the classical mechanical cutting force formula, it calculates the expected cutting force of each program segment online, and converts it to the current domain through machine tool transmission efficiency and motor torque constant, and to the vibration domain through equivalent modal parameters of the spindle-tool system and frequency response function, providing the expected mean values of the current and vibration envelopes for each phase and the upper and lower bounds of the physical feasible domain. The initial parameters of this model are calibrated offline according to the machine tool model and tool specifications before production. During the machining process, the parameters are continuously calibrated through virtual-real deviation feedback written into the closed-loop module to track changes in tool wear and other states. The output of the twin cutting force physical model serves as the physical baseline for waveform reconstruction of missing segments in the completion and calibration module, which is the key basis for the present invention to allow the twin to substantially participate in data completion.
[0059] The anchor point detection and alignment module detects endogenous anchor points from the multi-channel data stream through a dual-branch anchor point detection network and twin morphology template cross-attention under the prior constraints of the wall clock window. It then aligns the CNC coarse anchor points through dynamic programming with three-source band constraints, and outputs the process time axis mapping and sample-by-sample phase assignment.
[0060] The anchor point detection and alignment module receives three inputs: high-frequency current and vibration data streams from the signal input module, expected event sequences and window priors from the kinematics calculation module, and the CNC row number sequence from the signal input module. The output is a mapping from the clock time axis to the process time axis, and the phase attribution of each high-frequency sample's program segment. This step addresses a crucial question: without providing the exact timing from the CNC, how can the actual occurrence time of each program segment switch be extracted from the signal, and how can the three parties' accounts be made consistent?
[0061] In one embodiment of the present invention, the physical basis of the anchor point lies in the fact that program segment switching is inevitably accompanied by servo acceleration and deceleration, which presents a transition segment with a specific direction in the spindle and feed axis currents, and exhibits transient changes in the vibration envelope, and these changes are causally bound to the CNC commands. In other words, the information of the switching moment is inherent in the high-frequency signal; the problem is how to robustly locate the anchor point under noise backgrounds such as chatter, cutting force fluctuations, and power frequency interference. Fixed threshold detection often misses or misdetects when the cutting depth and width change, and template matching is also unstable under strong chatter. Therefore, the present invention introduces a lightweight two-branch one-dimensional convolutional neural network, which performs fine-tuning only within the expected window defined by the kinematics solution module, narrowing the search from global to local, and explicitly injecting the twin morphology prior into the two-branch anchor point detection network (i.e., the two-branch one-dimensional convolutional neural network).
[0062] The input to the dual-branch anchor point detection network is a multi-channel short sequence extracted from the expected window. The channel dimension has four channels: spindle current, synthesized feed current (the feed direction scalar current synthesized by projecting the X / Y / Z feed currents onto the current toolpath tangential direction), vibration envelope (the synthesized amplitude envelope obtained by Hilbert transforming the triaxial acceleration), and vibration kurtosis (the fourth-order cumulative quantity of the triaxial acceleration within the sliding short window, reflecting the impact intensity). The default value for the time dimension is the number of sampling points in the hundreds. The reason for processing in two branches is to allow the current and vibration to be processed separately in more suitable feature spaces before fusion: during strong chatter, the vibration channel is easily overwhelmed by continuous large-amplitude oscillations, while the servo acceleration / deceleration transition is relatively clean in the current channel; therefore, during fusion, the current evidence should dominate the moment regression.
[0063] The current branch receives two channels: the main spindle current and the synthesized feed current, and processes them sequentially through four layers. The first layer is an input convolutional layer, where the convolutional kernel slides in the time dimension to capture transitional local waveforms, expanding the 2 channels to intermediate feature channels (for example, in this embodiment, the number of channels is expanded to 16 by default). The second layer is a convolutional layer with a stride of 2, downsampling the time dimension to half its original length, and expanding the channels to 32. The third layer has the same structure as the second layer, further expanding the channels to 64, and halving the time dimension again. The fourth layer is a refined convolution that does not change the temporal resolution, allowing the dual-branch anchor detection network to focus on the details of the transitional neighborhood. Each convolutional layer is followed by batch normalization and GELU activation to stabilize training and enhance representation.
[0064] The vibration branch receives two channels: vibration envelope and vibration kurtosis. Its structure is a mirror image of the current branch but shallower (three layers are used by default in this embodiment): the first two layers of convolutions with a stride of 2 are responsible for time dimension downsampling, corresponding to the first two downsampling layers of the current branch, with channels expanding sequentially; the third layer is a refined convolution that does not change the time resolution, corresponding to the fourth refined layer of the current branch, but omitting the third downsampling layer of the current branch. Therefore, the time dimension at the end of the vibration branch is T / 2 instead of T / 4, and the number of channels is 32. An additional downsampling step is required in the subsequent alignment process to align it with the current branch. Channel expansion is performed synchronously.
[0065] After the two branch outputs are aligned in the time and channel dimensions, a unified feature is generated through cross-branch gating fusion. The alignment process is as follows: the output of the vibration branch is a 32-channel tensor with a time length of T / 2. First, a 1×1 convolution is applied to increase the number of channels from 32 to 64, and then a convolution with a stride of 2 is applied to downsample the time dimension from T / 2 to T / 4, so that it is completely aligned with the 64-channel tensor with a time length of T / 4 of the current branch output in both dimensions. After alignment, a gated weighted sum is performed. The gate value is not a fixed weight, but is obtained by taking the moving average of the vibration branch kurtosis channel along the time dimension on the last feature layer before alignment, and then mapping it to between zero and one using the Sigmoid function: the stronger the flutter, the larger the kurtosis moving average, the closer the Sigmoid output is to one, and the lower the feature weight of the vibration branch is (taking one minus the Sigmoid output value as the multiplicative factor of the vibration branch), with the current branch dominating the fusion. This adaptive gating is particularly critical for flutter conditions in thin-walled components, ensuring that the dual-branch anchor point detection network automatically switches to make timely judgments based on current evidence when flutter oscillates continuously and significantly, overshadowing the true transition characteristics.
[0066] In one embodiment of the present invention, the fused features are not directly fed into the output head, but first pass through a cross-attention module guided by a twin morphology template. The design of this module is based on the fact that the signal transition morphology of the same type of switching event varies greatly under different operating conditions. When the feed is high and the cut depth is small, the current step amplitude is small, the rise time is fast, and there is almost no overshoot. When the feed is low and the cut depth is large, the step amplitude is large, the rise time is slow, and there may be significant overshoot. Using a fixed template for matching is not feasible, and a purely data-driven CNN is easily confused when there is strong flutter. The present invention synthesizes the event-by-event expected morphology parameters (current step amplitude, rise time, overshoot ratio) output by the kinematics calculation module into a parameterized time-domain template sequence in real time as the query for cross-attention. This allows the dual-branch anchor detection network to match the signal features not with a fixed empirical template, but with a dynamic template calculated by physical simulation according to the current operating conditions.
[0067] In one embodiment of the present invention, the synthesis steps of the parameterized template are as follows: Based on the step response of a servo-equivalent second-order underdamped system to the current step amplitude, which reaches an amplitude of one minus an exponential decay multiple during the rise time and oscillates and converges to a steady-state value under overshoot ratio constraints, the response is scaled according to the step amplitude of the current event, the time scale is determined according to the rise time, and the damping parameters are determined according to the overshoot ratio. The response is then discretized to the same time sampling interval as the fusion feature, resulting in a one-dimensional parameterized template sequence of length T / 4. This template sequence is mapped to a 64-dimensional channel space through a linear projection layer, serving as a query tensor (1×T / 4×64). The fusion feature itself serves as a key and value tensor (1×T / 4×64).
[0068] Cross-attention calculation is performed only in the time dimension: the dot product of each time position of the query and all time positions of the key is divided by the square root of the channel dimension and then normalized using softmax to obtain the attention weight distribution. This distribution represents the degree of matching between each position on the template and each time position of the signal feature. The value is then weighted and summed using this weight to obtain the attention output. The maximum value of the attention weight distribution in the time dimension is the position of the best-matching twin template on the signal, constituting a coarse localization of the switching moment. The attention output is added to the original fused features as residuals and then fed into the output head as the enhanced feature.
[0069] The output header is divided into two branches. The time regression header, after global temporal pooling, is fed into a three-layer fully connected layer to regress the refined offset of the true transition time relative to the coarse time base address. Simultaneously, the maximum position of the cross-attention weight distribution is extracted using argmax as the coarse time index. This index is multiplied by the temporal sampling interval to convert it into the time relative to the window start point, which is used as the coarse time base address. The refined offset output from the regression header is superimposed on the coarse time base address to obtain the final anchor time. The coarse time anchors the approximate range, and the refined offset is corrected to the sub-sampling level within the coarse localization neighborhood. The type and confidence header retains the temporal dimension information, first undergoing a one-dimensional convolution followed by global average pooling, and finally connected to a fully connected layer to output the probability of event type attribution within the window and a continuous anchor confidence (a number between zero and one). The two branches share the preceding convolutional backbone and cross-attention module, separating only at the end.
[0070] In one embodiment of the invention, the training samples for the dual-branch anchor point detection network are primarily based on twin simulations, supplemented by a small amount of on-site annotations. On the twin side, forward calculations are performed under various toolpath types, feed and depth-of-cut combinations, and on-site measured vibration noise, power frequency interference, and typical chatter frequency band narrowband strong vibration modulation (the chatter frequency band, for example, in this embodiment, is a narrow band between several hundred hertz and several thousand hertz) are superimposed to generate a large number of transition samples with known actual switching times as the labeled main body. On the on-site side, during machine stoppages or slow-speed trial cuts, a small number of transition samples are manually confirmed by process engineers for fine-tuning, allowing the dual-branch anchor point detection network to adapt to the specific machine tool's characteristics. The optimizer uses AdamW, and the learning rate is scheduled using cosine annealing.
[0071] The loss function of the dual-branch anchor point detection network consists of four weighted terms: the first is the time regression loss, calculated using Huber loss to account for the difference between the predicted and true offset values, which is insensitive to outliers and resists strong vibration interference; the second is the classification loss, calculated using cross-entropy between the predicted and true event types; the third is the sequence consistency penalty, which applies a hinge-type penalty to adjacent switching times output by the dual-branch anchor point detection network within the same program segment if their order contradicts the inherent order of the CNC program segment, taking a positive value only when the order is violated; the fourth is the attention supervision loss, which constrains the distribution of cross-attention weights to concentrate them near the actual switching time. Specifically, a Gaussian target distribution is constructed with the actual switching time as the center and half the rise time as the standard deviation, and the loss is calculated using KL divergence between the attention weight distribution and this Gaussian target, guiding attention to focus on the correct location where the transition occurs. The four terms are summed with empirical weights, which are then optimized using a grid search on the validation set. When the anchor confidence of the type and confidence header output is lower than the first preset threshold (this threshold is selected by the ROC curve on the validation set, for example, the default value is 0.6 in this embodiment), the window is marked as a weak anchor, and its regression time is not directly used, but reserved for the alignment stage to use the twin prediction time as a fallback.
[0072] In one embodiment of the present invention, after obtaining the anchor points and confidence levels of each window, the three-source constraint alignment stage is entered. Here, the main purpose is to bring the three statements together on one axis: the CNC line number refers to which segment the program has reached (sequence is preserved but time is not reliable), the twin prediction refers to at what process time and what clock window each switch should occur (with a flexible range), and the signal anchor point refers to at which clock time the switch actually occurs on the signal (with confidence level). Since the three have different properties, a unified solution framework is needed.
[0073] The solver employs dynamic programming with physically feasible interval constraints. Its time complexity is proportional to the product of the number of events and the number of candidate anchor points, and it can be completed in real-time at the edge. The decision variable is the expected event for each twin. Corresponding clock time The optimization objective is given based on the scenario, and the specific formula is as follows:
[0074]
[0075] in The total number of expected twin events to be aligned; For the first The clock face time of the event to be determined; This refers to the signal anchor point time of the event obtained by the aforementioned CNN within the corresponding window after coarse localization by cross-attention and fine-tuning by the regression head; The predicted time of the event on the clock axis is obtained by projecting the event during the coarse anchoring stage of the kinematics solution module. The CNC coarse anchor point corresponding to this event is defined as the midpoint between two adjacent reading moments when the row number jumps from the front segment to the back segment in the CNC state sequence. This midpoint is an unbiased coarse estimate of the switching moment within the polling interval. The Huber function squares small residuals and linearizes large residuals, thus suppressing the influence of outliers. As the weight of the signal item, the confidence value of the anchor point in the window is taken as the weight itself. When the confidence of the weak anchor point is close to zero, the item degenerates and disappears, so that the event is covered by twin prediction. As the basic weight of the twin, it serves as a global safety net, ensuring that its value remains constant across all events; As a weight for numerical control items, records whose response time exceeds the anomaly judgment threshold will be automatically downgraded;
[0076] It should be noted that: The anchor confidence value output by the dual-branch anchor detection network can be directly taken, with the value ranging from zero to one, without any additional transformation. We choose a fixed positive number so that, even in the extreme case where all signal anchors are weak anchors, the alignment result will not diverge, as in this embodiment. The default value is taken as the full value of the anchor confidence level. One-several parts of. If the response time of the corresponding CNC record does not exceed the threshold, then take the AND operation. For positive numbers of the same magnitude, when they exceed the threshold, the decay is calculated as the ratio of the response time to the threshold. The threshold parameter in the Huber function that distinguishes between square segments and linear segments is taken as the median absolute deviation of the residual distribution at each anchor point, so that about half of the residuals fall within the square segment;
[0077] The solution must satisfy two hard constraints: one is that the events are ordered, that is, for all... have First, the switching order cannot be reversed. Second, adjacent intervals are feasible, meaning any... It must fall within the feasible interval of the process interval given by the kinematics solution module. Within this timeframe, rhythms that are physically impossible to escape are not allowed. The former ensures consistency with the program segment order, while the latter ensures that the intervals are physically reachable.
[0078] For cases where the composite window generated by the kinematics solution module contains two adjacent switches that need to be distinguished within a single window, the alignment stage locally pairs the two candidate anchor points output by the dual-branch anchor point detection network within the composite window with the two process moments predicted by the twins. While maintaining global ordering constraints, the correspondence between the two is determined by the local Huber fit. In this way, the two adjacent switches fall on their respective process moments, avoiding the merging of two toolpaths into one.
[0079] After the alignment solution is completed, each moment on the clock timeline can be mapped to the program segment number and phase within the segment on the process timeline. Based on this, the program segment assignment and phase label are backfilled for each high-frequency sample in the signal access module, and the sample at the transition moment is thus attached to its true program segment. The output of the anchor point detection and alignment module, namely this timeline mapping and sample-by-sample phase assignment, serves as the common benchmark for the sampling decision of the subsequent hierarchical compression module and the completion constraint of the completion calibration module.
[0080] The hierarchical compression module performs hierarchical retention and thinning compression on the multi-channel data stream based on the sample-by-sample phase assignment and processing criticality, and outputs a simplified data stream.
[0081] In one embodiment of the present invention, after the phase axis is established, the hierarchical compression module can selectively retain and thin the collected data based on the phase assignment and criticality assessment of each sample, thereby achieving efficient bandwidth utilization. Its input is the sample-by-sample phase assignment from the anchor point detection and alignment module and the twin criticality assessment from the kinematics solution module; the output is a simplified multi-channel data stream hierarchically based on criticality. The rationale is very practical: high-frequency vibration and current generate a large amount of data in long programs, while edge bandwidth and buffering are limited; the information density is not evenly distributed during processing, with dense information at corners, varying cutting depths, and thin-walled overhangs, and sparse information in idle and rapid positioning sections. Uniform sampling is equivalent to wasting resources on areas with little to no information.
[0082] The processing criticality is output by the kinematics calculation module during the kinematics calculation stage, and its evaluation method has been detailed in the kinematics calculation module. The hierarchical compression module directly uses the comprehensive criticality of each program segment given by the kinematics calculation module as the basis to make post-processing decisions on retention and thinning of the original high sampling rate data already collected by the signal access module. It should be emphasized that the hierarchical compression module does not retroactively change the behavior of the acquisition card (the signal access module has already collected all data at a uniform high sampling rate), but rather determines in the edge buffer which phase intervals retain the original density of the samples and which are thinned by integer multiples before forwarding. It should be noted that the criticality assessment of the kinematics solution module has achieved continuous intra-segment change through the intra-segment phase variable in the thin-walled overhang factor. Therefore, when the graded compression module makes retention / thinning decisions, the processing of different phase intervals within the same program segment is also different: the first half of the stable region within the segment is executed according to the strategy corresponding to the criticality level of that segment; if the overhang factor increases with the phase in the second half of the segment, resulting in the overall criticality being adjusted to a higher level, then a denser original sample is retained, so that information retention flows with the risk within the segment, rather than being cut off across the entire segment.
[0083] In one embodiment of the present invention, sampling and compression are performed in segments according to criticality. High-criticality segments retain all original sampling points without thinning and employ near-lossless compression (e.g., based on floating-point differential encoding plus entropy encoding) to ensure complete preservation of waveform details during transitions. Medium-criticality segments are thinned at equal intervals by integer multiples (e.g., in this embodiment, one point is taken every two or four points by default). After thinning, the retained samples are truncated by quantization bit width to further compress the volume; the effective number of bits is determined by the target compression ratio. Low-criticality segments are thinned at equal intervals by larger integer multiples (e.g., in this embodiment, one point is taken every eight or sixteen points by default). After thinning, only summary information sufficient to reflect the stationary state (summary values of peak mean, effective value, spectral peak frequency, etc.) is retained.
[0084] The specific thinning factors for each level are determined jointly by the edge-to-cloud transmission bandwidth budget and the time proportion of each level segment in the entire toolpath, ensuring that the total data rate does not exceed the bandwidth limit. A transition buffer is set between each segment, with the buffer length being a multiple of the rise time of the switching event at the boundary predicted by the kinematics calculation module (e.g., twice by default in this embodiment). This ensures that the transition waveform across boundaries falls completely into the high-retention side, avoiding the loss of boundary samples due to abrupt changes in the thinning rate at segment boundaries. The output of the hierarchical compression module is a simplified multi-channel data stream with keyness labels and intra-segment phase annotations, serving as the completion target for the completion calibration module.
[0085] The completion and calibration module uses a twin cutting force physical model to generate the expected envelope as the physical baseline for the missing segments of the simplified data stream. The missing waveform is reconstructed and the virtual-real deviation is calibrated under the constraints of the physical feasible region through a physical constraint residual completion network, and the completion data and deviation amount are output.
[0086] The purpose of the completion and calibration module is to address the gaps caused by packet loss in the field. Its inputs are the simplified data stream from the hierarchical compression module, the process parameters (depth of cut, width of cut, feed rate, spindle speed, tool geometry) calculated by the kinematics solution module, and the twin cutting force physical model. The output is the completed and calibrated multi-source data and the quantified virtual-to-real deviation. Networks and buffers in industrial settings are not always reliable, especially during periods of heavy cutting. If missing segments are filled using ordinary statistical interpolation, the resulting waveform may not match the actual cutting physics, essentially adding false data to the twin, thus misleading downstream diagnostics. It should be noted that low-criticality segments (idle stroke, rapid positioning, and other non-cutting segments) retain only the summary value after hierarchical compression, without temporal samples. If packet loss occurs in these segments, since they are in a stable, non-cutting state, they can be directly filled with the twin's expected mean, without entering the constrained spline reconstruction or physically constrained residual completion network process described below. The constrained spline reconstruction and physically constrained residual completion networks are only for packet loss in medium-critical and high-criticality segments.
[0087] In one embodiment of the present invention, the method employed is to subject the completion to cutting physics constraints. The generation of the expected envelope is performed according to the following steps: First, the instantaneous cutting force amplitude and direction under the working condition are calculated using a classical mechanical cutting force model based on the feed per tooth, depth of cut, width of cut, and material cutting ratio. The model is then periodically expanded according to the spindle angle to reflect the pulsating characteristics of intermittent cutting. Next, the cutting force is converted to the spindle current domain based on the mechanical transmission efficiency of the machine tool spindle, the motor torque constant, and the power equation, to obtain the trend of the expected mean value of the current with the phase. Then, based on the equivalent modal parameters (first-order modal frequency, damping ratio, modal mass) of the machine tool spindle-tool system, the cutting force excitation is converted to the acceleration domain through the frequency response function, to obtain the trend of the expected mean value of the vibration envelope with the phase. Finally, a tolerance band determined by the model uncertainty and the standard deviation of the field noise is superimposed above and below the expected mean value to obtain the upper and lower bounds of the physical feasible domain of the current and vibration. This feasible region is not derived from data extrapolation, but calculated from cutting physics, thus defining a true physical baseline for completion.
[0088] In one embodiment of the present invention, the completion is expanded in two ways under the constraint of the physical feasible region. For short missing segments (the missing length does not exceed a certain proportion of the length of the adjacent visible segments, for example, in this embodiment, it is assumed to not exceed one-third of the length of the visible segments), constrained spline reconstruction is performed using the real samples at both ends of the missing segment as boundary conditions. The optimization problem is described as follows: a quadratic penalty for smooth connection between the reconstructed waveform and the boundary samples is used as the base term; a second-order difference square accumulation term of the reconstructed waveform is used as the smoothing term; and a quadratic penalty for the portion of the reconstructed waveform that deviates from the physical feasible region is accumulated point by point according to the samples as the physical constraint term. The three terms are added together to obtain the objective function, which is a small-scale quadratic programming problem with boundary constraints. The solution uses ADMM iteration, which can be completed in real time at the edge. This part uses quadratic programming and ADMM known in the art, and no additional formulas are set.
[0089] For segments with long missing values that cannot be defined solely by boundary conditions, a physical constraint residual completion network is introduced to assist in solving them. This network is only activated for long missing values to avoid unnecessary computational overhead. The physical constraint residual completion network structure is based on a bidirectional Mamba encoder-decoder structure using a state-space model. This is because CNC machining signals have both long-term gradual changes (depth of cut drift, tool wear) and short-term abrupt changes (transition moments). The state-space model has better selective memory capabilities for long sequences than pure convolution or pure Transformer, and its inference cost at the edge is lower.
[0090] In one embodiment of the present invention, the core design idea of the physically constrained residual completion network is residual prediction rather than direct waveform generation. Since the twin cutting force model has already given the phase-by-phase expected mean of the current and vibration envelope of the missing segment (i.e., the physical baseline), the principal components of the signal that can be interpreted physically have already been deterministically calculated. Having the physically constrained residual completion network learn this part would be a waste of capacity and easily introduce bias. Therefore, the prediction target of the physically constrained residual completion network is defined as the residual of the true waveform relative to the physical baseline. The final completed waveform is equal to the twin expected mean plus the residual output by the physically constrained residual completion network. This design explicitly separates the physical prior, allowing the physically constrained residual completion network to focus on learning the random perturbations and modeling errors of the cutting pulsation, thus reducing the learning difficulty while ensuring physical interpretability.
[0091] The input tensor is composed of three types of conditional information combined along the channel dimension. The first type is the visible waveform residual (the difference between the visible waveform and the expected mean at the corresponding position) obtained by taking several sampling points at both ends of the missing segment, including the spindle current residual, the synthesized feed current residual, and the vibration envelope residual, totaling three channels. The second type is the phase-by-phase current and vibration expected mean, as well as the upper and lower bounds of the feasible region, given by the twin side for the entire missing segment, totaling six channels (current mean, current upper bound, current lower bound, vibration mean, vibration upper bound, vibration lower bound). The third type is the embedded vector of process parameters obtained by looking up tables from the depth of cut, width of cut, feed, rotational speed, and tool number, expanded into conditional channels of equal length to the time dimension through a linear layer; for example, one channel is used in this embodiment. After combining the three types, the total number of input channels is ten (under the default configuration), forming a long input sequence for the physical constraint residual completion network along the time dimension.
[0092] Data flows through the Physical Constraint Residual Completion Network in the following order: First, it passes through a one-dimensional input convolutional layer to map the multi-channel conditional input to a unified feature channel (e.g., the number of channels is 128 by default in this embodiment) for subsequent processing by the state space module. Then, it enters an encoding stack consisting of several bidirectional Mamba blocks cascaded together. Each Mamba block contains a forward selective scan branch and a backward selective scan branch. The forward branch scans from the visible left end to the missing region, and the backward branch scans from the visible right end to the missing region. The two are fused through gating at each time step so that the Physical Constraint Residual Completion Network can effectively utilize the visible information at both ends of the missing region. The intermediate layer compresses the state dimension while retaining long-range dependencies through the Mamba selection mechanism. Then, it enters a decoding stack symmetrical to the encoding stack, which restores the features layer by layer to output features whose time dimension is aligned with the original sequence. Finally, a one-dimensional output convolutional layer maps the features to two channels: the current residual and the vibration envelope residual of the missing segment, with the output dimension aligned with the length of the missing segment. The physical constraint residual completion network applies a tanh activation to the residual and multiplies it by a learnable upper bound scalar, forcing the residual magnitude to be bounded, thus physically ensuring that the final waveform (expected mean plus residual) does not deviate too far from the feasible region.
[0093] In one embodiment of the present invention, a physical constraint residual completion network is trained here, with the goal of reconstructing the continuous waveform residual of the missing segment under the constraint of the physical feasible region.
[0094] The training data for the physical constraint residual completion network mainly consists of twin simulations superimposed with on-site noise. The simulation side covers various toolpaths, feeds, depths of cut, and tool combinations. Missing segments of varying lengths are randomly masked from the simulation sequence for supervised learning, with the supervision objective being the difference between the true waveform and the expected mean (i.e., supervision of the residual space). A small amount of real packet loss reconstruction data is collected on the on-site side for fine-tuning. The optimizer uses AdamW, and the learning rate is scheduled using cosine annealing.
[0095] The loss function of the Physically Constrained Residual Completion Network consists of three weighted terms, all calculated in the residual space. The first term is the reconstruction loss: the difference between the residual output by the Physically Constrained Residual Completion Network and the ground truth residual (i.e., the ground truth waveform minus the expected mean) is accumulated point-by-point using Huber loss, which is not overly sensitive to extreme noise samples. The second term is the physical consistency loss: the residual output by the Physically Constrained Residual Completion Network is added back to the expected mean to obtain the completed waveform. Each sample point of the completed waveform is checked to see if it falls within the upper and lower bounds of the feasible region. Samples within the feasible region do not contribute to the loss, while samples outside the feasible region are penalized by accumulating the square of the out-of-bounds amount point-by-point. This term explicitly embeds the cutting physical constraints into the learning objective of the Physically Constrained Residual Completion Network, enabling it to learn not only data patterns but also physical baselines. The third term is the smoothing loss: the squares of the second-order differences of the residual output by the Physically Constrained Residual Completion Network are accumulated to avoid generating physically inconsistent spikes in the missing regions. The weights of the three terms are as follows: the weight of the physical consistency term increases as the uncertainty of the bed modal parameters increases, while the weight of the smoothing term remains moderate. Both terms are optimized on the validation set.
[0096] For cases where the completed segment spans a program segment switch and the missing region should contain a transition, the completion process does not treat the missing segment as a single operating condition. Instead, the kinematics calculation module first decomposes it into two operating condition sub-segments—one before and one after the switch—based on the expected events within the missing region, and uses their respective expected envelopes as constraints. The connection at the split point is handled as follows: using the step amplitude, rise time, and overshoot ratio of the switching event predicted by the kinematics calculation module as constraints, a transition curve is constructed near the split point. The right boundary value of the left sub-segment is taken as the expected mean of the operating condition before the switch, and the left boundary value of the right sub-segment is taken as the expected mean of the operating condition after the switch. The two are connected by an analytical waveform that reaches a new steady state in the rise time of the second-order underdamped step response and determines the oscillation amplitude according to the overshoot ratio. This transition curve is injected as a local boundary equality constraint at the split point into the constrained waveform reconstruction or as a monitoring tool for the target residual of the physical constraint residual completion network at the split point, thus ensuring that the completion result retains the transition that should exist, rather than smoothing it into a flat curve.
[0097] In one embodiment of the present invention, virtual-to-real calibration is performed after the data is completed. When the real data of the lost packet segment is subsequently recovered, or when the data is completed in the subsequent feedback, the prediction given by the twin based on the completed data is compared with the recovered real data to obtain the virtual-to-real deviation. This deviation is used, on the one hand, to evaluate the reliability of this completion and write it back to the data as a reliability label, and on the other hand, as a feedback quantity to indicate whether the parameters of the twin cutting force model need to be corrected.
[0098] To address the issue of continuous tool wear causing the actual cutting force to slowly deviate from the twin's expected envelope within the same program segment, the calibration does not discard each deviation as noise. Instead, it performs a weighted trend accumulation of deviations from the same program segment across multiple machining operations (higher weight for recent deviations and lower weight for historical deviations). When the accumulated trend exceeds the deviation trend judgment threshold, which is determined by adding a certain number of standard deviations to the historical deviation mean rather than a fixed constant, it triggers a small-step update of the tool-state-related parameters (cutting specific energy, tool geometric wear) in the twin cutting force model. This ensures that the expected envelope drifts synchronously with tool wear, avoiding the long-term use of outdated physical benchmarks for completion constraints. The output of the completion calibration module is the completed and calibrated multi-source data and the quantified virtual-real deviation. The former is written to the twin by the closed-loop writing module, while the latter is used for the closed-loop update of the twin parameters in the closed-loop writing module.
[0099] Write the completed data and deviation into the twin program segment slot according to the process phase in the closed-loop module. Use the deviation to make bounded corrections to the twin parameters and output twin state data that is consistent with the physical processing process.
[0100] The write-to-closed-loop module is the step that applies all the previous work to the twin; its input is the completion and calibration data and the virtual-to-real deviation from the completion and calibration module, and its output is twin state data organized according to the process phase and consistent with the physical machining process. The key to the write-to-closed-loop module is to store the data according to the process phase rather than clock time, because the twin is concerned with what happened on which part of the toolpath, not what was sampled at what time.
[0101] The data is written into the process timeline organization established by the anchor point detection and alignment module. Each data entry, along with its program segment affiliation, intra-segment phase, tool number, and process parameters, is written into the corresponding program segment context slot in the twin, ensuring that each toolpath in the twin is associated with the correct multi-source data. Although temperature data does not participate in the vertical axis alignment process, its acquisition time is also converted to the corresponding process phase through the process timeline mapping relationship of the anchor point detection and alignment module, and then flows into the thermal state slot of the twin at a low speed for use in thermal error compensation applications. Thus, the temperature channel introduced by the signal access module completes its data flow closure here. For data marked as weak anchor points or completed data, a confidence label is attached during writing. The confidence level is divided into four levels in this embodiment, such as strong anchor point, weak anchor point, short missing data completion, and long missing data completion, for downstream diagnostics to select as needed, ensuring traceability of the source.
[0102] In one embodiment of the invention, the closed-loop update utilizes the virtual-to-real deviation provided by the completion calibration module. The twin aggregates the deviation by program segment and tool number, and performs bounded feedback correction on the kinematic calculation parameters (acceleration / deceleration time constant, servo equivalent damping ratio) and cutting force model parameters (cutting specific energy, wear-related terms). Bounded means that the update step size is limited to a small range to avoid parameter oscillations caused by single abnormal deviations. The corrected parameters are fed back to the kinematic calculation module, making the expected time, expected shape, and expected envelope of the next round closer to the current actual state of the machine tool. This closed loop allows the prior and completion constraints of the vertical spindle to self-correct as the machining process progresses, preventing long-term inaccuracies due to machine tool state drift.
[0103] To address the scenario where multiple machining centers share a single cloud-based twin, yet each machine tool has unique characteristics, an edge-cloud collaborative architecture is adopted for writing and closed-loop processing. The edge side retains a lightweight twin prediction agent bound to its local machine tool, handling kinematic prediction for the real-time kinematics calculation module, expected envelope lookup for the completion and calibration module, and immediate deviation feedback. Parameter synchronization is completed in each machining cycle. The cloud retains the complete twin and aggregates deviations from multiple machine tools for longer-term parameter recalibration (e.g., triggering a cycle based on the cumulative number of processed parts reaching a set batch size), before distributing the updated parameters to each edge agent. An encrypted message channel transmits deviation summaries and parameter update packets between the edge and cloud, avoiding the transmission of all high-frequency raw data. This balances the real-time performance of the edge with global consistency in the cloud. The output of the closed-loop writing module is twin state data consistent with the physical machining process in terms of process phase, supporting applications such as chatter warning, tool wear monitoring, and thermal error compensation. Thus, the link from acquisition, spindle erection, sampling, completion to writing is closed, with the output of each step actually used in the next calculation, ensuring traceability.
[0104] In one embodiment of the present invention, an example illustrating each step of the invention is given in conjunction with a three-axis milling process of a thin-walled titanium alloy frame: A machining center processes a thin-walled frame. The toolpath includes a linear feed segment, a small-radius corner segment, and a thin-walled overhang finish milling segment. A FANUC CNC is used, and the program segment status is polled and read through its open interface. The spindle housing triaxial acceleration, spindle current, and X / Y / Z feed current are all sampled from the same source by an edge acquisition card. The sampling rate is the default value of the vibration channel in this embodiment; the temperature channel is accessed as a low-speed channel; the CNC status polling cycle is the default value in this embodiment.
[0105] During the data acquisition phase, the system accesses each signal through the signal access module and sets a clock to acquire the time, while simultaneously recording the CNC status sequence. Table 1 shows the polling record of the CNC status in a certain machining segment. It can be seen that the row number jumps from N1180 to N1190 between sequence number 2 and sequence number 3. The reading action can only pinpoint the switch to occur between two readings, but cannot provide the actual time of the switch. Furthermore, the response time for sequence number 3 is significantly higher than the average of other records, and the signal access module marks it as having weak time reliability based on the response anomaly judgment threshold.
[0106] Table 1 shows an example of CNC internal status records read through the open CNC interface during the acquisition phase, including reading time, program segment line number, tool number, spindle speed, feed command value and response time;
[0107] Table 1, Example of CNC Internal Status Recording
[0108]
[0109] During the vertical axis phase, the twin performs forward calculations on the segment using the kinematics solution module, identifying the transition from the straight segment N1180 to the corner segment N1190 as a corner deceleration event, and predicting its relative process time, current step transition pattern, and clock window. Within this window, the anchor point detection and alignment module uses a dual-branch 1D-CNN to detect the transition time on the spindle current. The current branch dominates regression, while the vibration branch is gated and suppressed due to the strong flutter indication at the current segment's overhang. The CNN outputs anchor points and confidence scores, and then the CNC row number sequence, twin prediction, and signal anchor points are aligned using constrained dynamic programming under order preservation and feasible interval constraints to obtain the process phase assignment. Table 2 provides examples of phase assignments for some high-frequency samples after alignment.
[0110] Table 2 shows an example of the phase assignment of some high-frequency samples after vertical axis alignment, including the sample clock time, assigned program segment, intra-segment phase and anchor point confidence.
[0111] Table 2. Examples of program segment phase assignment for high-frequency samples
[0112]
[0113] Samples b and c are at the transition moment at the corner. Using the existing method of assigning row numbers based on proximity, since the reading time of sequence number 3 is 1227 milliseconds, corresponding to row number N1190, samples from 1221 and 1224 milliseconds before 1227 milliseconds would be incorrectly assigned to the previous line segment N1180. However, this invention, based on the signal's intrinsic anchor point (the position near the previous segment within the interval between the reading times of sequence numbers 2 and 3, regressed by the CNN after cross-attention matching of the twin morphology template within the window defined by the kinematics calculation module) and twin prediction constraints, correctly assigns them to the N1190 corner segment. Sample d is at a strong oscillation phase; the jitter superposition causes the anchor point confidence of the CNN output to be lower than the first preset threshold, and it is judged as a weak anchor point. During alignment, the twin prediction time is used as a fallback, and the weak confidence label is retained.
[0114] Subsequently, the hierarchical compression module prioritizes corner segments as high-criticality (small corner radii make the geometric curvature factor close to 1, and the thin-wall overhang factor is increased), maintaining a high sampling rate and near-lossless compression for these samples. The completion and calibration module performs constrained spline reconstruction on a short missing segment of several milliseconds in this segment based on the twin's expected current envelope. The reconstruction result is compared with the real samples that are subsequently recovered after the missing segment to obtain the virtual-real deviation of this segment. The write-closed-loop module writes these data into the twin according to the process phase and incorporates the virtual-real deviation of this segment into the closed loop. The entire example illustrates how data is correctly attributed and transferred, facilitating understanding of the connections between the steps for those skilled in the art.
[0115] The embodiments of the present invention have been described above. However, the embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments under the guidance of the present embodiments, and all of them are within the protection scope of the present embodiments.
Claims
1. A data acquisition system for a CNC machining center based on digital twins, characterized in that, include: The signal input module collects vibration, current, temperature and internal state signals of the CNC machining center, and outputs a multi-channel data stream with acquisition time and a CNC state sequence with confidence label after edge timestamp annotation and channel buffering. The kinematics calculation module feeds the CNC program text and CNC state sequence into the digital twin kinematics model for forward calculation, predicts the process timing and transition parameters of each switch, and outputs the expected event sequence, the clock window prior, the feasible interval of the process interval, and the machining criticality. The anchor point detection and alignment module detects endogenous anchor points from the multi-channel data stream through a dual-branch anchor point detection network and twin morphology template cross-attention under the prior constraints of the wall clock window. It then aligns the CNC coarse anchor points through dynamic programming with three-source band constraints, and outputs the process time axis mapping and sample-by-sample phase assignment. The hierarchical compression module performs hierarchical retention and thinning compression on the multi-channel data stream based on the sample-by-sample phase assignment and processing criticality, and outputs a simplified data stream. The completion and calibration module uses a twin cutting force physical model to generate the expected envelope as the physical baseline for the missing segments of the simplified data stream. The missing waveform is reconstructed and the virtual-real deviation is calibrated under the constraints of the physical feasible region through a physical constraint residual completion network, and the completion data and deviation amount are output. The closed-loop module writes the completed data and deviation into the twin program segment slot according to the process phase, and uses the deviation to make bounded corrections to the twin parameters, outputting twin state data consistent with the physical processing process.
2. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, In the signal access module, the polling thread synchronously records the sending time and the response completion time for each CNC interface request, and the difference between the two is the response time. The average of all response times over a period of time, plus a preset multiple of the standard deviation, is used as the threshold for judging response anomalies. Records exceeding the corresponding threshold are marked as having weak time credibility, so that the anchor point detection and alignment module can adjust the weight of the corresponding record when constraining alignment.
3. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, In the kinematics calculation module, coarse anchoring is performed as follows: extract two adjacent records whose row numbers change from the CNC state sequence, and take the midpoint of the reading time of the two records as the CNC coarse anchor point of the switch. After filtering out records whose response time exceeds the response anomaly judgment threshold, the process relative time corresponding to the retained CNC coarse anchor point is fitted with the clock midpoint time using least squares linear fitting. This linear mapping is used to project the process relative time of each expected switch onto the clock axis as the prior center of the clock window. The a priori width of the clock window is determined by adding the inverse term of the instruction feed rate near the switch to the uncertain term determined by the CNC polling cycle and the standard deviation of the historical response time, and a lower limit is set that is not less than a preset multiple of the polling cycle.
4. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, The input to the dual-branch anchor detection network in the anchor detection and alignment module is a four-channel short sequence extracted from the prior corresponding interval of the clock window. The four channels are the main shaft current, the synthetic feed current, the vibration envelope, and the vibration kurtosis, respectively. The network includes a current branch and a vibration branch. The current branch receives the spindle current and the synthesized feed current, and then performs multi-layer convolution with stride to progressively reduce the time dimension and expand the channel dimension. The vibration branch receives the vibration envelope and vibration kurtosis, and after being processed by convolution with fewer layers than the current branch, the time dimension and channel dimension are aligned with the current branch through channel-level convolution and stride convolution. After alignment, the fused tensor is obtained by adaptive gating and weighted summation. The gating value is obtained by mapping the sliding mean of the kurtosis channel of the vibration branch to Sigmoid. The stronger the flutter, the lower the weight of the vibration branch.
5. A data acquisition system for a CNC machining center based on digital twins according to claim 4, characterized in that, The fused tensor is enhanced by a twin-morphic template cross-attention module before being sent to the output head; The corresponding module discretizes the current step amplitude, rise time and overshoot ratio in the transition mode parameters into a parameterized template sequence according to the servo equivalent second-order underdamped step response, and uses it as a query through linear projection and fuses the tensor as the key and value. The attention weight distribution is obtained by performing a dot product attention calculation on the query and key in the time dimension. The attention output is added to the fusion tensor residual to obtain the enhanced feature. The output header takes the maximum value of the attention weight index and multiplies it by the sampling interval to obtain the coarse time base address. The fine offset relative to the coarse time base address is then added to obtain the final anchor time.
6. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, In the three-source-band-constrained dynamic programming alignment, the clock time is solved for each expected event. The optimization objective includes three distance terms: the signal term calculates the Huber loss of the difference between the time to be determined and the anchor point time, the twin term calculates the Huber loss of the difference between the time to be determined and the prior center of the clock window, and the numerical control term calculates the Huber loss of the difference between the time to be determined and the numerical control coarse anchor point. The signal item weight is taken as the confidence value of the corresponding anchor point, and it degenerates to zero when the confidence value is lower than the preset threshold; the CNC item weight is automatically reduced for records whose response time exceeds the threshold; the solution satisfies two hard constraints: the events are ordered, and the interval between adjacent events falls within the feasible range of the process interval.
7. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, In the hierarchical compression module, high-criticality segments retain all original sampling points and are compressed in near-lossless manner; medium-criticality segments are thinned at equal intervals by integer multiple factors and then compressed by quantization bit width truncation; low-criticality segments are thinned by larger integer multiple factors and only retain summary information. The thinning factor of different phase intervals within the same program segment is adjusted accordingly with the phase change of the thin-wall overhang factor in the processing criticality; a transition buffer is set at the junction of adjacent segments, and the buffer length is a preset multiple of the rise time of the switching event at the junction.
8. The CNC machining center data acquisition system based on digital twin according to claim 1, characterized in that, In the completion and calibration module, low criticality segments are compressed in stages and only the summation amount is retained. Packet loss within the corresponding segment is directly filled with the expected average value of twin cutting force and does not enter the waveform reconstruction process. When the missing length does not exceed the preset ratio threshold, the real samples at both ends of the missing length are used as boundary conditions. The objective function consists of three terms: the second penalty for smooth connection between the reconstructed waveform and the boundary, the second-order difference square accumulation smoothing term, and the point-by-point second penalty for the part that deviates from the physical feasible region. The constrained spline reconstruction is solved by ADMM iteration. When the missing length exceeds a preset ratio threshold, a physical constraint residual completion network based on a bidirectional Mamba encoding and decoding structure is activated. The network prediction target is the residual of the real waveform relative to the physical baseline, and the final completed waveform is the sum of the expected envelope and the network output residual.
9. A data acquisition system for a CNC machining center based on digital twins according to claim 8, characterized in that, The loss function of the physical constraint residual completion network consists of three weighted terms in the residual space: the reconstruction loss is accumulated point by point according to the Huber loss based on the difference between the network output residual and the true residual; The physical consistency loss is achieved by adding the network output residual back to the expected envelope and then accumulating the samples that deviate from the upper and lower bounds of the physical feasible region point by point according to the square of the out-of-bounds amount. The smoothing loss is accumulated by the second-order difference squared of the network output residuals; the network ends by applying tanh activation to the residuals and multiplying them by a scalar of the learnable magnitude upper bound to force the residual magnitude to be bounded.
10. A data acquisition system for a CNC machining center based on digital twins according to claim 1, characterized in that, In the writing closed-loop module, each piece of data, along with the program segment affiliation, intra-segment phase, tool number, and process parameters, is written into the corresponding program segment slot of the twin. Temperature data is mapped to the corresponding process phase via the process time axis and then written into the thermal state slot of the twin; a confidence label is added to weak anchor points or completed data. During closed-loop correction, the deviation is aggregated according to the program segment and tool number, and a single-step bounded correction is performed on the kinematic solution parameters and cutting force model parameters. After correction, the parameters are fed back to the kinematic solution module for the next round of solution.