Method for constructing thermal error model, storage medium and computer device

By adjusting the BP neural network using the whale optimization algorithm and constructing a thermal error model, the problem of poor parameter applicability in existing technologies is solved, and high-precision prediction and stable machining of CNC machine tools under different working conditions are realized.

CN119689978BActive Publication Date: 2026-02-24SHENYANG UNIVERSITY OF TECHNOLOGY +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411659167.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2026-02-24
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

In existing technologies, the thermal error models established by machine learning methods have poor applicability of parameters, making it difficult to guarantee high-precision predictions under different machine tools and working conditions, which affects the machining accuracy of CNC machine tools.

Method used

The Whale Optimization Algorithm is used to adjust the BP neural network. A sample set is constructed by acquiring temperature field and thermal deformation data of the CNC machine tool spindle system. The Whale Optimization Algorithm is used to enhance the global search capability of the BP neural network and construct a thermal error model.

Benefits of technology

This improves the prediction accuracy and generalization performance of the thermal error model, ensures the stability and reliability of the machining accuracy of CNC machine tools at different speeds, and reduces the risk of the network getting trapped in local optima.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119689978B_ABST
    Figure CN119689978B_ABST
Patent Text Reader

Abstract

The application provides a kind of construction method of thermal error model, storage medium and computer equipment, the construction method of thermal error model, comprising: obtaining the working parameter when spindle system in numerical control machine tool idles at different speeds, working parameter includes the temperature field data of spindle system and the thermal deformation data of spindle system;According to the temperature field data of spindle system and the thermal deformation data of spindle system, a sample set is constructed;Based on whale optimization algorithm, the temperature rise data of spindle system is used as input, the thermal deformation data of spindle system is used as output to adjust target BP neural network, to obtain the first model;Sample data in sample set is used to train the first model, to obtain thermal error model;Wherein, the temperature rise data is determined according to the temperature field data.The global search capability of BP neural network is enhanced by using whale optimization algorithm, and then the training effect and generalization performance of the model are improved, and the influence of thermal error on the machining accuracy of numerical control machine tool is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control technology, and more specifically, to a method for constructing a thermal error model, a storage medium, and a computer device. Background Technology

[0002] Thermal errors in CNC machine tools have a significant impact on the machining accuracy of parts. Numerous studies have shown that thermal errors are the main error affecting the machining accuracy of CNC machine tools, accounting for 40% to 70% of the total machine tool error. Among these, thermal errors caused by the electric spindle account for 50% to 80% of the total thermal errors. Currently, there are two main methods to reduce the impact of thermal errors: thermal error prediction and thermal error compensation.

[0003] With the emergence and popularization of machine learning, many related technical solutions employ machine learning methods to characterize the mapping relationship between machine tool temperature and thermal deformation. Based on this, experts both domestically and internationally have established various thermal error models. For example, convolutional neural networks based on thermal images are used to model machine tool spindles and predict thermal deformation. Other scholars have used traditional neural networks and support vector machines to establish thermal error prediction models. Although these methods are simple, direct, and practical, the parameters in these models are usually determined empirically or experimentally. Data sets for different machine tools and different operating conditions often vary significantly, making it difficult to guarantee that the same parameters are applicable to new datasets. Furthermore, different parameters have a significant impact on the model's prediction accuracy. Summary of the Invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0005] Therefore, a first aspect of the present invention is to provide a method for constructing a thermal error model.

[0006] A second aspect of the present invention is that a readable storage medium is provided.

[0007] A third aspect of the present invention is that a computer device is provided.

[0008] In view of this, according to a first aspect of the present invention, the present invention provides a method for constructing a thermal error model, comprising: acquiring the operating parameters of a spindle system in a CNC machine tool when it idles at different speeds, the operating parameters including temperature field data and thermal deformation data of the spindle system; constructing a sample set based on the temperature field data and thermal deformation data of the spindle system; adjusting a target BP neural network based on a whale optimization algorithm, using the temperature rise data of the spindle system as input and the thermal deformation data of the spindle system as output, to obtain a first model; and training the first model using sample data from the sample set to obtain a thermal error model; wherein the temperature rise data is determined based on the temperature field data.

[0009] The technical solution of this invention proposes a method for constructing a thermal error model. By running the above-mentioned thermal error model construction method, the global search capability of the BP neural network is enhanced by the whale optimization algorithm, thereby improving the training effect and generalization performance of the model. At the same time, it alleviates the disadvantage that the network is prone to getting trapped in local optima.

[0010] Furthermore, the thermal error model constructed using the thermal error model construction method proposed in this invention has higher prediction accuracy compared to other neural network models. Therefore, when using the thermal error model constructed using the thermal error model construction method proposed in this invention to control CNC machine tools, the machining accuracy of CNC machine tools can be guaranteed, the influence of thermal error on the machining accuracy of CNC machine tools can be improved, and the operation of CNC machine tools can be made more stable and reliable.

