Workpiece compensation machining method and numerical control machine tool

By constructing a digital twin model and using automated compensation methods on CNC machine tools, the problem of machining deviations caused by tool wear and thermal deformation was solved, achieving efficient automated machining and inspection, and improving the machining efficiency and accuracy of CNC machine tools.

CN122322944BActive Publication Date: 2026-07-31WEIFANG GOERTEK ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEIFANG GOERTEK ELECTRONICS CO LTD
Filing Date
2026-06-04
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

During the machining process, existing CNC machine tools suffer from deviations between actual dimensions and theoretical design values ​​due to factors such as tool wear, cutting thermal deformation, and clamping repetitive positioning errors. They are unable to automatically determine whether the points of features of different accuracy levels are qualified, resulting in the detection and compensation process relying heavily on manual intervention and low machining efficiency.

Method used

By acquiring the original machining program and workpiece drawing of the workpiece to be processed, the tolerance range of the feature surface is determined, and the tool offset reference is established using the in-machine probe and the external tool setter. A digital twin model is constructed by combining multi-dimensional sensors to simulate the material removal rate and perform negative offset processing, thereby generating a corrected machining program and realizing automated dimensional compensation and inspection.

Benefits of technology

It realizes automated closed-loop control of CNC machine tool processing, reduces manual intervention, improves processing efficiency and first-pass yield, and significantly reduces dimensional dispersion and rework success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122322944B_ABST
    Figure CN122322944B_ABST
Patent Text Reader

Abstract

This invention discloses a workpiece compensation machining method and a CNC machine tool, relating to the field of CNC machine tool machining technology. The method includes: constructing a digital twin model synchronized with the machine tool's state; simulating the original machining program based on the digital twin model to predict machining deformation and generating a corrected machining program; executing the corrected machining program to machine the workpiece, obtaining the actual machining dimensions through in-machine detection, and identifying compensable points that exceed the tolerance range but are less than a preset threshold; inputting the dimensional deviations of the compensable points and real-time acquired data into the digital twin model for correction, and outputting a corrected allowance milling program; finally, performing secondary compensation machining on the workpiece based on the allowance milling program. This invention solves the problem of the disconnect between the detection, judgment, and compensation stages, reduces manual intervention, and improves machining efficiency and final pass rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CNC machine tool processing technology, and in particular to workpiece compensation processing methods and CNC machine tools. Background Technology

[0002] In the fields of mold manufacturing and precision parts machining, during CNC (Computer Numerical Control) machine tool processing, factors such as tool wear, cutting thermal deformation, and clamping repeatability errors can all cause deviations between actual dimensions and theoretical design values. Therefore, to ensure the pass rate of parts, post-machining inspection of critical dimensions has become an essential process.

[0003] Currently, some machine tools are equipped with in-machine measurement functions, which can use integrated probes to perform contact or non-contact measurements on specific points on the workpiece surface to obtain the actual coordinates or simple geometric dimensions of the measured points. However, these measurement functions only acquire the coordinates or simple geometric dimensions of the points and cannot automatically determine whether points with different accuracy levels are qualified or not, thus failing to compensate for abnormal points. Because the measurement, judgment, and compensation processes are disconnected, the entire inspection and rework process heavily relies on manual intervention, resulting in low processing compensation efficiency.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a workpiece compensation machining method and a CNC machine tool, aiming to solve the technical problem of how to improve the machining efficiency of CNC machine tools.

[0006] To achieve the above objectives, this application proposes a workpiece compensation machining method, comprising the following steps: Obtain the original machining program of the workpiece to be processed, and determine the tolerance range of each feature surface according to the workpiece drawing file of the workpiece to be processed, and generate the probe points and theoretical machining dimensions corresponding to each feature surface; The tool length compensation value and tool radius compensation value of the current tool are obtained by the in-machine probe, and the nominal parameters of the standard tool are obtained by the external tool setting instrument to establish the tool offset reference. A digital twin model synchronized with the machine tool's state is constructed by real-time acquisition of spindle load, vibration frequency, and temperature data using a multi-dimensional sensor array. Based on the tool offset reference, the material removal rate of the original machining program is simulated using the digital twin model to predict the machining deformation that will be generated by executing the original machining program. Based on the machining deformation, the original machining program is negatively offset to generate a corrected machining program containing tool path offset. After the workpiece is processed by executing the modified processing program, the actual processing dimensions of each probe point are obtained by in-machine detection. Based on the difference between the actual and theoretical processing dimensions of each probe point, the size deviation is determined, and the probe points whose size deviation exceeds the tolerance range of their respective feature surfaces but is less than a preset deviation threshold are determined as compensable points. The dimensional deviation of the compensable points and the real-time collected spindle load and vibration frequency data are input into the digital twin model to correct the cutting force coefficient and stiffness matrix of the digital twin model, and output the corrected allowance fine milling program. The workpiece to be processed is subjected to secondary compensation machining based on the margin milling program.

[0007] In some embodiments, after the step of determining the compensable point, the method further includes: Extract the deviation feature vector of the compensable points, match historical processing cases in the historical process knowledge graph, and calculate the rework success rate; If the rework success rate is greater than or equal to the preset success rate threshold, then the following step is executed: inputting the dimensional deviation of the compensable point and the real-time collected spindle load and vibration frequency data into the digital twin model.

[0008] In some embodiments, the step of extracting the deviation feature vector of the compensable point, matching historical processing cases in the historical process knowledge graph, and calculating the rework success rate includes: Based on the size deviation of the compensable point, the deviation feature vector of the compensable point is determined; Obtain the material grade and heat treatment status of the workpiece to be processed from the material management system, and determine the material hardness grade according to the preset material grade-hardness mapping table and heat treatment status-hardness correction coefficient table; The deviation feature vector, the material hardness grade, and the current process type are combined into a multi-dimensional feature vector according to a preset feature dimension order. In the historical process knowledge graph, the Euclidean distance between the multidimensional feature vector and the feature vector of each historical processing case is calculated, and the cases are sorted in ascending order of Euclidean distance to retrieve the historical processing cases with the highest similarity to the multidimensional feature vector. The success rate of rework is the ratio of the number of successful rework cases to the total number of cases.

[0009] In some embodiments, the secondary compensation machining of the workpiece based on the allowance finish milling program includes: The actual tool radius is predicted based on the current cumulative cutting distance of the tool and the pre-stored tool wear curve, and the tool compensation parameters of the corrected allowance milling program are dynamically adjusted according to the actual tool radius to generate a rework program. The rework procedure is subjected to overcutting and interference checks, and after the checks are passed, the workpiece to be processed is subjected to secondary compensation processing based on the rework procedure. The workpiece after the secondary compensation process is inspected online again, and the steps of determining the dimensional deviation to the secondary compensation process are repeated until the dimensional deviation of all probe points is within the corresponding tolerance range, or the number of compensations exceeds the preset number, at which point an alarm message is output.

[0010] In some embodiments, the generation of the rework procedure includes: Based on the dimensional deviation of the compensable points and the diameter of the machining tool, query conditions are constructed, and standardized rework programs are matched from a preset program library based on the query conditions. The preset program library is indexed in multiple levels according to feature surface type, tool type, dimensional deviation range, and tolerance range. If there is no matching standardized rework program in the preset program library, the original G-code program segment and machining tool corresponding to the compensable point are determined according to the preset association relationship. The path offset value is calculated based on the dimensional deviation. A tool offset instruction containing the path offset value is inserted into the original G-code program segment, or the tool depth of cut parameter in the original G-code program segment is directly modified to generate a rework program. The association relationship refers to the association between the feature surface and the start line number, end line number, and tool information of the G-code program segment used to process the feature surface.

[0011] In some embodiments, generating probe points and theoretical machining dimensions corresponding to each of the feature surfaces includes: Finite element analysis is performed on the geometric model of the workpiece to be processed. Based on the wall thickness distribution of each region of the geometric model, low stiffness regions with wall thickness less than a preset critical wall thickness value are identified. Probe points are generated according to a first density in the low stiffness region and according to a second density in the non-low stiffness region, wherein the second density is less than the first density and the first density is inversely proportional to the wall thickness of the low stiffness region. The identification information of each probe point is bound to the corresponding fine milling program segment number, and a mapping table is established with the probe point identification as the key and the fine milling program segment number and the tool number used by the program segment as the value. Based on the three-dimensional model of the workpiece drawing, using the spatial coordinates of each probe point as an index, a geometric query is performed in the three-dimensional model to read the theoretical machining dimensions of each probe point.

