External thread grinding machining pitch error prediction method and computer program product

By adopting the GA-GRNN model based on genetic algorithm optimization in external thread grinding processing, the problem of inaccurate prediction of pitch errors in external thread grinding processing in the prior art is solved, and higher accuracy and robustness are achieved.

CN119885810APending Publication Date: 2025-04-25BEIJING RES INST OF PRECISE MECHATRONICS CONTROLS
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411647359.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The prior art is difficult to effectively predict and compensate for pitch errors in external thread grinding, especially under the influence of thermal errors, resulting in low machining accuracy.

Method used

A generalized regression neural network (GA-GRNN) model based on genetic algorithm optimization is adopted. By constructing a four-layer GA-GRNN neural network structure framework, combining genetic algorithm to search the global minimum value, select the smooth factor σ, and establish an external thread grinding pitch error prediction model.

Benefits of technology

It improves the accuracy and robustness of external thread grinding, enhances the nonlinear fitting ability, avoids the local minimum value problem of BP neural network, and improves the prediction effect and generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885810A_ABST
    Figure CN119885810A_ABST
Patent Text Reader

Abstract

The invention discloses an external thread grinding machining pitch error prediction method and a computer program product, and the method comprises the steps: building a four-layer generalized regression neural network (GRNN) structure, optimizing a generalized regression neural network smooth factor through a genetic algorithm, and simply and accurately finding a global minimum value; a generalized regression neural network smooth factor is initialized by adopting a random population initialization mode. Constructing a fitness function of a genetic algorithm (GA), calculating individual fitness, performing natural operation on a population, and performing selection, crossover and inheritance on individuals; a GRNN framework is established, samples are trained, population evolution gradually reaches training precision, and finally, generalization of a generalized regression neural network (GA-GRNN) optimized by a genetic algorithm is verified by adopting experimental data of external thread grinding; according to the method, global optimal search is carried out on the smooth factors of the GRNN by using the genetic algorithm, and the prediction precision of the GRNN is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of external thread grinding, and in particular to a method for predicting pitch errors in external thread grinding and a computer program product. Background Art

[0002] The main factors affecting the accuracy of grinding machine parts and structures include load error and thermal error. As the processing accuracy and rigidity improve, thermal error becomes the most important factor affecting processing accuracy.

[0003] The external thread grinding error compensation method is to artificially create a new error to offset the original error, so as to reduce the processing error. The external thread grinding error compensation requires the establishment of an accurate error calculation mathematical model, the common ones are:

[0004] 1) Modeling through numerical algorithm fitting. "A pitch error compensation method" (patent number CN201210593474.2) proposes to obtain the measurement data of the target position and actual position of multiple discrete compensation points used to represent the screw transmission process, and compensate the compensation position by fitting the S-type function. This type of algorithm is very sensitive to some outlier noise points, especially for a large outlier point set, their weight is very large, causing the required straight line to be pulled off.

[0005] 2) Analyze through neural network modeling. Fuzzy neural network, comprehensive recursive neural network, neural network based on genetic algorithm and grey theory and other methods are extended. BP neural network is the most widely used neural network at present. BP neural network consists of two parts: information forward transmission and error back transmission. The information is transmitted from the input layer to the output layer after processing. The output layer outputs to the outside and compares with the expected output result. When there is an error between the two, reverse transmission begins. After the output layer is corrected, it is transmitted to the input layer again to update the weights and thresholds to minimize the error signal. However, the BP neural network has slow convergence speed, long training time and low efficiency. It may converge to the local minimum, affecting the accuracy and real-time performance of the model, which is not conducive to the real-time compensation of thermal errors in external thread grinding. With the improvement of training ability, the prediction ability will reach a peak. After exceeding the peak, the prediction ability decreases, and the "overfitting" phenomenon occurs. Summary of the invention

[0006] The technical problem solved by the present application is: to overcome the shortcomings of the prior art, to provide a method for predicting the pitch error of external thread grinding based on GRNN optimized by genetic algorithm, to use genetic algorithm to select the optimal value of the smoothness factor σ, to establish a model of the method for predicting the pitch error of external thread grinding, and to improve its accuracy and robustness during training.