[0011] Furthermore, since the temperature field data and thermal deformation data of the spindle system are working parameters measured when the spindle system of the CNC machine tool is idle at different speeds, the thermal error model constructed by the thermal error model construction method proposed in this invention can predict more accurate thermal deformation data at different speeds, which enables the CNC machine tool to ensure machining accuracy at different speeds.

[0012] In some technical solutions, the different rotational speeds can optionally be 4000 r / min, 6000 r / min, and 8000 r / min.

[0013] In some technical solutions, optionally, the sample set includes a training dataset and a test dataset. The sample set is constructed based on the temperature field data and thermal deformation data of the spindle system. Specifically, this includes: preprocessing the temperature field data and thermal deformation data of the spindle system to obtain a first dataset; randomly selecting sample data from the first dataset to obtain a training dataset and a test dataset; wherein the training dataset is used to train a first model, and the test dataset is used to test the trained first model.

[0014] In this technical solution, the temperature field data and thermal deformation data of the spindle system are preprocessed to integrate the temperature field data and thermal deformation data of the spindle system to form a first dataset. Then, random sample data is selected from the first dataset to form a training dataset and a test dataset.

[0015] In this process, the training dataset and the test dataset are obtained by random sampling. Therefore, the training dataset and the test dataset are both representative of the first dataset. Thus, after training the first model using the training dataset, the testing needs of the test dataset can be met to the greatest extent.

[0016] In some technical solutions, optionally, the temperature field data and thermal deformation data of the spindle system are preprocessed to obtain a first dataset. Specifically, this includes: aligning the temperature field data and thermal deformation data of the spindle system according to the time axis to obtain aligned first data information; dividing the first data information equally using the same time interval to obtain the first dataset; wherein each sample data in the first dataset includes temperature field data and thermal deformation data within a time interval.

[0017] In this technical solution, the temperature field data and thermal deformation data of the spindle system are aligned along the time axis to combine the temperature field data and thermal deformation data within the same time interval, thereby forming a sample data. In this process, each sample data contains temperature field data and thermal deformation data within a time interval. Therefore, after selecting the sample data, the temperature field data in the sample data can be used as input and the thermal deformation data as output to train the first model. Obviously, the trained thermal error model can use the temperature field data as input and give the prediction result of the thermal deformation data.

[0018] Specifically, the temperature field data and thermal deformation data of the spindle system obtained from the experiment are synchronized on the time axis. Based on the total experimental duration, the machine tool state is divided into n segments at equal time intervals. The temperature field data and thermal deformation data of the spindle system in each segment are the initial sample data of the model, that is, each sample data in the first dataset.

[0019] In some technical solutions, optionally, the spindle system includes a front bearing flange sleeve, a front end cover, a first front bearing chamber, a second front bearing chamber, a first front bearing outer ring cover, a second front bearing outer ring cover, a spindle box, and a motor; wherein, the temperature field data of the spindle system includes: temperature data of the front bearing flange sleeve, temperature data of the front end cover, temperature data of the first front bearing chamber, temperature data of the second front bearing chamber, temperature data of the first front bearing outer ring cover, temperature data of the second front bearing outer ring cover, temperature data of the spindle box, and temperature data of the motor; and the thermal deformation data of the spindle system includes: the thermal deformation value of the spindle in the Z-axis direction.

[0020] In some technical solutions, temperature data can optionally be obtained by measuring a patch-type temperature sensor.

[0021] In some technical solutions, the thermal deformation value can optionally be obtained by measuring a displacement sensor. Specifically, the thermal displacement of the spindle output by the displacement sensor is used as the thermal deformation value.

[0022] In some technical solutions, the temperature rise data may optionally include: the temperature data of the front bearing flange sleeve, the temperature data of the motor, the temperature data of the second front bearing outer ring cover, and the temperature data of the spindle box.

[0023] In some technical solutions, optionally, based on the whale optimization algorithm, the temperature rise data of the main shaft system is used as input, and the thermal deformation data of the main shaft system is used as output to adjust the target BP neural network to obtain a first model. Specifically, this includes: obtaining input layer nodes and output layer nodes, where the input layer nodes are used to input the temperature rise data of the main shaft system, and the output layer nodes are used to output the thermal deformation data of the main shaft system; obtaining the target BP neural network, which is a BP neural network with optimal hidden layer nodes; initializing the parameters of the whale optimization algorithm using Cubic chaotic mapping, where the parameters include the initial population size and the maximum number of iterations; in each iteration of the whale optimization algorithm, selecting different positions to determine the equation based on a first coefficient to determine the position of the individual whale in the next iteration, where the first coefficient is the coefficient controlling the swimming range of the whale in the whale optimization algorithm; obtaining the optimal weights and optimal thresholds when the number of iterations of the whale optimization algorithm reaches the maximum number of iterations; and assigning the optimal weights and optimal thresholds to the target BP neural network to obtain the first model.

[0024] In this technical solution, the whale optimization algorithm can be used to enhance the global search capability of the BP neural network, thereby improving the training effect and generalization performance of the model. At the same time, it reduces the disadvantage of the network being prone to getting stuck in local optima.