[0012] In some embodiments, the step of simulating the material removal rate of the original machining program using the digital twin model based on the tool offset reference, and predicting the machining deformation that will occur when the original machining program is executed, includes: Based on the tool offset reference, during the material removal rate simulation of the original machining program using the digital twin model, a finer mesh division is applied to the mesh cells identified as low stiffness regions in the geometric model of the workpiece to be processed. Based on the tool offset reference and the cutting parameters in the original machining program, the time-varying load of each mesh element under the action of the cutting force is calculated using the cutting force model, and then the deformation of each mesh element is calculated by the finite element solver to generate the machining deformation.

[0013] In some embodiments, before detecting the actual machining dimensions of each probe point through in-machine detection, the method further includes: The water gun device is controlled to perform high-pressure water rinsing on the workpiece to be processed according to the preset rinsing path, and the rinsing time is automatically set according to the processing path length of the modified processing program. The air gun device is controlled to blow and clean the workpiece with high-speed airflow after rinsing. The blowing time is set to a preset duration so that there are no obvious liquid droplets left on the surface of the workpiece.

[0014] In some embodiments, the method further includes: If a compensable point is detected N times consecutively, the real-time log data of the machine tool is associated with it. The real-time log data includes the spindle vibration spectrum, clamping oil / air pressure value, tool number and tool loading timestamp, where N is a preset positive integer. The root causes of non-compliance are analyzed by a causal inference algorithm. The causal inference algorithm is based on a preset Bayesian network model. The Bayesian network model takes fixture loosening, tool breakage, tool wear and thermal deformation as root cause nodes, and spindle load change, vibration spectrum peak frequency shift and clamping pressure decrease as observation nodes. If the defect is determined to be caused by a loose fixture or a broken tool, the machining task is locked and a manual intervention alarm is triggered to terminate the automatic rework process.

[0015] In some embodiments, the method further includes: The dimensional deviation values ​​of the compensable points, the identification of the feature surfaces to which they belong, the number of the generated rework program, the number of the tool used and the actual tool radius, and the information on whether the processing result is qualified are extracted into structured experiential knowledge containing preset correlations. The preset correlations include the correlation between defect features, root causes and optimal rework solutions. The root causes are obtained through the causal inference algorithm. The structured experience knowledge is synchronized to the control nodes of other related machine tools processing similar features in the production line through a distributed network, so as to trigger each related machine tool to update its local digital twin model and / or historical process knowledge graph.

[0016] In some embodiments, synchronizing the structured experiential knowledge to control nodes of other associated machine tools processing similar features on the production line via a distributed network includes: The structured experience knowledge is packaged into knowledge blocks, the hash value of the knowledge blocks is calculated, and the knowledge blocks and their hash values ​​are uploaded to the distributed shared ledger. Control nodes of other associated machine tools obtain the structured experience knowledge by subscribing to knowledge block update events related to the machine's machining feature type in the distributed shared ledger, or by receiving the hash value of the knowledge block via point-to-point broadcast and requesting the complete knowledge block from neighboring nodes accordingly. They then automatically trigger updates to the local digital twin model and / or historical process knowledge graph according to preset update rules.

[0017] In addition, this application also provides a CNC machine tool, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the workpiece compensation machining method described above.

[0018] This application's embodiments acquire workpiece drawings and bind tolerance ranges for each feature surface, generating differentiated probe points and theoretical machining dimensions. This allows in-machine probing to move beyond isolated point coordinate acquisition, automatically comparing measured data with preset tolerance zones. By setting a dual judgment logic of "exceeding the tolerance range but less than a preset deviation threshold," the system can automatically filter out irreparable defective features and accurately pinpoint compensable points with repair value. This mechanism fundamentally replaces the traditional mode of manually judging conformity by referring to drawings, eliminating human error and communication delays, and realizing a shift from "blind measurement" to "targeted diagnosis."

[0019] To address the static compensation failure caused by tool wear and fluctuations in operating conditions, this application introduces data fusion from an in-machine probe and an external tool setter to establish an offset reference based on the actual tool condition, rather than relying on ideal nominal values. Simultaneously, by combining spindle load, vibration, and temperature data collected by multi-dimensional sensors, a digital twin model synchronized with the machine tool's real-time status is constructed. Before machining, this model is used to simulate the material removal rate of the original program, predicting machining deformation in advance and applying negative offset processing. This "predict first, compensate later" feedforward control strategy effectively offsets systematic deviations caused by cutting forces and thermal deformation, significantly reducing the actual dimensional dispersion after the first machining operation.

[0020] Unlike traditional static and repetitive rework paths, this embodiment of the application, after the initial machining, inputs the dimensional deviations of compensable points along with real-time spindle load and vibration data into the digital twin model for reverse correction of the model's cutting force coefficient and stiffness matrix. This process evolves the digital twin model from a general physical simulation tool into a customized model tailored to the current actual machining conditions, and outputs a targeted allowance milling program accordingly. This "measured data-driven model self-correction" mechanism ensures that secondary compensation is no longer a simple path reversal, but rather a precision cutting based on the corrected high-precision model, significantly improving the success rate of single rework.

[0021] By combining the above-mentioned technical means, the embodiments of this application integrate the originally scattered processing, inspection, judgment, programming, and rework processes into a seamless automated closed loop. By eliminating the breakpoints of manual intervention between each process, the long-cycle rework process that traditionally required machine downtime for transfer, manual retesting, and manual machine adjustment is compressed into intelligent operations that are continuously executed within the machine. This not only significantly shortens the cycle time of single-piece processing, but also solves the technical problems of low efficiency, poor accuracy, and over-reliance on human experience caused by the disconnect between processes in the prior art through deep coupling of physical models and real-time data, achieving a dual improvement in CNC machine tool processing efficiency and first-pass yield. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating the first embodiment of the workpiece compensation processing method of this application.

[0024] Figure 2 This is a schematic flowchart of a workpiece compensation processing method according to an embodiment of this application.

[0025] Figure 3 This is a structural schematic diagram of a CNC machine tool according to an embodiment of this application.

[0026] Figure 4 This is a schematic diagram of probe point generation according to an embodiment of this application.

[0027] The image includes the following annotations: 300. CNC machine tool; 301. Controller; 3011. Processor; 3012. Memory; 302. Multi-dimensional sensor group; 303. In-machine probe; 304. Network interface; 305. Human-machine interface; 307. Machine tool actuator; 401. Workpiece geometric model; 402. Low-stiffness region; 403. High-density probe points; 404. Low-density probe points; 405. Non-low-stiffness region. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application. Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by those skilled in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application. Before further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application are explained, and the nouns and terms involved in the embodiments of this application are subject to the following interpretations.

[0029] A digital twin model is a virtual model that is synchronized in real time with the physical machine tool. This model integrates real-time status data of the machine tool (such as spindle load, vibration frequency, temperature, etc.) and is used to simulate and predict the behavior of the physical machine tool under specific working conditions, such as material removal processes and machining deformation. In this application, this model is the core carrier for realizing machining process prediction and optimization.

[0030] Historical process knowledge graph: This refers to a structured knowledge base that stores and manages historical processing cases in the form of a graph. Its nodes can represent workpiece characteristics, materials, defect types, rework strategies, etc., and edges represent the relationships between them. In the embodiments of this application, this knowledge graph is used to assess the success probability of rework by matching similar historical cases before making compensation processing decisions, thereby achieving intelligent decision support and avoiding the risk of workpiece scrapping caused by blind rework.

[0031] Compensable points refer to measurement points where, during post-processing inspection, the dimensional deviation exceeds the tolerance range of the corresponding feature surface (i.e., is deemed unqualified), but the deviation value itself is less than a preset deviation threshold that is technically considered safe and economical for secondary processing and repair. These points are the main targets for initiating subsequent compensation processing steps in this application's method.

[0032] Causal inference algorithms refer to a class of algorithms used to identify causal relationships between variables from observed data. In the embodiments of this application, it specifically refers to algorithms based on Bayesian network equiprobability graphical models, which analyze directly observable machine tool operating data such as spindle vibration spectrum and clamping pressure changes to infer the root cause of machining deviations (such as fixture loosening, abnormal tool wear or breakage, machine tool thermal deformation, etc.).

[0033] Distributed shared ledger: refers to a database technology that is jointly maintained, replicated, and synchronized across a network of multiple sites, geographical locations, or institutions. Its technical characteristics are similar to blockchain technology, featuring decentralization, immutability, and traceability. In the embodiments of this application, it is used as a secure and reliable knowledge-sharing platform to ensure that structured experiential knowledge extracted from a single machine tool can be securely, reliably, and consistently synchronized and distributed across multiple machine tool nodes throughout the production line or factory.

[0034] This application provides a workpiece compensation machining method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the workpiece compensation machining method of this application. In this embodiment, the workpiece compensation machining method is applied to a CNC machine and includes steps S100~S700: Step S100: Obtain the original machining program of the workpiece to be machined, and determine the tolerance range of each feature surface according to the workpiece drawing file of the workpiece to be machined, and generate the probe points and theoretical machining dimensions corresponding to each feature surface.