[0007] This patent proposes to combine genetic algorithm (GA) and generalized regression neural network (GRNN) to construct a pitch error prediction model for external thread grinding to make the nonlinear curve fitting effect more accurate.

[0008] The technical solutions provided by this application are as follows:

[0009] A method for predicting pitch error of external thread grinding, comprising:

[0010] S1: Establish a four-layer GA-GRNN neural network structure framework, which includes an input layer, a pattern layer, a summation layer, and an output layer;

[0011] S2: Input learning samples X = [x1, x2, ..., x n ];

[0012] S3: The pattern layer is used to save the training set samples X i The input layer passes the learning samples to the pattern layer, and the pattern layer calculates the activation function p according to the learning samples and the training set samples. i ;

[0013] S4: The summation layer is based on the activation function p i , obtain the summation result of the activation function;

[0014] S5: The output layer calculates the output y of the i-th neuron based on the sum of the activation functions i , i∈[1,k], and obtain the output Y=[y1,y2,…,y k ], n = k;

[0015] According to the output y of the i-th neuron i , calculate the joint probability density to calculate the estimated value of f(x,y) According to Get the output of GRNN Expression of

[0016] S6: Use genetic algorithm to search for the global minimum and select the smoothing factor σ;

[0017] S7: Substitute the smoothing factor σ obtained in S6 into The expression of GRNN is obtained

[0018] The activation function p i for:

[0019] Among them, Xi is the training sample corresponding to the i-th neuron in the pattern layer, and σ is the smoothing factor.

[0020] In S4, the summation layer is based on the activation function p i , obtain the sum of the activation function, including: The sum of the activation function includes S D and S Nj ,

[0021] Among them, y ij is the jth element of the i-th sample in the training set.

[0022] In S5, the output y of the i-th neuron i for:

[0023] In S5,

[0024] Where: n is the sample size; p is the dimension of the output matrix X; σ is the smoothing factor; yi is the output of the i-th neuron.

[0025] In S5,

[0026] In the formula, is the predicted value of Y under the condition that the input is X; f(X,y) is the joint probability density of the input variable X.

[0027] In S6, a genetic algorithm is used to search for the global minimum value and a smoothing factor σ is selected, including:

[0028] B1. Randomly initialize the population and calculate the gene size d n , population size p n , the crossover rate p c and mutation rate p m ; Randomly initialize individual genes, use binary coding, and set the value range of GRNN's smoothing factor σ to (0,1). Individual genes can be translated by the following formula:

[0029]

[0030] B2. Construct a fitness function and calculate individual fitness. The fitness function is:

[0031] Where f(σ) is the fitness function, E(σ) is the prediction error of the GRNN model;

[0032] B3. Perform natural selection on the population, perform selection, crossover and mutation operations on individual DNA to make the population evolve, obtain DNA in each iteration, obtain σ based on the DNA, and obtain the fitness function of each iteration based on σ;

[0033] B4. Repeat B2 and B3, set the training accuracy and number of iterations, and stop the iteration when the number of iterations or the fitness function of each iteration meets the training accuracy.

[0034] A computer program product comprises a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of any one of the above methods are implemented.

[0035] In summary, this application at least includes the following beneficial technical effects:

[0036] 1. Compared with the BP neural network, the GA-GRNN of the present invention has stronger deep learning ability and learning speed, fast convergence speed when the test samples are moderate, improved efficiency, strong nonlinear fitting ability and good prediction effect.

[0037] 2. The GRNN modeling process has accuracy problems. The genetic algorithm is used to simulate Darwin's genetic principles and the law of natural selection to obtain the optimal solution of the smoothness factor, optimize the accuracy of the model, and have better fitting and generalization capabilities for complex nonlinear systems.

[0038] 3. The hidden layer uses a nonlinear mapping function of radial basis, taking into account the influence of different types of patterns, and has strong compatibility. As long as there are enough data samples, it can converge to the Bayesian classifier, without the local minimum problem of BP neural network.