[0025] Among them, the whale optimization algorithm mimics the hunting behavior of humpback whales in nature, namely bubble-net hunting behavior. This hunting behavior is accomplished by humpback whales forming unique small bubbles along a spiral-shaped movement trajectory when surrounding prey. The hunting behavior of humpback whales has three stages: surrounding the prey, bubble-net attack, and searching for the prey.

[0026] Specifically, in the stage of surrounding the prey:

[0027] The behavior of whales gradually surrounding their prey can be represented by the following equation:

[0028]

[0029]

[0030] Where D represents the distance between the whale and its prey, then This can be understood as the distance between a whale and its prey, where t represents the current iteration number; A and C are coefficient vectors used to control the whale's movement; X *X(t) is the position vector of the optimal solution obtained in the current iteration; X(t) represents the position vector corresponding to the current iteration, and X(t+1) represents the position vector corresponding to the next iteration of the current iteration.

[0031] The formulas for calculating A and C are as follows:

[0032]

[0033]

[0034] Where r1 and r2 represent random vectors between [0,1]; a is the convergence factor, which decreases linearly from 2 to 0 as the number of iterations increases.

[0035] The formula for calculating 'a' is as follows:

[0036]

[0037] Among them, T max This indicates the maximum number of iterations.

[0038] During the bubble web attack phase, in order to express the whale's bubble web attack behavior using a mathematical model, two attack mechanisms were designed: shrinking encirclement and spiral position update.

[0039] The mathematical expression for the spiral position update behavior is as follows:

[0040]

[0041] Where D2 represents the distance between the individual whale and its prey; b represents a constant that defines the shape of the spiral movement; l represents a random variable that defines the optimal position of the whale; l∈[-1,1].

[0042] Since whales perform both the contraction and spiraling position updates simultaneously when capturing prey, we can assume that each behavior has a 50% probability of occurring. The mathematical expression for this behavior is as follows:

[0043]

[0044] Where ρ is a random number in the range [0,1].

[0045] During the prey-hunting phase, whales may change their positions based on other whales in their hunting space, as the location of the fish they are currently surrounding may not be the best location for the fish in their hunting space.

[0046] This hunting mechanism is determined by variable A. When |A|>1, the whale will conduct a global random search for prey; when 0<|A|<1, the whale will attack the prey. The mathematical model is as follows:

[0047]

[0048] Among them, X rand D is the position vector of a randomly selected individual whale in the current group; rand The distance between a randomly selected individual whale and its prey.

[0049] In some technical solutions, optionally, the input layer has 4 nodes, the hidden layer has 9 nodes, the output layer has 1 node, the number of training iterations is 5000, the learning rate is 0.01, and the minimum training error is 0.0001.

[0050] In some technical solutions, optionally, the momentum factor of the BP neural network with the best hidden layer node is 0.01, the minimum performance gradient is 0.000006, and the maximum number of failures is set to 6.

[0051] In some technical solutions, the initial population size can optionally be 30, and the maximum number of iterations can be 50.

[0052] In the above technical solution, during the process of determining the position of individual whales in the next iteration of the whale optimization algorithm, each individual is checked for whether it has exceeded the limit. If it exceeds the maximum value, it is set to the maximum value; if it exceeds the minimum value, it is set to the minimum value.

[0053] In some technical solutions, the Cubic chaotic map is optionally defined as follows:

[0054]

[0055] Where, x k ∈(0,1), where ρ is the control parameter. The chaotic nature of the Cubic mapping depends on the value of the parameter ρ. When ρ=2.595 and x=0.3, the Cubic mapping has better chaotic ergodicity.

[0056] In some technical solutions, optionally, in each iteration of the whale optimization algorithm, different position determination equations are selected based on the first coefficient to determine the position of the individual whale in the next iteration of the whale optimization algorithm. Specifically, this includes: when the first coefficient is less than 1, selecting the first position determination equation and the second position determination equation; when the first coefficient is greater than or equal to 1, selecting the third position determination equation.

[0057] The equation for determining the first position is:

[0058] (10)

[0059] The equation for determining the second position is:

[0060] (11)

[0061] The equation for determining the third position is:

[0062] (12)

[0063] Where t is the current iteration number, X(t+1) is the position vector for the next iteration of the current iteration number, w is the inertia weight, A is the coefficient vector, D represents the distance between the whale and the prey, and X... b (t) is a position vector for the current iteration number. Let be the distance between the current searched individual and the current optimal solution, b be a constant defining the shape of the spiral movement, and l be a random variable defining the distance of the whale from the optimal position. The distance between a randomly selected individual whale and its prey. This represents the position vector of a randomly selected individual whale from the current group at the current iteration number.

[0064] In this technical solution, the value of w will be adaptively adjusted according to the current individual fitness value and the average fitness value of the population, so as to improve the ability of the original whale algorithm to search for global optimization and escape local optima, and accelerate the convergence speed of the algorithm.

[0065] In some technical solutions, the inertia weight is optionally calculated based on the following formula:

[0066]