[0035] The original machining program refers to the initial G-code program generated by CAM software based solely on the workpiece's theoretical model, without considering dynamic machining errors. It includes information such as toolpaths and cutting parameters. The workpiece drawing file is a digital file containing the workpiece's three-dimensional geometric model and associated dimensional tolerances, surface finishes, and other annotation information, such as a CAD model with PMI information. A feature surface refers to a geometric region on the workpiece with independent tolerance requirements, such as a plane, cylindrical surface, or freeform surface. Probe points are specific measurement coordinate points planned on the workpiece's feature surface, used for in-machine probes to perform contact or non-contact dimensional inspection. The theoretical machining dimension is the ideal geometric dimension defined on the workpiece design model, such as the distance from a point to a reference surface or the diameter of a hole.

[0036] This step can be achieved through various methods to automatically generate probe points and associate them with tolerances. One method is automatic point placement based on color tolerances. In the CAM environment, different colors are assigned to feature surfaces of different precision levels in the workpiece drawing. For example, blue corresponds to a tolerance zone of ±0.01mm, and green corresponds to a tolerance zone of ±0.02mm. The CNC equipment analyzes the workpiece drawing with the color tolerance and automatically extracts the tolerance range of each feature surface based on the color. Probe points are generated according to preset rules. For planar features, equally spaced grids are used for point placement, with the grid spacing related to the feature surface area and tolerance level. For cylindrical surfaces, the probe points are evenly distributed along the circumference and axial direction. The theoretical machining dimensions of each probe point are obtained by querying the 3D model geometric database, and its tolerance range is determined based on the color of the feature surface to which the point belongs. Another approach is based on finite element analysis and adaptive density-based probe placement. Finite element static analysis is performed on the workpiece's geometric model to identify easily deformable areas with thin walls and low rigidity. Probe points are generated at a higher density in these low-rigidity areas and at a lower density in non-low-rigidity areas, concentrating measurement resources on areas prone to exceeding tolerances. The relationship between each probe point and a feature surface is automatically established using ray casting or nearest-nearest-plane projection algorithms, thus inheriting the tolerance range of the corresponding feature surface. The theoretical machining dimensions are also obtained through a geometry engine query. This step automatically establishes the mapping relationship between probe points, feature surfaces, tolerance ranges, and theoretical dimensions, eliminating manual drawing reading, manual point placement, and tolerance annotation, improving the efficiency and accuracy of measurement preparation, and providing a data foundation for subsequent automatic judgment.

[0037] In step S200, the tool length compensation value and tool radius compensation value of the current tool are obtained through the in-machine probe, and the nominal parameters of the standard tool are obtained through the external tool setting instrument to establish the tool offset reference.

[0038] The in-machine probe is a contact or laser-type tool setter installed within the working area of ​​the CNC machine tool (such as next to the spindle or tool magazine) to measure the actual length and radius of the tool on-machine. The tool length compensation value is the difference between the actual extension length of the tool tip relative to the machine tool spindle end face after clamping and the programmed reference length. The tool radius compensation value is the difference between the actual cutting edge radius and the programmed nominal radius. The external tool setter is a precision tool setter independent of the machine tool, typically measuring the geometric parameters of a standard tool at room temperature. The nominal parameters of a standard tool are theoretical values ​​such as the tool diameter and length provided by the tool manufacturer or calibrated by metrology. The tool offset reference is a set of reference parameters determined by integrating real-time in-machine measurements and precise external calibration data, accurately describing the current actual geometry of the tool, and used for tool modeling in subsequent simulations.

[0039] There are several ways to establish the tool offset reference in this step. One method is the difference reference method, which measures the length and radius compensation values ​​of the current tool inside the machine and calculates the difference with the nominal parameters of a standard tool of the same specification obtained by an external tool setter. This yields the actual geometric deviation of the current tool due to wear or clamping. This deviation is then superimposed with the standard tool parameters to form the equivalent actual size of the current tool, which serves as the tool offset reference. Another method is the wear state calibration reference method. For tools that have been used for a period of time, an external tool setter measures multiple cross-sectional diameters under their current state and fits the tool wear profile, such as the amount of taper wear and the change in the blunt radius of the cutting edge. The length compensation value measured by the in-machine probe and the wear profile together constitute a three-dimensional tool offset reference, which more precisely describes the spatial position and shape changes of the tool's cutting edge. Through this step, the true geometric state of the current tool is accurately obtained, providing a tool model consistent with actual machining for subsequent material removal rate simulation. This makes the predicted machining deformation closer to reality, thereby improving the effectiveness of subsequent negative offset compensation.

[0040] In step S300, the spindle load, vibration frequency and temperature data of the machine tool are collected in real time through a multi-dimensional sensor group to build a digital twin model synchronized with the machine tool status.

[0041] The multi-dimensional sensor array comprises a collection of various sensors deployed at key locations on the machine tool, including but not limited to spindle power sensors, accelerometers, and temperature sensors attached to spindle bearings, guide rails, and the machine bed. Spindle load refers to the real-time power or torque output of the spindle motor during cutting, reflecting the magnitude of the cutting force. Vibration frequency refers to the spectral characteristics of the vibration signal generated by the machine tool structure under cutting excitation, with particular attention paid to frequency components related to cutting chatter or structural modes. The digital twin model is a virtual mirror of the machine tool constructed by fusing data-driven and physical models. It can simulate the dynamic behavior of the machine tool, including stress deformation, thermal deformation, and vibration response. Its core parameters, such as the cutting force coefficient and structural stiffness matrix, are updated in real-time with sensor data, maintaining synchronization with the physical machine tool's state.

[0042] There are several ways to construct a digital twin model. One approach is synchronization based on a reduced-order finite element model. A detailed finite element model of the machine tool structure is pre-built, and a reduced-order model is generated using modal reduction technology. Real-time temperature data is used to update the thermal strain load in the model, vibration frequency data is used to calibrate local stiffness parameters, and spindle load data is used to update the unit cutting force coefficient in the cutting force calculation formula. The reduced-order model can be solved online quickly, achieving millisecond-level synchronization. Another approach is synchronization based on a data-driven surrogate model. Machine learning methods such as neural networks or Gaussian process regression are used, with spindle load, vibration frequency, and temperature as inputs, and machining errors such as spindle end displacement and tool tip trajectory deviation as outputs. A mapping model from sensor data to the deformation field is trained. Before machining, this surrogate model is trained offline using historical data. During machining, real-time sensor data is input into the surrogate model, and the output prediction error is fed back to the digital twin, achieving state synchronization. Through this step, a virtual model that can reflect the dynamics and thermodynamic state of the machine tool in real time is established, providing a high-fidelity, adaptive simulation environment for subsequent machining deformation prediction and program correction.

[0043] Step S400: Based on the tool offset reference, use a digital twin model to simulate the material removal rate of the original machining program, predict the machining deformation that will be generated when the original machining program is executed, and perform negative offset processing on the original machining program according to the machining deformation to generate a corrected machining program containing tool path offset.

[0044] Material removal rate simulation simulates the volume and distribution of material removed per unit time as the tool moves along the programmed path, thereby calculating the cutting force acting on the tool and workpiece. Machining deformation refers to the deviation in the relative position of the tool tip and workpiece caused by elastic and thermal deformation of the workpiece and tool system under the combined action of cutting force, thermal load, and clamping constraints, ultimately manifesting as dimensional errors on the machined surface. Negative offset processing involves shifting the tool path inwards towards the workpiece when positive deformation (excess material) is predicted, and outwards when negative deformation is predicted, to counteract the deformation and bring the final machined dimensions closer to the theoretical value. The tool path offset is a correction vector applied to the coordinates of each tool position point in the original G-code, equal in magnitude to the predicted deformation but opposite in direction.

[0045] There are several ways to implement this step. One approach is based on static offset calculation using point-by-point cutting force. The tool path is discretized into a series of micro-segments. The instantaneous undeformed chip thickness at each discrete point is calculated based on the tool offset reference, spindle speed, and feed rate. An empirical cutting force model is used to calculate the cutting force, which is then applied to the workpiece finite element model to solve for steady-state deformation. Finally, each tool position point is offset along the surface normal by a distance equal to the deformation, generating a corrected G-code. Another approach is time-domain simulation considering regenerative effects and dynamic response. Regenerative chatter theory of the cutting process is introduced into the material removal simulation, considering the influence of the ripples left by the previous cut on the current cutting thickness. Time-domain numerical integration is performed using the machine tool structural dynamics model to obtain the dynamic trajectory of the tool tip. The predicted machining deformation includes static deformation and dynamic vibration amplitude. In negative offset processing, not only is the average offset considered, but the feed rate or spindle speed is also appropriately adjusted in areas with large vibration amplitudes to suppress chatter and generate a more stable corrected machining program. This step enables the prediction of actual machining errors through virtual machining and the proactive setting of reverse compensation amounts in the program, so that the first machining operation is close to the final size requirements, significantly reducing the probability of subsequent rework and turning post-compensation into pre-prevention.

