A numerical control machining surface roughness prediction method
By collecting and processing triaxial cutting force signal data in CNC machining, and using time series dimensionality reduction and convolutional neural networks, surface roughness can be directly predicted. This solves the problem of limited prediction accuracy caused by manual feature extraction in existing technologies, and realizes efficient and intelligent surface roughness prediction and online detection.
Patent Information
- Application Number
- CN202310157771.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-02-23
AI Technical Summary
In existing CNC machining, surface roughness prediction models require manual feature extraction, which limits prediction accuracy and prevents the realization of highly intelligent production and control of part quality.
The three-dimensional cutting force signal data during the processing is collected, and the data length is transformed by time series dimensionality reduction algorithm. The cutting force signal is directly used as the feature vector to build a convolutional neural network prediction model, which reduces the feature extraction work and improves the intelligence of prediction.
It improves prediction efficiency and accuracy, reduces human intervention, enables efficient use of processing data and online real-time status monitoring, and improves production efficiency and part quality.
Smart Images

Figure CN116186499B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining, and more particularly to a method for predicting the surface roughness of CNC machining. Background Technology
[0002] In the field of CNC machining technology, a crucial evaluation indicator for part machining quality is the quality of its surface morphology. Surface morphology refers to the traces remaining on the surface of the machined part caused by the interaction between the cutting edge and the workpiece during machining. Macroscopically, the machined surface appears relatively smooth, but at the microscopic scale displayed by precision measuring instruments, the undulating contours of the machined surface can be clearly seen. Surface roughness is an important quantitative indicator of surface morphology and is closely related to surface morphology quality. It is commonly represented by Ra and used to describe and evaluate the quality of the machined surface. Appropriate roughness has a significant impact on the wear resistance, corrosion resistance, sealing performance, and service life of parts.
[0003] In traditional production, the surface roughness of a part is typically measured after machining to determine its quality. However, with the development of computers and the rise of machine learning, more and more neural networks are being applied to predict surface roughness, promoting intelligent manufacturing. Currently, surface roughness prediction models mainly consider machining parameters and process signals. Processing these signals primarily involves extracting time-domain, frequency-domain, and time-frequency-domain signals from the time-series data, combining this with machining parameters to form feature vectors in the prediction dataset. However, this method requires additional human effort for feature extraction from the process signals and inevitably loses some information, limiting prediction accuracy and hindering the achievement of highly intelligent manufacturing and effective part quality control. Summary of the Invention
[0004] To address the drawback of requiring additional human effort in signal feature extraction during machining, this application provides a method for predicting surface roughness in CNC machining, comprising the following steps:
[0005] S1. Conduct machining experiments, collect triaxial cutting force signal data during the machining process, and cut and segment the data to obtain triaxial cutting force signal data for each sample. After machining, use a roughness measuring instrument to obtain the surface roughness value of the machined surface.
[0006] S2. The time series dimensionality reduction algorithm is used to transform the data length of the three-dimensional cutting force signal data obtained in step S1 to obtain three-dimensional cutting force data with consistent length.
[0007] S3. Using the three-dimensional cutting force data with consistent length described in step S2 as feature vectors and the surface roughness value described in step S1 as label values, merge the data to form three sets of prediction datasets.
[0008] S4. Build a convolutional neural network prediction model. Divide the three sets of prediction datasets mentioned in step S3 into training set and test set respectively. Perform model training and structure evaluation, and select the cutting force direction and convolutional neural network prediction model with the highest prediction accuracy.
[0009] S5. Use the selected convolutional neural network prediction model to predict roughness.
[0010] The beneficial effects provided by this invention are: it eliminates the need for feature extraction of processing data, reduces human intervention, and improves the intelligence level of the prediction process; at the same time, it can reduce workload, improve prediction efficiency, and thus promote the improvement of production efficiency. Attached Figure Description
[0011] Figure 1 This is a flowchart of the CNC machining surface roughness prediction method according to an embodiment of the present invention;
[0012] Figure 2 This is a logic diagram of cutting force data segmentation and trimming used in an embodiment of the present invention;
[0013] Figure 3 This is a diagram showing the results of cutting force data segmentation and trimming in an embodiment of the present invention;
[0014] Figure 4 This is a comparison diagram of the cutting force data before and after length transformation in an embodiment of the present invention;
[0015] Figure 5 This is a comparison chart of the predicted and actual values of the machined surface roughness obtained by model training using X-direction cutting force data in an embodiment of the present invention.
[0016] Figure 6 This is a comparison chart of the predicted and actual values of the machined surface roughness obtained by model training using cutting force data in the Y direction in this embodiment of the invention.
[0017] Figure 7 This is a comparison chart of the predicted and actual values of the machined surface roughness obtained by model training using Z-direction cutting force data in an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0019] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the method flow of the present invention. In this embodiment of the invention, CNC milling is used as the object, and the machining feature of the part is a rectangular groove; in other embodiments, the machining method can also be turning, drilling, sawing, grinding, boring, stamping, etc.; the machining feature of the part can also be extended to other straight line features, curved features, curved surface features, etc.
[0020] This invention provides a method for predicting surface roughness in CNC machining, comprising the following steps:
[0021] S1. Conduct machining experiments, collect triaxial cutting force signal data during the machining process, and cut and segment the data to obtain triaxial cutting force signal data for each sample. After machining, use a roughness measuring instrument to obtain the surface roughness value of the machined surface.
[0022] It should be noted that conducting machining experiments requires designing experimental parameters, mainly including spindle speed, feed rate, and depth of cut, while also determining the dimensions of the machining features of the part.
[0023] In this embodiment, with the fixture, machine tool rigidity, workpiece material, tool diameter, and cooling conditions kept constant, the process parameters for milling on the CNC machine tool are spindle speed (3000–12000 r / min), feed rate (175–350 mm / min), and depth of cut (0.2 mm–2.5 mm). In this embodiment, spindle speed, feed rate, and depth of cut are the three factors. Ten levels were designed for spindle speed, eight levels for feed rate, and seven levels for depth of cut. A comprehensive experiment was conducted, machining four workpieces, with 70 samples machined on each side of each workpiece, for a total of 560 experimental samples.
[0024] In this embodiment, the machining feature of the part is a rectangular groove with dimensions of 9*4mm², wherein the groove length is 9mm, the groove width is the same as the diameter of the milling cutter, which is 4mm, and the groove depth is determined by the cutting depth.
[0025] In this embodiment, the process data collected during CNC machining is mainly cutting force data, which is acquired through an external sensor. The specific details of cutting force data acquisition are as follows: a force gauge is mounted on the base plate of an adapter plate, and the base plate is tightened using a vise, thereby fixing the force gauge on the milling table. The upper plate of the adapter plate is then connected to the upper surface of the force gauge, and the workpiece is clamped onto the upper plate, thus completing the entire machining clamping setup. The sampling frequency of the force gauge is set to 5kHz. Cutting forces are collected in real time during machine milling, and the data is transmitted through a force sensor, charge amplifier, data acquisition card, and host computer to ultimately obtain the cutting forces Fz experienced by the workpiece in the machining feed direction Fx, feed perpendicular direction Fy, and spindle direction.
[0026] After completing the machining experiment, a roughness measuring instrument is needed to measure the surface roughness to obtain the surface roughness value. In this embodiment, a white light interferometer is used to measure the surface roughness, with Ra as the surface roughness evaluation standard.
[0027] It should be noted that after data collection is completed, due to the continuity of collection and the discontinuity of sample processing, the collected processing data needs to be cropped and segmented to obtain individual processing data for each sample.
[0028] Specifically, in this embodiment: Figure 2 As shown, the first step is to trim the machining process data, removing the cutting force data from the initial idle spindle before cutting. The strategy for finding the starting point of machining involves two steps: First, starting from the beginning of the data set, find data points with a cutting force greater than 5N (considering that the cutting force is essentially 0 before cutting and greater than 10N after cutting, a force threshold of 5N is set); second, after finding the first data point with a cutting force greater than 5N, ensure that the average cutting force of the subsequent 200 data points is also greater than 5N (to avoid misjudgments caused by cutting force fluctuations, a time threshold is added). The strategy for finding the ending point of machining is similar: First, starting from the end of the data set, find data points with a cutting force greater than 5N; second, continue judging from the end to the beginning, checking if the average cutting force of the next 200 data points is also greater than 5N. After data trimming, the data needs to be segmented.
[0029] In this embodiment, seven samples are processed as a group, so the cutting force data for one cycle contains seven samples, which need to be segmented one by one. The starting point of the processing is taken as the starting point of the first sample, and the ending point of the current sample is found using a force threshold of 5N and a time threshold of 200 points. After the segmentation of the current sample is completed, the starting point and ending point of the next sample are searched until the ending point of the sample coincides with the end point of the processing, which indicates that the data segmentation is complete, thereby obtaining the processing data of each sample.
[0030] like Figure 3 As shown, the data cropping and segmentation method used in this invention can accurately distinguish each sample, calculate the deviation between the theoretical data point and the segmented data point, and achieve a sample segmentation accuracy of 98%.
[0031] S2. The time series dimensionality reduction algorithm is used to transform the data length of the three-dimensional cutting force signal data obtained in step S1 to obtain three-dimensional cutting force data with consistent length.
[0032] It should be noted that directly using cutting force signal data as input to the neural network model can skip the feature extraction process of the cutting force signal, reduce the degree of human intervention, and maximize the use of machining process signal data for machining quality prediction. Since the neural network model requires consistent input data format, and in actual machining processes, different feed rates will cause differences in machining time, leading to inconsistent lengths of the cutting force signal data, it is necessary to first standardize the length of the input data.
[0033] In this embodiment, the maximum feed rate is 350 mm / min. With a sample length of 9 mm and a force gauge sampling frequency of 5 kHz, the theoretical number of sampling points is approximately 7700. The minimum feed rate is 175 mm / min, with a theoretical number of sampling points of approximately 15000. In this embodiment, the Time Series Dimensionality Reduction (LTTB) algorithm is used to downsample different samples, resulting in a uniform length of 7225 data points.
[0034] As shown in Figure (4), (a) is the cutting force data before downsampling, and (b) is the cutting force data after downsampling. It can be seen that the cutting force data before downsampling consisted of 13729 data points, while the cutting force data after downsampling became the set 7225 data points, satisfying the requirement for uniform data length. A comparison of the waveforms before and after downsampling reveals that the Time Series Dimensionality Reduction (LTTB) algorithm can unify the cutting force data length while preserving the basic characteristics of the original signal data. The formula for the Time Series Dimensionality Reduction (LTTB) algorithm is as follows:
[0035]
[0036] in, Data for three-dimensional cutting forces with different lengths; The data represents the three-dimensional cutting force data with consistent length; i represents the number of samples.
[0037] S3. Using the three-dimensional cutting force data with consistent length described in step S2 as feature vectors and the surface roughness value described in step S1 as label values, merge the data to form three sets of prediction datasets.
[0038] In traditional methods, features are extracted from the three-dimensional cutting force data and then input as a whole into a neural network model to predict machining quality.
[0039] This invention directly uses the raw cutting force data as input and uses the cutting force data in three directions as the feature vectors of three sets of predicted data. On the one hand, this can reduce the problem of data dimensionality explosion after merging the three directions. On the other hand, it can analyze the cutting force direction most related to the surface roughness of the machined surface by using the prediction results of the three sets of predicted data under the same convolutional neural network.
[0040] It should be noted that directly using cutting force data to construct the feature vector of the prediction dataset reduces the workload of feature extraction from the cutting force data. Specifically, it eliminates the need to extract time-domain features (including mean, variance, kurtosis, and skewness), frequency-domain features (including centroid frequency and center frequency), and time-frequency-domain features (including wavelet packet features). Furthermore, directly using cutting force data to construct the feature vector of the prediction dataset allows for full utilization of the cutting force data, avoiding the information loss that occurs after feature extraction.
[0041] In this embodiment, (0, 1) normalization is used to normalize the feature vector formed by the original cutting force data in the three directions. The specific formula is as follows:
[0042]
[0043] Where Max and Min are the maximum and minimum values of the corresponding feature among all feature vectors, respectively;
[0044] S4. Build a convolutional neural network prediction model. Divide the three sets of prediction datasets mentioned in step S3 into training set and test set respectively. Perform model training and structure evaluation, and select the cutting force direction and convolutional neural network prediction model with the highest prediction accuracy.
[0045] In this embodiment, a CNN model is built using MATLAB's Deep Learning Toolbox. This model has an N+2 layer structure, where layer 1 is the input layer, layers 2 through N+1 are intermediate hidden layers, and layer N+2 is the output layer. In this embodiment, the CNN model has a total of 36 layers, with 34 intermediate hidden layers.
[0046] The loss function for the CNN model is set to cross-entropy:
[0047]
[0048] In the formula, M is the number of categories, N is the number of samples, c represents category c, and y ic This indicates that if category c is the same as sample i, then y ic =1, otherwise 0, p ic This represents the predicted probability that observed sample i belongs to category c.
[0049] The activation function for the hidden layer uses ReLU:
[0050]
[0051] In the formula, x is the input value of the node.
[0052] The output layer has 1 node, and the softmax function is used as the activation function for the output layer.
[0053]
[0054] In the formula, e i Let ∑ represent the input value of the i-th output node. j e j S represents the sum of the input values of all output nodes. i This represents the output result after softmax calculation.
[0055] In this embodiment, the number of processed samples is 560. After removing samples with failed cutting force acquisition, 557 valid samples remain. The training set and test set are divided with a sample size of 80% and a sample size of 20%, respectively. In other embodiments, the sample size ratio of the training set and test set can be adjusted according to the number of samples and the actual prediction task requirements. For example, the training set sample size can be 70% and the test set sample size 30%, or the training set sample size can be 75% and the test set sample size 25%. In this embodiment, the number of valid samples is 557, the number of training set samples is 557 * 0.80 = 445, and the number of test set samples is 557 * 0.20 = 112.
[0056] The three prediction datasets were divided into three training and test sets. The corresponding training and test set data were input into the constructed CNN model, and the model parameters were adjusted and the model was trained. In this embodiment, the main parameters of the CNN model are: gradient descent algorithm, set to adam; MiniBatchSize (number of samples per training session), set to 4; MaxEpochs (maximum number of training epochs), set to 1000; InitialLearnRate, set to 0.5e-5; LearnRateDropFactor, set to 0.5; and LearnRateDropPeriod, set to 200. The computing hardware used in this embodiment is a GPU, specifically an NVIDIA GeForce RTX 3060 12G.
[0057] After the model training is complete, it needs to be used to predict and evaluate the test set data. The evaluation metrics used in this embodiment mainly include root mean square error (RMSE), mean absolute error (MAE), and prediction accuracy (Acc). The formulas for calculating these three metrics are as follows:
[0058]
[0059]
[0060]
[0061] Where m is the number of samples in the test set; y i For the label values in the test set, The predicted value given by the prediction model.
[0062] The root mean square error (RMSE) represents the sample standard deviation of the difference (residual) between the predicted and observed values. When evaluating prediction performance, a lower RMSE is better. The mean absolute error (MAE) represents the average of the absolute errors between the predicted and observed values. Since it is calculated directly from the residuals, as a linear evaluation metric, all individual differences have equal weight on the mean. For this metric, a lower MAE is also better. Prediction accuracy is calculated by subtracting the quotient of the residuals from the observed values. It introduces the observed values as the denominator, defining prediction accuracy in the range of 0-1. The higher the value, the more accurate the prediction and the better the model training effect.
[0063] S5. Use the selected convolutional neural network prediction model to predict roughness.
[0064] Figure 5 , Figure 6 and Figure 7 This is a comparison chart of the predicted and actual surface roughness values obtained after training the model when using the raw cutting force data in the X, Y, and Z directions as the feature vector of the prediction dataset in an embodiment of the present invention. When the actual value is plotted on the x-axis and the predicted value on the y-axis, the straight line in the chart represents y = x. Therefore, the closer the points in the chart are to the straight line, the closer the predicted and actual values are, and the better the prediction effect.
[0065] In this embodiment, the model trained using three sets of cutting force data (X, Y, and Z) as input data had RMSE values of 0.0997, 0.0703, and 0.07867, respectively; MAE values of 0.0628, 0.0527, and 0.0594, respectively; and Acc values of 83.0%, 86.9%, and 83.2%, respectively. Figure 5-7 It can be concluded that in this embodiment, directly using cutting force data as input for surface roughness prediction has a prediction accuracy of over 80%. Among them, the cutting force data in the Y direction is the most relevant cutting force direction for surface roughness prediction, followed by the cutting force in the Z direction, while the accuracy of using cutting force data in the X direction as input for surface roughness prediction is the lowest.
[0066] In summary, the beneficial effects of this invention are:
[0067] 1. On the one hand, by eliminating feature extraction from machining process data, human intervention is reduced, increasing the intelligence level of the prediction process; simultaneously, workload is reduced, prediction efficiency is improved, and thus production efficiency is boosted. On the other hand, applying all raw cutting force data to roughness prediction enables efficient utilization of machining process data and improves prediction accuracy.
[0068] 2. Due to the different feed rates in the processing parameters and the cropping and segmentation operations performed on the collected processing data, the length of the processing data of each sample is not consistent, and it is necessary to transform its length. This invention uses a time series dimensionality reduction algorithm to downsample the processing data, thereby obtaining processing data of consistent length and forming a prediction dataset.
[0069] 3. The prediction method proposed in this invention can accurately predict the surface roughness of CNC machining, and utilize the machining process data collected by sensors to achieve online real-time status detection and machining quality prediction of CNC machining. It analyzes the cutting force direction most related to machining quality, helping production personnel to observe changes in machining quality more timely and intuitively, providing guidance for part production, reducing the use of measuring instruments, improving production efficiency and part quality, and enhancing the intelligence level of prediction. Furthermore, the method proposed in this invention is easy to integrate into CNC machine tool systems, making it convenient for production personnel to use.
[0070] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for predicting surface roughness in CNC machining, characterized in that: Includes the following steps: S1. Conduct machining experiments, collect triaxial cutting force signal data during the machining process, and cut and segment the data to obtain triaxial cutting force signal data for each sample. After machining, use a roughness measuring instrument to obtain the surface roughness value of the machined surface. S2. The time series dimensionality reduction algorithm is used to transform the data length of the three-dimensional cutting force signal data obtained in step S1 to obtain three-dimensional cutting force data with consistent length. S3. Using the three-dimensional cutting force data with consistent length described in step S2 as feature vectors and the surface roughness value described in step S1 as label values, merge the data to form three sets of prediction datasets. S4. Build a convolutional neural network prediction model. Divide the three sets of prediction datasets mentioned in step S3 into training set and test set respectively. Perform model training and structure evaluation, and select the cutting force direction and convolutional neural network prediction model with the highest prediction accuracy. S5. Use the selected convolutional neural network prediction model to predict roughness.
2. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The three-directional cutting force data mentioned in step S1 are the cutting force data Fx in the machining feed direction, the cutting force data Fy in the feed perpendicular direction, and the cutting force data Fz in the spindle direction.
3. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The cropping and segmentation are performed using a custom threshold method.
4. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The surface roughness value is calculated as the arithmetic mean of the absolute values of the Z-axis deviation relative to the mean line over a sampling length.
5. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The time series dimensionality reduction algorithm maintains the same length while ensuring that the characteristics of the three-dimensional cutting force data remain unchanged.
6. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: In step S3, the data merging specifically refers to: directly using cutting force data as feature vectors and roughness values as label values to form a prediction dataset; and using cutting force data in different directions as feature vectors to obtain different prediction datasets.
7. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The convolutional neural network prediction model has a K+2 layer structure, where the first layer is the input layer of the model, the second to N+1 layers are intermediate hidden layers, and the K+2 layer is the output layer of the model; where K is a preset value.
8. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The loss function of the convolutional neural network prediction model is set to cross-entropy: In the formula, M is the number of categories, N is the number of samples, c represents the category, and y ic This indicates that if category c is the same as sample i, then y ic =1, otherwise 0, p ic This represents the predicted probability that observed sample i belongs to category c.
9. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that: The hidden layers of the convolutional neural network prediction model use the ReLU activation function, while the output layer uses the softmax function.
10. The method for predicting surface roughness in CNC machining as described in claim 1, characterized in that, The same convolutional network model was used to train the model and predict the roughness of different prediction datasets. The results were compared and analyzed to find the cutting force direction most relevant to the roughness prediction of the machined surface, and the corresponding prediction model was obtained.
Citation Information
Patent Citations
Prediction method of cut surface roughness
CN106407669A
Milling tool wear state identification method based on partition clustering
CN109434562A