[0067] Among them, w b w s T represents the initial maximum inertia weight and the initial minimum inertia weight, respectively. max Let t be the maximum number of iterations, t be the current iteration number, and f be the current fitness value of the individual whale. avg This represents the average fitness value of the current whale population.

[0068] According to a second aspect of the present invention, the present invention provides a readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, a method for constructing a thermal error model as described above is implemented.

[0069] According to a third aspect of the present invention, a computer device is provided, including a processor and a memory, the memory storing a program or instructions executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for constructing a thermal error model as described above.

[0070] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0071] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0072] Figure 1 A flowchart illustrating a method for constructing a thermal error model according to an embodiment of the present invention is shown.

[0073] Figure 2 The illustration shows a flowchart of an embodiment of the present invention, which uses the temperature rise data of the spindle system as input and the thermal deformation data of the spindle system as output to adjust the target BP neural network to obtain the first model.

[0074] Figure 3 A schematic diagram of the overall process of constructing the thermal error model in an embodiment of the present invention is shown;

[0075] Figure 4 The predicted values ​​of five models are shown in an embodiment of the present invention at a spindle speed of 4000 r / min;

[0076] Figure 5 The predicted values ​​of five models are shown in an embodiment of the present invention at a spindle speed of 6000 r / min;

[0077] Figure 6 The predicted values ​​of five models are shown in an embodiment of the present invention at a spindle speed of 8000 r / min;

[0078] Figure 7 The residual values ​​of five models at a spindle speed of 4000 r / min are shown in this embodiment of the invention.

[0079] Figure 8 The residual values ​​of five models at a spindle speed of 6000 r / min are shown in this embodiment of the invention.

[0080] Figure 9 The residual values ​​of five models at a spindle speed of 8000 r / min are shown in this embodiment of the invention.

[0081] Figure 10 A schematic block diagram of a computer device according to an embodiment of the present invention is shown. Detailed Implementation

[0082] To better understand the above aspects, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0083] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0084] In one embodiment of this application, such as Figure 1 As shown, a method for constructing a thermal error model is provided, including:

[0085] Step 102: Obtain the working parameters of the spindle system in the CNC machine tool when it is idling at different speeds. The working parameters include the temperature field data and thermal deformation data of the spindle system.

[0086] Step 104: Construct a sample set based on the temperature field data and thermal deformation data of the spindle system;

[0087] Step 106: Based on the whale optimization algorithm, the target BP neural network is adjusted using the temperature rise data of the spindle system as input and the thermal deformation data of the spindle system as output to obtain the first model;

[0088] Step 108: The first model is trained using sample data from the sample set to obtain the thermal error model; wherein, the temperature rise data is determined based on the temperature field data.

[0089] The technical solution of this invention proposes a method for constructing a thermal error model. By running the above-mentioned thermal error model construction method, the global search capability of the BP neural network is enhanced by the whale optimization algorithm, thereby improving the training effect and generalization performance of the model. At the same time, it alleviates the disadvantage that the network is prone to getting trapped in local optima.

[0090] Furthermore, the thermal error model constructed using the thermal error model construction method proposed in this invention has higher prediction accuracy compared to other neural network models. Therefore, when using the thermal error model constructed using the thermal error model construction method proposed in this invention to control CNC machine tools, the machining accuracy of CNC machine tools can be guaranteed, the influence of thermal error on the machining accuracy of CNC machine tools can be improved, and the operation of CNC machine tools can be made more stable and reliable.

[0091] Furthermore, since the temperature field data and thermal deformation data of the spindle system are working parameters measured when the spindle system of the CNC machine tool is idle at different speeds, the thermal error model constructed by the thermal error model construction method proposed in this invention can predict more accurate thermal deformation data at different speeds, which enables the CNC machine tool to ensure machining accuracy at different speeds.

[0092] In some technical solutions, the different rotational speeds can optionally be 4000 r / min, 6000 r / min, and 8000 r / min.

[0093] In some technical solutions, optionally, the sample set includes a training dataset and a test dataset. The sample set is constructed based on the temperature field data and thermal deformation data of the spindle system. Specifically, this includes: preprocessing the temperature field data and thermal deformation data of the spindle system to obtain a first dataset; randomly selecting sample data from the first dataset to obtain a training dataset and a test dataset; wherein the training dataset is used to train a first model, and the test dataset is used to test the trained first model.

[0094] In this technical solution, the temperature field data and thermal deformation data of the spindle system are preprocessed to integrate the temperature field data and thermal deformation data of the spindle system to form a first dataset. Then, random sample data is selected from the first dataset to form a training dataset and a test dataset.

[0095] In this process, the training dataset and the test dataset are obtained by random sampling. Therefore, the training dataset and the test dataset are both representative of the first dataset. Thus, after training the first model using the training dataset, the testing needs of the test dataset can be met to the greatest extent.