[0046] Step S500: After the workpiece to be processed is processed by the correction processing program, the actual processing size of each probe point is obtained by in-machine detection. The size deviation is determined according to the difference between the actual processing size and the theoretical processing size of each probe point. The probe points whose size deviation exceeds the tolerance range of their respective feature surfaces and is less than the preset deviation threshold are determined as compensable points.

[0047] In-machine probing refers to measuring the coordinates of probe points on the workpiece surface using a contact probe or non-contact laser sensor integrated into the machine tool, without disassembling the workpiece after processing. The actual processed dimension is the measured distance or coordinate value from the probe point to the measurement reference obtained from in-machine probing. Dimensional deviation is the algebraic difference between the actual processed dimension and the theoretical processed dimension; a positive value indicates excess material (undercutting), and a negative value indicates insufficient material (overcutting). The tolerance range is the allowable dimensional variation range of the feature surface to which the probe point belongs, usually defined by an upper and lower limit. The preset deviation threshold is a pre-set value greater than the upper limit of the tolerance range, used to determine whether the point can still be repaired through secondary compensation processing. Points exceeding this threshold may be unrepairable due to excessive deformation or program errors. Compensable points are probe points whose dimensional deviations are between the tolerance range and the preset deviation threshold; that is, points that are out of tolerance but still have repair value.

[0048] There are several possible logics for determining compensable points in this step. One approach is a determination with overcut protection. First, it checks if the dimensional deviation exceeds the upper limit of the tolerance range (positive over-tolerance). Then, it checks if it is less than a preset deviation threshold. For negative dimensional deviations (overcut) or deviations exceeding the threshold, these are marked as uncompensable points and an alarm is triggered to prevent invalid processing of damaged workpieces. Another approach is a joint determination based on regional features. For multiple probe points belonging to the same feature surface or adjacent regions, not only are each point checked individually, but the proportion of out-of-tolerance points and the average out-of-tolerance amount within the region are also statistically analyzed. If, although a single point within a region does not exceed the threshold, the out-of-tolerance points are densely packed and the average out-of-tolerance amount is large, the system automatically includes all points in that region within the compensable range, or adjusts the tolerance band on a regional basis to optimize the overall compensation strategy. This step achieves automated evaluation and grading of post-processing quality, quickly identifying defective points that are necessary and suitable for automatic rework, avoiding manual judgment one by one, and preventing invalid processing of unrepairable points, thus improving rework efficiency and safety.

[0049] In step S600, the dimensional deviation of the compensable points and the real-time collected spindle load and vibration frequency data are input into the digital twin model to correct the cutting force coefficient and stiffness matrix of the digital twin model, and output the corrected allowance fine milling program.

[0050] The cutting force coefficient is a proportionality factor in the cutting force model related to the workpiece material and tool geometry, such as the unit cutting force coefficient. Correcting this coefficient makes the simulated cutting force closer to the actual cutting force corresponding to the measured load. The stiffness matrix describes the force-displacement relationship of the machine tool structure or workpiece at different degrees of freedom. Real-time correction can reflect stiffness changes caused by temperature variations, the condition of the mating surfaces, etc. The allowance milling program is a local or global finishing program specifically used to remove excess material at compensable points. Its cutting depth and path are recalculated based on the current deviation.

[0051] There are several ways to correct the digital twin model and generate the finish milling program in this step. One approach is coefficient calibration based on deviation inversion. The measured dimensional deviations of the compensable points are treated as known results. In the digital twin model, an optimization algorithm is used to inversely adjust the cutting force coefficients, making the simulated deviations as close as possible to the measured deviations in the least-squares sense. Simultaneously, the change in the stiffness matrix is ​​inverted using the modal shift in the measured vibration frequency. After model correction, the simulation is run again on the region with the remaining margin, outputting the optimal finish milling path and depth of cut. Another approach is adaptive model updating with load and vibration fusion. Using online estimation algorithms such as Kalman filtering or particle filtering, real-time spindle load and vibration frequency are used as observations to continuously update the state variables of the digital twin model, such as the cutting force coefficient and damping ratio. Then, in the updated model, iterative simulations are performed using the measured deviations of the compensable points as initial conditions to calculate the finish milling program that precisely eliminates these deviations. This method is suitable for continuous adaptive model adaptation when continuously compensating multiple points. This step utilizes real measurement data and working condition feedback after the initial processing to correct the digital twin model, making it more accurately reflect the current actual processing physical environment. This generates a high-precision compensation program for rework, ensuring the success rate of secondary compensation.

[0052] Step S700: Perform secondary compensation machining on the workpiece to be machined based on the allowance fine milling program.

[0053] Secondary compensation machining refers to the machining process in which, after the initial machining, one or more local material removals are performed on specific out-of-tolerance points detected, so that the workpiece dimensions eventually come within the tolerance zone.

[0054] The implementation method of this step can be flexibly selected according to the compensation range. One approach is to process only the local area where the compensable points are located. The allowance milling program only includes tool paths for those points identified as compensable and their neighborhoods. The tool quickly positions itself to the target area, completes a small cut, and then retracts, resulting in the shortest processing time and highest efficiency. Another approach is to uniformly remove compensation layer by layer. If the compensable points are distributed on multiple feature surfaces of the workpiece, to prevent stress release deformation caused by local cutting, the allowance milling program layers all compensation areas according to the cutting depth, uniformly micro-machining all areas layer by layer until all points meet the dimensional requirements, thus improving overall dimensional stability. Alternatively, an integrated automatic tool setting and wear compensation method can be used. Before the secondary compensation machining begins, the tool length and radius are quickly checked again by an in-machine probe, and the wear compensation value is updated based on the cumulative cutting distance. After automatically correcting the tool compensation parameters, the milling program is executed to ensure the dimensional accuracy of the compensation machining. This step corrects the workpiece from a near-qualified state to fully meet tolerance requirements with minimal processing and maximum efficiency, ultimately achieving full closed-loop automation of processing, inspection, and compensation, minimizing manual intervention and workpiece turnaround time.

[0055] Please see Figure 2 This application provides a workpiece compensation machining method to address the problems of low automation, reliance on manual intervention, and low efficiency in existing CNC machining compensation processes. This method achieves intelligent and adaptive adjustment of the machining process by constructing a closed-loop control system from prediction, machining, detection, and compensation. First, the method obtains the original machining program of the workpiece to be machined and determines the tolerance requirements of key feature surfaces based on the workpiece drawing. Based on this, probe points and their theoretical machining dimensions for subsequent detection are generated. This step (S201) serves as the benchmark for all subsequent comparisons and judgments, ensuring the clarity of the compensation machining objective.

[0056] To precisely control the machining process, it is necessary to eliminate the influence of uncertainties in the tool's dimensions. Therefore, this method uses an in-machine probe 303 to obtain the actual length and radius compensation values ​​of the currently clamped tool, while simultaneously using an external tool setter to obtain the nominal parameters of a standard tool. By comparing these two sets of data, a precise tool offset reference (S202) is established. This reference unifies the dimensional references between different tools and different clamping cycles, serving as the foundation for subsequent high-precision simulation and machining. In existing technologies, tool changes or wear often lead to fluctuations in machining dimensions; this step effectively solves this problem by establishing a unified reference.

[0057] Furthermore, to make the prediction of the machining process as close as possible to physical reality, this method uses a multi-dimensional sensor array 302 deployed at key parts of the machine tool to collect real-time data on the spindle load, vibration frequency, and temperature of key components such as the spindle and bed during operation. This real-time data is used to drive and update a digital twin model (S203) synchronized with the physical machine tool state. This digital twin model is not only a geometric model of the machine tool, but also a physical behavior model that includes the dynamic and thermal characteristics of the machine tool, capable of reflecting the machine tool's health status and performance in real time.

[0058] Based on the established tool offset reference and the real-time updated digital twin model, this method performs a virtual machining simulation (S204) on the original machining program before actual machining. By simulating the material removal process using the digital twin model, the amount of machining deformation that the workpiece (especially thin-walled and weakly rigid structures) may experience under the current machine tool conditions and cutting parameters can be predicted. Based on the predicted deformation, such as a predicted elastic deformation of 0.05mm due to cutting force at a certain location, the system automatically applies a corresponding negative offset to the original machining program, generating a corrected machining program that includes tool path offset. This "pre-compensation" method proactively offsets most foreseeable machining errors, improving the first-time machining pass rate.

