Dynamic response prediction method and system for numerical control machine tool based on conditional diffusion model
By constructing a prediction model based on a conditional diffusion model in CNC machine tools, and combining a semi-empirical physical model and a data-driven method, the sparsity problem of dynamic response data prediction is solved, achieving high-precision and robust dynamic response prediction, and improving the stability of the model and the consistency of the prediction results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to accurately predict dynamic response data in CNC machine tools, especially in the machining of large workpieces. The sparse nature and high cost of dynamic response data make it difficult for data-driven models to capture dynamic features, affecting machining accuracy and equipment safety.
A prediction model is built based on the conditional diffusion model. It combines a semi-empirical physical model and a data-driven approach. The training process is guided by a physical loss term, and a conditional encoder, a time encoder, and a denoising network are used to predict dynamic response data.
It achieves high-precision and robust dynamic response data prediction with a small amount of initial data, taking into account both local and global features, and improving the stability of the model and the physical consistency of the prediction results.
Smart Images

Figure CN122488482A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the fields of electronic engineering and computer science, and specifically relates to a method and system for predicting the dynamic response of CNC machine tools based on a conditional diffusion model. Background Technology
[0002] As modern manufacturing transforms towards intelligent manufacturing, accurate prediction and optimization of the manufacturing process have become crucial. In CNC milling, dynamic response data such as cutting force and tool speed serve as core machining data, directly impacting machining accuracy, surface quality, and equipment safety. Especially in the finishing stage, accurate prediction of dynamic response data is vital for ensuring workpiece quality. Simultaneously, dynamic response data prediction can guide the setting of machining parameters, preventing machine tool damage due to overload. This role is particularly significant in the finishing stage, where accurate prediction of dynamic response data plays a decisive role in optimizing machining parameters and ensuring workpiece accuracy. However, in actual machining scenarios, the machining cycle for large workpieces is long, and material and sensor costs are high, making real-time dynamic response data acquisition difficult. The small sample size of dynamic response data makes it difficult to support data-driven models in capturing its dynamic characteristics, severely restricting research on surface roughness analysis, machining deformation prediction, and equipment fault diagnosis, which rely heavily on dynamic response data.
[0003] To address the above issues, existing dynamic response data prediction methods do not perform well in CNC machine tool scenarios. Summary of the Invention
[0004] To address the challenge of accurately predicting the dynamic response (tool speed and cutting force) of CNC machine tools, this application proposes a prediction model based on a conditional diffusion model. This model can predict the dynamic response data of the entire cutting process using only a small amount of initial data and machining parameters. Furthermore, a semi-empirical cutting force physical model is constructed, and a physical loss term is established based on this model. A physical information-guided approach is used to guide the training process of the prediction model.
[0005] The objective of this application is achieved through the following technical solution:
[0006] According to a first aspect of this application, a method for predicting the dynamic response of a CNC machine tool based on a conditional diffusion model is provided, comprising: constructing an input dataset based on a preset combination of machining parameters and their corresponding time position labels, wherein the machining parameters in the combination of machining parameters include spindle speed, radial depth of cut, feed rate, and cutting speed; using a trained prediction model based on the input dataset and a preset initial noise, outputting dynamic response data corresponding to the time position labels, wherein the dynamic response data includes cutting force and the actual feed rate of the tool; wherein the prediction model is constructed based on a conditional diffusion model, and the loss function applied during its training consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term, wherein the physical loss term is determined based on a semi-empirical physical model constructed based on the machining process.
[0007] Preferably, the semi-empirical physical model is constructed as follows: by analyzing cutting theory and the machining process, the influencing parameters affecting the dynamic response data and the mathematical relationships between them are identified; at least one undetermined coefficient is preset, and a physical model between the dynamic response data and the influencing parameters is constructed based on the at least one undetermined coefficient and the influencing parameters and the mathematical relationships between them; the fitting problem of the at least one undetermined coefficient is transformed into a multi-objective optimization problem, the multi-objective optimization problem is solved, and the optimal value of the at least one undetermined coefficient is obtained; the optimal value of the at least one undetermined coefficient is substituted into the physical model between the dynamic response data and the influencing parameters to obtain the semi-empirical physical model.
[0008] Preferably, the physical model between dynamic response data and influencing parameters includes:
[0009] (3)
[0010] in, The cutting force is in the x-direction. The cutting force is in the y-direction. The cutting force is in the z-direction. , , , , , , , , , , , , There are 13 undetermined coefficients. Let be the real-time feed rate of the tool in the x-direction. Let be the real-time feed rate of the tool in the y-direction. Let be the real-time feed rate of the tool in the z-direction, and D be the radial depth of cut. For cutting speed, Let be the cutting angle of the tool; apply a logarithmic transformation to equation (3) and transform the coefficient fitting problem into a multi-objective optimization problem as shown in equation (5):
[0011] (5)
[0012] Among them, intermediate variables ;
[0013] The NSGA-II multi-objective optimization algorithm is adopted, utilizing the following: The measured dataset is used to optimize the coefficient space consisting of the 13 undetermined coefficients to obtain the optimal values of the 13 undetermined coefficients, where n is the data size of the measured dataset; the optimal values of the 13 undetermined coefficients are substituted back into formula (3) to obtain the semi-empirical physical model as shown in formula (8):
[0014] (8)
[0015] in, To calculate the cutting force value in the x-direction, To calculate the cutting force value in the y direction, This represents the calculated cutting force value in the z-direction.
[0016] Preferably, the physical loss term is determined based on a semi-empirical physical model. The expression is shown in formula (9):
[0017] (9)
[0018] in, This represents the cutting force value in the k-direction predicted by the conditional diffusion prediction model. This represents the cutting force value in direction k calculated by a semi-empirical physical model. N represents the amount of data.
[0019] The boundary condition loss term The expression is shown in formula (10):
[0020] (10)
[0021] in, Indicates a time location label.
[0022] Preferably, the prediction model includes a conditional encoder, a time encoder, and a denoising network; wherein, the conditional encoder is used to convert the combination of processing parameters and time position labels into conditional embedding vectors; the time encoder is used to encode the time step labels to obtain time embedding vectors; and the denoising network is used to perform iterative denoising processing based on the current noise, the conditional embedding vectors, and the time embedding vectors to output the predicted value of the dynamic response data corresponding to the time position labels.
[0023] Preferably, the conditional encoder includes an MLP mapping layer and a multi-head attention layer; wherein, the MLP mapping layer adopts a single-layer fully connected structure with a ReLU activation function to map each processing parameter and time position label to a dimension of The space is used to extract preliminary features; the multi-head attention layer uses a dual-head self-attention mechanism to capture the nonlinear correlation between processing parameters. Based on the preliminary features, the query, key, and value matrices of the two attention heads are calculated respectively, and the attention weights are obtained by normalization using the softmax function. The attention weights output by the two attention heads are concatenated and combined with the output projection matrix to obtain the conditional embedding vector; the time encoder adopts a sinusoidal position encoding structure, using sine and cosine functions of different frequencies in different dimensions, and its output time embedding vector has a dimension of... The denoising network adopts a conditional diffusion Transformer block structure, which consists of a denoising encoder and a denoising decoder. The denoising encoder is constructed from multiple stacked Transformer modules, and the denoising decoder adopts a structure that combines Transformer modules with an MLP network.
[0024] Preferably, the training data used to train the prediction model includes at least the following types of data: the first type is the measured values of the machining parameter combination, including spindle speed, radial depth of cut, feed rate, and cutting speed; the second type is time step labels, used to identify the current stage of the diffusion process in the prediction model; the third type is the measured values of dynamic response data, including time-series data of the real dynamic response data in the x, y, and z directions corresponding to the machining parameter combination; and the fourth type is time position labels, used to identify the block positions after the measured values of the dynamic response data are segmented, and injected during the training process.
[0025] Preferably, the prediction model is trained in the following manner: The measured values of the dynamic response data in the training data are divided into several time blocks of equal length, with each time block's position on the time axis identified by the time position label; each time block is treated as an independent masking unit and processed separately to generate a corresponding masked sequence; all masked sequences corresponding to different processing parameter combinations and different time position labels are integrated together to form a time series set, and the position of each masked sequence in the time series set is labeled with time sequence using time position labels; an extended parameter set is constructed based on the processing parameter combinations and their corresponding time position labels; the prediction model is trained using a distributed anchoring generation strategy based on the extended parameter set, the time series set, and the time step labels, and the weights of the prediction model are adjusted based on the loss function until the prediction model converges.
[0026] According to a second aspect of this application, a dynamic response prediction system for CNC machine tools based on a conditional diffusion model is provided. This system includes an input dataset construction module and a prediction module. The input dataset construction module is configured to construct an input dataset based on a preset combination of machining parameters and their corresponding time position labels. The machining parameters in the machining parameter combination include spindle speed, radial depth of cut, feed rate, and cutting speed. The prediction module is configured to use a trained prediction model to output dynamic response data corresponding to the time position labels based on the input dataset and initial noise. The dynamic response data includes cutting force and the actual feed rate of the tool. The prediction model is constructed based on a conditional diffusion model, and the loss function applied during training consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term. The physical loss term is determined based on a semi-empirical physical model constructed based on the machining process.
[0027] According to a third aspect of this application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of the first aspect of this application.
[0028] According to a fourth aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method of the first aspect of this application.
[0029] Compared with the prior art, the main advantages of this application are:
[0030] This application addresses the challenges of extracting sufficient information from sparse features of CNC machine tools under various operating conditions, and the difficulty in simultaneously considering both overall distribution and local non-stationary features in dynamic response data prediction. It constructs a prediction model based on a conditional diffusion model, achieving the effect of fully extracting and generating sparse features while considering both local and global characteristics. Furthermore, to address the limitations of model interpretability and stability in dynamic response prediction methods, a physical information-guided method is proposed. This method utilizes physical loss to guide the training of the prediction model, thereby improving model stability and the physical consistency of prediction results. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying 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. In the drawings:
[0032] Figure 1 This is a schematic diagram illustrating the conceptual framework of a dynamic response prediction scheme for CNC machine tools according to an embodiment of this application.
[0033] Figure 2 This is a schematic flowchart of a method for predicting the dynamic response of a CNC machine tool according to an embodiment of this application. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. Furthermore, the technical features involved in the various embodiments described below can be combined with each other as long as they do not conflict with each other. To achieve the above objectives, this application adopts the following technical solutions.
[0035] As mentioned in the background section, dynamic response prediction is a core component in the intelligent upgrading of CNC milling. Existing dynamic response prediction methods are mainly divided into three categories: physical modeling-based methods establish theoretical equations based on mechanical principles, but their accuracy is limited under complex working conditions. Data-driven methods utilize machine learning to learn mapping relationships from large amounts of data; while highly adaptable, they have poor interpretability, and traditional autoregressive methods are prone to error accumulation. Data-driven and physical fusion methods attempt to combine the advantages of both, but existing methods still have shortcomings in model stability and feature extraction capabilities.
[0036] The inventors discovered in their research that the difficulty in fully extracting information from sparse features and the inability to simultaneously consider both overall distribution and local non-stationary features are pressing problems in dynamic response prediction. To address these issues, one embodiment of this application proposes constructing a prediction model based on a conditional diffusion model. A semi-empirical physical model is established based on the analysis of the machining process and theory, and the advantages of both the semi-empirical physical model and the prediction model are combined. The prediction model is trained using physical information to achieve high-precision and robust prediction of the dynamic response of CNC machine tools, enabling dynamic response prediction of the entire cutting process with only a small amount of initial data and machining parameters.
[0037] First, the overall idea of the prediction method proposed in the embodiments of this application will be introduced. Figure 1 This is a schematic diagram illustrating the conceptual framework of a dynamic response prediction scheme for CNC machine tools according to an embodiment of this application. Figure 1 As shown, the overall approach is implemented through three interconnected functional modules. The first module, the semi-empirical physical model establishment module 1 for CNC machine tool cutting process, performs the following steps: 1. Establishing a semi-empirical physical model of the cutting process, providing a basic framework for subsequent parameter optimization. 2. Optimizing the parameters of the established semi-empirical cutting model, outputting the optimized model, and providing input for the next module. The second module, the physical information constraint design module 2, designs physical constraints and completes model training. Its sequential steps include: designing the corresponding physical loss function based on the optimized semi-empirical physical model, introducing physical law constraints. 3. Based on the physical loss function, completing model training through a multi-loss guided approach, outputting the trained model, and providing input for the final module. The third module, the CNC machine tool dynamic response data prediction model establishment module 3, constructs the final dynamic response data prediction model, which is divided into two levels. Distribution anchoring generation, as a prerequisite step for the prediction model, generates distribution anchoring, providing a foundation for the subsequent conditional diffusion model. The diffusion model for conditional information embedding executes the following steps in sequence: performing a time-series masking operation on the input data; completing the hybrid embedding of conditional information and time data; and finally, using a prediction model built based on the conditional diffusion model to predict the dynamic response data of CNC machine tools.
[0038] The dynamic response prediction method for CNC machine tools according to the embodiments of this application will be described in detail below.
[0039] Figure 2 This is a flowchart illustrating a method for predicting the dynamic response of a CNC machine tool according to an embodiment of this application. Figure 2 As shown, the method includes: Step S201: Constructing an input dataset based on a preset combination of machining parameters and its corresponding time position labels, wherein the machining parameters in the combination of machining parameters include spindle speed R, radial depth of cut D, feed rate P, and cutting speed. Step S202: Using the trained prediction model, output dynamic response data corresponding to the time position labels based on the input dataset and initial noise. The dynamic response data includes cutting force and the actual feed rate of the tool. The prediction model is built based on a conditional diffusion model, and its loss function during training consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term. The physical loss term is determined based on a semi-empirical physical model built based on the machining process. In some embodiments, the initial noise is random noise following a standard Gaussian distribution.
[0040] This application addresses the challenges of extracting sufficient information from sparse features of CNC machine tools under different operating conditions, and the difficulty in simultaneously considering both overall distribution and local non-stationary features in dynamic response data prediction. It constructs a prediction model based on a conditional diffusion model, achieving the effect of fully extracting and generating sparse features while considering both local and global characteristics. Furthermore, to address the limitations of model interpretability and stability in dynamic response data prediction methods, a scheme using physical loss to guide the training of the prediction model is proposed, thereby improving model stability and the physical consistency of prediction results.
[0041] To better understand this application, the embodiments of this application will be described below in four aspects: loss function, training dataset, structure of prediction model, and training method.
[0042] I. Loss Function
[0043] According to one embodiment of this application, a semi-empirical physical model is proposed, comprising: identifying the influencing parameters affecting dynamic response data and their mathematical relationships through analysis of cutting theory and machining process; pre-setting at least one undetermined coefficient; constructing a physical model between dynamic response data and influencing parameters based on the at least one undetermined coefficient and the influencing parameters and their mathematical relationships; transforming the fitting problem of the at least one undetermined coefficient into a multi-objective optimization problem; solving the multi-objective optimization problem to obtain the optimal value of the at least one undetermined coefficient; and substituting the optimal value of the at least one undetermined coefficient into the physical model between dynamic response data and influencing parameters to obtain a semi-empirical physical model. The specific process is as follows:
[0044] Cutting speed The effect on cutting force is a result of the combined effects of strain rate and thermal softening. In high-speed machining of aluminum alloys, the strain rate effect is significant, causing the cutting force to increase with... It changes with the temperature. Furthermore, although aluminum alloys have high thermal conductivity and a relatively weak thermal softening effect, The resulting heat accumulation can still cause softening, thus affecting the cutting force. Therefore, the cutting force F and There is a certain correlation between them.
[0045] The radial depth of cut, D, determines the cutting width and is proportional to the cutting area. Since the cutting force in aluminum alloys is approximately linearly related to the cutting area, and this is supported by Merchant's cutting force theory, F is related to D.
[0046] The feed rate P directly affects the cutting thickness and the cross-sectional area of the tool. According to Merchant's theory and the commonly used empirical cutting force formula F=KDP (where K is the cutting coefficient), there is a clear correlation between the cutting thickness and the cutting force, making F dependent on P.
[0047] In addition, the contact area between the tool and the workpiece is Proportional, and because Therefore, the cutting force and the cutting angle of the tool It is inversely proportional to the sine, that is .
[0048] By analyzing cutting theory and the machining process, the factors affecting cutting forces are identified. The influencing parameters include radial depth of cut D, feed rate P, and cutting speed. and the cutting angle of the tool .
[0049] The semi-empirical tool cutting force model formula is obtained by refining (1):
[0050] (1)
[0051] Among them, cutting speed n is the spindle speed; , , , , The coefficient is to be determined; the feed rate P can be expressed as the real-time speed of the tool in three directions. , , , The real-time feed rates of the tool in the x, y, and z directions are respectively used to simplify formula (1) to obtain formula (2):
[0052] (2)
[0053] Extending formula (2) to the x, y, and z directions yields formula (3), as shown in formula (3). A total of 13 undetermined coefficients need to be fitted. .
[0054] (3)
[0055] in, The cutting force is in the x-direction. The cutting force is in the y-direction. The cutting force is in the z-direction.
[0056] To linearize the nonlinear formula and reduce computational complexity, a logarithmic transformation is applied, and formula (3) is rearranged to obtain formula (4):
[0057] (4)
[0058] in, .
[0059] The problem of fitting the coefficients is transformed into a multi-objective optimization problem, as shown in formula (5):
[0060] (5)
[0061] The parameter space optimization is performed using the NSGA-II multi-objective optimization algorithm. The specific steps are as follows:
[0062] The input is the actual test dataset. Population size B and maximum number of iterations The output is a constant. , This represents the data volume of the actual test dataset.
[0063] Randomly select 50% of the data as training data. For each set of data... Perform the following operations:
[0064] Taking the natural logarithm of formula (5) yields the linear form shown in formula (6):
[0065] (6)
[0066] Redefine the variable according to the following formula:
[0067] .
[0068] Transform equation (6) into a linear form as shown in equation (7):
[0069] (7)
[0070] in, , , , This indicates a coefficient that is yet to be determined.
[0071] Population initialization and objective function value calculation; non-dominated sorting of the population and calculation of crowding distance to maintain diversity; transformation of the multi-objective problem into multiple single-objective problems and determination of the optimization boundary.
[0072] Select B parent individuals and generate a progeny population P'; perform crossover and mutation on each individual in P' to generate a new population P. new ; P' and P new The populations are merged into a single population Q. Q is then non-dominated and divided into several sets. The frontier priority is determined based on these sets. The top N individuals are selected from Q based on the frontier priority and crowding distance to form a new population P'. If the maximum number of iterations is reached... Stop the iteration, select the individual with the optimal objective function value from the final population P', and extract its corresponding... The value of is taken as the optimal value of the corresponding undetermined coefficient.
[0073] According to one embodiment of this application, the design of a physical loss function (i.e., a physical loss term) based on a semi-empirical physical model includes:
[0074] Will , , , , , , , , , , , , Substituting the optimal values of these 13 undetermined coefficients back into formula (3), we obtain the semi-empirical physical model shown in formula (8):
[0075] (8)
[0076] in, To calculate the cutting force value in the x-direction, To calculate the cutting force value in the y direction, This represents the calculated cutting force value in the z-direction.
[0077] The physical loss term is established based on the deviation between the calculated dynamic response data and the predicted dynamic response data, as shown in formula (9):
[0078] (9)
[0079] in, Represents the physical loss term; This represents the cutting force value in the k-direction predicted by the conditional diffusion prediction model. This represents the cutting force value in direction k calculated by a semi-empirical physical model. N represents the amount of data.
[0080] In addition, it is necessary to pay attention to the time boundary conditions of the cutting process, at the initial time, i.e. The conditions should be met. =0. Based on this idea, the boundary condition loss term is established according to formula (10). :
[0081] (10)
[0082] in, Indicates a time location label.
[0083] Establish the data-driven loss term according to formula (11). :
[0084] (11)
[0085] in, This represents the predicted values of the dynamic response data in the x, y, and z directions output by the prediction model. The measured values represent the dynamic response data in the x, y, and z directions.
[0086] Since the prediction model focuses on predicting time-series distributions and therefore pays more attention to the characteristics of the time-series distribution, it is necessary to include KL divergence as a distribution consistency constraint. Its expression is shown in formula (12):
[0087] (12)
[0088] The loss function for training the prediction model is established based on formulas (9) to (12). This guides the model training process from different perspectives, as shown in formula (13):
[0089] (13)
[0090] in, These are the weights of the corresponding loss terms or constraint terms, i.e., parameters that control the impact of differences in the distribution of data, physical information, and temporal data on the prediction model. Embedding these loss functions into the model training process enables multi-factor guidance for model training.
[0091] II. Training Data
[0092] According to one embodiment of this application, the training data used to train the prediction model includes at least the following four categories: The first category is the measured values of machining parameter combinations, including spindle speed, radial depth of cut, feed rate, and cutting speed. The second category is time step labels. The first category is used to identify the current stage of the diffusion process in the prediction model, i.e., the degree to which the data has been denoised or de-denoised. The second category is the measured values of dynamic response data, including time-series data of the actual cutting force and feed rate in the x, y, and z directions corresponding to the combination of machining parameters. The third category is time position labels. It is used to identify the block position of the dynamic response data measurement after it is divided (i.e., to identify the position of the data on the time axis) and is injected during training.
[0093] III. Structure of the Prediction Model
[0094] According to one embodiment of this application, the prediction model includes a conditional encoder, a temporal encoder, and a denoising network. The conditional encoder transforms sparse processing parameters and temporal location labels into high-dimensional semantic representations, obtaining conditional embedding vectors. The conditional encoder includes a Multi-Layer Perceptron (MLP) mapping layer and a multi-head attention layer; the MLP mapping layer employs a single-layer fully connected structure with a ReLU (Rectified Linear Unit) activation function to map each processing parameter and temporal location label to a dimension of... In the spatial domain, preliminary features are extracted. The multi-head attention layer employs a dual-head self-attention mechanism to capture the nonlinear relationships between processing parameters. Based on the preliminary features, the query, key, and value matrices of the two attention heads are calculated separately, and attention weights are obtained through softmax normalization. The attention weights output by the two attention heads are concatenated and combined with the output projection matrix to obtain the conditional embedding vector. The temporal encoder encodes the time step labels to obtain the temporal embedding vector. The temporal encoder uses a sinusoidal positional encoding structure, employing sine and cosine functions of different frequencies in different dimensions. Its output temporal embedding vector has a dimension of [missing information]. The denoising network iteratively denoises based on the current noise, conditional embedding vector, and temporal embedding vector to output predicted values of the dynamic response data corresponding to the time location labels. The denoising network employs a Conditional DiT Block (CDT) structure, where each CDT Block consists of a denoising encoder and a denoising decoder. The denoising encoder is constructed from multiple stacked Transformer modules, and the denoising decoder combines Transformer modules with an MLP network.
[0095] In some embodiments, the specific structure and corresponding parameters of the denoising network are shown in Table 1: it includes a denoising encoder and a denoising decoder, with the total number of iterations set to 150. The denoising encoder comprises a four-layer structure. The first layer is a Transformer structure with 4 attention heads and an embedding dimension of 32. The second layer is also a Transformer structure with 4 attention heads and an embedding dimension of 32. The third layer continues with a Transformer structure with 4 attention heads and an embedding dimension of 32. The fourth layer is a projection layer that uses a linear transformation to map the 67-dimensional input to a 32-dimensional output. The denoising decoder comprises a six-layer structure. The first layer is a Transformer structure with 11 attention heads and an embedding dimension of 32. The second layer is also a Transformer structure with 11 attention heads and an embedding dimension of 32. The third layer is a linear transformation layer that maps the 33-dimensional input to a 256-dimensional output, followed by a ReLU activation function. The fourth layer is a linear transformation layer that maps the 256-dimensional input to a 128-dimensional output, followed by a ReLU activation function. The fifth layer is a linear transformation layer that maps the 128-dimensional input to a 64-dimensional output, followed by a ReLU activation function. The sixth layer is a linear transformation layer that maps the 64-dimensional input to a 3-dimensional output, which serves as the final prediction result.
[0096] Table 1
[0097]
[0098] IV. Training Methods
[0099] According to one embodiment of this application, the prediction model constructed based on the conditional diffusion model is trained in the following manner: using measurements of dynamic response data from the training data. The time sequence is divided into several equal-length time blocks, each labeled with a time position tag on the time axis. Each time block is treated as an independent masking unit and processed separately to generate a corresponding masked sequence. The masked sequences corresponding to all different processing parameter combinations and time position tags are integrated to form a time series set, and the position of each masked sequence in the time series set is chronologically labeled using time position tags. An extended parameter set is constructed based on the processing parameter combinations and their corresponding time position tags. Based on the extended parameter set, the time series set, and the time step tags, a distributed anchoring generation strategy is used to train the prediction model, and the weights of the prediction model are adjusted based on the loss function until the prediction model converges. Specifically, this includes:
[0100] First, for the corresponding time series under different processing parameters Divide it into m blocks of equal length. , The position of this mask block on the time axis is called the time position label or time index. Each mask block is used as a mask unit to generate a corresponding masked sequence. Masked sequences with different processing parameters and positions form a timing set. This provides a foundation for supplementing and updating missing data.
[0101] In some embodiments, in addition to point-by-point analysis, segmented analysis of time series data provides more information for understanding its dynamic patterns. This is achieved through time location label adjustment and distributed anchor generation. Based on segmentation and masking of time series data, this method extracts model features at different scales, thereby providing a more comprehensive understanding of the dynamic patterns of the time series. Specifically, it includes the following steps:
[0102] Step 1) Time sequence labeling mechanism: The position of each masked block in the masked time series set is labeled with time sequence using time position labels. Identify its position on the timeline. This method effectively captures local non-stationary characteristics while preserving the overall trend information of the sequence. The position of each data block is chronologically labeled using time position labels. This labeling mechanism identifies the sequence's position on the timeline. It helps subsequent models understand and model the sequence evolution process.
[0103] Step 2) Constructing parameters for integrating time and location tags: Based on the original processing parameters, introduce time dimension information to construct an extended parameter set. .in, Indicates rotational speed; Indicates the radial cutting depth; Indicates the feed rate; Indicates cutting speed; Indicates a time location label.
[0104] Then, based on the extended parameter set with time location labels constructed above. A distributed anchoring generation strategy is employed to train the prediction model. This strategy enhances the model's adaptability to different time periods and operating conditions. This mechanism helps improve model robustness, especially its stability when dealing with non-stationary time series. Furthermore, the introduction of time location labels allows the model to perceive the overall temporal evolution trend while focusing on local details, thereby improving prediction accuracy and generalization ability. The specific process of training the prediction model using the distributed anchoring generation strategy is as follows:
[0105] 1. Perform information mixing and embedding operations as follows:
[0106] Achieved through a hybrid approach combining MLP and attention mechanisms. The hybrid embedding. The mapping of processing parameters across MLP layers is described by equation (14):
[0107] (14)
[0108] in, It is the weight matrix of parameter embedding. It is a bias term, and This represents the parameter representation after MLP mapping.
[0109] Feature weighting and fusion in the attention mechanism are performed according to formulas (15) to (17):
[0110] (15)
[0111] (16)
[0112] (17)
[0113] in, For the first A query matrix with attention heads For the first The key matrix of each attention head. For the first Transpose of the key matrix of each attention head For the first The value matrix of each attention head, No. The output of each attention head, It is the first Projection matrix of each attention head query It is the first The projection matrix of the key of each attention head It is the first The projection matrix of the values of each attention head. ; It is the output projection matrix. The parameter representation of the embedding is indicated. Represents the dimension of the feature space.
[0114] To capture dynamic changes in the data, sinusoidal position coding is used to map the time step to a high-dimensional space according to formulas (18) and (19):
[0115] (18)
[0116] (19)
[0117] in, and Representing the embedding dimensions and Time step tag The encoded value, where It is the embedded dimension, and i is the dimension index. .
[0118] The above data is then merged to obtain the final fused information input. .
[0119] 2. Train the prediction model using a conditional diffusion model:
[0120] Conditional diffusion models, as a type of data generation model, feature high training stability, a rich variety of generated data, and the ability to be controlled through embedded information. They are suitable for predicting dynamic response data during tool cutting and solve the problem of predicting the temporal characteristics and distribution of sparse information (machining parameters). During training, the conditional diffusion model consists of two processes: forward noise addition and backward denoising. In application prediction, only the backward denoising process is included.
[0121] During the training phase, the input to the prediction model includes: 1. Raw, clean data. 1. The measured value of the real dynamic response data from the training data. 2. Time step labels τ are obtained by uniformly and randomly sampling from integers between 1 and the maximum diffusion step number T. The time encoder generates the time embedding vector corresponding to each time step. 3. Gaussian noise sampled at each time step 4. From Initially, the data at step τ after forward noise addition is obtained step by step according to formula (20). 5. With The corresponding processing parameters R, D, P, The conditional encoder, along with t, transforms the processing parameters and their corresponding time position labels into conditional embedding vectors. The output of the prediction model is the predicted noise. The output is determined by the ConditionalDiT Block based on the input. Conditional embedding and time embedding The calculation is obtained. Then, the iterative denoising process begins, starting from the current... Decrease to 0, utilizing predicted noise. According to the denoising formula (21), let the denoised data corresponding to the τth step of formula (21) be... ,Will Restore to the denoised data corresponding to step τ-1 When the loop ends When the value is 0, output the predicted clean data. That is, the predicted value It contains time-series data of dynamic response data in the x, y, and z directions. The weights of the prediction model are adjusted based on the loss function until the prediction model converges. The training objective is to minimize the noise in the predictions. As close as possible to the actual added noise .
[0122] (20)
[0123] in, It is a noise scheduling hyperparameter used to control the amount of noise added, and It is standard noise The Step-by-step random sampling.
[0124] (twenty one)
[0125] in, It is a random sample of standard Gaussian noise, in addition, hyperparameters The linear scheduling method is used to determine the schedule before training. This represents the noise variance of the prediction, typically set to... ; The function representing the predicted noise.
[0126] In the stage of applying the model for prediction, the inputs to the prediction model include: and initial noise The condition encoder will Convert to conditional embedding vector The time encoder generates time embedding vectors corresponding to the labels of each time step. , Decrease from T to 0. Then iterative denoising is performed using a denoising network: using a Conditional DiT Block to denoise the initial noise of the input. Start by looping T times, then embedding the condition. and time embedding Predicted noise Then, according to the noise reduction formula, Restored to the noise corresponding to step τ-1 Finally, when the loop ends... When the value is 0, output clean data for the prediction phase. That is, the predicted value of dynamic response data.
[0127] Based on the same inventive concept, one embodiment of this application provides a dynamic response prediction system for CNC machine tools. The system includes an input dataset construction unit and a prediction unit. The input dataset construction unit is configured to construct an input dataset based on a preset combination of machining parameters and their corresponding time position labels. The machining parameters in the machining parameter combination include spindle speed, radial depth of cut, feed rate, and cutting speed. The prediction unit is configured to use a trained prediction model to output dynamic response data corresponding to the time position labels based on the input dataset and initial noise. The dynamic response data includes cutting force and the actual feed rate of the tool. The loss function applied during the training of the prediction model consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term. The physical loss term is determined based on a semi-empirical physical model constructed based on the machining process. Since the system embodiment is basically similar to the method embodiment, the details of the relevant technical features and the effects of implementation can be found in the corresponding descriptions of the method embodiments provided above.
[0128] This application addresses the challenges of sparse features in CNC machine tool prediction under various operating conditions, which hinder information extraction and the difficulty in simultaneously considering both overall distribution and local non-stationary features in dynamic response data prediction. A prediction model is constructed that achieves sufficient information extraction and generation control under sparse features, while also considering both local and global features. Furthermore, to address the limitations of model interpretability and stability in dynamic response data prediction methods, a scheme using physical loss to guide the prediction model training is proposed, thereby improving model stability and the physical consistency of prediction results.
[0129] The embodiments provided in this application may be systems, methods, and / or computer program products. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this application.
[0130] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can include, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.
[0131] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0132] In the embodiments provided in this application, it should be understood that the division of modules or units is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection between units may be through some interfaces, or indirect coupling or communication connection between units, or it may be an electrical, mechanical or other form of connection.
[0133] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The aforementioned units can be implemented in hardware or as software functions.
[0134] The various embodiments in this application are described in a progressive manner, with each embodiment focusing on the differences from other embodiments or implementation methods. Similar or identical parts between the various embodiments of this application can be referred to mutually. The implementation principles and technical effects of the inventive concept can be mutually referenced, and will not be repeated here. Where there is no conflict, the various embodiments or implementation methods in this application can be combined with each other.
[0135] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently, or even in a different order, as long as the required function can be achieved.
[0136] This application uses specific embodiments to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the solution and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for predicting the dynamic response of CNC machine tools based on a conditional diffusion model, characterized in that, include: The input dataset is constructed based on the preset combination of machining parameters and their corresponding time position labels. The machining parameters in the combination of machining parameters include spindle speed, radial depth of cut, feed rate and cutting speed. Using a pre-trained prediction model, based on the input dataset and preset initial noise, the dynamic response data corresponding to the time position label is output. The dynamic response data includes the cutting force and the actual feed rate of the tool. The prediction model is built based on the conditional diffusion model. The loss function applied during training consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term. The physical loss term is determined based on a semi-empirical physical model built based on the processing procedure.
2. The method according to claim 1, characterized in that, The semi-empirical physical model is constructed as follows: By analyzing cutting theory and machining processes, we identify the parameters that affect dynamic response data and the mathematical relationships between them. At least one undetermined coefficient is preset, and a physical model between dynamic response data and influence parameters is constructed based on the at least one undetermined coefficient and the influence parameters and their mathematical relationship. The fitting problem of the at least one undetermined coefficient is transformed into a multi-objective optimization problem, and the multi-objective optimization problem is solved to obtain the optimal value of the at least one undetermined coefficient. The optimal value of the at least one undetermined coefficient is substituted into the physical model between the dynamic response data and the influencing parameters to obtain a semi-empirical physical model.
3. The method according to claim 2, characterized in that, The physical model between dynamic response data and influencing parameters includes: (3) in, The cutting force is in the x-direction. The cutting force is in the y-direction. The cutting force is in the z-direction. , , , , , , , , , , , , There are 13 undetermined coefficients. Let be the real-time feed rate of the tool in the x-direction. Let be the real-time feed rate of the tool in the y-direction. Let be the real-time feed rate of the tool in the z-direction, and D be the radial depth of cut. For cutting speed, The cutting angle of the tool; Applying a logarithmic transformation to equation (3) and transforming the coefficient fitting problem into a multi-objective optimization problem as shown in equation (5): (5) Among them, intermediate variables ; The NSGA-II multi-objective optimization algorithm is adopted, utilizing the following: The measured dataset is used to optimize the coefficient space consisting of the 13 undetermined coefficients to obtain the optimal values of the 13 undetermined coefficients, where n is the data size of the measured dataset; Substituting the optimal values of the 13 undetermined coefficients back into formula (3), we obtain the semi-empirical physical model as shown in formula (8): (8) in, To calculate the cutting force value in the x-direction, To calculate the cutting force value in the y direction, This represents the calculated cutting force value in the z-direction.
4. The method according to claim 3, characterized in that, The physical loss term determined by the semi-empirical physics model The expression is shown in formula (9): (9) in, This represents the cutting force value in the k-direction predicted by the conditional diffusion prediction model. This represents the cutting force value in direction k calculated by a semi-empirical physical model. N represents the amount of data. The boundary condition loss term The expression is shown in formula (10): (10) in, Indicates a time location label.
5. The method according to claim 1, characterized in that, The prediction model includes a conditional encoder, a temporal encoder, and a denoising network; wherein... The conditional encoder is used to convert combinations of machining parameters and time location labels into conditional embedding vectors; The time encoder is used to encode the time step labels to obtain the time embedding vector; The denoising network is used to perform iterative denoising based on the current noise, conditional embedding vector, and temporal embedding vector to output the predicted value of the dynamic response data corresponding to the time position label.
6. The method according to claim 5, characterized in that, The conditional encoder includes an MLP mapping layer and a multi-head attention layer; wherein, the MLP mapping layer adopts a single-layer fully connected structure with a ReLU activation function to map each processing parameter and time position label to a dimension of 1. In the space, preliminary features are extracted; the multi-head attention layer uses a dual-head self-attention mechanism to capture the nonlinear correlation between processing parameters. Based on the preliminary features, the query, key, and value matrices of the two attention heads are calculated respectively, and the attention weights are obtained by normalization through the softmax function. The attention weights output by the two attention heads are concatenated and combined with the output projection matrix to obtain the conditional embedding vector. The time encoder employs a sinusoidal position encoding structure, using sine and cosine functions of different frequencies for different dimensions. The dimension of its output time embedding vector is... ; The denoising network adopts a conditional diffusion Transformer block structure, which consists of a denoising encoder and a denoising decoder. The denoising encoder is constructed from multiple stacked Transformer modules, and the denoising decoder adopts a structure that combines Transformer modules with an MLP network.
7. The method according to claim 1, characterized in that, The training data used to train the prediction model includes at least the following types of data: The first category consists of measured values of machining parameter combinations, including spindle speed, radial depth of cut, feed rate, and cutting speed. The second type is time step labels, which are used to identify the current stage of the diffusion process in the prediction model; The third category is the measured values of dynamic response data, including time-series data of the real dynamic response data in the x, y, and z directions corresponding to the combination of processing parameters; The fourth type is time location labels, which are used to identify the block positions after the measurement values of the dynamic response data are segmented, and are injected during the training process.
8. The method according to claim 7, characterized in that, The prediction model was trained in the following manner: For the measured values of dynamic response data in the training data, they are divided into several time blocks of equal length, and the position of each time block on the time axis is identified by the time position label. Each time block is treated as an independent masking unit and masked separately to generate the corresponding masked sequence. All masked sequences corresponding to different processing parameter combinations and different time position labels are integrated together to form a time series set, and the position of each masked sequence in the time series set is marked with time position labels. Construct an extended parameter set based on the combination of processing parameters and their corresponding time location labels; The prediction model is trained using a distributed anchoring generation strategy based on the extended parameter set, the time series set, and the time step labels, and the weights of the prediction model are adjusted based on the loss function until the prediction model converges.
9. A dynamic response prediction system for CNC machine tools based on a conditional diffusion model, characterized in that, The system includes an input dataset construction module and a prediction module; among which, The input dataset construction module is configured to construct the input dataset based on a preset combination of machining parameters and their corresponding time position labels. The machining parameters in the combination of machining parameters include spindle speed, radial depth of cut, feed rate, and cutting speed. The prediction module is configured to use a pre-trained prediction model to output dynamic response data corresponding to the time position label based on the input dataset and initial noise. The dynamic response data includes cutting force and actual tool feed rate. The prediction model is built based on the conditional diffusion model. The loss function applied during training consists of a physical loss term, a boundary condition loss term, a data-driven loss term, and a distribution consistency constraint term. The physical loss term is determined based on a semi-empirical physical model built based on the processing procedure.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-8.