[0096] In some technical solutions, optionally, the temperature field data and thermal deformation data of the spindle system are preprocessed to obtain a first dataset. Specifically, this includes: aligning the temperature field data and thermal deformation data of the spindle system according to the time axis to obtain aligned first data information; dividing the first data information equally using the same time interval to obtain the first dataset; wherein each sample data in the first dataset includes temperature field data and thermal deformation data within a time interval.

[0097] In this technical solution, the temperature field data and thermal deformation data of the spindle system are aligned along the time axis to combine the temperature field data and thermal deformation data within the same time interval, thereby forming a sample data. In this process, each sample data contains temperature field data and thermal deformation data within a time interval. Therefore, after selecting the sample data, the temperature field data in the sample data can be used as input and the thermal deformation data as output to train the first model. Obviously, the trained thermal error model can use the temperature field data as input and give the prediction result of the thermal deformation data.

[0098] Specifically, the temperature field data and thermal deformation data of the spindle system obtained from the experiment are synchronized on the time axis. Based on the total experimental duration, the machine tool state is divided into n segments at equal time intervals. The temperature field data and thermal deformation data of the spindle system in each segment are the initial sample data of the model, that is, each sample data in the first dataset.

[0099] In some technical solutions, optionally, the spindle system includes a front bearing flange sleeve, a front end cover, a first front bearing chamber, a second front bearing chamber, a first front bearing outer ring cover, a second front bearing outer ring cover, a spindle box, and a motor; wherein, the temperature field data of the spindle system includes: temperature data of the front bearing flange sleeve, temperature data of the front end cover, temperature data of the first front bearing chamber, temperature data of the second front bearing chamber, temperature data of the first front bearing outer ring cover, temperature data of the second front bearing outer ring cover, temperature data of the spindle box, and temperature data of the motor; and the thermal deformation data of the spindle system includes: the thermal deformation value of the spindle in the Z-axis direction.

[0100] In some technical solutions, temperature data can optionally be obtained by measuring a patch-type temperature sensor.

[0101] In some technical solutions, the thermal deformation value can optionally be obtained by measuring a displacement sensor. Specifically, the thermal displacement of the spindle output by the displacement sensor is used as the thermal deformation value.

[0102] For example, taking a vertical machining center produced by a certain company as an example, the experimental equipment used mainly includes an electric spindle, a spindle water chiller, a CNC system, an oil-air lubrication device, and a sensor for measuring the temperature of the spindle bearing. The sensor for measuring the temperature of the spindle bearing is a traditional resistance sensor, which is installed at the head of the spindle to detect the temperature of the bearing at the head of the spindle.

[0103] Regarding the arrangement of temperature and displacement measuring points, a K-type thermocouple thermometer was used for temperature measurement, and the "five-point measurement method" was employed for thermal error measurement. Real-time temperature data and spindle thermal displacement data of the front bearing flange, front end cover, first front bearing chamber, second front bearing chamber, first front bearing outer ring cover, second front bearing outer ring cover, spindle box, and motor were acquired at 4000 r / min, 6000 r / min, and 8000 r / min. The experiment lasted for 240 minutes, and the collected data were saved to a computer for subsequent processing and application.

[0104] The collected data were processed, and the two sets of different data, temperature and z-axis thermal deformation values, were synchronized on the time axis. The machine tool state was divided into n segments at 1-minute intervals according to the total experimental time. The temperature field information and z-axis thermal deformation value information of each segment were the initial sample data of the model. The processed dataset was shuffled, and a training set was randomly selected. For example, the first 480 samples of the shuffled dataset were used as the training set at a ratio of 2:1. The remaining 240 samples at 4000r / min, 6000r / min, and 8000r / min were used as the test set.

[0105] In some technical solutions, the temperature rise data may optionally include: the temperature data of the front bearing flange sleeve, the temperature data of the motor, the temperature data of the second front bearing outer ring cover, and the temperature data of the spindle box.

[0106] In some technical solutions, optionally, based on the whale optimization algorithm, the temperature rise data of the main shaft system is used as input, and the thermal deformation data of the main shaft system is used as output to adjust the target BP neural network to obtain a first model. Specifically, this includes: obtaining input layer nodes and output layer nodes, where the input layer nodes are used to input the temperature rise data of the main shaft system, and the output layer nodes are used to output the thermal deformation data of the main shaft system; obtaining the target BP neural network, which is a BP neural network with optimal hidden layer nodes; initializing the parameters of the whale optimization algorithm using Cubic chaotic mapping, where the parameters include the initial population size and the maximum number of iterations; in each iteration of the whale optimization algorithm, selecting different positions to determine the equation based on a first coefficient to determine the position of the individual whale in the next iteration, where the first coefficient is the coefficient controlling the swimming range of the whale in the whale optimization algorithm; obtaining the optimal weights and optimal thresholds when the number of iterations of the whale optimization algorithm reaches the maximum number of iterations; and assigning the optimal weights and optimal thresholds to the target BP neural network to obtain the first model.

[0107] In this technical solution, the whale optimization algorithm can be used to enhance the global search capability of the BP neural network, thereby improving the training effect and generalization performance of the model. At the same time, it reduces the disadvantage of the network being prone to getting stuck in local optima.