[0059] Subsequently, the controller 301 of the CNC machine tool 300 executes the corrected machining program to perform the first machining of the workpiece. After machining, without removing the workpiece, the machine tool's integrated in-machine probe 303 is used to perform online detection according to the probe positions determined in step S201, thereby obtaining the actual machining dimensions of each probe position (S205). This in-machine online detection method avoids positioning errors caused by secondary workpiece clamping, ensures the accuracy of detection data, and shortens the detection waiting time.

[0060] After obtaining the actual machining dimensions, the system compares them with the theoretical machining dimensions to determine the dimensional deviation of each probe point. Next, the system performs a crucial judgment (S206): probe points whose dimensional deviations exceed the tolerance range of their respective feature surfaces (i.e., unqualified), but whose deviation values ​​are less than a preset safety deviation threshold (e.g., 0.1 mm), are identified as compensable points. This judgment mechanism automatically filters and classifies unqualified points, distinguishing between scrapped points exceeding the repair threshold and points that can be compensated for, laying the foundation for subsequent compensation.

[0061] For the identified compensable points, the system will initiate the model correction and compensation procedure generation process (S207). Specifically, the actual dimensional deviations of these points, along with the spindle load and vibration frequency data collected in real time during the machining of these points, will be used as "real-world" feedback and input back into the digital twin model. Based on the differences between these actual data and simulation predictions, the model will automatically correct its internal key parameters, such as the cutting force coefficient and system stiffness matrix, thereby further improving the model's predictive ability for the machining process and achieving self-learning and evolution. The corrected model will then generate a dedicated finish milling program for removing remaining machining allowances.

[0062] Finally, the machine tool will perform secondary compensation machining on the workpiece based on this highly customized allowance milling program (S208). Since this program is generated based on a high-fidelity model after precise measurement and correction of actual deviations, it greatly ensures the accuracy of the compensation machining, guaranteeing that the final machined dimensions fall within the tolerance range. Through the complete closed loop described above, from prediction, machining, inspection, feedback correction to remachining, this method solves the problem of the disconnect between measurement, judgment, and compensation links in traditional machining modes, thereby improving workpiece machining quality and efficiency.

[0063] In a preferred embodiment, the deviation feature vector of the compensable point is extracted, historical processing cases are matched in the historical process knowledge graph, and the rework success rate is calculated; if the rework success rate is greater than or equal to the preset success rate threshold, then the following steps are performed: inputting the dimensional deviation of the compensable point and the real-time collected spindle load and vibration frequency data into the digital twin model.

[0064] After identifying compensable points, to avoid ineffective compensation attempts at points with extremely high rework difficulty or low success rates, which could waste machine time or even lead to the scrapping of the entire workpiece, the system introduces a decision support step based on historical experience. Specifically, the system first extracts the deviation feature vectors of these compensable points, such as the direction and magnitude of the deviation value, and the geometric attributes of the feature surface where it is located. Then, the system uses these deviation feature vectors to perform pattern matching in a pre-built historical process knowledge graph to retrieve processing cases with similar characteristics from history.

[0065] By analyzing the rework results (success or failure) of these similar historical cases, the system can calculate the expected success rate of performing rework under the current circumstances. For example, if 9 out of 10 similar historical cases were successful, the rework success rate is 90%. The system compares this calculated success rate with a preset success rate threshold (e.g., 80%). Only when the calculated rework success rate is greater than or equal to this threshold will the system continue with the subsequent steps of digital twin model correction and allowance milling program generation. This design is equivalent to adding a risk assessment and decision-making module to the automated rework process. By drawing on historical experience, it assesses the risks of rework tasks, thereby making more rational and economical decisions and effectively avoiding high-risk machining operations.

[0066] Further, the steps of extracting the deviation feature vectors of compensable points, matching them with historical processing cases in the historical process knowledge graph, and calculating the rework success rate specifically include: determining the deviation feature vectors of compensable points based on their dimensional deviations; obtaining the material grade and heat treatment status of the workpiece to be processed from the material management system, and determining the material hardness grade according to the preset material grade-hardness mapping table and heat treatment status-hardness correction coefficient table; combining the deviation feature vectors, material hardness grades, and current process type into a multi-dimensional feature vector according to the preset feature dimension order; calculating the Euclidean distance between the multi-dimensional feature vectors and the feature vectors of each historical processing case in the historical process knowledge graph, sorting them by Euclidean distance from smallest to largest, and retrieving the multiple historical processing cases with the highest similarity to the multi-dimensional feature vectors; and calculating the ratio of the number of successful rework cases among the multiple historical processing cases to the total number of cases as the rework success rate.

[0067] The specific implementation of extracting the deviation feature vector and matching it with historical cases is as follows: First, the system constructs a basic deviation feature vector based on the dimensional deviation value, deviation direction (e.g., +0.05mm or -0.03mm) of the determined compensable points, and the type of geometric feature at that point (e.g., plane, curved surface, hole, etc.). To improve the matching accuracy, the system also automatically obtains the material grade (e.g., 7075 aluminum alloy) and heat treatment state (e.g., T6) of the workpiece to be processed from the material management system (MES or ERP).

[0068] Subsequently, the system automatically queries and calculates the actual material hardness grade of the current workpiece based on the preset material grade-hardness mapping table and heat treatment state-hardness correction coefficient table. This hardness grade, along with the current process type (such as roughing, finishing, or rework), is combined with the aforementioned basic deviation feature vector, according to the preset feature dimension order, to form a higher-dimensional, more information-rich multi-dimensional feature vector. This multi-dimensional feature vector comprehensively describes the context of the current "problem to be repaired".

[0069] Next, the system uses mathematical methods to calculate the similarity between the multidimensional feature vector and the feature vector of each historical processing case stored in the historical process knowledge graph. A common method is to calculate their Euclidean distance in the multidimensional feature space. The smaller the Euclidean distance, the more similar the features of the two cases are. The system sorts the cases in ascending order of Euclidean distance and retrieves the N historical processing cases (e.g., N=10) with the highest similarity to the current situation. Finally, by counting the number of these N most similar historical cases whose rework results are marked as "successful" and dividing by the total number of cases N, a quantitative and statistically significant rework success rate can be obtained. In this way, the system can make an objective prediction of the rework success rate based on multidimensional data.

[0070] In another preferred embodiment, the step of performing secondary compensation machining on the workpiece to be machined based on the allowance milling program includes: predicting the actual tool radius based on the current cumulative cutting distance of the tool and the pre-stored tool wear curve, and dynamically adjusting the tool compensation parameters of the corrected allowance milling program according to the actual tool radius to generate a rework program; performing overcutting and interference checks on the rework program, and after passing the checks, performing secondary compensation machining on the workpiece to be machined based on the rework program; performing online inspection on the workpiece after secondary compensation machining again, and repeating the steps of determining the dimensional deviation to secondary compensation machining until the dimensional deviation of all probe points is within the corresponding tolerance range, or when the number of compensations exceeds the preset number, an alarm message is output.

[0071] This embodiment refines and enhances the secondary compensation machining step (S208) to address dynamic changes such as tool wear and achieve more intelligent program generation and process control. Specifically, the secondary compensation machining process based on the allowance milling program includes: First, the system dynamically predicts the actual tool radius at the current moment based on the current cumulative cutting distance of the tool (this data can be recorded in real time by the controller 301) and the wear curve of the tool model pre-stored in the system. For example, if a new tool has a radius of 6mm, and after cutting 500 meters, the wear curve predicts that its radius will wear by 0.005mm, then the actual radius is 5.995mm. Based on this dynamically changing actual tool radius, the system fine-tunes the tool compensation parameters of the allowance milling program generated in the previous step to generate the final rework program. This dynamic adjustment can compensate for errors caused by tool wear, ensuring the accuracy of the rework.

[0072] After generating the rework program, to ensure machining safety, the system does not execute it immediately. Instead, it first performs a rigorous simulation check on the rework program. This includes overcutting checks (checking whether the toolpath will cut into the acceptable workpiece surface) and interference checks (checking whether the tool, tool holder, or other machine tool components will collide with the workpiece or fixture). Only after both checks pass will the controller 301 load and execute the rework program to perform safe secondary compensation machining on the workpiece. This strategy of checking before execution is a key element in ensuring the stability and reliability of the automated rework process.

[0073] More importantly, this implementation introduces a closed-loop logic for iterative compensation. After one secondary compensation process is completed, the system controls the in-machine probe 303 to perform online inspection of the workpiece again, and repeats the entire cycle from determining the dimensional deviation to performing secondary compensation. This cycle continues until the dimensional deviations of all probe points are corrected to their corresponding tolerance ranges, and the workpiece is fully qualified. Meanwhile, to prevent infinite loops due to some persistent problems, the system also sets an upper limit on the number of compensation attempts. If there are still unqualified points after the number of compensation attempts exceeds the preset number (e.g., two or three), the system will automatically stop the compensation process and output an alarm message, prompting manual intervention for inspection, thus balancing automation efficiency with robustness in handling anomalies.

