Thermal memory enhanced neural network numerical control machine tool thermal error prediction method and system
By combining thermal memory-enhanced neural networks and two-layer GRU networks, the problems of insufficient generalization ability and high maintenance cost of thermal error prediction models in existing technologies are solved, and high-precision, real-time compensation and stable prediction of machine tool thermal errors are achieved.
Patent Information
- Application Number
- CN202511872972.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-03-20
AI Technical Summary
Existing thermal error prediction and compensation technologies cannot adapt to changes in cutting conditions and cooling conditions after the model is solidified. They have poor generalization ability and are difficult to continuously memorize complex error patterns, resulting in large compensation residuals and high maintenance costs.
By employing a hot memory augmented neural network, a high-precision hot error prediction model is constructed through a hot memory library with diverse control, time decay, and adaptive forgetting mechanisms, combined with a two-layer GRU neural network and a high-error sample weighted replay strategy, enabling continuous learning and real-time compensation of complex error patterns.
It significantly improves the accuracy and robustness of thermal error prediction, reduces compensation residuals, and lowers maintenance costs, making it suitable for high-precision machining scenarios on machine tools.
Smart Images

Figure CN121704338A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent manufacturing and machine tool thermal error compensation technology, specifically to a thermal memory enhanced neural network CNC machine tool thermal error prediction method and system. Background Technology
[0002] In the field of high-precision machining, thermal error is one of the key factors affecting machining accuracy. Existing thermal error prediction and compensation technologies are mainly divided into two categories, but both have obvious shortcomings: One type is the offline calibration method, which involves placing temperature sensors on key parts of the machine tool, measuring thermal deformation under fixed operating conditions, and establishing a linear or quasi-linear "temperature-error" mapping model. This method has three major limitations: once the model is solidified, it cannot adapt to changes in cutting conditions, cooling conditions, and machine tool aging, resulting in poor generalization ability; the calibration cycle is long, and it is sensitive to production line downtime, affecting production efficiency; the linear assumption is difficult to describe multi-heat source coupling, non-uniform temperature rise, and asymmetric structural deformation, resulting in large compensation residuals.
[0003] Another type is data-driven prediction compensation methods, which use recurrent networks such as LSTM and GRU to learn temporal mapping relationships. However, there are still insurmountable pain points: high-error samples are "forgotten as soon as they are passed," and the network cannot continuously remember complex error patterns after training, and the same anomalies recur repeatedly; the data collected continuously in the workshop are highly correlated, and simple random sampling leads to memory redundancy, and the input distribution drifts with the season and batch, resulting in a monotonous decline in model performance; there is a lack of a controllable forgetting mechanism, which cannot target the reduction of the influence of old data, requiring full retraining, resulting in high maintenance costs; hot error peaks mostly occur in transient operating conditions, negative samples are scarce, the network generalization error is large, and simple replication and amplification can easily introduce spurious correlations.
[0004] To address the aforementioned technical deficiencies, this invention proposes a prediction method and system that integrates a thermal memory enhancement mechanism with an optimized neural network structure, achieving high-precision and robust continuous operation throughout the entire lifecycle. Summary of the Invention
[0005] The purpose of this invention is to provide a thermal memory-enhanced neural network method and system for predicting thermal errors in CNC machine tools, in order to solve the long-term online accuracy drift problem caused by existing thermal error prediction models mentioned in the background art, such as "forgetting" high-error samples after they are passed, accumulation of memory redundancy, and inability to selectively eliminate old knowledge. This enables the CNC machine tool thermal error compensation system to operate with high precision and high robustness throughout its entire life cycle.
[0006] In a first aspect, the present invention provides a method and system for predicting thermal errors in CNC machine tools using thermal memory enhanced neural networks, wherein the thermal error prediction method includes the following steps: S1: Use multi-point temperature sensors to collect temperature difference sensitive point data under different working conditions of the machine tool (such as different loads, speeds and ambient temperatures), and synchronously record the corresponding thermal error data through precision measuring instruments to ensure the timeliness and representativeness of the data. Data collection should cover typical working scenarios of the machine tool to improve the generalization ability of the model. Collect temperature difference sensitive point data and corresponding thermal error data of the machine tool under different working conditions to build training set and test set. S2: Standardize the data in S1 and reconstruct the input features into a temporal tensor form; S3: Construct a Thermal MemoryBank, which includes: a diversity control mechanism based on vector similarity, a memory weight calculation mechanism based on time decay and sample strength, and a forgetting mechanism based on an adaptive threshold. In the Thermal MemoryBank, the diversity control mechanism ensures that samples written to the memory bank have high information entropy through vector similarity calculation. The time decay mechanism dynamically adjusts the memory weights in conjunction with sample strength, and the adaptive forgetting threshold intelligently cleans up low-value memories according to training progress, maintaining the real-time performance and effectiveness of the memory bank. S4: Construct a two-layer GRU neural network model, which includes batch normalization layers, dropout layers, and residual connection structures. Each layer adds batch normalization and dropout layers to reduce overfitting and improve the model's generalization ability. The residual connection structure allows deeper networks to better retain low-level feature information and alleviate the gradient vanishing problem. The network design fully considers the nonlinear characteristics and complex mapping relationships of time-series data. S5: During training, the feature vectors and labels of high-error samples are periodically written into the memory bank through the memory bank callback mechanism. In subsequent training, weighted sample replay is performed based on the memory bank. By periodically sampling and evaluating the prediction error, the feature vectors and labels of high-error samples are written into the memory bank. The weighted sample replay strategy based on the memory bank enables the model to focus on learning samples that are difficult to predict and gradually improve its ability to learn complex hot error patterns. S6: Use the trained model to predict the thermal error of the machine tool in real time and output the compensation value.
[0007] In this embodiment, step S2 involves standardizing the collected raw data, including removing outliers, normalizing, and centering. Using a GRU neural network as a reference, one-dimensional or two-dimensional input features are reconstructed into a three-dimensional temporal tensor to meet the input requirements of the GRU network. During the preprocessing, the statistical characteristics of the data, such as the mean and variance, need to be retained for subsequent inverse transformation and error restoration.
[0008] In this embodiment, the vector similarity threshold in S3 is set to 0.7-0.9, and the error percentile coefficient is taken as the top 10%-30% quantile of the sample in the error distribution; Diversity control mechanism: Based on vector similarity threshold, redundant samples are prevented from being written, ensuring the diversity of samples in the memory bank; Based on time decay and sample strength weighting: The memory weight is dynamically calculated by combining the sample "age" and error percentile to achieve priority retention of "high error, low decay" samples; The adaptive threshold forgetting mechanism automatically adjusts the cleanup threshold during the training phase, taking into account both the needs of early exploration and later convergence.
[0009] In this embodiment, the number of neurons in the two-layer GRU neural network in S4 is 64-256, and the Dropout probability is set to 0.1-0.3. Optimization of the two-layer GRU network structure: Cascaded dual-layer GRUs enhance long-term time series modeling capabilities; Interlayer insertion batch normalization + Dropout suppresses overfitting; Residual connections alleviate gradient vanishing, accelerate convergence, and improve prediction stability.
[0010] In this embodiment, the criteria for determining high-error samples in S5 are that the prediction error is within the top 15%-25% of the current batch and the memory bank sample playback ratio is 20%-40%. High-error sample sampling and playback strategy: During training, a callback mechanism is used to periodically extract features and labels of high-error samples and write them into the memory. Subsequent batches are retrained using a weighted replay method to continuously enhance the model's sensitivity to key error patterns.
[0011] In this embodiment, step S6 specifically involves: using the trained model to predict the thermal error of the machine tool under real-time operating conditions; the prediction result is directly input into the compensation module of the machine tool control system; and by actively adjusting the machine tool's geometric parameters or operating parameters, real-time suppression and compensation of the thermal error are achieved.
[0012] Secondly, the present invention provides a thermal error prediction system for CNC machine tools using a thermal memory enhanced neural network, the thermal error prediction system comprising the following modules: The data acquisition module is used to acquire data on temperature difference sensitive points and thermal error data of the machine tool; The data preprocessing module is used to standardize and reconstruct the data in a time series. It develops a dedicated data preprocessing algorithm library to achieve data cleaning, standardization and time series reconstruction. The module should support compatibility and adaptive processing of multiple data sources and provide a visual preprocessing quality assessment tool. The hot memory module is used to store and manage high-error samples, and features diversity control, time decay, and adaptive forgetting functions. The GRU prediction model module is used for thermal error prediction based on time-series input and memory replay mechanism. It provides a flexible model building interface, supports dynamic configuration of network layer number, number of neurons and regularization parameters, integrates memory replay mechanism to realize priority learning of high-value samples, and the module should also support incremental learning of the model and rapid on-site deployment and online updates. At the same time, the interfaces of each module are standardized and can be directly embedded into the existing CNC system without modifying the machine tool hardware. The model training and update module is used to dynamically update the memory and model parameters during training. The output module is used to output thermal error prediction results for machine tool compensation control. It provides multiple output interfaces for thermal error prediction results, such as numerical values, confidence intervals, and visualization reports. It is seamlessly integrated with the compensation module of the machine tool control system and supports real-time, closed-loop thermal error compensation control.
[0013] In this embodiment, the data acquisition module is equipped with a high-precision temperature sensor array with a temperature sensor sampling frequency of ≥5Hz and a thermal error measurement device accuracy of ≤0.1μm, covering key machine tool components such as the spindle, guide rail, and machine tool frame. The sensors should have high sampling rate and low noise characteristics to ensure the capture of minute temperature changes. The data acquisition system should also include a synchronous displacement measurement device.
[0014] In this embodiment, the hot memory module implements an efficient storage mechanism based on memory and index, supports fast similarity retrieval and dynamic updates, and the diversity control algorithm is based on vector space clustering and entropy calculation to ensure the richness of information in the memory. Time decay and adaptive forgetting strategies are implemented through configurable parameters.
[0015] In this embodiment, the model training and update module is designed with an end-to-end model training process, including data loading, model initialization, training process monitoring and model saving, to achieve adaptive learning rate scheduling and early stopping mechanism to prevent overfitting, and to provide model performance evaluation and interpretability analysis tools. The early stopping trigger condition is that the validation set error does not decrease for 5 consecutive batches.
[0016] Compared with the prior art, the beneficial effects of the present invention are: This thermal memory-enhanced neural network method and system for predicting thermal errors in CNC machine tools collects temperature difference sensitive point data and thermal error data under multiple working conditions of the machine tool. After preprocessing, it constructs a thermal memory library with diverse control, time decay, and adaptive forgetting mechanisms. Combined with a two-layer GRU neural network and a high-error sample weighted replay strategy, it achieves high-precision prediction and real-time compensation of thermal errors. The system consists of six modules: data acquisition, preprocessing, thermal memory library, GRU prediction model, training and updating, and output. It supports online incremental learning and rapid deployment, effectively solving the problems of existing models "forgetting" high-error samples, memory redundancy, and accuracy drift. It significantly improves prediction accuracy, robustness, and long-term operational stability, and is suitable for high-precision machining scenarios of machine tools.
[0017] 1. Furthermore, this solution utilizes a "dedicated storage of high-error samples + weighted replay" mechanism in the hot memory library to retain the feature vectors and labels of samples with errors in the top 15%-25% for a long period. These samples are assigned high weights based on their error percentiles and given priority in loss calculations during subsequent training batches, forcing the model to continuously learn complex error patterns. The dual-layer GRU network enhances long-term temporal modeling capabilities through a cascaded structure. The first layer captures short-term fluctuations in temperature data, while the second layer mines long-term cumulative thermal deformation patterns. Combined with batch normalization to eliminate inter-layer data distribution shifts and Dropout to suppress overfitting, the model's adaptability to complex scenarios such as multi-heat source coupling (simultaneous heating of the spindle, guide rail, and motor) and non-uniform temperature rise (temperature difference of more than 5℃ between the two sides of the machine bed) is significantly improved. Combined with the temporal modeling capabilities of the dual-layer GRU network, it effectively captures the dynamic evolution of machine tool thermal errors, solving the problems of "forgetting" high-error samples and large generalization errors, and significantly reducing compensation residuals.
[0018] 2. Furthermore, through time decay and adaptive forgetting mechanisms, a dynamic balance is achieved between "retention of old knowledge" and "learning of new knowledge": For outdated samples stored for more than 30 days, the weight is reduced by a decay coefficient of 0.01 / day to avoid them interfering with the modeling of current working conditions; at the same time, the adaptive forgetting threshold is intelligently adjusted with the training phase. In the early stage of training, the threshold is set to 0.3 to retain more exploratory samples to cover diverse working conditions; in the later stage of training, the threshold is reduced to 0.1 to clean up low-value samples with weights below the threshold (such as steady-state temperature data with high repetition), ensuring that the memory bank capacity is stable at 5000-8000 sets of effective samples. This allows the system to cope with distribution drift without full retraining, so that the time decay and adaptive forgetting mechanisms avoid memory redundancy and interference from outdated data, achieving stable accuracy throughout the entire life cycle and reducing maintenance costs.
[0019] 3. Furthermore, residual connections are introduced between the two-layer GRUs. The output of the first layer is directly superimposed on the input of the second layer through a shortcut path, enabling gradient propagation across layers. This increases the gradient magnitude by 1-2 orders of magnitude and improves the model convergence speed by 30%-50% compared to structures without residual connections. Simultaneously, the system adopts a modular decoupled design. The data acquisition module supports compatibility with different brands of sensors, and the data preprocessing module allows adjustment of the normalization method and time window size via configuration files. The GRU prediction model module supports dynamic configuration of the number of neurons (64-256) and Dropout probability (0.1-0.3), adapting to different types of equipment such as vertical machining centers, horizontal lathes, and five-axis CNC machine tools without modifying the core code. This combination of batch normalization, Dropout, and residual connections accelerates model convergence and suppresses overfitting. The modular architecture supports online incremental learning and rapid on-site deployment, adapting to different types of machine tools and processing scenarios.
[0020] 4. Furthermore, pure software algorithm optimization requires no additional modification to machine tool hardware and is compatible with existing CNC systems; it is reusable and highly adaptable, reducing scrap rate and energy consumption caused by thermal errors, and improving processing quality and production efficiency. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the thermal memory enhanced neural network CNC machine tool thermal error prediction method of the present invention; Figure 2 This is a schematic diagram illustrating the data standardization process of the present invention; Figure 3 This is a schematic diagram illustrating the construction of the hot memory library for this invention; Figure 4 This is a schematic diagram of the two-layer GRU neural network model of the present invention; Figure 5 This is a schematic diagram of high-error sample sampling and playback in this invention; Figure 6 This is a schematic diagram of the thermal memory enhanced neural network CNC machine tool thermal error prediction system of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] This application provides a thermal memory-enhanced neural network method for predicting thermal errors in CNC machine tools. The core of this method involves collecting temperature difference sensitive point data and corresponding thermal error data of the machine tool under different operating conditions, constructing training and testing sets, standardizing the S1 data, reconstructing the input features into a time-series tensor, and constructing a thermal memory bank. This memory bank includes: a diversity control mechanism based on vector similarity, a memory weight calculation mechanism based on time decay and sample strength, and a forgetting mechanism based on adaptive thresholds. A two-layer GRU neural network model is constructed, including a batch normalization layer and a Dropo layer. The ut layer and residual connection structure, during training, periodically write the feature vectors and labels of high-error samples into the memory bank through a memory bank callback mechanism. In subsequent training, weighted sample replay is performed based on the memory bank. The trained model is used to predict machine tool thermal errors in real time and output compensation values. By constructing a thermal memory bank with time decay and diversity control, the learning of high-error samples is continuously strengthened. Combined with a two-layer GRU, batch normalization and residual connection, the dynamic evolution law of machine tool thermal errors is effectively captured, significantly improving prediction accuracy, convergence speed and model robustness, reducing compensation lag, and achieving energy saving and quality stability in high-precision machining scenarios.
[0024] Example 1: To better understand the above technical solution, the following will provide a detailed description of the technical solution in conjunction with the accompanying drawings and specific implementation methods. (Refer to...) Figure 1 As shown in the figure, this is a schematic diagram of the thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network includes the following steps: In step S1, temperature difference sensitive point data and corresponding thermal error data of the machine tool under different operating conditions are collected to construct training set and test set.
[0025] It should be noted that multi-point temperature sensors are used to collect temperature difference sensitive point data under different working conditions of the machine tool (such as different loads, speeds and ambient temperatures), and the corresponding thermal error data is recorded synchronously by precision measuring instruments to ensure the timeliness and representativeness of the data. Data collection should cover typical working scenarios of the machine tool to improve the generalization ability of the model.
[0026] It should be further noted that the selection of temperature-sensitive points directly determines the representativeness of the data and requires precise placement based on the machine tool's structural characteristics and heat conduction patterns: 3-4 temperature sensors should be placed in the spindle system (bearing housing, front / rear end of the spindle box) to capture concentrated heat sources generated by the high-speed rotation of the spindle; 2 sensors should be installed in each of the feed system (X / Y / Z axis guide sliders, ball screw nut seats) to monitor frictional heating of moving parts; 2-3 sensors should be placed in basic components such as the machine tool bed and column to record ambient temperature and structural heat conduction; 1-2 additional sensors should be placed near auxiliary heat sources such as servo motors and cooling system exhaust vents to cover the influence of heat sources in all dimensions. Platinum resistance temperature sensors with an accuracy ≤ ±0.1℃ and a sampling frequency ≥ 10Hz should be selected and connected to the data acquisition module via shielded cables to avoid data distortion caused by electromagnetic interference. During the data acquisition process, tests were conducted under various load conditions (50%, 75%, 100% rated load), spindle speed gradients (1000 rpm, 2500 rpm, 4000 rpm, 6000 rpm), and ambient temperature ranges (15℃, 25℃, 35℃). Data was continuously collected for 1-2 hours under each condition to ensure data coverage of the entire process from startup to steady state to shutdown. This ensured the complete capture of the temperature rise curve from the initial value to the stable value, steady-state fluctuations, and the cooling trend after shutdown. Thermal error data was synchronously acquired using a laser interferometer with an accuracy of ≤0.1μm. The focus was on monitoring the radial runout error of the machine tool spindle end face, the positioning error in the Z-axis feed direction, and the straightness error in the X / Y axis plane. The acquisition frequency was consistent with that of the temperature sensor (10Hz). Timestamp synchronization technology was used to ensure a one-to-one correspondence between the temperature data and the thermal error data, with a timing deviation of ≤10ms. After data collection, the training set and test set are divided in a 7:3 ratio. The training set covers complete time-series data under all operating conditions and is used for model parameter learning and memory construction. The test set selects new combinations of operating conditions that do not overlap with the training set (such as 60% load, 3000 rpm, and 20℃ ambient temperature) to objectively evaluate the model's generalization ability. At the same time, the dataset is checked for completeness, and invalid data segments such as sensor failures (such as constant temperature data) and mechanical anomalies (such as error jumps caused by sudden collisions) are removed. Finally, a structured dataset is formed in which each sample contains "60-second time-series temperature features + corresponding thermal error value", with a total sample size of no less than 50,000 sets, providing sufficient data support for the model to accurately learn the "temperature-error" mapping relationship.
[0027] In step S2, the data from S1 is standardized, and the input features are reconstructed into a temporal tensor form.
[0028] refer to Figure 2As shown in the figure, this is a schematic diagram of data standardization processing. It should be noted that the collected raw data is standardized, including outlier removal, normalization, and centering. Using the GRU neural network as a reference, the one-dimensional or two-dimensional input features are reconstructed into a three-dimensional time series tensor to meet the input requirements of the GRU network. During the preprocessing process, the statistical characteristics of the data, such as the mean and variance, need to be preserved for subsequent inverse transformation and error restoration.
[0029] Further explanation is needed: In the data preprocessing stage, data quality is first ensured through multi-dimensional outlier removal. The 3σ criterion is used to identify extreme outliers in the temperature and thermal error data (such as temperature jumps exceeding 5℃ or thermal error jumps greater than 20μm). This is combined with a sliding window mean filter (window size set to 5) to smooth data fluctuations, while also removing null and duplicate values caused by brief sensor downtime, ensuring the continuity and reliability of the original data. Subsequently, standardization is performed—the temperature data is centered using the Z-Score formula x_norm = (x-μ) / σ, where μ is the mean and σ is the variance, eliminating dimensional differences between different sensors (e.g., spindle temperature range 50-80℃, ambient temperature 15-35℃). The thermal error data is normalized using Min-Max to map to the [0,1] interval. To avoid the interference of large numerical errors on the weights of model training, and to record the mean, variance and other statistical parameters of each feature dimension throughout the process, data support is reserved for the inverse transformation of the prediction results (restoring the true thermal error value) and error calibration. Finally, features are reconstructed according to the input requirements of the GRU network: a sliding window of length 60 (corresponding to 6 seconds of time series data, matched with a 10Hz sampling frequency) is used to reconstruct the one-dimensional temperature time series data (single sensor) or two-dimensional temperature matrix (multiple sensors) into a three-dimensional time series tensor (format: [number of samples, time step, feature dimension]). The feature dimension corresponds to the number of sensors at all temperature difference sensitive points, and the time step is fixed at 60. This ensures that the input data retains the temporal correlation of temperature changes and can be effectively parsed by the GRU network, laying the foundation for the model to explore the evolution law of long-term and short-term thermal errors.
[0030] In step S3, a thermal memory bank is constructed. This memory bank includes: a diversity control mechanism based on vector similarity, a memory weight calculation mechanism based on time decay and sample strength, and a forgetting mechanism based on an adaptive threshold. In the thermal memory bank, the diversity control mechanism ensures that samples written to the memory bank have high information entropy through vector similarity calculation. The time decay mechanism dynamically adjusts memory weights based on sample strength, and the adaptive forgetting threshold intelligently cleans up low-value memories according to training progress, maintaining the real-time performance and effectiveness of the memory bank.
[0031] refer to Figure 3As shown in the figure, this is a schematic diagram of constructing a hot memory library. It should be noted that the vector similarity threshold in S3 is set to 0.7-0.9, and the error percentile coefficient is taken as the top 10%-30% quantile of the sample in the error distribution. Diversity control mechanism: Based on vector similarity threshold, redundant samples are prevented from being written, ensuring the diversity of samples in the memory bank; Based on time decay and sample strength weighting: The memory weight is dynamically calculated by combining the sample "age" and error percentile to achieve priority retention of "high error, low decay" samples; The adaptive threshold forgetting mechanism automatically adjusts the cleanup threshold during the training phase, taking into account both the needs of early exploration and later convergence.
[0032] It should be further explained that the hot memory database is built around the core principles of "accurately storing high-value samples and dynamically optimizing memory resources." Efficient management is achieved through three collaborative mechanisms: The diversity control mechanism uses a cosine similarity algorithm to calculate the similarity of feature vectors between new samples and existing samples in the memory database, setting an adaptive threshold of 0.7-0.9 (0.7 in the early stages of training to retain more samples, adjusted to 0.9 later to filter redundancy). New samples are only allowed to be written when their similarity is below the threshold, avoiding duplicate steady-state samples occupying storage resources and ensuring that the information entropy of the samples in the memory database remains high. The time decay and sample strength weighting mechanism dynamically calculates weights using the formula "Memory Weight = (1 - Decay Coefficient × Sample Storage Days) × Error Percentile Coefficient," where the decay coefficient is fixed at 0.01 (i.e., the sample weight decays by 1% per day), and the error percentile coefficient is calculated based on... The quantile values of the samples in the error distribution (the coefficients for the first 10%-30% quantiles are 1.0-0.6) enable a differentiated retention strategy that allows for slower weight decay of high-error samples (top 10% of the error) and faster weight reduction of low-error samples. The adaptive forgetting mechanism adjusts the clearing threshold as training progresses—the threshold is set to 0.3 in the first 30% of the training stage to retain more exploratory samples to cover complex conditions; the threshold is lowered to 0.2 in the middle 40% of the stage to gradually select core samples; and the threshold is stabilized at 0.1 in the last 30% of the stage to periodically clear low-value samples with weights below the threshold (such as old and small steady-state samples), so that the memory bank capacity is always controlled within the range of 5000-8000 effective samples. This ensures continuous memory of high-error samples while avoiding storage redundancy that could affect training efficiency, thus maintaining the real-time performance and effectiveness of the memory bank.
[0033] In step S4, a two-layer GRU neural network model is constructed. This model includes batch normalization layers, Dropout layers, and residual connection structures. Batch normalization and Dropout layers are added to each layer to reduce overfitting and improve the model's generalization ability. The residual connection structure allows the deep network to better retain low-level feature information and alleviate the gradient vanishing problem. The network design fully considers the nonlinear characteristics and complex mapping relationships of time-series data.
[0034] refer to Figure 4 As shown in the figure, this is a schematic diagram of a two-layer GRU neural network model. It should be noted that the number of neurons in the two-layer GRU neural network in S4 is 64-256, and the Dropout probability is set to 0.1-0.3. Optimization of the two-layer GRU network structure: Cascaded dual-layer GRUs enhance long-term time series modeling capabilities; Interlayer insertion batch normalization + Dropout suppresses overfitting; Residual connections alleviate gradient vanishing, accelerate convergence, and improve prediction stability.
[0035] It should be further explained that the two-layer GRU neural network model aims to "enhance the ability to model time series, suppress overfitting, and accelerate convergence" as its core optimization goals. It adopts an adjustable neuron configuration of 64-256 neurons (the first layer is set with 128-256 neurons, focusing on capturing short-term fluctuations and local features of temperature time series data; the second layer is set with 64-128 neurons, focusing on mining the cumulative laws of long-range thermal deformation and complex mapping relationships). Through a cascaded structure, it achieves deep extraction of full-dimensional features of "short-term temperature change - long-term error evolution". Each GRU layer is followed by a batch normalization layer and a dropout layer. The batch normalization layer standardizes the input data (mean is 0, variance is 1) to eliminate the model training instability caused by the data distribution offset between layers. The dropout layer is set to 0.1-0. The probability of randomly deactivating some neurons is 3 (0.2-0.3 in the early stage of training to enhance generalization ability, and 0.1-0.2 in the later stage to ensure model fitting accuracy), which effectively avoids over-reliance on redundant features. At the same time, the model introduces a cross-layer residual connection structure, which directly superimposes the output of the first layer GRU to the output of the second layer GRU, so that the gradient can be directly transmitted through the shortcut path during backpropagation, which greatly alleviates the gradient vanishing problem in deep network training (gradient magnitude is increased by 1-2 orders of magnitude), accelerates the model convergence speed (shortening the training cycle by 30%-50% compared with the structure without residuals), and can better retain the temperature feature information of the bottom layer, improve the stability and accuracy of thermal error prediction in complex scenarios such as multi-heat source coupling and non-uniform temperature rise, and fully adapt to the nonlinear characteristics of time series data.
[0036] In step S5, during the training process, the feature vectors and labels of high-error samples are periodically written into the memory bank through the memory bank callback mechanism. In subsequent training, weighted sample replay is performed based on the memory bank. By periodically sampling and evaluating the prediction error, the feature vectors and labels of high-error samples are written into the memory bank. The weighted sample replay strategy based on the memory bank enables the model to focus on learning samples that are difficult to predict, and gradually improve its ability to learn complex hot error patterns.
[0037] refer to Figure 5 As shown in the figure, this is a schematic diagram of high error sample sampling and playback. It should be noted that the criteria for judging high error samples in S5 is that the prediction error is in the top 15%-25% of the current batch, and the memory bank sample playback ratio is 20%-40%. High-error sample sampling and playback strategy: During training, a callback mechanism is used to periodically extract features and labels of high-error samples and write them into the memory. Subsequent batches are retrained using a weighted replay method to continuously enhance the model's sensitivity to key error patterns.
[0038] It should be further explained that the memory callback and weighted replay strategy revolves around "accurately capturing high-error patterns and continuously strengthening model learning": During training, after every 5 batches, the prediction errors of all samples in the current batch are sorted, and samples with errors in the top 15%-25% are identified as high-error samples (e.g., in a batch of 1000 samples, the top 200 samples with the largest errors are selected). Simultaneously, their three-dimensional temporal feature vectors and corresponding hot error labels are extracted, and after verification by a diversity control mechanism (to avoid exceeding the similarity limit with existing samples in the memory), they are written into the hot memory. In subsequent training batches, samples are drawn from the memory at a replay ratio of 20%-40% (e.g., 80 new samples per batch). The system uses 0 sets of samples, paired with 200-320 sets of samples replayed from the memory bank. Loss weights are assigned based on the sample memory weights (calculated from time decay and error percentile coefficients). High-weight samples (such as samples in the top 10% of errors and stored for ≤7 days) have a 2-3 times higher weight in the loss function calculation, forcing the model to focus on learning complex thermal error patterns that are difficult to predict, such as blade switching transients and multi-heat source coupling. At the same time, the replay process uses a combination of random sampling and weighted sampling, which ensures repeated learning of core high-error samples while avoiding model bias caused by overtraining of a single type of sample. This allows the model to gradually improve its ability to identify and fit complex error patterns through continuous iteration, further reducing prediction bias.
[0039] In step S6, the trained model is used to predict the machine tool thermal error in real time and output the compensation value.
[0040] It should be noted that the specific operation of S6 is as follows: the trained model is used to predict the thermal error of the machine tool under real-time working conditions. The prediction result will be directly input into the compensation module of the machine tool control system. By actively adjusting the geometric parameters or working parameters of the machine tool, the thermal error can be suppressed and compensated in real time.
[0041] It should be further explained that after the trained model is deployed, it maintains synchronous communication with the machine tool control system through a real-time data interface. First, it receives the standardized real-time temperature time-series tensor output by the data preprocessing module (dynamically generated according to the sliding window rules set by S2, ensuring the input format is consistent with the training phase). The model outputs the predicted thermal error value at an inference speed of ≤100ms / inference. Simultaneously, it performs an inverse transformation using the statistical parameters (mean, variance) retained by S2, restoring the normalized prediction result to the true thermal error value (unit: μm), along with a prediction confidence interval (e.g., error fluctuation ±0.5μm at 95% confidence level), providing a reliable reference for compensation decisions. The prediction results are transmitted via Eth... The erCAT industrial bus transmits data in real time to the compensation module of the machine tool control system. The system adaptively adjusts the compensation strategy according to the type of error: for spindle radial runout error, it compensates for geometric deviation by correcting the servo motor rotation parameters; for X / Y / Z axis positioning error, it dynamically adjusts the feed axis motion coordinate offset; for straightness error, it optimizes the guide rail lubrication frequency and cooling system flow rate, realizing closed-loop control of "prediction-compensation-feedback". The entire process has a response delay of ≤200ms, and can track changes in machine tool operating conditions in real time (such as sudden load changes and spindle speed adjustments), continuously outputting accurate compensation values, and stabilizing thermal errors within 3μm, significantly improving the dimensional consistency and surface quality of precision-machined parts.
[0042] This invention provides a thermal memory enhanced neural network CNC machine tool thermal error prediction system. Its core is to build a fast and complete system by combining a data acquisition module, a data preprocessing module, a thermal memory library module, a GRU prediction model module, a model training and update module, and an output module with the above-mentioned thermal memory enhanced neural network CNC machine tool thermal error prediction method. The system is easy to operate.
[0043] Example 2: To better understand the above technical solution, the following will provide a detailed description of the technical solution in conjunction with the accompanying drawings and specific implementation methods. (Refer to...) Figure 6 As shown in the figure, this is a schematic diagram of a thermal memory-enhanced neural network CNC machine tool thermal error prediction system. The thermal memory-enhanced neural network CNC machine tool thermal error prediction system includes the following modules: In the data acquisition module, the data acquisition module is used to acquire data on temperature difference sensitive points and thermal error data of the machine tool.
[0044] It should be noted that the data acquisition module is equipped with a high-precision temperature sensor array with a temperature sensor sampling frequency of ≥5Hz and a thermal error measurement accuracy of ≤0.1μm, covering key components of the machine tool such as the spindle, guide rail, and machine tool frame. The sensors should have high sampling rate and low noise characteristics to ensure the capture of minute temperature changes. The data acquisition system should also include a synchronous displacement measurement device.
[0045] It should be further noted that the data acquisition module is designed with "high precision, high synchronization, and full coverage" as its core principles. It is equipped with a sensor array consisting of 10-15 high-precision platinum resistance temperature sensors. The sensors have a temperature measurement accuracy of ≤±0.1℃, a sampling frequency of ≥5Hz, and a noise voltage of ≤1μV. They are magnetically mounted on key machine tool components—the front and rear spindle bearing seats, the lead screw nut seat, the X / Y / Z axis guide slides, the bed frame, and the servo motor housing—comprehensively covering core heat source areas such as spindle rotation heat generation, frictional heat generation from moving parts, and environmental conduction heat, ensuring accurate capture of minute temperature changes (such as temperature fluctuations at the 0.2℃ level). Simultaneously, it integrates… The laser interferometer serves as a synchronous displacement measurement device, with a measurement accuracy of ≤0.1μm and a sampling frequency consistent with the temperature sensor (≥5Hz). It achieves millisecond-level alignment of temperature data and thermal error data (time deviation ≤10ms) through GPS timestamp synchronization technology, avoiding prediction deviations caused by data asynchrony. The module is also equipped with an electromagnetic interference-resistant industrial-grade data acquisition card, supporting both RS485 and EtherCAT communication protocols. It can be directly connected to existing CNC systems (such as FANUC and Siemens series) and transmit raw data to the preprocessing module in real time, providing high-quality and highly reliable data source support for subsequent model training and online prediction.
[0046] The data preprocessing module is used to standardize and reconstruct the data in a time series. A dedicated data preprocessing algorithm library is developed to realize data cleaning, standardization and time series reconstruction. The module should support compatibility and adaptive processing of multiple data sources and provide a visual preprocessing quality assessment tool.
[0047] It should be noted that the data preprocessing module is built on a modular algorithm architecture with a dedicated preprocessing algorithm library. Its core functions cover multi-dimensional data cleaning, standardization, and time-series reconstruction. The data cleaning stage integrates the 3σ criterion, sliding window mean filtering, and intelligent null value filling algorithms. It can automatically identify and remove extreme outliers caused by sensor malfunctions and electromagnetic interference (such as temperature jumps ≥5℃, thermal error jumps ≥20μm), duplicate values, and null values, while preserving the original time-series characteristics of the data. The standardization stage supports multiple algorithm configurations such as Z-Score centering and Min-Max normalization. It can adaptively select the processing method according to the data type (temperature, thermal error), eliminating the influence of dimensional differences and numerical ranges. Furthermore, it records the mean, variance, and other statistical parameters of each feature dimension throughout the process, providing data for subsequent inverse transformation. Provides data support; in the time series reconstruction stage, according to the model input requirements, a configurable sliding window (window size adjustable from 30-120 seconds) is used to convert one-dimensional or two-dimensional raw data into three-dimensional time series tensors, ensuring the integrity of data time series correlation; the module is compatible with different types of sensor data such as thermocouples and platinum resistance thermometers, as well as multiple data formats such as CSV and JSON, and supports seamless integration with mainstream CNC systems (FANUC, Siemens) and data acquisition cards. At the same time, it has a built-in visualization quality assessment tool, which displays the fluctuation trend before and after data cleaning, the standardized data distribution histogram, and the time series tensor reconstruction effect in real time through line graphs, intuitively presenting key indicators such as data integrity (≥99.5%) and outlier removal rate (≤5%), making it convenient for users to quickly verify the preprocessing quality and ensure the reliability of the data input to the model.
[0048] The hot memory module is used to store and manage high-error samples, and features diversity control, time decay, and adaptive forgetting capabilities.
[0049] It should be noted that the hot memory module implements an efficient storage mechanism based on memory and indexes, supports fast similarity retrieval and dynamic updates, and the diversity control algorithm is based on vector space clustering and entropy calculation to ensure the richness of information in the memory. Time decay and adaptive forgetting strategies are implemented through configurable parameters.
[0050] It should be further explained that the hot memory module adopts a two-layer high-efficiency storage architecture of "memory + index". The memory layer is used to cache recently accessed high-error samples (the capacity can be configured to 5000-8000 groups), ensuring millisecond-level retrieval response speed. The index layer builds an inverted index based on feature vector hash values, supporting fast similarity retrieval (retrieval time ≤10ms / time), realizing real-time comparison between new samples and samples in the library. The module's built-in diversity control algorithm integrates vector space K-means clustering and information entropy calculation - first, the sample feature vectors are clustered into several categories according to error patterns, and then the information entropy value of each category is calculated. When the entropy value of the category to which a new sample belongs is lower than the threshold (adjustable from 0.7 to 0.9), the algorithm will be activated. The system refuses to write to avoid excessive accumulation of samples with a single error pattern, ensuring that the memory bank covers all types of complex error scenarios, such as tool change transients, multiple heat source coupling, and sudden changes in ambient temperature. The time decay and adaptive forgetting strategies can be flexibly adjusted through a visual parameter configuration interface. Core parameters such as the time decay coefficient (0.005-0.01 / day) and the adaptive forgetting threshold (0.3 in the early stage of training and 0.1 in the later stage) can be adjusted as needed. The system dynamically updates the sample memory weights according to preset rules and regularly cleans up low-value samples (such as old steady-state samples) with weights below the threshold. While maintaining the richness of information in the memory bank, it avoids the decrease in training efficiency caused by storage redundancy, and achieves accurate storage and intelligent management of high-error samples.
[0051] The GRU prediction model module is used for thermal error prediction based on time-series input and memory replay mechanism. It provides a flexible model building interface, supports dynamic configuration of network layer number, number of neurons and regularization parameters, integrates memory replay mechanism to realize priority learning of high-value samples, and the module should also support incremental learning of the model and rapid on-site deployment and online updates. At the same time, the interfaces of each module are standardized and can be directly embedded into existing CNC systems without modifying machine tool hardware.
[0052] It should be noted that the GRU prediction model module is designed with "flexible adaptation, efficient learning, and rapid deployment" as its core principles. It provides a visual model building interface and supports dynamic configuration of the number of network layers (adjustable from 2 to 4 layers), the number of neurons per layer (64-256), and regularization parameters (Dropout probability 0.1-0.3, L2 regularization coefficient 0.001-0.01). Users can adjust these parameters as needed based on machine tool type (vertical machining center, five-axis CNC machine tool, etc.) and machining scenario without modifying the underlying code. The module deeply integrates a memory bank playback mechanism, automatically extracting high-value samples (high error, high information entropy samples) at a ratio of 20%-40% during training and mixing them with new samples for training, and allocating loss according to memory weights. The model prioritizes learning complex error patterns to minimize errors. It also supports incremental learning, allowing it to receive new operating data (such as adding high-load machining processes) without downtime, updating only some model parameters (without requiring full retraining). A single incremental training session takes ≤30 minutes, adapting to the dynamic adjustment needs of flexible production lines. The module uses a standardized industrial interface (compatible with EtherCAT and Modbus protocols), allowing direct embedding into mainstream CNC systems such as FANUC and Siemens without modifying machine tool hardware. Deployment only requires interface configuration and parameter calibration, with on-site deployment time ≤2 hours, significantly lowering the barrier to entry. It also supports online model updates and version rollback, ensuring stability and maintainability during operation.
[0053] The model training and update module is used to dynamically update the memory and model parameters during training.
[0054] It should be noted that the model training and update module is designed with an end-to-end model training process, including data loading, model initialization, training process monitoring and model saving. It implements adaptive learning rate scheduling and early stopping mechanism to prevent overfitting, and provides model performance evaluation and interpretability analysis tools. The early stopping trigger condition is that the validation set error does not decrease for 5 consecutive batches.
[0055] It should be further noted that the model training and update module constructs a fully automated end-to-end training system, covering four core stages: data loading (supporting batch import of preprocessed time-series tensor data, compatible with automatic partitioning of training and validation sets), model initialization (automatically configuring the two-layer GRU network structure and weight initialization according to preset parameters), training process monitoring (real-time visualization of training loss, validation loss, and prediction accuracy curves), and model saving (automatically storing optimal performance model parameters and configuration files, supporting version management). The module has a built-in adaptive learning rate scheduling mechanism, using a cosine annealing algorithm to dynamically adjust the learning rate (initial learning rate 0.001, decaying by 10% every 10 batches, down to a minimum of 1e-6), combined with an early stopping mechanism (when the validation set error exceeds 5 consecutive batches...). Training automatically terminates when there is no further decrease in accuracy, effectively avoiding model overfitting and training redundancy. It also provides multi-dimensional performance evaluation tools, quantifying model performance through metrics such as mean absolute error (MAE), root mean square error (RMSE), and prediction accuracy. Combined with interpretability analysis functions (such as heatmaps showing the contribution of each temperature sensor to error prediction), it helps users intuitively understand the model's learning effect and key influencing factors. During training, the module and the thermal memory module work in real-time, dynamically writing high-error samples and updating memory weights according to the rules set in S5. Simultaneously, it iteratively optimizes model parameters through backpropagation, achieving collaborative updates between the memory and the model. Furthermore, it supports parameter fine-tuning in incremental training mode, ensuring the model can quickly adapt to new operating conditions and continuously maintain high-precision prediction capabilities.
[0056] The output module is used to output thermal error prediction results for machine tool compensation control. It provides multiple output interfaces for thermal error prediction results, such as numerical values, confidence intervals, and visualization reports. It is seamlessly integrated with the compensation module of the machine tool control system and supports real-time, closed-loop thermal error compensation control.
[0057] It should be noted that the output module is designed with "high-precision transmission, multi-format presentation, and closed-loop compensation" as its core features. It boasts rich output interfaces and flexible integration capabilities: it can output real-time thermal error prediction values (unit: μm, accuracy ≤0.1μm), 95% confidence intervals (e.g., predicted value ±0.5μm), and trend visualization reports (including real-time error curves, historical error statistics, and operating condition correlation analysis charts). It supports synchronous display via industrial touchscreens and host computer monitoring systems, allowing operators to intuitively grasp error dynamics. The module adopts standardized industrial communication protocols (compatible with EtherCAT, ModbusTCP, and Profinet). It can seamlessly interface with the compensation modules of mainstream CNC systems such as FANUC, Siemens, and Mitsubishi, without the need for additional adapter development, and the data transmission latency is ≤100ms. It also supports real-time closed-loop compensation control, converting the prediction results into compensation commands that the machine tool can recognize. For positioning errors, it outputs coordinate offset values; for geometric errors, it outputs servo parameter correction values; and for thermal deformation accumulation errors, it links the cooling system to adjust commands. Through the closed-loop process of "prediction output - compensation execution - data feedback - model fine-tuning", it continuously corrects the machine tool working parameters, ensuring that thermal errors are always controlled within the preset accuracy range, significantly improving the dimensional stability and production efficiency of precision-machined parts.
[0058] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
[0059] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for predicting thermal errors in CNC machine tools using a thermal memory-enhanced neural network, characterized in that: The thermal error prediction method includes the following steps: S1: Collect temperature difference sensitive point data and corresponding thermal error data of machine tool under different working conditions, and construct training set and test set; S2: Standardize the data in S1 and reconstruct the input features into a temporal tensor form; S3: Construct a thermal memory bank, which includes: a diversity control mechanism based on vector similarity, a memory weight calculation mechanism based on time decay and sample strength, and a forgetting mechanism based on adaptive threshold; S4: Construct a two-layer GRU neural network model, which includes a batch normalization layer, a Dropout layer, and a residual connection structure; S5: During training, the feature vectors and labels of high-error samples are periodically written into the memory bank through the memory bank callback mechanism, and weighted sample replay is performed based on the memory bank in subsequent training. S6: Use the trained model to predict the thermal error of the machine tool in real time and output the compensation value.
2. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network according to claim 1, characterized in that: S2 involves standardizing the collected raw data, including removing outliers, normalizing, and centering. Using the GRU neural network as a reference, one-dimensional or two-dimensional input features are reconstructed into three-dimensional temporal tensors to meet the input requirements of the GRU network. During the preprocessing, the statistical characteristics of the data, such as the mean and variance, need to be retained for subsequent inverse transformation and error restoration.
3. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network according to claim 2, characterized in that: In S3, the vector similarity threshold is set to 0.7-0.9, and the error percentile coefficient is taken as the top 10%-30% percentile of the sample in the error distribution; Diversity control mechanism: Based on vector similarity threshold, redundant samples are prevented from being written, ensuring the diversity of samples in the memory bank; Based on time decay and sample strength weighting: The memory weight is dynamically calculated by combining the sample "age" and error percentile to achieve priority retention of "high error, low decay" samples; The adaptive threshold forgetting mechanism automatically adjusts the cleanup threshold during the training phase, taking into account both the needs of early exploration and later convergence.
4. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network according to claim 3, characterized in that: The number of neurons in the two-layer GRU neural network in S4 is 64-256, and the Dropout probability is set to 0.1-0.
3. Optimization of the two-layer GRU network structure: Cascaded two-layer GRUs enhance long-term time series modeling capabilities; Interlayer insertion batch normalization + Dropout suppresses overfitting; Residual connections alleviate gradient vanishing, accelerate convergence, and improve prediction stability.
5. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network according to claim 4, characterized in that: The criteria for determining high-error samples in S5 are that the prediction error is in the top 15%-25% of the current batch and the memory bank sample playback ratio is 20%-40%. High-error sample sampling and playback strategy: During training, a callback mechanism is used to periodically extract features and labels of high-error samples and write them into the memory. Subsequent batches are retrained using a weighted replay method to continuously enhance the model's sensitivity to key error patterns.
6. The thermal error prediction method for CNC machine tools using a thermal memory-enhanced neural network according to claim 5, characterized in that: The specific operation of S6 is as follows: using the trained model to predict the thermal error of the machine tool under real-time working conditions, the prediction result will be directly input into the compensation module of the machine tool control system, and the real-time suppression and compensation of thermal error will be achieved by actively adjusting the geometric parameters or working parameters of the machine tool.
7. A thermal memory-enhanced neural network CNC machine tool thermal error prediction system, applied to the thermal memory-enhanced neural network CNC machine tool thermal error prediction method described in claims 1-6, characterized in that: The thermal error prediction system includes the following modules: The data acquisition module is used to acquire data on temperature difference sensitive points and thermal error data of the machine tool; The data preprocessing module is used to standardize and reconstruct the time series of data; The hot memory library module is used to store and manage high-error samples, and has the functions of diversity control, time decay and adaptive forgetting. The GRU prediction model module is used for thermal error prediction based on time-series input and memory bank playback mechanism. The model training and update module is used to dynamically update the memory and model parameters during training. The output module is used to output the thermal error prediction results and for machine tool compensation control.
8. The thermal memory enhanced neural network CNC machine tool thermal error prediction system according to claim 7, characterized in that: The data acquisition module is equipped with a high-precision temperature sensor array with a temperature sensor sampling frequency of ≥5Hz and a thermal error measurement accuracy of ≤0.1μm, covering key machine tool components such as the spindle, guide rail, and machine tool frame. The sensors should have high sampling rate and low noise characteristics to ensure the capture of subtle temperature changes. The data acquisition system should also include a synchronous displacement measurement device.
9. The thermal memory enhanced neural network CNC machine tool thermal error prediction system according to claim 8, characterized in that: The hot memory module implements an efficient storage mechanism based on memory and indexes, supports fast similarity retrieval and dynamic updates, and uses a diversity control algorithm based on vector space clustering and entropy calculation to ensure the richness of information in the memory. Time decay and adaptive forgetting strategies are implemented through configurable parameters.
10. A thermal memory-enhanced neural network CNC machine tool thermal error prediction system according to claim 9, characterized in that: The model training and update module is designed with an end-to-end model training process, including data loading, model initialization, training process monitoring and model saving. It implements adaptive learning rate scheduling and early stopping mechanism to prevent overfitting, and provides model performance evaluation and interpretability analysis tools. The early stopping trigger condition is that the validation set error does not decrease for 5 consecutive batches.