[0108] Among them, the whale optimization algorithm mimics the hunting behavior of humpback whales in nature, namely bubble-net hunting behavior. This hunting behavior is accomplished by humpback whales forming unique small bubbles along a spiral-shaped movement trajectory when surrounding prey. The hunting behavior of humpback whales has three stages: surrounding the prey, bubble-net attack, and searching for the prey.

[0109] Specifically, in the stage of surrounding the prey:

[0110] The behavior of whales gradually surrounding their prey can be represented by the following equation:

[0111]

[0112]

[0113] Where D represents the distance between the whale and its prey, then This can be understood as the distance between a whale and its prey, where t represents the current iteration number; A and C are coefficient vectors used to control the whale's movement; X * X(t) is the position vector of the optimal solution obtained in the current iteration; X(t) represents the position vector corresponding to the current iteration, and X(t+1) represents the position vector corresponding to the next iteration of the current iteration.

[0114] The formulas for calculating A and C are as follows:

[0115]

[0116]

[0117] Where r1 and r2 represent random vectors between [0,1]; a is the convergence factor, which decreases linearly from 2 to 0 as the number of iterations increases.

[0118] The formula for calculating 'a' is as follows:

[0119]

[0120] Among them, T max This indicates the maximum number of iterations.

[0121] During the bubble web attack phase, in order to express the whale's bubble web attack behavior using a mathematical model, two attack mechanisms were designed: shrinking encirclement and spiral position update.

[0122] The mathematical expression for the spiral position update behavior is as follows:

[0123]

[0124] Where D2 represents the distance between the individual whale and its prey; b represents a constant that defines the shape of the spiral movement; l represents a random variable that defines the optimal position of the whale; l∈[-1,1].

[0125] Since whales perform both the contraction and spiraling position updates simultaneously when capturing prey, we can assume that each behavior has a 50% probability of occurring. The mathematical expression for this behavior is as follows:

[0126]

[0127] Where ρ is a random number in the range [0,1].

[0128] During the prey-hunting phase, whales may change their positions based on other whales in their hunting space, as the location of the fish they are currently surrounding may not be the best location for the fish in their hunting space.

[0129] This hunting mechanism is determined by variable A. When |A|>1, the whale will conduct a global random search for prey; when 0<|A|<1, the whale will attack the prey. The mathematical model is as follows:

[0130]

[0131] Among them, X rand D is the position vector of a randomly selected individual whale in the current group; rand The distance between a randomly selected individual whale and its prey.

[0132] In some technical solutions, optionally, the input layer has 4 nodes, the hidden layer has 9 nodes, the output layer has 1 node, the number of training iterations is 5000, the learning rate is 0.01, and the minimum training error is 0.0001.

[0133] In some technical solutions, optionally, the momentum factor of the BP neural network with the best hidden layer node is 0.01, the minimum performance gradient is 0.000006, and the maximum number of failures is set to 6.

[0134] In some technical solutions, the initial population size can optionally be 30, and the maximum number of iterations can be 50.

[0135] In the above technical solution, during the process of determining the position of individual whales in the next iteration of the whale optimization algorithm, each individual is checked for whether it has exceeded the limit. If it exceeds the maximum value, it is set to the maximum value; if it exceeds the minimum value, it is set to the minimum value.

[0136] In some technical solutions, the Cubic chaotic map is optionally defined as follows:

[0137]

[0138] Where, x k ∈(0,1), where ρ is the control parameter. The chaotic nature of the Cubic mapping depends on the value of the parameter ρ. When ρ=2.595 and x=0.3, the Cubic mapping has better chaotic ergodicity.

[0139] In some technical solutions, optionally, in each iteration of the whale optimization algorithm, different position determination equations are selected based on the first coefficient to determine the position of the individual whale in the next iteration of the whale optimization algorithm. Specifically, this includes: when the first coefficient is less than 1, selecting the first position determination equation and the second position determination equation; when the first coefficient is greater than or equal to 1, selecting the third position determination equation.

[0140] The equation for determining the first position is:

[0141] (10)

[0142] The equation for determining the second position is:

[0143] (11)

[0144] The equation for determining the third position is:

[0145] (12)

[0146] Where t is the current iteration number, X(t+1) is the position vector for the next iteration of the current iteration number, w is the inertia weight, A is the coefficient vector, D represents the distance between the whale and the prey, and X... b (t) is a position vector for the current iteration number. Let be the distance between the current searched individual and the current optimal solution, b be a constant defining the shape of the spiral movement, and l be a random variable defining the distance of the whale from the optimal position. The distance between a randomly selected individual whale and its prey. This represents the position vector of a randomly selected individual whale from the current group at the current iteration number.

[0147] In this technical solution, the value of w will be adaptively adjusted according to the current individual fitness value and the average fitness value of the population, so as to improve the ability of the original whale algorithm to search for global optimization and escape local optima, and accelerate the convergence speed of the algorithm.

[0148] In some technical solutions, the inertia weight is optionally calculated based on the following formula:

[0149]

