HPO optimization BP neural network main shaft thermal error modeling method
Through HPO optimization of BP neural network, the slow convergence speed and overfitting problems of BP neural network in high-speed electric spindle thermal error prediction are solved, the prediction accuracy and robustness are improved, and the thermal error prediction accuracy is achieved.
Patent Information
- Application Number
- CN202410944219.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-11-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prediction of high-speed electrical spindle thermal errors, BP neural networks have problems such as slow convergence speed, sensitive to initial weights and biases, require a large amount of training data, and are prone to overfitting, resulting in insufficient prediction accuracy and robustness.
Using HPO optimization BP neural network spindle thermal error modeling method, the weights and thresholds are corrected by building an experimental platform, acquiring and analyzing data, initializing weights and thresholds, and using hunter prey optimization algorithm to optimize the BP neural network model to improve prediction Accuracy and robustness.
The thermal error prediction accuracy and robustness are improved, and the prediction accuracy and performance are achieved. The optimized model shows better prediction effects at different speeds.
Smart Images

Figure CN118917349A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of high-speed electric spindle thermal error prediction and analysis, and specifically relates to a HPO optimized BP neural network spindle thermal error modeling method. Background Art
[0002] Research shows that the core component of precision machine tools is the high-speed electric spindle. During long-term high-speed operation of the machine tool, the internal heat dissipation of the high-speed electric spindle is insufficient and slow, resulting in a rapid increase in the internal temperature, causing thermal deformation of the spindle, and affecting the machining accuracy of the machine tool. In the field of fine machining, the machining error caused by the heating of the machine tool spindle accounts for 40% to 70% of the total error of the machine tool. Therefore, the thermal error of the electric spindle caused by the thermal deformation of the high-speed electric spindle is the main reason affecting the machining accuracy of the machine tool. To ensure the machining accuracy of the machine tool, the thermal error of the electric spindle must be minimized. At this stage, there are three methods to reduce the thermal error of the high-speed electric spindle: thermal error prevention method, temperature control method and thermal error compensation method. The thermal error compensation method is to predict the thermal error deformation in advance and compensate it, which is the most widely used.
[0003] BP neural network is a common type of artificial neural network, which is widely used in pattern recognition, predictive analysis, control systems and other fields. Although BP neural network has many advantages, such as the ability to approximate any complex function, the ability to learn and adapt to various input data, it also has some disadvantages: slow convergence, easy to fall into local minima, sensitive to initial weights and biases, requiring a large amount of training data, requiring a carefully designed network structure, and prone to overfitting. Summary of the invention
[0004] In order to solve the problems of slow convergence speed, sensitivity to initial weights and biases, requirement of a large amount of training data, and easy overfitting in the prediction of thermal errors of high-speed electric spindles, the present invention provides a HPO optimized BP neural network spindle thermal error modeling method, which has the characteristics of high prediction accuracy and robustness.
[0005] The technical solution adopted by the present invention is:
[0006] A HPO optimized BP neural network spindle thermal error modeling method comprises the following steps:
[0007] S1. Build the experimental platform and arrange the temperature and displacement measurement points;
[0008] S2. Analyze the data obtained in S1 and select key measurement point information as training sets and test sets;
[0009] S3. Initialize the weights between the input layer and the hidden layer, the hidden layer and the output layer, and the built-in thresholds of the hidden layer and the output layer;
[0010] S4. Input training set data to BP neural network;
[0011] S5. The BP neural network is used to bring in the training set, and the error MSE between the actual output and the expected output is obtained after the calculation output, and then compared with the cost function E (i) In contrast, if MSE < E (i) Then predict the test set. If MSE>E (i) Then the back propagation process is started, and the hunter-prey optimization algorithm is introduced to correct the weights and thresholds to obtain the optimal initialization weights and thresholds;
[0012] S6. Substitute the optimal solution to train the BP neural network;
[0013] S7. The error, accuracy, determination coefficient, mean absolute error and root mean square error between the prediction result of the BP neural network model and the true value are used as prediction evaluation indicators;
[0014] S8. The performance and prediction accuracy of the optimized BP neural network model are evaluated by calculating the prediction evaluation index between the prediction result and the true value.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] 1. The HPO-BP thermal error prediction model proposed in the present invention has higher thermal error prediction accuracy than the original BP thermal error prediction model;
[0017] 2. The present invention proposes a new BP optimization scheme, which can be applied to the field of thermal error modeling of electric spindles;
[0018] 3. The HPO-BP thermal error prediction model proposed in the present invention has better robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a simplified diagram of the BP neural network structure process;
[0020] Figure 2 It is the BP neural network process diagram;
[0021] Figure 3 It is a diagram of the process of optimizing BP neural network by hunter-prey optimization algorithm;
[0022] Figure 4 This is a schematic diagram of the temperature measurement point distribution of the test bench, 1-T1 measurement point, 2-T2 measurement point, 3-T3 measurement point, 4-T4 measurement point, 5-T5 measurement point, 6-T6 measurement point, 7-T7 measurement point, 8-T8 measurement point, 9-T9 measurement point, 10-T10 measurement point. DETAILED DESCRIPTION
[0023] In order to better understand the purpose, structure and function of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings.
[0024] Taking the electric spindle speed, temperature and spindle thermal elongation at 6000r / min as data, predicting the spindle thermal elongation at 4000r / min and 8000r / min as an example, the HPO optimized BP neural network spindle thermal error modeling method of the present invention includes the following steps:
[0025] S1. Build an experimental platform, arrange temperature measurement points and displacement measurement points, and obtain real-time temperature data and spindle thermal displacement data of the front end cover, front bearing chamber, front bearing bracket, spindle box, rear bearing chamber, and rear bearing bracket at different speeds;
[0026] The detailed locations are shown in Table 1 and Figure 4 As shown, the real-time temperature data and spindle thermal displacement data are obtained at rotation speeds of 4000 rpm, 6000 rpm, 8000 rpm, and 10000 rpm respectively.
[0027] Table 1 Measurement point code and deployment location details
[0028]
[0029]
[0030] S2. Analyze the data obtained in S1 and select key measurement point information to be used as training sets and test sets.
[0031] S3. Initialize the weights between the input layer and the hidden layer, the hidden layer and the output layer, and the built-in thresholds of the hidden layer and the output layer;
[0032] S4. Input training set data to BP neural network;
[0033] S5. Based on the forward propagation principle of BP neural network, the BP neural network is used to bring in the training set, and the error MSE between the actual output and the expected output is obtained after the calculation output, and then compared with the cost function E (i) In contrast, if MSE < E (i) Then predict the test set. If MSE>E (i) Then the back propagation process is started, and the hunter-prey optimization algorithm is introduced to correct the weights and thresholds to obtain the optimal initialization weights and thresholds;
[0034] The calculation formula of the mean square error MSE is:
[0035]
[0036] Its cost function E (i) The expression is
[0037]
[0038] Where y (i) is the expected output value (true value), o (i) is the actual output value (predicted value), n L is the dimension of the output data.
[0039] S51. Input the test set data, randomly generate N groups of populations as the initial population (parameter set); the hunter population randomly initializes the position (parameter set) within the search range;
[0040] S52. Calculate the position of the prey (loss function value) according to the hunter's position;
[0041] S53. According to the position of the prey, select the hunter closest to the prey to chase, that is, select the parameter combination in the parameter set that is closest to the loss function value;
[0042] S54. During the pursuit process, the hunter moves according to a certain strategy to gradually approach the prey, that is, to update the value of the parameter;
[0043] S55. Repeat S53 and S54 until the required number of iterations is reached or the convergence condition is reached;
[0044] S56. Return the final iteration result, obtain the optimal weights and thresholds, and obtain the optimized BP neural network.
[0045] S6. Substitute the optimal solution to train the BP neural network;
[0046] Import the training set and the test set into the BP neural network model optimized by the hunter-prey optimization algorithm, use the training set to train the BP neural network model optimized by the hunter-prey optimization algorithm, and predict the test set;
[0047] S7. The error, accuracy, determination coefficient, mean absolute error and root mean square error between the prediction result of the BP neural network model and the true value are used as prediction evaluation indicators;
[0048] S8. The performance and prediction accuracy of the optimized BP neural network model are evaluated by calculating the prediction evaluation index between the prediction result and the true value.
[0049] In the process of forward propagation, there is a link of "comparing with the expected result to see if it is satisfactory". In this link, an error will be generated between the actual output result and the expected output result. In order to reduce this error, it is converted into an optimization process. For any optimization problem, there is always an objective function, which is the loss function.
[0050]
[0051] In formula (3), LOSS is the loss function, n is the number of samples, and y i is the true value of the i-th sample, is the predicted value of the i-th sample, w is the weight, x i is the input node and b is the bias.
[0052] In order to minimize the error between the actual output result and the expected output result, we need to find the minimum value of this function. The iterative method to find the minimum value of the function is to find the numerical solution through gradient descent + iteration. The iterative method generally needs to be repeated many times, because the search for the minimum value of the function may require multiple iterations, and in each iteration, the weights between the nodes in each layer will also be continuously iterated and updated.
[0053]
[0054] In formula (4) Adjustment amount
[0055] α[W (t) -W (t-1) ]: Smoothing item
[0056] η>0, is the learning rate; α is the momentum factor, 0≤α<1;
[0057] In this way, each iteration will generate a weight update, and then the updated weights and training samples will be forward propagated. If the result is not satisfactory, back propagation will be performed and the iteration will continue. This process will be repeated until a satisfactory result is obtained.
[0058] The above content is the main calculation formula for the regression prediction of the BP neural network. After inputting the information of the thermal elongation at 6000r / min at a certain time point obtained from the experiment into the input layer of the BP neural network, the cell state is updated with the time, and then the output layer outputs the regression prediction data under the current state, so as to achieve the prediction of the thermal elongation at the same time under the working conditions of 4000r / min and 8000r / min.
[0059] like Figure 3 As shown, the optimization process of the hunter-prey optimization algorithm (HPO) of the present invention is as follows:
[0060] Phase 1: Population initialization
[0061] The hunter population is randomly initialized by (5):
[0062] x i =rand(1,d)*(ul)+l (5)
[0063] In Equation (5), x i is the position of predation, l is the minimum value (lower bound), u is the maximum value (upper bound), and d is the number of problem variables (dimensions).
[0064] Second stage: Hunter search
[0065] Equation (6) is the hunter's search mechanism:
[0066] x i,j (t + 1) = x i,j (t) + 0.5[(2CZP pos(j) - x i,j (t)) + (2(1 - C)Zγ(j) - x i,j (t))] (6)
[0067] In Equation (6), x i,j (t) is the current position of the predator, x i,j (t + 1) is the next position of the predator, P pos is the position of the prey, γ is the average of all positions, Z is an adaptive parameter, calculated by Equation (8)
[0068] P = R1 < C; IDX = (P == 0) (7)
[0069]
[0070] In Equations (7) and (8), R1 and R3 are random vectors within [0, 1], P is the index value of R1 < C, R2 is a random number within [0, 1], IDX is the index value of vector R1 that satisfies the condition (P == 0), and C is the balance parameter between exploration and exploitation, whose value decreases from 1 to 0.02 during the iteration process. The calculation is shown in Equation (9).
[0071]
[0072] In Equation (9), i is the current iteration number, and M is the maximum iteration number.
[0073] γ in Equation (6) is
[0074]
[0075] The Euclidean distance is calculated as
[0076]
[0077] According to the hunting scenario, when the predator catches the prey, the prey will die. Next, the predator will move to the new prey position. To solve this problem, a decreasing mechanism is considered, as shown in Equation (12).
[0078] k = round(C × N) (12)
[0079] In formula (12), N is the number of search populations. At the beginning of the algorithm, the value of k is equal to N. The last search individual farthest from the average position γ of the search individuals is selected as prey and captured by the predator.
[0080] The distance between the hunter and the prey is measured by using the Euclidean distance. Based on the calculated distance, the hunter closest to the prey is selected as the target of pursuit.
[0081] Assuming that the best safe position is the global best position, the predator may choose another prey because it will give the prey a better chance of survival. Equation (13) is used to update the prey position.
[0082] x i,j (t+1)=T pos(j) +CZcos(2πR4)×[T pos(j) -x i,j (t)] (13)
[0083] In formula (13), x i,j (t) is the current position of the prey, x i,j (t+1) is the next iteration position of the prey, T pos(j) is the global optimal position, Z is the adaptive parameter calculated by equation (8), R4 is a random number in [0,1], C is the balance parameter between exploration and exploitation, its value decreases during the iteration of the algorithm and is calculated by equation (9), and the cos function and its input parameters allow the next prey position to be the global optimal position at different radii and angles. In order to select predators and prey, the following equation is proposed by combining equations (6) and (13).
[0084] x i (t+1)=x i (t)+0.5[(2CZP pos(j) -x i (t))+(2(1-C)Zγ(j)-x i (t))] (14)
[0085] x i (t+1)=T pos +CZcos(2πR4)×(T pos -x i (t)) (15)
[0086] Among them, R4 is a random number in the range of [0,1], and β is a tuning parameter, which is set to 0.1 in this paper. If R5 < β, the search population will be regarded as a hunter, and the search for the next position will be updated using formula (14); otherwise, the search population will be regarded as prey, and the search for the next position will be updated using formula (15).
[0087] Phase 3: Algorithm End Judgment
[0088] Determine whether the algorithm has reached the set maximum number of iterations maxIt. If so, stop the HPO algorithm and output the optimal solution. Otherwise, return to the hunter search stage.
[0089] Hunter-prey optimization algorithm optimizes the BP neural network process Figure 3 As shown:
[0090] The training set and test set data are imported into the HPO-BP electric spindle thermal error prediction model. The HPO optimization algorithm will determine the initial values of each weight parameter, the initial value of the bias parameter and the initial value of the hidden state of the BP neural network through layer-by-layer iteration based on the training set and test set data, and output the optimal solution; finally, the training set and test set data are applied to the optimized BP neural network for regression prediction and the prediction results and evaluation indicators are output to complete the regression prediction task.
[0091] According to the experimental data, the thermal error model of the electric spindle optimized by the hunter-prey optimization algorithm and the BP neural network was established. In order to verify that the accuracy of the prediction model of the hunter-prey optimization algorithm and the BP neural network is better than that of the sparrow search optimization algorithm and the BP neural network prediction model, it was verified at different speeds. The results show that at the speeds of 4000r / min and 8000r / min, the accuracy of the thermal error model predicted by the hunter-prey optimization algorithm and the BP neural network, the sparrow search optimization algorithm and the BP neural network prediction model are 96.83%, 96.93% (hunter-prey optimization algorithm and BP neural network), 93.17%, 93.75% (sparrow search optimization algorithm and BP neural network), 83.74%, 82.60% (BP neural network prediction model). Among them, the model accuracy of the hunter-prey optimization algorithm and the BP neural network is about 98.141%. The hunter-prey optimization algorithm and the BP neural network have greatly shortened the prediction time required by the sparrow search optimization algorithm and the BP neural network by reducing the parameter settings. The hunter-prey optimization algorithm and the BP neural network show better prediction accuracy in the thermal error prediction model.
[0092] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.
Claims
1. A HPO optimized BP neural network spindle thermal error modeling method, characterized by: It includes the following steps: S1. Build an experimental platform and arrange temperature measurement points and displacement measurement points; S2. Analyze the data obtained in S1, and select the key measurement point information as the training set and the test set for use; S3. Initialize the weights between the input layer and the hidden layer, and between the hidden layer and the output layer, as well as the thresholds built in the hidden layer and the output layer; S4. Input the training set data into the BP neural network; S5. The BP neural network is used to bring in the training set, and the error MSE between the actual output and the expected output is obtained after the calculation output, and then compared with the cost function E (i) In contrast, if MSE < E (i) Then predict the test set. If MSE>E (i) Then the back propagation process is started, and the hunter-prey optimization algorithm is introduced to correct the weights and thresholds to obtain the optimal initialization weights and thresholds; S6. Substitute the optimal solution to train the BP neural network; S7. Use the error, accuracy, determination coefficient, mean absolute error, and root mean square error between the prediction result of the BP neural network model and the true value as the prediction evaluation indicators; S8. Evaluate the performance and prediction accuracy of the optimized BP neural network model by calculating the prediction evaluation indicators between the prediction result and the true value.
2. The HPO optimized BP neural network spindle thermal error modeling method according to claim 1, characterized in that: In S1, it is necessary to obtain the real-time temperature data of the front end cover, front bearing chamber, front bearing bracket, main spindle box, rear bearing chamber, and rear bearing bracket at different rotational speeds, as well as the thermal displacement data of the main spindle.
3. A CPA optimized BP neural network spindle thermal error modeling method according to claim 2, characterized in that: The calculation formula of the mean square error MSE in S5 is Its cost function E (i) The expression is Where y (i) is the expected output value (true value), o (i) is the actual output value (predicted value), n L is the dimension of the output data.
4. The HPO optimized BP neural network spindle thermal error modeling method according to claim 1, characterized in that: The specific steps to optimize the BP neural network with the carnivorous plant optimization algorithm in S5 are as follows: S51. Input the test set data, and randomly generate N groups of populations as the initial population; the hunter population randomly initializes its position within the search range; S52. Calculate the position of the prey according to the position of the hunter; S53. According to the position of the prey, select the hunter closest to the prey for pursuit, that is, select the parameter combination in the parameter set that is closest to the loss function value; S54. During the pursuit process, the hunter moves according to a certain strategy to gradually approach the prey, that is, update the value of the parameter; S55. Repeat S53 and S54 until the requirement of the number of iterations is reached or the convergence condition is met; S56. Return the final iteration result, obtain the optimal weights and thresholds, and get the optimized BP neural network.
5. The HPO optimized BP neural network spindle thermal error modeling method according to claim 4, characterized in that: The method for the hunter population to randomly initialize its position within the search range in S51 is as follows: The hunter population randomly initializes its position by formula (5): x i =rand(1,d)*(u-l)+l (5) In formula (5), x i is the location of the prey, l is the minimum value, u is the maximum value, and d is the number of problem variables.
6. The HPO optimized BP neural network spindle thermal error modeling method according to claim 4, characterized in that: The method for calculating the position of the prey according to the position of the hunter in S52 is as follows: x i,j (t+1)=x i,j (t)+0.5[(2CZP pos(j) -x i,j (t))+(2(1-C)Zγ(j)-x i,j (t))] (6) In formula (6), x i,j (t) is the current position of the predator, x i,j (t+1) is the next position of the predator, P pos is the position of the prey, γ is the average of all positions, and Z is the adaptive parameter, which is calculated by formula (8): P = R1 < C; IDX = (P == 0)? (7) In formulas (7) and (8), R1 and R3 are random vectors within [0, 1], P is the index value of R1 < C, R2 is a random number within [0, 1], IDX is the index value of the vector R1 that satisfies the condition (P == 0), C is the balance parameter between exploration and exploitation, and its value decreases from 1 to 0.02 during the iteration process, and the calculation is shown in formula (9). In formula (9), i is the current iteration number, and M is the maximum iteration number; γ in formula (6) is Calculate the Euclidean distance as 7. The HPO optimized BP neural network spindle thermal error modeling method according to claim 4, characterized in that: The specific method for selecting the hunter closest to the prey for pursuit in S53 is as follows: k = round(C × N) (12) In formula (12), N is the number of the search population. At the beginning of the algorithm, the value of k is equal to N, and the last search individual that is farthest from the average position γ of the search individuals is selected as the prey and is captured by the predator.
8. The HPO optimized BP neural network spindle thermal error modeling method according to claim 4, characterized in that: The method for updating the parameter value in S54 is as follows: x i,j (t+1)=T pos(j) +CZcos(2πR4)×[T pos(j) -x i,j (t)] (13) Among them, x i,j (t) is the current position of the prey, x i,j (t+1) is the next iteration position of the prey, T pos(j) is the global optimal position, Z is the adaptive parameter calculated by equation (8), R4 is a random number in [0,1], C is the balance parameter between exploration and exploitation, its value decreases during the iteration of the algorithm and is calculated by equation (9). The cosine function and its input parameters allow the next prey position to be at the global optimal position at different radii and angles. In order to select predators and prey, the following equation is proposed by combining equations (6) and (13): x i (t+1)=x i (t)+0.5[(2CZP pos(j) -x i (t))+(2(1-C)Zγ(j)-x i (t))] (14) x i (t+1)=T pos +CZcos(2πR4)×(T pos -x i (t)) (15) In formula (14) and (15), R4 is a random number in the range of [0,1], β is an adjustment parameter. If R5 < β, the search population will be regarded as a hunter, and the search for the next position will be updated using formula (14); otherwise, the search population will be regarded as a prey, and the search for the next position will be updated using formula (15).
Citation Information
Patent Citations
BP neutral network heavy machine tool thermal error modeling method optimized through genetic algorithm
CN104597842A
Thermal error prediction method for electric spindle with variable bearing pre-tightening force
CN114970049A
Milling force prediction method based on improved whale algorithm optimized BP neural network
CN117669084A
Reliability calculation method of the thermal error model of a machine tool based on deep neural network and the monte carlo method
US20210064988A1
Cited By
Thermal error model construction method, storage medium and computer equipment
CN119689978A
Method and system for predicting granularity of lithium battery material
CN121725957A