[0074] Furthermore, the steps for generating a rework program include: constructing query conditions based on the dimensional deviation of the compensable point and the diameter of the machining tool; matching a standardized rework program from a preset program library based on the query conditions; wherein the preset program library establishes a multi-level index according to feature surface type, tool type, dimensional deviation range, and tolerance range; if there is no matching standardized rework program in the preset program library, then determining the original G-code program segment and machining tool corresponding to the compensable point based on the preset association relationship; calculating the path offset value based on the dimensional deviation; inserting a tool offset instruction containing the path offset value into the original G-code program segment; or directly modifying the tool depth of cut parameter in the original G-code program segment to generate a rework program. The association relationship is the relationship between the feature surface and the start line number, end line number, and tool information of the G-code program segment that processes the feature surface.

[0075] This embodiment elaborates on the specific method of generating rework programs. The system can employ two strategies to generate rework programs. The first is a matching strategy based on a standardized program library. The system pre-establishes a large program library, in which standardized rework programs are indexed at multiple levels according to feature surface type (plane, bevel, internal fillet, etc.), tool type (ball end mill, flat end mill, etc.), dimensional deviation range (e.g., 0.02-0.04mm, 0.04-0.06mm), and tolerance range level (e.g., IT7, IT8). When a rework program needs to be generated, the system constructs a query condition based on information such as the dimensional deviation of the currently compensable point and the required machining tool diameter, and performs a rapid match within the program library. If a completely matching standardized rework program is found, it is directly invoked; this is an efficient method.

[0076] The second strategy is a dynamic generation strategy. In this case, the system first determines, based on a preset association, which G-code segment (e.g., located by start and end line numbers) and which tool were used to machine the compensable point in the initial machining program. This association is established when the probe point is generated in step S201. Then, based on the current dimensional deviation value (e.g., +0.03mm), the system calculates the path offset value that needs compensation. Finally, the system generates a rework program by modifying the original G-code segment in one of two ways: one is to intelligently insert a tool offset instruction (e.g., G41 / G42) containing the path offset value into the segment; the other is to more directly modify the coordinate values ​​controlling the depth of cut in the segment (e.g., Z-axis coordinates). In this way, even without a readily available program, the system can make precise local modifications to the original program and dynamically generate a customized rework program. This second dynamic generation strategy can also serve as a backup plan when the first strategy fails (i.e., there is no readily available standardized program in the library).

[0077] In a preferred embodiment, the steps of generating probe points and theoretical machining dimensions corresponding to each feature surface include: performing finite element analysis on the geometric model of the workpiece to be machined; identifying low-stiffness regions with wall thicknesses less than a preset critical wall thickness value based on the wall thickness distribution of each region of the geometric model; generating probe points in the low-stiffness regions according to a first density, and generating probe points in non-low-stiffness regions according to a second density, wherein the second density is less than the first density, and the first density is inversely proportional to the wall thickness of the low-stiffness region; binding the identification information of each probe point with the corresponding milling program segment number, and establishing a mapping table with the probe point identification as the key and the milling program segment number and the tool number used by the program segment as the value; and performing a geometric query in the three-dimensional model of the workpiece drawing, using the spatial coordinates of each probe point as the index, to read the theoretical machining dimensions of each probe point.

[0078] This embodiment optimizes the process of generating probe points and theoretical processing dimensions in step S201 to improve the efficiency and specificity of the detection. Please refer to [link / reference]. Figure 4 The process begins by performing a rapid finite element analysis (FEA) on the workpiece geometry model 401 corresponding to the workpiece drawing. The purpose of this analysis is not to calculate deformation, but to analyze the wall thickness distribution of the model, thereby identifying regions with wall thicknesses less than the preset critical wall thickness value. These regions typically exhibit poor rigidity during processing, i.e., low-rigidity regions 402.

[0079] After identifying the low-stiffness region 402, the system employs a differentiated density strategy when deploying probe points. Specifically, within the region identified as low-stiffness area 402, the system generates high-density probe points 403 according to a higher first density to enhance monitoring of these easily deformable areas. In other non-low-stiffness regions 405 with thicker walls and better rigidity, low-density probe points 404 are generated according to a lower second density. The first density can also be inversely proportional to the specific wall thickness of the region; that is, the thinner the wall, the denser the probe points. This "focused monitoring of key areas" strategy, compared to uniform point deployment, reduces the total number of detection points while ensuring detection accuracy in critical areas, thereby shortening detection time and improving overall efficiency.

[0080] To directly link the inspection results with the machining process, the system binds the unique identifier (ID) of each probe point to the milling program segment number of the area where that point is located when generating the probe points. Specifically, a mapping table can be established, using the probe point identifier as the key and the corresponding milling program segment number and the tool number used in that program segment as the value. This mapping table is a crucial data foundation for subsequent rework and root cause analysis. Finally, based on the 3D CAD model of the workpiece drawing, the system performs a geometric query in the model using the spatial coordinates of each probe point as an index, accurately reading and recording the theoretical machining dimensions of each point.

[0081] In another preferred embodiment, the step of simulating the material removal rate of the original machining program using a digital twin model based on the tool offset reference and predicting the machining deformation amount to be generated by executing the original machining program includes: applying a finer mesh to the mesh elements identified as low-stiffness regions in the geometric model of the workpiece to be machined during the material removal rate simulation of the original machining program using a digital twin model based on the tool offset reference; calculating the time-varying load of each mesh element under the action of the cutting force using a cutting force model based on the tool offset reference and the cutting parameters in the original machining program, and then calculating the deformation amount of each mesh element through a finite element solver to generate the machining deformation amount.

[0082] The simulation prediction process using the digital twin model in step S204 has been enhanced to obtain more accurate prediction results of processing deformation. This enhancement is closely integrated with the aforementioned step of identifying low-stiffness regions. Specifically, when the digital twin model performs finite element calculations for material removal rate simulation, it applies a finer mesh to the mesh elements identified as low-stiffness regions 402 in step S201. In regions with better stiffness, a conventional mesh density is maintained. This adaptive meshing strategy improves the simulation accuracy of key deformation regions without significantly increasing the overall computational load.

[0083] Based on a refined mesh, the model uses a cutting force model (such as the Kienzle model) to calculate the time-varying cutting force load on each mesh cell during the virtual cutting process, based on the established tool offset reference and the cutting parameters (such as spindle speed, feed rate, and depth of cut) set in the original machining program. These time-varying loads are then input into the finite element solver, which calculates the deformation of each mesh cell on the workpiece under these loads, ultimately compiling a distribution map of the machining deformation of the entire workpiece. By focusing on and refining the calculation of low-stiffness regions, this method can predict the workpiece deformation caused by cutting forces more accurately than traditional uniform mesh simulation methods, thus providing a solid foundation for generating more effective negative offset correction machining programs.

[0084] To further improve the accuracy and reliability of in-machine detection (S205), a preferred embodiment adds an automated workpiece surface pretreatment step before detection. After machining with a correction program, chips and coolant often remain on the workpiece surface, especially in complex cavities and corners. These residues can severely affect the accuracy of measurements taken by the in-machine probe 303. Therefore, in this step, the controller 301 first controls the water gun device equipped on the machine tool to perform high-pressure water rinsing on the workpiece according to a preset rinsing path. This rinsing path can be intelligently generated to ensure coverage of all areas to be measured, and the rinsing time can be automatically set according to the total machining path length of the correction program. The longer the machining path, the more potential residues there are, and the longer the rinsing time will be.

[0085] After high-pressure water rinsing, to remove residual water droplets, controller 301 then controls the air gun device to perform high-speed airflow cleaning of the workpiece. The cleaning path can be the same as or similar to the rinsing path. The cleaning time is usually set to a preset fixed duration, which must ensure that there are no obvious liquid droplet residues on the workpiece surface, especially near the probe points, achieving a "dry" state. Through this automated cleaning process of "rinsing first and then blowing," it is ensured that the internal probe 303 contacts a clean, interference-free measuring surface, thereby maximizing the accuracy of subsequent actual machining dimension data acquisition and providing an important guarantee for the precise operation of the entire closed-loop compensation system.

[0086] In one embodiment of this application, the system not only handles single processing deviations but also possesses the capability to perform in-depth diagnosis and root cause analysis of recurring quality problems. Specifically, the system monitors the frequency of non-conformities. If compensable points are detected on the same or similar features in N consecutive processing operations (N being a preset positive integer, such as 3), the system determines that this may not be an accidental processing error but rather an underlying systemic problem. In this case, the system automatically triggers the root cause analysis process.