[0150] Among them, w b w s T represents the initial maximum inertia weight and the initial minimum inertia weight, respectively. max Let t be the maximum number of iterations, t be the current iteration number, and f be the current fitness value of the individual whale. avg This represents the average fitness value of the current whale population.

[0151] Figure 2 This illustration shows a flowchart of an embodiment of the present invention based on the whale optimization algorithm, using the temperature rise data of the spindle system as input and the thermal deformation data of the spindle system as output to adjust the target BP neural network to obtain the first model. Figure 2 As shown, the inertia weight is adjusted during the bubble web attack phase.

[0152] Figure 3This diagram illustrates the overall flow of the method for constructing the thermal error model in an embodiment of the present invention. Figure 3 As shown, the methods for constructing the thermal error model include:

[0153] Step 302: Use a patch-type temperature sensor, a multi-channel digital display meter, and an eddy current displacement sensor to measure the temperature and Z-axis thermal deformation at each measuring point.

[0154] The Z-axis thermal deformation is the thermal deformation value of the main shaft in the Z-axis direction in this application.

[0155] Step 304: Process the experimental data.

[0156] Step 306: Shuffle the experimental data and select the training dataset and test dataset.

[0157] Step 308: Establish an improved whale algorithm prediction model.

[0158] Step 310: Determine the temperature data as the CAWOA-BP input signal and the Z-axis thermal deformation data of the electric spindle as the output signal, and establish an electric spindle thermal error model with improved whale algorithm and optimized BP neural network.

[0159] Among them, the improved whale algorithm to optimize the thermal error model of the BP neural network is also the first model in this application.

[0160] Step 312: Compare and verify the CAWOA-BP algorithm with other algorithms.

[0161] Figure 4 The following are the predicted values ​​of five models at a spindle speed of 4000 r / min in an embodiment of the present invention: Figure 4 As shown in Table 1, the comparison and verification of the CAWOA-BP algorithm with other algorithms are presented.

[0162] Table 1

[0163]

[0164] Figure 5 The following are the predicted values ​​of five models at a spindle speed of 6000 r / min in an embodiment of the present invention, such as... Figure 5 As shown in Table 2, the comparison and verification of the CAWOA-BP algorithm with other algorithms are presented.

[0165] Table 2

[0166]

[0167] Figure 6 The following are the predicted values ​​of five models at a spindle speed of 8000 r / min in an embodiment of the present invention, such as... Figure 6As shown in Table 3, the comparison and verification of the CAWOA-BP algorithm with other algorithms are presented.

[0168] Table 3

[0169]

[0170] By comparing the proposed CAWOA-BP algorithm with the BP algorithm, WOA-BP, PSO-BP, and SSA-BP, the CAWOA-BP model consistently demonstrates a higher R² value, closer to 1, regardless of spindle speeds of 4000 r / min, 6000 r / min, or 8000 r / min. Furthermore, the RMSE and MAE of the CAWOA-BP model are lower than the other four prediction models, indicating significant advantages in robustness and prediction accuracy. Therefore, it can be concluded that the improved algorithm effectively enhances the prediction of thermal errors in CNC machine tools, maintaining high prediction accuracy and stability under various operating conditions.

[0171] Figure 7 The residual values ​​of five models at a spindle speed of 4000 r / min are shown in this embodiment of the invention. Figure 8 The residual values ​​of five models at a spindle speed of 6000 r / min are shown in this embodiment of the invention. Figure 9 The residual values ​​of five models at a spindle speed of 8000 r / min are shown in this embodiment of the invention. Figure 7 , Figure 8 and Figure 9 As shown, the residual values ​​predicted by CAWOA-BP fluctuate less, indicating that CAWOA-BP fits fluctuating data better than BP neural networks, WOA-BP, PSO-BP, and SAA-BP, thus confirming the rationality of introducing Cubic chaotic mapping and adaptive inertial weights.

[0172] In some embodiments, the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement a method for constructing a thermal error model as described above.

[0173] In some embodiments, such as Figure 10 As shown, the present invention provides a computer device 1000, including a processor 1002 and a memory 1004. The memory 1004 stores programs or instructions that can run on the processor 1002. When the program or instructions are executed by the processor 1002, they implement the steps of the method for constructing a thermal error model as described above.