[0039] 4. Generalized regression neural network (GRNN) is a type of radial neural network (RBF), and has advantages over radial neural network in some aspects. Generalized regression neural network has strong nonlinear mapping ability and learning speed, which is stronger than radial neural network, and finally converges to the optimal regression with more sample size. When the sample data is small, the prediction effect is very good, and the network can also handle unstable data. It can be clearly seen from the training curve that GA-GRNN has higher prediction accuracy and generalization ability than RBFNN. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a network structure diagram of the GRNN model in the present invention;

[0041] Figure 2 It is the flow chart of GA-GRNN model;

[0042] Figure 3 Select smooth factor training curve graph for GA algorithm;

[0043] Figure 4 This is the prediction result diagram of the test workpiece L1;

[0044] Figure 5 This is the L2 prediction result diagram of the test workpiece;

[0045] Figure 6 This is the prediction result diagram of the test workpiece L3;

[0046] Figure 7 This is the prediction result diagram of the test workpiece R1;

[0047] Figure 8 This is the R2 prediction result diagram of the test workpiece. DETAILED DESCRIPTION

[0048] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments disclosed in the present invention will be further described in detail below with reference to the accompanying drawings.

[0049] The GRNN external thread grinding pitch error prediction method based on genetic algorithm optimization involved in the present invention is mainly used for predicting and modeling the pitch error generated in the external thread grinding process, so as to improve the processing accuracy and robustness.

[0050] The specific steps of the generalized neural network external thread grinding pitch error modeling method based on genetic algorithm optimization in this embodiment include:

[0051] A. Establish a four-layer GA-GRNN neural network structure framework, such as Figure 1 As shown; the corresponding input is the learning sample X = [x1, x2, ..., x n ], the corresponding output is Y=[y1,y2,…,y k ], n=k, X is the axial deformation value, and Y is the predicted value of the pitch error.

[0052] The GA-GRNN neural network structure adopts a four-layer network structure, in which:

[0053] A1. The input layer directly inputs the learning samples. For the external thread grinding pitch error modeling, the input layer directly inputs the learning samples, which are the axial deformation matrix. The axial deformation matrix is ​​directly passed to the model layer without any processing.

[0054] A2. For the modeling of external thread grinding pitch error, the pattern layer stores the training set samples, and mainly calculates between the input samples (i.e., learning samples) and the training set samples. The activation function of the pattern layer neuron is shown in Formula 1:

[0055]

[0056] Among them, pi is the activation function, Xi is the training sample corresponding to the i-th neuron in the pattern layer, and σ is the smoothing factor of GRNN;

[0057] A3. The summation layer of GRNN contains two different types of neurons. The number of neurons in the first type has only one activation function, as shown in Formula 2:

[0058]

[0059] The activation function of another neuron is shown in Formula 3:

[0060]

[0061] Among them, y ij is the jth element of the i-th sample in the training set;

[0062] A4. The output of the i-th neuron in the output layer is shown in formula 4:

[0063]

[0064] GRNN is theoretically based on the idea of ​​conditional mean, and its purpose is to calculate the output value with the maximum probability based on the input variable X. First, we need to calculate the joint probability density f(x,y) between the input variable x and the output variable y through the training data set. Then when the input is X, the predicted output of GRNN is The calculation formula is shown in Formula 5:

[0065] The input variable x is x1-x n For any value in , the output variable y is y1-y k Any value of

[0066]

[0067] Where: It is the predicted value of Y given the input variable X. f(X,y) is the joint probability density, and its input variable is X.

[0068] The kernel parameter estimation method can be used to estimate the function f(x,y). Based on the training sample data {(X i ,Y i )|i=1,2,…,n},the estimate of f(x,y) The calculation formula is shown in Formula 6:

[0069]

[0070] Where: n is the sample capacity; p is the dimension of the output matrix X; σ is the width coefficient of the Gaussian kernel function, which is the smoothing factor here; yi is the output of the i-th neuron.

[0071] use Substituting f(X,y) into Formula 5, we get the output of GRNN, as shown in Formula 7:

[0072]

[0073] B. Genetic algorithm searches for the global minimum value and selects the smooth factor σ by merit. The process of selecting the smooth factor in GRNN is as follows: Figure 2 As shown, the specific steps are as follows:

[0074] B1. Randomly initialize the population and calculate the gene size d n , population size p n , the crossover rate p c and mutation rate p m The individual genes are randomly initialized, using binary coding, and the range of the smoothing factor σ of GRNN is set to (0,1). The individual genes can be translated by the following formula, as shown in Formula 8:

[0075]

[0076] B2. Select the fitness function and calculate the individual fitness. We hope that the predicted output of the thermal error prediction model is as close to the actual value as possible. Therefore, the prediction error of the GRNN prediction model is used to construct the fitness function. The calculation formula is shown in Formula 9:

[0077]

[0078] Where f(σ) is the fitness function and E(σ) is the prediction error of the GRNN model.

[0079] B3. After constructing the fitness function, it is necessary to perform natural selection operations on the population, perform selection, crossover and mutation operations on individual DNA to evolve the population, obtain DNA, obtain σ based on DNA, and obtain the fitness function of each iteration based on σ: ① Selection: Select individuals with high fitness to build a new population. ② Crossover: Select two individual genes for recombination according to the crossover rate. ③ Mutation: Change the value of a certain bit of the individual gene according to the mutation rate, from 0 to 1 or from 1 to 0.

[0080] B4. Repeat B2 and B3 until the fitness function of each iteration meets the accuracy or reaches the maximum number of iterations, then stop.

[0081] C. Use python to implement the GA-GRNN model, including the establishment, training and verification of the GA-GRNN model.

[0082] Specifically, firstly, the GRNN framework is built according to the formula and the fitness function is constructed.

[0083] In the model construction part, the GRNN framework is first built according to formulas 1 to 4. Then the fitness function of the genetic algorithm (GA) is constructed according to formula 9 to determine the population size p n =40, crossover rate p c =0.5, mutation rate pm =0.003, and the smoothing factor σ is initialized by random initialization.

[0084] In the model training part, based on the test results, the axial deformation value of the test workpiece in the external thread grinding test is used as the input of the GA-GRNN model, and the pitch error value of the test workpiece in the external thread grinding test is used as the output to train the model. This patent uses the experimental data of the R3 workpiece in the external thread grinding test as the training data set, and the training accuracy is set to 0.001. The population evolves 200 times to reach the training accuracy. Finally, the optimal smoothing factor σ is selected as 0.707 through the genetic algorithm. The GA algorithm iterative evolution curve is shown as follows: Figure 3 shown.

[0085] In the model verification part, the test data of L1, L2, L3, R1, and R2 workpieces in the external thread grinding test were used as the verification data set to verify the accuracy of the GA-GRNN model. The correlation coefficient (R), determination coefficient (R2), and root mean square error (RMSE) were used for evaluation.

[0086] The R calculation formula for the verification part is:

[0087]

[0088] R 2 The calculation formula is:

[0089]

[0090] The RMSE calculation formula is:

[0091]

[0092] Where: n is the number of samples, is the output value of the regression model, y i is the actual value of the sample, is the sample mean.

[0093] A computer program product comprises a computer program / instruction, which implements the steps of the above method when executed by a processor.

[0094] Based on the above scheme, this embodiment is as follows:

[0095] In this embodiment, a GA-GRNN external thread grinding pitch error prediction model is established according to steps A, B, and C. A comparative study is conducted between GA-GRNN and RBFNN to verify the prediction accuracy and generalization ability of the GA-GRNN model.

[0096] In the model verification part, the test data of Z1 and Z3 workpieces in the axial drift test of external thread grinding workpieces are used as the verification data set to verify the generalization of the GA-GRNN model. 2 ) and root mean square error (RMSE). The prediction curve of the GA-GRNN external thread grinding pitch error prediction model is as follows: Figure 4 and Figure 5 shown.

[0097] The value of R between variables reflects the linear correlation between them. The calculation formula of R is shown in Formula 10:

[0098]

[0099] Where: Cov(X,Y) is the covariance of X and Y, Var(X) and Var(Y) are the variances of X and Y respectively.

[0100] R 2 It is an indicator of how well the regression model fits the sample. 2 The larger the value of, the better the model fits the sample. 2 The calculation formula is shown in Formula 11:

[0101]

[0102] Where: n is the number of samples, is the output value of the regression model, y i is the actual value of the sample, is the sample mean.

