Milling surface roughness online monitoring method and system
Through the 1DCNN-LSTM neural network model and Gray Wolf optimization algorithm, the problem of low accuracy and reliability in online monitoring of milling surface roughness is solved, and efficient and accurate surface roughness prediction is achieved.
Patent Information
- Application Number
- CN202510110479.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-04-08
AI Technical Summary
The prior art has low accuracy and reliability in online monitoring of milling surface roughness. Traditional methods require a lot of time and labor costs. The methods based on traditional theory and data mining are not accurate and difficult to effectively deal with dynamic factors.
The one-dimensional convolution-long and short-term memory (1DCNN-LSTM) neural network model is used to combine the gray wolf optimization algorithm to extract the spindle electrical signals and cutting parameters during milling, and improve the accuracy of surface roughness prediction by optimizing model parameters.
Improve the accuracy and reliability of milling surface roughness prediction, realize effective online monitoring of surface roughness, and reduce the complexity of manual intervention and feature extraction.
Smart Images

Figure CN119772659A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of cutting processing, and in particular to an online monitoring method and system for milling surface roughness. Background Art
[0002] Surface roughness directly affects the wear resistance, fit stability, fatigue strength, corrosion resistance and other properties of parts, and is a key indicator for testing whether the processing quality is qualified. Therefore, it is necessary to monitor the surface roughness to ensure that the workpiece quality meets the standards.
[0003] The traditional method of surface roughness detection is usually to use professional instruments to detect after processing. Although this method has high accuracy, it takes a lot of time and manpower, resulting in low processing efficiency. In recent years, with the development of sensor technology, communication technology and other fields, it has become possible to predict surface roughness online. At present, surface roughness prediction algorithms can be divided into two categories, namely based on traditional theory and based on data mining.
[0004] The surface roughness prediction method based on traditional theory focuses on the potential mechanism of surface formation. The modeling process is complicated. In addition, the actual processing environment changes complexly, the theoretical model often deviates greatly from the actual value, and the model accuracy is not high. The surface roughness prediction method based on data mining can handle complex problems, but most of them currently only use static factors such as process parameters and tools to predict surface roughness. The actual processing process may be affected by dynamic factors such as tool wear, so the model accuracy is not high.
[0005] Some researchers have considered dynamic factors, such as vibration signals, cutting force signals, electrical signals, etc., but most of them are through manual feature extraction, relying on the assistance of expert experience and knowledge. In addition, the dynamic signals collected by sensors are time-series, and neural networks such as BP and CNN cannot extract time-series information well. Summary of the invention
[0006] The object of the present invention is to provide a method and system for online monitoring of milling surface roughness, which method and system are beneficial to improving the accuracy and reliability of milling surface roughness prediction.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is: a method for online monitoring of milling surface roughness, comprising the following steps:
[0008] Step S1: obtaining the spindle electrical signal, cutting parameters and surface roughness during milling processing, taking the spindle electrical signal and cutting parameters as input data and the surface roughness as label data;
[0009] Step S2: preprocessing the acquired data to form a data set;
[0010] Step S3: Divide the data set into training set, validation set and test set in proportion;
[0011] Step S4: construct a one-dimensional convolution-long short-term memory (1DCNN-LSTM) neural network model;
[0012] Step S5: Optimizing the 1DCNN-LSTM neural network model parameters using the Gray Wolf Optimization Algorithm;
[0013] Step S6: Use the optimized 1DCNN-LSTM neural network model to perform online monitoring of surface roughness.
[0014] Furthermore, the step S1 specifically includes the following steps:
[0015] Step S1.1: Select spindle speed n, feed rate per minute f, and cutting depth ap as experimental factors, design the levels of each factor, and design an orthogonal experiment;
[0016] Step S1.2: Collect the three cutting elements in the CNC machine tool processing process, and collect the spindle electrical signals in the processing process through sensors, and transfer them to the MySQL database for storage. The surface roughness of the workpiece after processing is measured, and the roughness value Ra is used as the label data of the model.
[0017] Furthermore, the step S2 specifically includes the following steps:
[0018] Step S2.1: Processing the collected original electrical signals, firstly judging the machining state of the machine tool by the collected spindle power and spindle speed, and removing irrelevant data including spindle stop, spindle idling, and abnormal values;
[0019] Step S2.2: Convert the dimensional expression into a dimensionless expression and normalize the input variables. The normalization method is:
[0020]
[0021] Where, X si is the value of the original variable after normalization, X i is the initial value of the original variable, X min is the minimum value of the original variable, X max is the maximum value of the original variable;
[0022] The normalized data is divided into samples according to the sliding time window method, and the electrical signal sample data set D L =[d1,d2,d3,…,d i ], cutting three elements sample data set M L =[m1,m2,m3,…,m i], label sample dataset Y L =[y1,y2,y3,…,y i ], where d i is the electrical signal matrix of a single sample, m i is the cutting three-element matrix corresponding to a single sample, y i is the label value corresponding to a single sample.
[0023] Furthermore, in step S3, the preprocessed data set sample D L 、M L and Y L , divided into training set D according to the set ratio Lt 、M Lt and Y Lt ; Validation set D Lv 、M Lv and Y Lv ; Test set D Lm 、M Lm and Y Lm .
[0024] Furthermore, in step S4, the constructed 1DCNN-LSTM neural network model includes three parts: a feature extraction part, a feature fusion part and a prediction part; the feature extraction part operates on static features and electrical signals, the static feature extraction branch consists of an input layer and a fully connected layer, and the electrical signal feature extraction branch consists of an input layer, a 1DCNN layer, a maximum pooling layer, 2 LSTM layers, a Dropout layer and a fully connected layer; the feature fusion part connects the two sets of features in series through the feature fusion layer; the prediction part is composed of a shallow neural network, and the shallow neural network consists of two fully connected layers with ReLU as the activation function and a fully connected output layer with only one neuron.
[0025] Furthermore, in step S4, in the 1DCNN-LSTM neural network model, the 1DCNN layer performs a convolution operation on the input electrical signal and the convolution kernel to extract local features in the electrical signal. The convolution operation formula is as follows:
[0026]
[0027] In the formula, is the i-th feature map of convolutional layer m, represents the i-th convolution kernel, and * represents the j-th layer feature map and Perform convolution operation, represents the bias term, f() represents the activation function;
[0028] Among them, the maximum pooling layer extracts the most important features and reduces the redundant complexity of the data information after the convolution layer output by selecting the maximum value in the pooling window. The maximum pooling formula is as follows:
[0029]
[0030] In the formula, a l(i,t) refers to the activation value of the tth neuron of the ith feature in the lth layer, W refers to the width of the pooling window, and p l(i,j) It refers to the output feature value of the jth neuron of the i-th feature in the l-th layer after pooling;
[0031] In the 1DCNN-LSTM neural network model, the LSTM layer is used to extract the temporal features of the signal. The LSTM network layer contains several unit groups, each of which consists of a forget gate, an input gate, and an output gate.
[0032] The calculation formula of the forget gate is as follows:
[0033] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0034] In the formula, f t is a value between [0,1], indicating the proportion of long-term information passed in from the previous time step, σ is the sigmoid activation function, W f is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b f is the bias term of the forget gate;
[0035] The calculation of the input gate is as follows:
[0036] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0037]
[0038] Where σ is the sigmoid activation function, tanh is the tanh activation function, and W i , W c is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b i 、b cis the bias term, i t is the input gate vector, is the unit state vector of the current input;
[0039] The calculation formula of the output gate is as follows:
[0040] o t =σ(W o [h t-1 ,x t ]+b o )
[0041] h t =o t *tanh(C t )
[0042] Where σ is the sigmoid activation function, tanh is the tanh activation function, and W o is the parameter to be trained, h t-1 is the output of the unit at the previous moment, b o is the bias term, o t is the output gate vector, h t For this moment, the unit output, x t is the input vector at the current moment, C t is the unit state vector at the current moment;
[0043] Assign values to the non-optimized hyperparameters in the 1DCNN-LSTM neural network model.
[0044] Furthermore, in step S5, in order to improve the ability of network dynamic signal feature extraction and make the surface roughness monitoring model more accurate, the gray wolf optimization algorithm is used to optimize the hyperparameters of the dynamic signal feature extraction branch in the 1DCNN-LSTM neural network model; specifically, the following steps are included:
[0045] Step S5.1: The number of convolution kernels in the convolution layer of the 1DCNN-LSTM model is recorded as q1, the number of neurons in the first LSTM layer is recorded as q2, the number of neurons in the second LSTM layer is recorded as q3, the dropout of the Dropout layer is recorded as q4, and the number of nodes in the fully connected layer of the dynamic signal feature extraction part is recorded as q5, Q = {q1, q2, q3, q4, q5}, Q is the variable to be optimized;
[0046] Step S5.2: The hyperparameter to be optimized is used as the position coordinates of the wolf pack, the gray wolf optimization algorithm is initialized, the dimension dim of the wolf search space in the gray wolf optimization algorithm is set, each dimension corresponds to a parameter to be optimized, the maximum number of iterations T, the wolf population size N, and the upper and lower bounds ub and lb of each dimension are set;
[0047] Step S5.3: Randomly initialize the wolf pack positions;
[0048] Step S5.4: Social class stratification, using the mean square error (MSE) of the validation set as the fitness function of the gray wolf optimization algorithm, calculating the fitness value, finding the position of the wolf according to the fitness value, the optimal solution is recorded as α wolf, the second and third optimal solutions are recorded as β wolf and δ wolf respectively, and the remaining candidate solutions are recorded as ω wolf;
[0049] The MSE function formula is as follows:
[0050]
[0051] In the formula, l is the number of samples, y is i is the true value, is the predicted value;
[0052] Step S5.5: In the encirclement step, the wolves first need to encircle the prey. The following formula is used to describe this behavior:
[0053]
[0054] Where t is the current iteration number, represents the position vector of the prey after the tth iteration, represents the position vector of the gray wolf after the tth iteration, in is the convergence factor, which decreases linearly from 2 to 0 as the number of iterations decreases. and is a random number between [0,1], Indicates the distance between the wolf and the prey;
[0055] Step S5.6: In the hunting step, the positions of other wolves in the wolf pack are updated along with the positions of α, β and δ. The position update formula is as follows:
[0056]
[0057] In the formula, Respectively represent the distances between α, β, δ and other wolf pack individuals, is a random vector, Represent the position vectors of α, β, and δ in the current iteration respectively, represents the intermediate variable used to update the wolf pack position in the tth iteration, is a vector that changes with iteration, represents the position vector of the gray wolf after the tth iteration, is to update the wolf pack position;
[0058] Step S5.7: Update the wolf pack position to obtain a new network structure, return to step S5.4, calculate the fitness value of the new position until the maximum number of iterations T is reached, calculate the best individual and save the individual position, obtain the optimal parameters, and use the optimal parameters to establish a 1DCNN-LSTM model.
[0059] Furthermore, the step S6 is specifically as follows: using the optimized 1DCNN-LSTM neural network model to predict the test set, evaluating the generalization ability of the model on unseen data, and calculating the performance indicators on the test set.
[0060] The present invention also provides an online monitoring system for milling surface roughness, comprising a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the above method can be implemented.
[0061] The present invention also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.
[0062] Compared with the prior art, the present invention has the following beneficial effects: the present invention adopts 1DCNN and LSTM to extract features in one-dimensional time series data, giving full play to the advantages of both, better extracting effective information in time series signals, avoiding the complexity of manually extracted features and dependence on experience, and in addition, integrating cutting parameters with a high correlation with surface roughness, and using the gray wolf optimization algorithm to optimize the hyperparameters of the network, thereby improving the reliability of surface roughness prediction and realizing effective online monitoring of surface roughness. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 A flowchart of a method implementation of an embodiment of the present invention;
[0064] Figure 2 This is a flowchart for implementing the gray wolf optimization 1DCNN-LSTM neural network model in an embodiment of the present invention;
[0065] Figure 3 This is a schematic diagram of the structure of a 1DCNN-LSTM neural network model in an embodiment of the present invention;
[0066] Figure 4 This is a schematic diagram of the 1DCNN feature extraction part in an embodiment of the present invention;
[0067] Figure 5 Schematic diagram of the structure of the LSTM module in an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0069] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0070] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0071] like Figure 1 As shown, this embodiment provides a method for online monitoring of milling surface roughness, comprising the following steps:
[0072] Step S1: Obtain the spindle electrical signal (power, voltage, current, etc.), cutting parameters and surface roughness during milling processing, and use the spindle electrical signal and cutting parameters as input data and the surface roughness as label data.
[0073] Step S2: pre-process the acquired data to form a data set.
[0074] Step S3: Divide the dataset into training set, validation set and test set in proportion.
[0075] Step S4: Construct a one-dimensional convolution-long short-term memory (1DCNN-LSTM) neural network model.
[0076] Step S5: Optimize the 1DCNN-LSTM neural network model parameters using the Gray Wolf Optimization Algorithm.
[0077] Step S6: Use the optimized 1DCNN-LSTM neural network model to perform online monitoring of surface roughness.
[0078] The step S1 specifically includes the following steps:
[0079] Step S1.1: Select spindle speed n, feed rate per minute f, and cutting depth ap as experimental factors, design the levels of each factor, and design an orthogonal experiment.
[0080] Step S1.2: The three cutting elements in the CNC machine tool processing process are collected through the data acquisition system, and the spindle electrical signals in the processing process are collected through the sensor and transmitted to the MySQL database for storage. The surface roughness of the workpiece after processing is measured, and the roughness value Ra is used as the label data of the model.
[0081] The step S2 specifically includes the following steps:
[0082] Step S2.1: Process the collected original electrical signals. First, determine the machining status of the machine tool by collecting the spindle power and spindle speed, and remove irrelevant data such as spindle stop, spindle idling, and abnormal values.
[0083] Step S2.2: Convert the dimensional expression into a dimensionless expression and normalize the input variables. The normalization method is:
[0084]
[0085] Where, X si is the value of the original variable after normalization, X i is the initial value of the original variable, X min is the minimum value of the original variable, X max is the maximum value of the original variable in this embodiment,
[0086] The normalized data is divided into samples according to the sliding time window method, and the electrical signal sample data set D L =[d1,d2,d3,…,d i ], cutting three elements sample data set M L =[m1,m2,m3,…,m i ], label sample dataset Y L =[y1,y2,y3,…,y i ], where d i is the electrical signal matrix of a single sample, m i is the cutting three-element matrix corresponding to a single sample, y i is the label value corresponding to a single sample.
[0087] In step S3, the preprocessed data set sample D L 、M L and Y L , divided into training set D according to the set ratio Lt 、M Lt and Y Lt ; Validation set D Lv 、M Lv and Y Lv ; Test set D Lm 、M Lm and Y Lm .
[0088] In step S4, the constructed 1DCNN-LSTM neural network model includes three parts: feature extraction part, feature fusion part and prediction part; the feature extraction part operates on static features (three elements of cutting) and electrical signals, the static feature extraction branch consists of an input layer and a fully connected layer, and the electrical signal feature extraction branch consists of an input layer, a 1DCNN layer, a maximum pooling layer, two LSTM layers, a Dropout layer and a fully connected layer; the feature fusion part connects two sets of features in series through the feature fusion layer; the prediction part is composed of a shallow neural network, which consists of two fully connected layers with ReLU as the activation function and a fully connected output layer with only one neuron. Schematic diagram of the implementation structure of the 1DCNN-LSTM neural network model, the 1DCNN feature extraction part and the LSTM module.
[0089] In the 1DCNN-LSTM neural network model, the 1DCNN layer performs a convolution operation on the input electrical signal and the convolution kernel to extract local features in the electrical signal. The convolution operation formula is as follows:
[0090]
[0091] In the formula, is the i-th feature map of convolutional layer m, represents the i-th convolution kernel, and * represents the j-th layer feature map and Perform convolution operation, represents the bias term, and f() represents the activation function.
[0092] Among them, the maximum pooling layer extracts the most important features and reduces the redundant complexity of the data information after the convolution layer output by selecting the maximum value in the pooling window. The maximum pooling formula is as follows:
[0093]
[0094] In the formula, a l(i,t) refers to the activation value of the tth neuron of the ith feature in the lth layer, W refers to the width of the pooling window, and p l(i,j) It refers to the output feature value of the jth neuron of the i-th feature in the l-th layer after pooling;
[0095] In the 1DCNN-LSTM neural network model, the LSTM layer is used to extract the temporal features of the signal. The LSTM network layer contains several unit groups, each of which consists of a forget gate, an input gate, and an output gate.
[0096] The calculation formula of the forget gate is as follows:
[0097] f t =σ(W f·[h t-1 ,x t ]+b f )
[0098] In the formula, f t is a value between [0,1], indicating the proportion of long-term information passed in from the previous time step, σ is the sigmoid activation function, W f is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b f is the bias term of the forget gate.
[0099] The calculation of the input gate is as follows:
[0100] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0101]
[0102] Where σ is the sigmoid activation function, tanh is the tanh activation function, and W i , W c is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b i 、b c is the bias term, i t is the input gate vector, is the unit state vector of the current input.
[0103] The calculation formula of the output gate is as follows:
[0104] o t =σ(W o [h t-1 ,x t ]+b o )
[0105] h t =o t *tanh(C t )
[0106] Where σ is the sigmoid activation function, tanh is the tanh activation function, and W o is the parameter to be trained, h t-1 is the output of the unit at the previous moment, b o is the bias term, o t is the output gate vector, ht For this moment, the unit output, x t is the input vector at the current moment, C t is the unit state vector at the current moment.
[0107] In the 1DCNN-LSTM neural network model, the Dropout layer is a regularization technique commonly used in training deep neural networks to prevent overfitting of the model and improve the generalization ability of the model;
[0108] Assign values to the non-optimized hyperparameters in the 1DCNN-LSTM neural network model.
[0109] In step S5, in order to improve the ability of network dynamic signal feature extraction and make the surface roughness monitoring model more accurate, the gray wolf optimization algorithm is used to optimize the hyperparameters of the dynamic signal feature extraction branch in the 1DCNN-LSTM neural network model. The implementation process is as follows: Figure 2 As shown; specifically including the following steps:
[0110] Step S5.1: The number of convolution kernels in the convolution layer of the 1DCNN-LSTM model is denoted as q1, the number of neurons in the first LSTM layer is denoted as q2, the number of neurons in the second LSTM layer is denoted as q3, the dropout of the Dropout layer is denoted as q4, and the number of nodes in the fully connected layer of the dynamic signal feature extraction part is denoted as q5. Q = {q1, q2, q3, q4, q5}, where Q is the variable to be optimized.
[0111] Step S5.2: Use the hyperparameters to be optimized as the position coordinates of the wolf pack, initialize the gray wolf optimization algorithm, set the dimension dim of the wolf search space in the gray wolf optimization algorithm, each dimension corresponds to a parameter to be optimized, set the maximum number of iterations T, the wolf population size N, and the upper and lower bounds ub and lb of each dimension.
[0112] The optimization process of the gray wolf optimization algorithm includes steps such as social hierarchy stratification, encirclement, hunting, and attacking prey;
[0113] Step S5.3: Randomly initialize the wolf pack positions.
[0114] Step S5.4: Social level stratification, use the mean square error MSE of the validation set as the fitness function of the gray wolf optimization algorithm, calculate the fitness value, find the position of the wolf according to the fitness value, the optimal solution is denoted as α wolf, the second and third optimal solutions are denoted as β wolf and δ wolf respectively, and the remaining candidate solutions are denoted as ω wolf.
[0115] The MSE function formula is as follows:
[0116]
[0117] In the formula, l is the number of samples, y isi is the true value, is the predicted value.
[0118] Step S5.5: In the encirclement step, the wolves first need to encircle the prey. The following formula is used to describe this behavior:
[0119]
[0120]
[0121] Where t is the current iteration number, represents the position vector of the prey after the tth iteration, represents the position vector of the gray wolf after the tth iteration, in is the convergence factor, which decreases linearly from 2 to 0 as the number of iterations decreases. and is a random number between [0,1], Indicates the distance between the wolf and its prey.
[0122] Step S5.6: In the hunting step, the positions of other wolves in the wolf pack are updated along with the positions of α, β and δ. The position update formula is as follows:
[0123]
[0124] In the formula, Respectively represent the distances between α, β, δ and other wolf pack individuals, is a random vector, Represent the position vectors of α, β, and δ in the current iteration respectively, represents the intermediate variable used to update the wolf pack position in the tth iteration, is a vector that changes with iteration, represents the position vector of the gray wolf after the tth iteration, Update the wolf pack position.
[0125] Step S5.7: Update the wolf pack position to obtain a new network structure, return to step S5.4, calculate the fitness value of the new position until the maximum number of iterations T is reached, calculate the best individual and save the individual position, obtain the optimal parameters, and use the optimal parameters to establish a 1DCNN-LSTM model.
[0126] The step S6 specifically includes: using the optimized 1DCNN-LSTM neural network model to predict the test set, evaluating the generalization ability of the model on unseen data, and calculating the performance indicators on the test set.
[0127] This embodiment also provides an online monitoring system for milling surface roughness, including a memory, a processor, and computer program instructions stored in the memory and executable by the processor. When the processor executes the computer program instructions, the above method can be implemented.
[0128] The present invention also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.
[0129] Example
[0130] This embodiment is to perform side milling on a 45 steel plate with a length of 100mm, a width of 100mm, and a thickness of 30mm on a CNC milling machine (VMC850E vertical machining center). In this experiment, the radial cutting depth is set to a fixed value of 5mm, and three factors of spindle speed, feed rate, and axial cutting depth are designed, each factor has three levels, and an orthogonal experimental table is designed. The orthogonal experimental table is shown in Table 1.
[0131] Table 1 Orthogonal experimental design factors and levels
[0132]
[0133] Table 2 Orthogonal experimental design table
[0134]
[0135] Table 2 is an orthogonal experimental design table, the three factors are represented by letters from A to C, and the experimental numbers are represented by 1 to 9. According to the experimental arrangement in Table 2, each set of experimental parameters corresponds to a 10×25×10×75 four-edge carbide milling cutter, and the change in surface roughness from new to the wear width of the back face of the milling cutter greater than 0.3mm is recorded. In order to effectively observe the influence of tool wear on surface roughness, the surface roughness Ra value and electrical parameters of the tool are recorded every 2m of milling. The surface roughness measurement method is: use a handheld surface roughness measuring instrument to measure the surface roughness three times and take the average value. Table 3 gives the data of some 45# steel milling experiments.
[0136] Table 3 Partial 45# steel milling experimental data
[0137]
[0138] (1) Assigning values to non-optimized parameters
[0139] Assign values to the non-optimized hyperparameters in the 1DCNN-LSTM neural network architecture, as shown in Table 4;
[0140] Table 4 Hyperparameters not to be optimized
[0141]
[0142] In order to improve the ability of network dynamic signal feature extraction and make the surface roughness monitoring model more accurate, the gray wolf optimization algorithm is used to optimize the hyperparameters of the dynamic signal feature extraction branch in the 1DCNN-LSTM model. The algorithm optimization process is shown in the attached figure. Figure 2 shown.
[0143] (2) Setting the parameters of the Gray Wolf Optimization Algorithm
[0144] The hyperparameters to be optimized are used as the position coordinates of the wolf pack, and the gray wolf optimization algorithm is initialized. The dimension dim of the wolf search space in the gray wolf optimization algorithm is set to 5, each dimension corresponds to a parameter to be optimized, and the maximum number of iterations T = 30, the wolf population size N = 50, and the upper and lower bounds ub and lb of each dimension are set, as shown in Table 5;
[0145] Table 5 Hyperparameters to be optimized
[0146]
[0147] The optimal parameters are obtained: convolution kernel q1 is 97, LSTM hidden layer number q2 is 32, q3 is 94, Dropout q4 is 0.214, and fully connected layer number q5 is 49. The 1DCNN-LSTM model is established using the optimal parameters.
[0148] (3) Fitting results of 1DCNN-LSTM model optimized by Gray Wolf Optimization Algorithm
[0149] In order to reflect the prediction effect of the 1DCNN-LSTM model after optimization by the Grey Wolf Optimization Algorithm (GWO), it is compared with the model without optimization. The evaluation results of the model are shown in Table 5:
[0150] Table 7 Comparison of evaluation results of different models
[0151]
[0152] Mean square error MSE, calculates the average value of the square of the difference between the predicted value and the actual value, can quantify the size of the prediction error, the smaller the value, the better the prediction effect of the model; mean absolute error MAE, calculates the average value of the absolute value of the difference between the predicted value and the actual value, intuitively indicates the degree of deviation of the predicted value from the actual value, the smaller the value, the better the prediction effect of the model; R2 measures the quantitative representation of the goodness of fit of the model to the data, the value range of R2 is [0,1], the closer the value is to 1, the stronger the explanatory power of the model. It can be seen from Table 7 that the method of the present invention is better and can achieve more accurate online monitoring of surface roughness.
[0153] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0154] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0155] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0156] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0157] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. A method for online monitoring of milling surface roughness, characterized in that: The following steps are involved: Step S1: obtaining the spindle electrical signal, cutting parameters and surface roughness during milling processing, taking the spindle electrical signal and cutting parameters as input data and the surface roughness as label data; Step S2: preprocessing the acquired data to form a data set; Step S3: Divide the data set into training set, validation set and test set in proportion; Step S4: construct a one-dimensional convolution-long short-term memory (1DCNN-LSTM) neural network model; Step S5: Optimizing the 1DCNN-LSTM neural network model parameters using the Gray Wolf Optimization Algorithm; Step S6: Use the optimized 1DCNN-LSTM neural network model to perform online monitoring of surface roughness.
2. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: The step S1 specifically includes the following steps: Step S1.1: Select spindle speed n, feed rate per minute f, and cutting depth ap as experimental factors, design the levels of each factor, and design an orthogonal experiment; Step S1.2: Collect the three cutting elements in the CNC machine tool processing process, and collect the spindle electrical signals in the processing process through sensors, and transfer them to the MySQL database for storage. The surface roughness of the workpiece after processing is measured, and the roughness value Ra is used as the label data of the model.
3. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: The step S2 specifically includes the following steps: Step S2.1: Processing the collected original electrical signals, firstly judging the machining state of the machine tool by the collected spindle power and spindle speed, and removing irrelevant data including spindle stop, spindle idling, and abnormal values; Step S2.2: Convert the dimensional expression into a dimensionless expression and normalize the input variables. The normalization method is: In the formula, X si is the value of the original variable after normalization, X i is the initial value of the original variable, X min is the minimum value of the original variable, X max is the maximum value of the original variable; The normalized data is divided into samples according to the sliding time window method, and the electrical signal sample data set D L =[d1,d2,d3,…,d i ], cutting three elements sample data set M L =[m1,m2,m3,…,m i ], label sample dataset Y L =[y1,y2,y3,…,y i ], where d i is the electrical signal matrix of a single sample, m i is the cutting three-element matrix corresponding to a single sample, y i is the label value corresponding to a single sample.
4. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: In step S3, the preprocessed data set sample D L 、M L and Y L , divided into training set D according to the set ratio Lt 、M Lt and Y Lt ; Validation set D Lv 、M Lv and Y Lv ; Test set D Lm 、M Lm and Y Lm .
5. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: In the step S4, the constructed 1DCNN-LSTM neural network model includes three parts: a feature extraction part, a feature fusion part and a prediction part; the feature extraction part operates on static features and electrical signals, the static feature extraction branch consists of an input layer and a fully connected layer, and the electrical signal feature extraction branch consists of an input layer, a 1DCNN layer, a maximum pooling layer, two LSTM layers, a Dropout layer and a fully connected layer; the feature fusion part connects two sets of features in series through the feature fusion layer; the prediction part is composed of a shallow neural network, and the shallow neural network consists of two fully connected layers with ReLU as the activation function and a fully connected output layer with only one neuron.
6. The method for online monitoring of milling surface roughness according to claim 5, characterized in that: In step S4, in the 1DCNN-LSTM neural network model, the 1DCNN layer performs a convolution operation on the input electrical signal and the convolution kernel to extract local features in the electrical signal. The convolution operation formula is as follows: In the formula, is the i-th feature map of convolutional layer m, represents the i-th convolution kernel, and * represents the j-th layer feature map and Perform convolution operation, represents the bias term, f() represents the activation function; Among them, the maximum pooling layer extracts the most important features and reduces the redundant complexity of the data information after the convolution layer output by selecting the maximum value in the pooling window. The maximum pooling formula is as follows: In the formula, a l(i,t) refers to the activation value of the tth neuron of the ith feature in the lth layer, W refers to the width of the pooling window, and p l(i ,j) It refers to the output feature value of the jth neuron of the i-th feature in the l-th layer after pooling; In the 1DCNN-LSTM neural network model, the LSTM layer is used to extract the temporal features of the signal. The LSTM network layer contains several unit groups, each of which consists of a forget gate, an input gate, and an output gate. The calculation formula of the forget gate is as follows: f t =σ(W f ·[h t-1 ,x t ]+b f ) In the formula, f t is a value between [0,1], indicating the proportion of long-term information passed in from the previous time step, σ is the sigmoid activation function, W f is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b f is the bias term of the forget gate; The calculation of the input gate is as follows: i t =σ(W i ·[h t-1 ,x t ]+b i ) Where σ is the sigmoid activation function, tanh is the tanh activation function, and W i , W c is the parameter to be trained, h t-1 is the output of the unit at the previous moment, x t is the input vector at the current moment, b i 、b c is the bias term, i t is the input gate vector, is the unit state vector of the current input; The calculation formula of the output gate is as follows: the t =σ(W o [h t-1 ,x t ]+b o ) h t =o t *tanh(C t ) Where σ is the sigmoid activation function, tanh is the tanh activation function, and W o is the parameter to be trained, h t-1 is the output of the unit at the previous moment, b o is the bias term, o t is the output gate vector, h t For this moment, the unit output, x t is the input vector at the current moment, C t is the unit state vector at the current moment; Assign values to the non-optimized hyperparameters in the 1DCNN-LSTM neural network model.
7. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: In step S5, in order to improve the ability of network dynamic signal feature extraction and make the surface roughness monitoring model more accurate, the hyperparameters of the dynamic signal feature extraction branch in the 1DCNN-LSTM neural network model are optimized using the gray wolf optimization algorithm; specifically, the following steps are included: Step S5.1: The number of convolution kernels in the convolution layer of the 1DCNN-LSTM model is recorded as q1, the number of neurons in the first LSTM layer is recorded as q2, the number of neurons in the second LSTM layer is recorded as q3, the dropout of the Dropout layer is recorded as q4, and the number of nodes in the fully connected layer of the dynamic signal feature extraction part is recorded as q5, Q = {q1, q2, q3, q4, q5}, Q is the variable to be optimized; Step S5.2: The hyperparameter to be optimized is used as the position coordinates of the wolf pack, the gray wolf optimization algorithm is initialized, the dimension dim of the wolf search space in the gray wolf optimization algorithm is set, each dimension corresponds to a parameter to be optimized, the maximum number of iterations T, the wolf population size N, and the upper and lower bounds ub and lb of each dimension are set; Step S5.3: Randomly initialize the wolf pack positions; Step S5.4: Social class stratification, using the mean square error (MSE) of the validation set as the fitness function of the gray wolf optimization algorithm, calculating the fitness value, finding the position of the wolf according to the fitness value, the optimal solution is recorded as α wolf, the second and third optimal solutions are recorded as β wolf and δ wolf respectively, and the remaining candidate solutions are recorded as ω wolf; The MSE function formula is as follows: In the formula, l is the number of samples, y is i is the true value, is the predicted value; Step S5.5: In the encirclement step, the wolves first need to encircle the prey. The following formula is used to describe this behavior: Where t is the current iteration number, represents the position vector of the prey after the tth iteration, represents the position vector of the gray wolf after the tth iteration, in is the convergence factor, which decreases linearly from 2 to 0 as the number of iterations decreases. and is a random number between [0,1], Indicates the distance between the wolf and the prey; Step S5.6: In the hunting step, the positions of other wolves in the wolf pack are updated along with the positions of α, β and δ. The position update formula is as follows: In the formula, Respectively represent the distances between α, β, δ and other wolf pack individuals, is a random vector, Represent the position vectors of α, β, and δ in the current iteration respectively, represents the intermediate variable used to update the wolf pack position in the tth iteration, is a vector that changes with iteration, represents the position vector of the gray wolf after the tth iteration, is to update the wolf pack position; Step S5.7: Update the wolf pack position to obtain a new network structure, return to step S5.4, calculate the fitness value of the new position until the maximum number of iterations T is reached, calculate the best individual and save the individual position, obtain the optimal parameters, and use the optimal parameters to establish a 1DCNN-LSTM model.
8. The method for online monitoring of milling surface roughness according to claim 1, characterized in that: The step S6 specifically includes: using the optimized 1DCNN-LSTM neural network model to predict the test set, evaluating the generalization ability of the model on unseen data, and calculating the performance indicators on the test set.
9. An online monitoring system for milling surface roughness, characterized in that: The method comprises a memory, a processor, and computer program instructions stored in the memory and executable by the processor. When the processor executes the computer program instructions, the method according to any one of claims 1 to 8 can be implemented.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Milling surface roughness detection method and device, electronic equipment and vehicle
CN121213484A
Milling surface roughness detection method and device, electronic equipment and vehicle
CN121213484B
Roughness online monitoring method and system fused with surface topography geometric simulation model
CN121578667A