[0174] The memory 1004 can be used to store software programs and various data. The memory 1004 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback function, image playback function, etc.). Furthermore, the memory 1004 can include volatile memory or non-volatile memory, or both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0175] The terms "first" and "second" in the specification and claims of this application may explicitly or implicitly include one or more of the features. In the textual description of this invention, unless otherwise stated, "a plurality of" means two or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0176] In the textual description of this invention, it is understood that, unless explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0177] In the claims, description, and accompanying drawings of this invention, the terms "one embodiment," "some embodiments," "specific embodiment," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the invention. In the claims, description, and accompanying drawings of this invention, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0178] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for constructing a thermal error model, characterized in that, include: The operating parameters of the spindle system in a CNC machine tool when it is idling at different speeds are obtained. The operating parameters include the temperature field data and thermal deformation data of the spindle system. A sample set is constructed based on the temperature field data and thermal deformation data of the spindle system. Based on the whale optimization algorithm, the temperature rise data of the spindle system is used as input and the thermal deformation data of the spindle system is used as output to adjust the target BP neural network to obtain the first model; The first model is trained using sample data from the sample set to obtain a thermal error model; The temperature rise data is determined based on the temperature field data; The whale-based optimization algorithm, using the temperature rise data of the spindle system as input and the thermal deformation data of the spindle system as output, adjusts the target BP neural network to obtain the first model, specifically including: Obtain input layer nodes and output layer nodes. The input layer nodes are used to input the temperature rise data of the spindle system, and the output layer nodes are used to output the thermal deformation data of the spindle system. Obtain the target BP neural network, which is the BP neural network with the best hidden layer nodes; The parameters of the whale optimization algorithm are initialized using Cubic chaotic mapping, and the parameters of the whale optimization algorithm include the initial population size and the maximum number of iterations. In each iteration of the whale optimization algorithm, different positions are selected based on the first coefficient to determine the equation, thereby determining the position of the individual whale in the next iteration of the whale optimization algorithm. The first coefficient is the coefficient that controls the swimming range of the whale in the whale optimization algorithm. When the number of iterations of the whale optimization algorithm reaches the maximum number of iterations, the optimal weights and the optimal thresholds are obtained. The optimal weights and the optimal thresholds are assigned to the target BP neural network to obtain the first model.

2. The method for constructing a thermal error model according to claim 1, characterized in that, The sample set includes a training dataset and a test dataset. The construction of the sample set based on the temperature field data and thermal deformation data of the spindle system specifically includes: The temperature field data and thermal deformation data of the spindle system are preprocessed to obtain the first dataset. The training dataset and the test dataset are obtained by randomly selecting sample data from the first dataset. The training dataset is used to train the first model, and the test dataset is used to test the trained first model.

3. The method for constructing the thermal error model according to claim 2, characterized in that, The preprocessing of the temperature field data and thermal deformation data of the spindle system to obtain the first dataset specifically includes: The temperature field data and thermal deformation data of the spindle system are aligned along the time axis to obtain the first aligned data information. The first data information is divided into equal parts using the same time interval to obtain the first dataset; Each sample data in the first dataset includes the temperature field data and the thermal deformation data within the time interval.

4. The method for constructing a thermal error model according to claim 2, characterized in that, The spindle system includes a front bearing flange sleeve, a front end cover, a first front bearing chamber, a second front bearing chamber, a first front bearing outer ring cover, a second front bearing outer ring cover, a spindle box, and a motor. The temperature field data of the spindle system includes: temperature data of the front bearing flange sleeve, temperature data of the front end cover, temperature data of the first front bearing chamber, temperature data of the second front bearing chamber, temperature data of the first front bearing outer ring cover, temperature data of the second front bearing outer ring cover, temperature data of the spindle box, and temperature data of the motor. The thermal deformation data of the spindle system includes: thermal deformation value of the spindle in the Z-axis direction.

5. The method for constructing a thermal error model according to claim 4, characterized in that, The temperature rise data includes: the temperature data of the front bearing flange sleeve, the temperature data of the motor, the temperature data of the second front bearing outer ring cover, and the temperature data of the spindle box.

6. The method for constructing a thermal error model according to claim 1, characterized in that, In each iteration of the whale optimization algorithm, different positions are selected based on the first coefficient to determine the equation, thereby determining the position of the individual whale in the next iteration of the whale optimization algorithm. Specifically, this includes: If the first coefficient is less than 1, the equation is determined by selecting the first position and the equation is determined by selecting the second position. If the first coefficient is greater than or equal to 1, the third position is selected to determine the equation; The equation for determining the first position is: The equation for determining the second position is: The equation for determining the third position is: in, t This represents the current iteration number. X ( t+1 () represents the position vector for the next iteration after the current iteration. w It is inertial weight. A It is a coefficient vector, where D represents the distance between the whale and its prey. X b ( t ) is a position vector for the current iteration number. D ' represents the distance between the current searched individual and the current optimal solution, and b is a constant defining the spiral movement shape. l Let represent the random variable defining the distance of the whale from the optimal position. D rand The distance between a randomly selected individual whale and its prey. X rand (t) represents the position vector of a randomly selected whale individual in the current group at the current iteration number.

7. The method for constructing a thermal error model according to claim 6, characterized in that, The inertia weight is calculated based on the following formula: in, w b , w s These represent the initial maximum inertia weight and the initial minimum inertia weight, respectively. T max The maximum number of iterations, t This represents the current iteration number. f This represents the current fitness value of the individual whale. f avg This represents the average fitness value of the current whale population.

8. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the method for constructing a thermal error model as claimed in any one of claims 1 to 6.

9. A computer device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, they implement the steps of the method for constructing a thermal error model as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Thermal error prediction method of numerical control machine tool based on wrapping principle

    CN110161968A