[0103] RMSE represents the prediction error of the regression model. Generally, the smaller the RMSE, the smaller the error. The RMSE calculation formula is shown in Formula 12:

[0104]

[0105] The performance parameters of GA-GRNN are calculated based on formulas 10 to 12.

[0106] Table 1 GA-GRNN performance table

[0107]

[0108]

[0109] By analyzing Table 1, it can be seen that the GA-GRNN model has higher R and R 2 and smaller RMSE, so the GA-GRNN model has a higher prediction accuracy for the pitch error prediction method of external thread grinding.

[0110] The contents not described in detail in this application specification belong to the common knowledge of those skilled in the art.

[0111] The present application is described in detail above in conjunction with specific implementation methods and exemplary examples, but these descriptions cannot be understood as limiting the present application. Those skilled in the art understand that, without departing from the spirit and scope of the present application, a variety of equivalent replacements, modifications or improvements can be made to the technical solution of the present application and its implementation methods, all of which fall within the scope of the present application. The scope of protection of the present application shall be subject to the attached claims.

Claims

1. A method for predicting pitch error in external thread grinding, characterized in that: include: S1: Establish a four-layer GA-GRNN neural network structure framework, which includes an input layer, a pattern layer, a summation layer, and an output layer; S2: Input learning samples X = [x1, x2, ..., x n ]; S3: The pattern layer is used to save the training set samples X i The input layer passes the learning samples to the pattern layer, and the pattern layer calculates the activation function p according to the learning samples and the training set samples. i ; S4: The summation layer is based on the activation function p i , obtain the summation result of the activation function; S5: The output layer calculates the output y of the i-th neuron based on the sum of the activation functions i , i∈[1,k], and obtain the output Y=[y1,y2,…,y k ], n = k; According to the output y of the i-th neuron i , calculate the joint probability density to calculate the estimated value of f(x,y) According to Get the output of GRNN Expression of S6: Use genetic algorithm to search for the global minimum and select the smoothing factor σ; S7: Substitute the smoothing factor σ obtained in S6 into The expression of GRNN is obtained 2. The method for predicting pitch error in external thread grinding according to claim 1, characterized in that: The activation function p i for: Among them, Xi is the training sample corresponding to the i-th neuron in the pattern layer, and σ is the smoothing factor.

3. The method for predicting pitch error in external thread grinding according to claim 1, characterized in that: In S4, the summation layer is based on the activation function p i , obtain the sum of the activation function, including: The sum of the activation function includes S D and S Nj , Among them, y ij is the jth element of the i-th sample in the training set.

4. The method for predicting pitch error in external thread grinding according to claim 3, characterized in that: In S5, the output y of the i-th neuron i for:

5. The method for predicting pitch error in external thread grinding according to claim 1, characterized in that: In S5, Where n is the sample size; p is the dimension of the output matrix X; σ is the smoothing factor; yi is the output of the i-th neuron.

6. The method for predicting pitch error in external thread grinding according to claim 1, characterized in that: In S5, In the formula, is the predicted value of Y under the condition that the input is X; f(X,y) is the joint probability density of the input variable X.

7. The method for predicting pitch error in external thread grinding according to claim 1, characterized in that: In S6, a genetic algorithm is used to search for the global minimum value and a smoothing factor σ is selected, including: B1. Randomly initialize the population and calculate the gene size d n , population size p n , the crossover rate p c and mutation rate p m ; Randomly initialize individual genes, use binary coding, and set the value range of the smoothing factor σ of GRNN to (0,1). The individual genes can be translated by the following formula: B2. Construct a fitness function and calculate individual fitness. The fitness function is: Where f(σ) is the fitness function, E(σ) is the prediction error of the GRNN model; B3. Perform natural selection on the population, perform selection, crossover and mutation operations on individual DNA to make the population evolve, obtain DNA in each iteration, obtain σ based on the DNA, and obtain the fitness function of each iteration based on σ; B4. Repeat B2 and B3, set the training accuracy and number of iterations, and stop the iteration when the number of iterations or the fitness function of each iteration meets the training accuracy.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • A Compensation Method for Pitch Error

    CN103075989B