[0087] The process first involves linking and retrieving real-time log data from the CNC machine tool 300 during the machining of these N workpieces. This data includes not only spindle load and vibration spectrum collected by the multi-dimensional sensor group 302, but also deeper equipment status information, such as the hydraulic / pneumatic pressure values ​​of the clamping system, the currently used tool number, and the tool loading timestamp accurate to the second. Subsequently, the system uses a causal inference-based algorithm to analyze this data and find the root cause of the defects. This algorithm is based on a pre-defined Bayesian network model, which predefines the probabilistic causal relationships between various potential faults (root cause nodes, such as fixture loosening, tool breakage, excessive tool wear, and machine tool thermal deformation) and observable phenomena (observation nodes, such as sudden changes in spindle load, shifts in specific frequency peaks in the vibration spectrum, and decreases in clamping pressure).

[0088] By inputting observed data into this Bayesian network, the algorithm can infer the most likely root cause of the current problem. For example, if a continuous decrease in clamping pressure is observed along with a low-frequency anomaly in the vibration spectrum, the algorithm may infer with high probability that "clamp loosening" is the root cause. If the algorithm ultimately determines that the root cause of the defect is a major equipment failure such as "clamp loosening" or "tool breakage," the system will immediately take the highest priority response: lock the current machining task, suspend all automated processes, and trigger a high-level manual intervention alarm (e.g., through the shop floor Andon system), while explicitly terminating subsequent automated rework processes to prevent further damage from continued machining under equipment failure conditions. This mechanism expands the system's functionality from simply performing repairs to being able to diagnose faults.

[0089] Based on the aforementioned root cause analysis capabilities, another embodiment of this application constructs an ecosystem for knowledge evolution and sharing. In this embodiment, the dimensional deviation values ​​of compensable points during the current processing, the identifiers of their respective feature surfaces, the number of the generated rework program, the number of the tool used and its actual radius, and whether the processing result is qualified are extracted into structured experiential knowledge containing preset correlations. The root cause is obtained through causal inference algorithm analysis, and the preset correlations include the relationship between defect features, root causes, and optimal rework solutions. This structured experiential knowledge is synchronized to the control nodes of other associated machine tools processing similar features on the production line via a distributed network, triggering each associated machine tool to update its local digital twin model and / or historical process knowledge graph.

[0090] After a machining-rework cycle is completed (regardless of success or failure), the system automatically extracts structured experiential knowledge. This knowledge includes the strong correlation between "defect characteristics, root causes, and optimal rework solutions." Specifically, it records the detailed dimensional deviation values ​​of compensable points during the machining process, the unique identifier of the feature surface to which it belongs, the rework program number generated to repair it, the tool number and actual tool radius used when performing the rework, and the final machining result (pass / fail). Among these, the crucial "root cause" information is obtained through the aforementioned causal inference algorithm analysis.

[0091] This structured experiential knowledge has a higher value density compared to raw processing data. To enable this experience to play a broader role, the system synchronizes this refined knowledge in real time via a distributed network to the controllers 301 of other associated machine tools processing similar features on the production line. Upon receiving this new knowledge, these associated machine tools trigger updates to their local digital twin models and / or historical process knowledge graphs. For example, if the knowledge indicates that a certain cutting strategy is prone to causing vibration on a specific material, the digital twin models of other machine tools will adjust their simulation parameters accordingly, thereby proactively avoiding this problem in future processing. This forms a collaborative optimization system across multiple machine tools, enabling the processing level of the entire production line to evolve and continuously improve together.

[0092] To ensure the secure, reliable, and efficient synchronization of the aforementioned structured experiential knowledge across multiple machine tools, one specific implementation of this application employs a distributed shared ledger-based technology. When a machine tool generates new structured experiential knowledge, it first packages the knowledge into a "knowledge block." Then, it calculates the hash value (a digital fingerprint that uniquely identifies the block's content) of this knowledge block and uploads the knowledge block itself and its hash value together to a distributed shared ledger maintained by all machine tools on the production line.

[0093] The controller 301 of other associated machine tools can acquire this new knowledge in two ways. One is a "subscription" mode: each node pre-subscribes to the type of knowledge it is interested in (e.g., knowledge update events related to the feature type being processed on its machine). When a new relevant block is confirmed on the ledger, the node will automatically receive a notification and download the block. The other is a more distributed "broadcast" mode: the node that generates the knowledge can directly broadcast it point-to-point to its neighboring nodes in the network. The broadcast content may only be the hash value of the new knowledge block. If the node receiving the hash value does not find the block locally, it will request the complete knowledge block data from the broadcast source or other nodes in the network based on the hash value. Once the new knowledge block is acquired, the node will securely and automatically trigger the update of its local digital twin model or historical process knowledge graph according to preset update rules. This synchronization mechanism based on a distributed ledger ensures the timeliness, integrity, and immutability of knowledge transfer, providing technical support for building a truly self-learning and self-evolving intelligent manufacturing system.

[0094] Please see Figure 3 This application also provides a physical embodiment of a CNC machine tool 300. This CNC machine tool 300 is the physical carrier for implementing any of the aforementioned workpiece compensation machining methods. Its core is a controller 301, which integrates a high-performance processor 3011 and a sufficiently large memory 3012. The memory 3012 stores a computer program containing logical instructions for implementing all the aforementioned method steps.

[0095] When the CNC machine tool 300 is running, the processor 3011 executes the computer program stored in the memory 3012. According to the program's instructions, the processor 3011 coordinates the various hardware components of the machine tool to work together. For example, it controls the machine tool actuators 307 (including the spindle motor and servo motors for each feed axis) via the machine tool bus to execute the machining program; it reads real-time data from the multi-dimensional sensor group 302 (such as force sensors, acceleration sensors, and temperature sensors) installed on the machine tool to build and update the digital twin model; it controls the in-machine probes 303 to perform online workpiece measurement; and it interacts with the factory's MES system, tool management system, or distributed shared ledger via the network interface 304. Users can monitor the machining process, receive system alarms, or intervene manually when necessary through the human-machine interface 305. Therefore, through the deep integration of its hardware and software, the CNC machine tool 300 constitutes an intelligent machining unit capable of independently completing the entire process from intelligent prediction and adaptive machining to closed-loop compensation.

[0096] In a specific application scenario, the workpiece compensation machining method and the numerical control machine tool provided by the present invention can be widely applied to the manufacturing of complex structural parts in the aerospace field, such as the machining of integral aircraft panels. Such parts are usually milled integrally from large aluminum alloy or titanium alloy blanks, and have a large number of thin-walled and high-reinforcement structures, which are extremely prone to cutting deformation during the machining process. Traditional machining methods often rely on experienced technicians to repeatedly trial cut and manually measure, with low efficiency and poor quality consistency.

[0097] Adopting the technical solution of the present invention, first, when the system generates a machining program, all low-rigidity regions 402 (i.e., thin-walled regions) on the panel are automatically identified through finite element analysis, and high-density probe points 403 are densely arranged in these regions. Before the formal machining, the digital twin model will conduct refined mesh simulation for these thin-walled regions, predict the deformation amount caused by the cutting force, and generate a corrected machining program with a negative offset. After the first machining is completed, the machine tool will automatically execute the cleaning and in-machine detection process to quickly obtain the actual dimensions of all probe points. Suppose the size of a certain thin wall exceeds the tolerance by +0.03 mm. The system will query the historical process knowledge graph, confirm that the repair success rate for such deviations is as high as 95%, and thus decides to execute the compensation.

[0098] The system feeds back the deviation of +0.03 mm to the digital twin model for self-correction, and generates an accurate finishing milling program for the remaining amount. At the same time, the system takes into account that the tool has been cutting for 2 hours, predicts that the tool radius has decreased by 0.003 mm according to the wear model, and automatically adds the corresponding tool compensation to the repair program. After passing the safe overcutting and interference inspection, the machine tool executes the repair. After the repair, the measurement is taken again and the size is qualified. The whole process is fully automatic without manual intervention, greatly shortening the machining cycle. If similar problems occur at the same position for multiple consecutive integral aircraft panels, the system can also infer through causal analysis that it may be due to insufficient fixture support force in this area, and put forward suggestions for optimizing the fixture design to the process engineer, so as to fundamentally solve the problem and achieve continuous improvement of the process.

[0099] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the above-described division of the system, device, and unit is only a functional division. In actual implementation, different division methods can be adopted. For example, multiple units or components can be combined or integrated into another system, or some functions can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0100] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, for system or device embodiments, since their basic structure is similar to the method embodiments, the description is relatively simple; relevant parts can be referred to the description of the method embodiments. The above descriptions are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made without departing from the spirit and substance of this application should be included within the protection scope of this application.

Claims

1. A workpiece compensation machining method, characterized in that, Includes the following steps: Obtain the original machining program of the workpiece to be processed, and determine the tolerance range of each feature surface according to the workpiece drawing file of the workpiece to be processed, and generate the probe points and theoretical machining dimensions corresponding to each feature surface; The tool length compensation value and tool radius compensation value of the current tool are obtained by the in-machine probe, and the nominal parameters of the standard tool are obtained by the external tool setting instrument to establish the tool offset reference. A digital twin model synchronized with the machine tool's state is constructed by real-time acquisition of spindle load, vibration frequency, and temperature data using a multi-dimensional sensor array. Based on the tool offset reference, the material removal rate of the original machining program is simulated using the digital twin model to predict the machining deformation that will be generated by executing the original machining program. Based on the machining deformation, the original machining program is negatively offset to generate a corrected machining program containing tool path offset. After the workpiece is processed by executing the modified processing program, the actual processing dimensions of each probe point are obtained by in-machine detection. Based on the difference between the actual and theoretical processing dimensions of each probe point, the size deviation is determined, and the probe points whose size deviation exceeds the tolerance range of their respective feature surfaces but is less than a preset deviation threshold are determined as compensable points. The dimensional deviation of the compensable points and the real-time collected spindle load and vibration frequency data are input into the digital twin model to correct the cutting force coefficient and stiffness matrix of the digital twin model, and output the corrected allowance fine milling program. The workpiece to be processed is subjected to secondary compensation machining based on the margin milling program.

2. The workpiece compensation machining method as described in claim 1, characterized in that, After the step of determining the compensable point, the method further includes: Extract the deviation feature vector of the compensable points, match historical processing cases in the historical process knowledge graph, and calculate the rework success rate; If the rework success rate is greater than or equal to the preset success rate threshold, then the following step is executed: inputting the dimensional deviation of the compensable point and the real-time collected spindle load and vibration frequency data into the digital twin model.

3. The workpiece compensation machining method as described in claim 2, characterized in that, The step of extracting the deviation feature vector of the compensable points, matching it with historical processing cases in the historical process knowledge graph, and calculating the rework success rate includes: Based on the size deviation of the compensable point, the deviation feature vector of the compensable point is determined; Obtain the material grade and heat treatment status of the workpiece to be processed from the material management system, and determine the material hardness grade according to the preset material grade-hardness mapping table and heat treatment status-hardness correction coefficient table; The deviation feature vector, the material hardness grade, and the current process type are combined into a multi-dimensional feature vector according to a preset feature dimension order. In the historical process knowledge graph, the Euclidean distance between the multidimensional feature vector and the feature vector of each historical processing case is calculated, and the cases are sorted in ascending order of Euclidean distance to retrieve the historical processing cases with the highest similarity to the multidimensional feature vector. The success rate of rework is the ratio of the number of successful rework cases to the total number of cases.

4. The workpiece compensation machining method as described in claim 1, characterized in that, The secondary compensation machining of the workpiece based on the allowance fine milling program includes: The actual tool radius is predicted based on the current cumulative cutting distance of the tool and the pre-stored tool wear curve, and the tool compensation parameters of the corrected allowance milling program are dynamically adjusted according to the actual tool radius to generate a rework program. The rework procedure is subjected to overcutting and interference checks, and after the checks are passed, the workpiece to be processed is subjected to secondary compensation processing based on the rework procedure. The workpiece after the secondary compensation process is inspected online again, and the steps of determining the dimensional deviation to the secondary compensation process are repeated until the dimensional deviation of all probe points is within the corresponding tolerance range, or the number of compensations exceeds the preset number, at which point an alarm message is output.

5. The workpiece compensation machining method as described in claim 4, characterized in that, The rework generation procedure includes: Based on the dimensional deviation of the compensable points and the diameter of the machining tool, query conditions are constructed, and standardized rework programs are matched from a preset program library based on the query conditions. The preset program library is indexed in multiple levels according to feature surface type, tool type, dimensional deviation range, and tolerance range. If there is no matching standardized rework program in the preset program library, the original G-code program segment and machining tool corresponding to the compensable point are determined according to the preset association relationship. The path offset value is calculated based on the dimensional deviation. A tool offset instruction containing the path offset value is inserted into the original G-code program segment, or the tool depth of cut parameter in the original G-code program segment is directly modified to generate a rework program. The association relationship refers to the association between the feature surface and the start line number, end line number, and tool information of the G-code program segment used to process the feature surface.

6. The workpiece compensation machining method as described in claim 1, characterized in that, The generation of probe points and theoretical processing dimensions corresponding to each of the aforementioned feature surfaces includes: Finite element analysis is performed on the geometric model of the workpiece to be processed. Based on the wall thickness distribution of each region of the geometric model, low stiffness regions with wall thickness less than a preset critical wall thickness value are identified. Probe points are generated in the low stiffness region according to a first density, and in the non-low stiffness region according to a second density, wherein the second density is less than the first density, and the first density is inversely proportional to the wall thickness of the low stiffness region. The identification information of each probe point is bound to the corresponding fine milling program segment number, and a mapping table is established with the probe point identification as the key and the fine milling program segment number and the tool number used by the program segment as the value. Based on the three-dimensional model of the workpiece drawing, using the spatial coordinates of each probe point as an index, a geometric query is performed in the three-dimensional model to read the theoretical machining dimensions of each probe point.

7. The workpiece compensation machining method as described in claim 1, characterized in that, Based on the tool offset reference, the digital twin model is used to simulate the material removal rate of the original machining program and predict the machining deformation that will occur when the original machining program is executed, including: Based on the tool offset reference, during the material removal rate simulation of the original machining program using the digital twin model, a finer mesh is applied to the mesh cells identified as low-stiffness regions in the geometric model of the workpiece to be processed. Based on the tool offset reference and the cutting parameters in the original machining program, the time-varying load of each mesh element under the action of the cutting force is calculated using the cutting force model, and then the deformation of each mesh element is calculated by the finite element solver to generate the machining deformation.

8. The workpiece compensation machining method as described in claim 1, characterized in that, Before obtaining the actual machining dimensions of each probe point through in-machine detection, the method further includes: The water gun device is controlled to perform high-pressure water rinsing on the workpiece to be processed according to the preset rinsing path, and the rinsing time is automatically set according to the processing path length of the modified processing program. The air gun device is controlled to blow and clean the workpiece with high-speed airflow after rinsing. The blowing time is set to a preset duration so that there are no obvious liquid droplets left on the surface of the workpiece.

9. The workpiece compensation machining method as described in claim 1, characterized in that, The method further includes: If a compensable point is detected N times consecutively, the real-time log data of the machine tool is associated with it. The real-time log data includes the spindle vibration spectrum, clamping oil / air pressure value, tool number and tool loading timestamp, where N is a preset positive integer. The root causes of non-compliance are analyzed by a causal inference algorithm. The causal inference algorithm is based on a preset Bayesian network model. The Bayesian network model takes fixture loosening, tool breakage, tool wear and thermal deformation as root cause nodes, and spindle load change, vibration spectrum peak frequency shift and clamping pressure decrease as observation nodes. If the defect is determined to be caused by a loose fixture or a broken tool, the machining task is locked and a manual intervention alarm is triggered to terminate the automatic rework process.

10. The workpiece compensation machining method as described in claim 9, characterized in that, The method further includes: The dimensional deviation values ​​of the compensable points, the identification of the feature surfaces to which they belong, the number of the generated rework program, the number of the tool used and the actual tool radius, and the information on whether the processing result is qualified are extracted into structured experiential knowledge containing preset correlations. The preset correlations include the correlation between defect features, root causes and optimal rework solutions. The root causes are obtained through the causal inference algorithm. The structured experience knowledge is synchronized to the control nodes of other related machine tools processing similar features in the production line through a distributed network, so as to trigger each related machine tool to update its local digital twin model and / or historical process knowledge graph.

11. The workpiece compensation machining method as described in claim 10, characterized in that, The step of synchronizing the structured experience knowledge to the control nodes of other related machine tools processing similar features on the production line via a distributed network includes: The structured experience knowledge is packaged into knowledge blocks, the hash value of the knowledge blocks is calculated, and the knowledge blocks and their hash values ​​are uploaded to the distributed shared ledger. Control nodes of other associated machine tools obtain the structured experience knowledge by subscribing to knowledge block update events related to the machine's machining feature type in the distributed shared ledger, or by receiving the hash value of the knowledge block via point-to-point broadcast and requesting the complete knowledge block from neighboring nodes accordingly. They then automatically trigger updates to the local digital twin model and / or historical process knowledge graph according to preset update rules.

12. A CNC machine tool, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the workpiece compensation machining method as described in any one of claims 1 to 11.