Real-time compensation method and system for thermally induced positioning error of full-closed-loop feeding system based on C-A-L-A algorithm

By constructing a thermally induced positioning error model based on the CALA algorithm, and combining convolutional neural networks and long short-term memory networks, the thermal error compensation problem of the fully closed-loop feed system is solved and the machining accuracy of CNC machine tools is improved by acquiring temperature in real time and performing EMZPS compensation.

CN122044085APending Publication Date: 2026-05-15XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XI AN JIAOTONG UNIV
Filing Date
2026-03-17
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

The lack of efficient and accurate thermally induced positioning error model algorithms in fully closed-loop feed systems in CNC machine tools makes it difficult to effectively compensate for thermal errors, thus affecting machining accuracy.

Method used

A thermally induced localization error model is constructed by using a CALA algorithm-based approach, combining a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module. The temperature of the heat source is collected in real time by a temperature sensor, and real-time compensation is performed by offsetting the mechanical coordinate origin using EMZPS.

Benefits of technology

It achieves accurate and efficient compensation for thermally induced positioning errors in the fully closed-loop feed system, improves the machining accuracy of CNC machine tools, and reduces interference and errors in the signal conversion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122044085A_ABST
    Figure CN122044085A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of thermally-induced positioning error compensation, and discloses a C-A-L-A algorithm-based real-time compensation method and system for thermally-induced positioning errors of a full-closed-loop feeding system, and the method comprises the steps: obtaining the real-time temperature of a heat source of the full-closed-loop feeding system; the full-closed-loop feeding system comprises a motor, a front / rear bearing pack, a lead screw nut pair and a guide rail sliding block pair, the real-time temperature is input into a thermally-induced positioning error model to obtain a thermal error, and the thermally-induced positioning error model comprises a convolutional neural network module, a long-short term memory network module and a mixed attention mechanism module; and the thermal error is input into a numerical control system, and the thermal-induced positioning error of the full-closed-loop feeding system is compensated in real time by shifting the mechanical coordinate origin through the EMZPS, so that the influence of the thermal-induced positioning error of the full-closed-loop feeding system on precision machining is inhibited, and the machining precision of a precision machine tool is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of thermally induced positioning error compensation technology, and relates to a method and system for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm. Background Technology

[0002] The positioning accuracy and stability of the linear feed axes of a CNC machine tool determine the machining contour accuracy and dimensional consistency. CNC machine tools employ a fully closed-loop feed system. During long-term operation, the ball screws, servo motors, and other components of this system experience temperature rises due to internal and external heat sources such as friction, iron loss, and copper loss. This leads to thermal deformation of the components, causing deviations between the actual travel distance of the tool post and the worktable and the CNC system's command values, resulting in thermal errors that affect machining accuracy.

[0003] Existing thermal error modeling mainly focuses on machine tool spindles and semi-closed-loop feed axes. Fully closed-loop feed systems lack efficient and accurate thermally induced positioning error model algorithms, making it difficult to effectively compensate for thermal errors in fully closed-loop feed systems and failing to meet the high-precision machining requirements of CNC machine tools. Summary of the Invention

[0004] To address the shortcomings of existing technologies, the present invention aims to provide a method and system for real-time compensation of thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: This invention provides a real-time compensation method for thermally induced positioning error of a fully closed-loop feed system based on the CALA algorithm, comprising the following steps: obtaining the real-time temperature of the heat source of the fully closed-loop feed system; The real-time temperature is input into the thermally induced localization error model to obtain the thermal error. The thermally induced localization error model includes a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module. The thermal error is input to the CNC system, and the thermally induced positioning error of the fully closed-loop feed system is compensated in real time by offsetting the mechanical coordinate origin using EMZPS.

[0006] Furthermore, the fully closed-loop feed system includes: a motor, a front / rear bearing assembly, a lead screw and nut pair, and a guide rail and slider pair; acquiring the real-time temperature of the heat source of the fully closed-loop feed system includes: attaching a temperature sensor to the heat source of the fully closed-loop feed system, converting the analog current signal output by the temperature sensor into a digital signal through a data acquisition card, and transmitting it to the host computer.

[0007] Furthermore, the convolutional neural network module is used to extract spatial features under the coupling effects of heat source, thermal flow structure response, and different spatial error components; the long short-term memory network module is used to extract temporal features of thermal evolution, hysteresis characteristics, and long-term memory; the hybrid attention mechanism module includes spatial attention, temporal attention, and fusion layer attention; the spatial attention is used to enhance the spatial thermal distribution features extracted by the convolutional neural network, the temporal attention is used to enhance the temporal change features of thermal characteristics extracted by the long short-term memory network module, and the fusion layer attention is used to extract the comprehensive thermal characteristic laws.

[0008] Furthermore, the input to the Long Short-Term Memory (LSTM) network module is a vector of independent variables. The output is the hidden state at the current time step. ; The hidden state at the current time step for:

[0009] in, For output gate, For the previous time step ( The cell state at any given moment.

[0010] Furthermore, the output gate for:

[0011] in, For input vectors The weight matrix, Here is the weight matrix of the hidden state. The hidden state at the current time step , For bias terms;

[0012] in, for Cellular state at any given moment For the previous time step ( Cellular state at any given moment For the Gate of Oblivion For input gate, For input vectors The weight matrix, Let the input vector be the input vector at the current time. The hidden state of the previous moment The weight matrix, This is the hidden state from the previous moment. For bias terms;

[0013] in, This is the Sigmoid activation function (used to map the output to between 0 and 1). In the forget gate, the input vector The weight matrix, Let the input vector be the input vector at the current time. Within the Forgotten Gate, the state was hidden in the previous moment. The weight matrix, This is the hidden state from the previous moment. For the bias term of the forget gate;

[0014] in, In the input gate, the input vector The weight matrix, For the input gate, the hidden state in the previous time step. The weight matrix, This is the bias term for the input gate.

[0015] Furthermore, the convolutional neural network module extracts spatial features through convolutional layers and pooling layers; The convolution operation of the convolutional layer is as follows:

[0016] in, For activation function, To experience the wild, For the next level (the first) The feature map of the layer (i.e., the local data input to the current layer). Convolutional kernels are used to extract specific features from the input data. The index (or channel number) of the output feature map for the current layer. This refers to the bias term corresponding to the current convolution operation; The pooling operation of the pooling layer is as follows:

[0017] in, As weight, For downsampling function, For feature maps, This is the bias term for the current pooling operation.

[0018] Furthermore, the hybrid attention mechanism module will input the attention layer's input vector. with weight matrix Multiply to obtain the weighted reconstructed feature vector. .

[0019] Furthermore, the reconstructed feature vector for:

[0020] in, The weight matrix, This is the input vector for the attention layer.

[0021] Furthermore, the weight matrix for:

[0022]

[0023] in, For normalized exponential functions, For the first The similarity value of each feature It is a natural constant. For the first The similarity value of each feature The dimension of the similarity between feature vectors. For activation function, As weight, For the first One input feature vector, This is the bias matrix.

[0024] This invention also provides a real-time compensation system for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, comprising: a temperature acquisition module for acquiring the real-time temperature of the heat source of the fully closed-loop feed system; a thermal error acquisition module for inputting the real-time temperature into a thermally induced positioning error model to acquire thermal errors, wherein the thermally induced positioning error model includes a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module; and a compensation module for inputting the thermal errors into a CNC system and performing real-time compensation for the thermally induced positioning errors of the fully closed-loop feed system by offsetting the origin of the mechanical coordinates using EMZPS.

[0025] Compared with the prior art, the present invention has the following beneficial technical effects: This invention presents a real-time compensation method for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm. The method combines a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module to construct a thermally induced positioning error model. This model can accurately and efficiently extract the complex nonlinear mapping relationship between the heat source temperature and the thermally induced positioning error in the fully closed-loop feed system. Simultaneously, it captures the temporal dependence characteristics of temperature data, improving the accuracy and real-time performance of thermal error prediction. The acquired thermal error is input into the CNC system, and the machine tool external zero offset (EMZPS) mechanism is used to correct the origin of the machine coordinates in real time. This suppresses the impact of thermally induced positioning errors in the fully closed-loop feed system on precision machining, thereby improving the machining accuracy of precision machine tools.

[0026] By directly attaching the temperature sensor to the heat source location of the fully closed-loop feed system, the real temperature signal of the heat source can be collected in real time and accurately. Then, the analog current signal output by the temperature sensor is efficiently converted into a digital signal by the data acquisition card and transmitted to the host computer, which improves the accuracy of temperature data acquisition and transmission stability, and reduces interference and errors in the signal conversion process. Attached Figure Description

[0027] Figure 1 This is a flowchart of a real-time compensation method for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, according to the present invention. Figure 2 This is a structural diagram of the multi-loop real-time temperature acquisition system in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the principle of EMZPS compensation for thermally induced positioning errors in an embodiment of the present invention. Figure 4 This is a signal interface diagram of the FANUC CNC in an embodiment of the present invention; Figure 5 This is a flowchart illustrating the invocation of the FOCAS function based on the communication handle in an embodiment of the present invention. Figure 6 This diagram illustrates the alternating calls of the FOCAS function in single-threaded and dual-threaded modes in an embodiment of the present invention. Figure 7 The signal address related to EMZPS in the embodiments of the present invention; Figure 8 This is a timing diagram of EMZPS triggered by the FOCAS function in an embodiment of the present invention; Figure 9 This is a flowchart of the thermally induced positioning error compensation process for the fully closed-loop feed axis in an embodiment of the present invention; Figure 10 This is a compensation diagram for a 500mm stroke segmented at 50mm intervals in an embodiment of the present invention; Figure 11This is a diagram showing the three-thread architecture and task distribution of the compensation software in this embodiment of the invention. Figure 12 This is a flowchart illustrating the operation of the compensation software in an embodiment of the present invention. Figure 13 This is a flowchart illustrating the operation of the temperature acquisition module in an embodiment of the present invention. Figure 14 This is a flowchart of thermally induced positioning error compensation based on EMZPS in an embodiment of the present invention; Figure 15 This is an HMI interface diagram of the compensation software in an embodiment of the present invention; Figure 16 This is a diagram showing the contents recorded in the log file in an embodiment of the present invention; Figure 17 This is a diagram showing the Ethernet connection interface set on the CNC panel in an embodiment of the present invention; Figure 18 The graphs shown are of the thermally induced positioning error over time in an embodiment of the present invention, where a is the graph of the thermally induced positioning error over time before compensation, and b is the graph of the thermally induced positioning error over time after compensation. Figure 19 This is a diagram illustrating the algorithm architecture of the spatiotemporal convolutional network with a multi-attention mechanism in an embodiment of the present invention. Figure 20 This is a structural diagram of the fully closed-loop feed system in an embodiment of the present invention; Figure 21 This is a heat exchange principle diagram of the fully closed-loop feed system in an embodiment of the present invention; Figure 22 This is a diagram of the measurement points of the fully closed-loop feed system in an embodiment of the present invention; Figure 23 This is a comparison chart of the thermally induced positioning error model with LSTM, Ridge, and SVM compensation methods. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0029] Example 1 This invention discloses a real-time compensation method for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, such as... Figure 1As shown, the process includes the following steps: obtaining the real-time temperature of the heat source of the fully closed-loop feed system; inputting the real-time temperature into a thermally induced positioning error model to obtain the thermal error, wherein the thermally induced positioning error model includes a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module; inputting the thermal error into the CNC system, and using EMZPS to offset the origin of the mechanical coordinates to compensate for the thermally induced positioning error of the fully closed-loop feed system in real time.

[0030] The real-time temperature of the heat source of the fully closed-loop feed system includes: attaching a temperature sensor to the heat source of the fully closed-loop feed system, converting the analog current signal output by the temperature sensor into a digital signal through a data acquisition card, and transmitting it to the host computer.

[0031] The temperature sensor is a precision magnetic platinum resistance thermometer (Pt100), and each probe is non-linearly conditioned by an individual transmitter, requiring a voltage of 24V and an output current of 4... 20mA, measuring range [-20, 150°C], Class A accuracy (0.15°C +0.002t), IEC-751 standard. First, the temperature sensor is magnetically attached to the corresponding temperature measuring point in the fully closed-loop feed system. The temperature signal is acquired by the acquisition system, which consists of an SCXI-1000 chassis, an SCXI-1600 acquisition card, an SCXI-1125 conditioning and isolation module, and an SCXI-1338 terminal module from NI (National Instruments). It connects to the computer via a USB bus. The system has strong anti-interference capabilities, can independently isolate and filter each input signal, and allows simultaneous acquisition of multiple channels. It can perform A / D conversion and has a 16-bit high resolution, such as... Figure 2 As shown, before the temperature signal is transmitted to the acquisition card, eight SCXI-1125 modules are used to condition the temperature signal through gain, attenuation, isolation, amplification, and filtering. Then, the analog current signal output from the temperature sensor is converted into a digital signal by the SCXI-1600 data acquisition card and transmitted to the host computer. The host computer then performs data storage, display, analysis, and processing. The SCXI architecture provides a simple, integrated platform for temperature signal conditioning and switching, allowing selection from various analog input / output, digital I / O, and switching modules to meet the specific needs of the application.

[0032] Fully closed-loop feed system, such as Figure 20 As shown, the system comprises a motor, ball screw, sliding nut, front / rear bearings, guide rails and slider, and a grating ruler as a feedback mechanism. The motor and ball screw are connected by a coupling. The heat exchange of the fully closed-loop feed system is as follows. Figure 21As shown, the heat sources include the motor, front / rear bearing assemblies, lead screw and nut pairs, and guide rail and slider pairs. The heat generated by these heat sources causes a temperature rise in each component, directly affecting the temperature field and thermal deformation of the feed system. Simultaneously, the heat is also conducted to larger machine tool components near the feed system, such as the column and slide, causing their temperature to rise and resulting in thermal deformation. Furthermore, the heat generated by each heat source can also be conducted through the column and slide to the grating ruler's setting and reading heads, affecting their temperature field and thermal deformation.

[0033] The real-time temperature is input into the thermally induced positioning error model to obtain the thermal error. The architecture of the thermally induced positioning error model is as follows: Figure 19 As shown, the system includes a convolutional neural network module, a long short-term memory (LSTM) network module, and a hybrid attention mechanism module. The convolutional neural network module extracts spatial features resulting from the coupling effects of heat source, thermal flow structure response, and different spatial error components. These spatial error components include: thermal expansion error components in the closed-loop feed system's thermal error caused by the thermal expansion of the grating ruler and the lead screw; and thermal drift error components caused by the overall thermal drift of the grating ruler and the feed system. The LSTM network module extracts temporal features related to thermal evolution, hysteresis characteristics, and long-term memory. The hybrid attention mechanism module includes spatial attention, temporal attention, and a fusion layer attention. The spatial attention enhances the spatial thermal distribution features extracted by the convolutional neural network, the temporal attention enhances the temporal variation features of thermal characteristics extracted by the LSTM network module, and the fusion layer attention extracts the overall thermal characteristic patterns.

[0034] The input to the Long Short-Term Memory (LSTM) network module is a vector of independent variables. The output is the hidden state at the current time step. ; The hidden state at the current time step for:

[0035] in, For output gate, For the previous time step ( The cell state at any given moment.

[0036] Output gate for:

[0037] in, For input vectors The weight matrix, Here is the weight matrix of the hidden state. The hidden state at the current time step , For bias terms;

[0038] in, for Cellular state at any given moment For the previous time step ( Cellular state at any given moment For the Gate of Oblivion For input gate, For input vectors The weight matrix, Let the input vector be the input vector at the current time. The hidden state of the previous moment The weight matrix, This is the hidden state from the previous moment. For bias terms;

[0039] in, This is the Sigmoid activation function (used to map the output to between 0 and 1). In the forget gate, the input vector The weight matrix, Let the input vector be the input vector at the current time. Within the Forgotten Gate, the state was hidden in the previous moment. The weight matrix, This is the hidden state from the previous moment. For the bias term of the forget gate;

[0040] in, In the input gate, the input vector The weight matrix, For the input gate, the hidden state in the previous time step. The weight matrix, This is the bias term for the input gate.

[0041] The convolutional neural network module extracts spatial features through convolutional layers and pooling layers.

[0042] The convolution operation of a convolutional layer is as follows:

[0043] in, For activation function, To experience the wild, For the next level (the first) The feature map of the layer (i.e., the local data input to the current layer). Convolutional kernels are used to extract specific features from the input data. The index (or channel number) of the output feature map for the current layer. This refers to the bias term corresponding to the current convolution operation; The pooling operation of the pooling layer is as follows:

[0044] in, As weight, For downsampling function, For feature maps, This is the bias term for the current pooling operation.

[0045] The hybrid attention mechanism module takes the input vector of the attention layer as input. with weight matrix Multiply to obtain the weighted reconstructed feature vector. .

[0046]

[0047] in, The weight matrix, This is the input vector for the attention layer.

[0048]

[0049]

[0050] in, For normalized exponential functions, For the first The similarity value of each feature It is a natural constant. For the first The similarity value of each feature The dimension of the similarity between feature vectors. For activation function, As weight, For the first One input feature vector, This is the bias matrix.

[0051] Multiple real-time temperatures are acquired to train the thermally induced location error model, such as... Figure 22As shown, temperature measuring points are arranged at typical heat source locations in the fully closed-loop feed system, such as motor temperature measuring points (T1, T15, T23), bearing temperature measuring points (T2, T4, T6, T18), moving nut temperature measuring points (T3, T17), guide rail temperature measuring points (T5, T6, T19, T20), grating ruler fixed-length temperature measuring points (T9-T13), reading head temperature measuring point (T26), critical column temperature measuring points near the fixed-length measuring point (T7, T8, T14, T21, T22), critical slide temperature measuring points near the reading head (T24, T25, T27-T30), and ambient temperature measuring points (T31, T32), for a total of 32 temperature sensors. This system can comprehensively reflect the main physical factors controlling thermally induced positioning errors, covering the sources of thermal drift errors and key transmission nodes in the error chain. This helps improve the physical interpretability of training data and the effectiveness of feature information, enhancing the thermally induced positioning error model's ability to identify the main control error components, thereby improving prediction accuracy and compensation effect. In this embodiment, the X-axis is a dual-drive feed system; therefore, temperature measurement points are arranged on both the upper and lower X-axis to comprehensively reflect the thermal state of the dual-drive feed system. However, since the full closed-loop control is based on the upper X-axis as the active axis, temperature measurement points are only arranged on the grating ruler and reading head of the upper axis; no additional measurement points are needed on the lower axis.

[0052] Specifically, temperature rise data from 32 temperature measurement points were input using both temporal and convolutional processing methods. During the training phase, LSTM (Long Short-Term Memory) and CNN (Convolutional Neural Network) extracted the temporal and spatial features of the input data, assigning differentiated weights to features in different time and spatial dimensions. A unified spatiotemporal feature set was constructed by fusing temporal and spatial features. Further, the dynamic evolution relationship of spatiotemporal features with changes in the thermal field was extracted, and a spatiotemporal attention mechanism was introduced into the fusion layer to refine more physically meaningful multi-heat source coupling features. The total number of spatiotemporal attention layers is the sum of the number of temporal and spatial attention layers. Finally, the thermal error was output through a fully connected (Dense) layer. Simulated Annealing-Whale Optimization (SA-IWOA) was employed. The evaluation metric (Root Mean Square Error, RMSE) and the parameters to be optimized were input into SA-IWOA to determine whether the evaluation metric met the iteration requirements. If not, location updates and group behavior judgments were triggered to ensure the solution remained within the parameter boundaries. Subsequently, the updated hyperparameters were fed back to the thermally induced localization error model, iterating until the convergence condition was met. The optimal batch size and number of training cycles obtained are the final hyperparameters of the model.

[0053] The software architecture for thermal positioning error compensation of the host computer is as follows: Figure 9As shown, it mainly includes three modules: error compensation, error calculation, and temperature acquisition. The error compensation module dynamically links with the FOCAS ".dll" file during software runtime, thereby enabling functions such as position monitoring and external zero-point offset (EMZPS) of the machine tool. The error calculation module uses the acquired temperature data and a built-in pre-trained error prediction model to calculate thermally induced positioning error data in real time. The temperature acquisition module uses the application programming interface (API) functions provided by the NI-DAQmx driver to read real-time temperature data using the established multi-loop temperature acquisition device.

[0054] Compensation requires first obtaining the current position, then writing the corresponding compensation amount to execute EMZPS. Different positions require different compensation amounts. Therefore, the real-time performance of the compensation software is crucial when the feed axis is running at high speed. To address this, a dual-threaded approach can be used to execute position reading and EMZPS tasks separately. Since the thermally induced positioning errors of adjacent positions do not differ significantly, the feed stroke can be divided into multiple segments, with the same compensation amount used within each segment. Figure 10 As shown. Theoretically, the smaller the segment interval, the more precise the compensation; however, the resolution of the compensation amount is the smallest movement unit set by the CNC, such as 1μm; when the thermal positioning error difference between the coordinate positions within a segment is less than 1μm, it is not advisable to further subdivide the segments. Segmented compensation can reduce the real-time requirements of the compensation software.

[0055] The compensation software uses a three-thread architecture, such as Figure 11 As shown, these threads are named Thread1, Thread2, and Thread3, respectively. Error data is stored in a position-indexed table, with the error table and index number serving as global variables to establish a unidirectional information flow between threads. The tasks of temperature acquisition and error calculation, which have lower real-time requirements, are separated from the error compensation tasks, which have higher real-time requirements, ensuring that error data can be immediately accessed by position each time EMZPS is executed. Specifically, since both temperature and error change slowly over time, Thread1 performs tasks such as temperature acquisition, error calculation and updating, plotting temperature and error curves, and logging, while simultaneously responding to HMI events and managing the other two threads. Thread2 continuously monitors the current position coordinates of the target axis, and Thread3 executes EMZPS for thermally induced positioning error compensation.

[0056] The operation process of the compensation software is as follows: Figure 12 As shown, the temperature acquisition and error calculation modules are sequential, while the error compensation module runs in parallel with both error calculation and temperature acquisition, allowing the error compensation function to be started and stopped at will during software operation. A log function and data graph window are provided to record temperature, calculated error values, and compensation status, as well as to display temperature and error curves in real time.

[0057] like Figure 13 As shown, in the preparation stage of temperature acquisition, the data acquisition task is instantiated using the DAQmx.Task() method; the analog current channel is established using the AIChannels.CreateCurrentChannel() method, and the physical channel and current range to be acquired are set; the sampling frequency and sampling type are set using the Timing.ConfigureSampleClock() method, where a finite sampling type is used, sampling 1000 times per channel at a frequency of 2kHz at certain time intervals, and using the average value as the true value to reduce the influence of noise; the data stream is established using the AnalogMultiChannelReader() method. During the actual temperature acquisition stage, the data acquisition interval can be modified in real time to adapt to the characteristics of rapid temperature and error changes in the initial stage of machine tool operation, and slow temperature and error changes as it approaches thermal equilibrium. Simultaneously with temperature acquisition, temperature data can be recorded in a text file and displayed in a graph window according to the data acquisition interval.

[0058] like Figure 14 As shown, after connecting the host computer and the CNC, Thread2, which performs the coordinate reading task, runs automatically and continuously to monitor the current position of the feed axis in real time, so as to index the error from the error table according to the position at any time, until the PC and CNC are disconnected; while Thread3, which performs the EMZPS task, can be started and stopped at any time as needed to meet the needs of compensation practice.

[0059] For the analytical model of thermally induced positioning error, the calculation process can be directly implemented using C# code. For deep learning neural network models, relevant algorithm libraries can be compiled into dynamic link library (.dll) files for deployment in the compensation software. The error calculation module calculates the thermally induced positioning error based on the collected temperature, and the error calculation and update frequency is consistent with the temperature collection frequency. Error data is synchronously updated to the error table for real-time indexing by the error compensation module.

[0060] like Figure 16 As shown, the log function is used to save the operating status of the compensation software and key data such as timestamps, temperature, and errors for subsequent analysis. It utilizes the .NET IO.StreamWriter class and Encoding.UTF8 encoding format to write the necessary content to a .txt file. The chart function is used to display or input temperature and error data. The temperature and time-varying error terms used for error prediction are visually displayed as curves using a Chart control; some data items, such as initial temperature, may require manual input from the user, which are displayed as tables using a DataGridView control to accept user input.

[0061] The human-machine interface (HMI) of the compensation software is as follows: Figure 15 As shown, the interface is divided into three main areas: the upper left area is the control area, which includes interactive functions such as connecting to the CNC, connecting to the NI, setting the temperature, and calculating the clock frequency for error calculation; the middle left and upper right areas are the temperature display areas, where the temperature data table in the middle left allows users to input the temperature name and initial temperature data; the lower part of the interface is the error-related area, where the table on the left displays various error data, the button above the table is used to control the start and stop of error compensation, and the graph on the right displays the error curve.

[0062] The host computer compensation software connects to the CNC system via Ethernet and calls the FOCUS function library to read real-time status information such as the rotational speed and current operating position of the fully closed-loop feed system. A crossover twisted-pair cable with an RJ45 interface is used to connect the CNC and the industrial computer. In the CNC's HMI interface, the built-in port under the SYSTEM menu is selected to access the Ethernet settings interface. For example... Figure 17 As shown, configure the embedded Ethernet IP address, subnet mask, and port parameters. Enable the TCP / IPv4 protocol in the industrial control computer and set an appropriate IP address and subnet mask to ensure that the CNC and the industrial control computer are on the same local area network.

[0063] Run the compensation software and enter the correct IP address and port number in the upper left corner. Then, in the compensation software on the host computer, call the FOCAS function `cnc_allclibhndl3()` to establish an Ethernet connection between the PC and the CNC and enable communication based on TCP / IPv4. It should be noted that when calling the function, a communication handle must be created, and this handle and the CNC's IP address must be passed to the function as parameters. When the program subsequently calls other FOCAS functions, the handle must be maintained and released when the program ends. Figure 5 As shown. The working conditions in single-threaded and dual-threaded modes are as follows. Figure 6 As shown. Depending on the requirements, by calling other FOCAS functions that can extract CNC information, it is possible to read current feed rate and current position coordinates in real time. For example... Figure 4 The image shows the signal interface of the FANUC CNC system.

[0064] The thermally induced positioning error of the fully closed-loop feed system is compensated in real time by offsetting the mechanical coordinate origin using EMZPS. For example... Figure 4 As shown, the FOCAS function library provides functions for reading and writing data to the G and F signal addresses of the PMC. The function for reading data is pmc_rdpmcrng(), and the function for writing data is pmc_wrpmcrng(). By passing the signal address, communication handle, and data structure to the function, the corresponding data (such as status variables and compensation values) can be read and written.

[0065] EMZPS is implemented in the CNC interpolation stage, therefore it requires the use of G signal interfaces and F signal interfaces, specifically G001 and G001 respectively. G002 and F60, in terms of hardware, they are located in the PMC, such as Figure 7 As shown in the diagram. Bytes G000 and G001 together store a signed word data value, recording the EMZPS value; bytes G002 and F60 each store an unsigned byte data value, respectively setting the EMZPS function and indicating the EMZPS status. Specifically, the data range of G000 and G001 is -9999. 9999, the unit is the smallest movement unit, which is 0 by default when the CNC is powered on; the lower 4 bits of G002 are used to select the axis executed by EMZPS, for example, 0010 represents the Z axis; the middle 3 bits of G002 are used to set G000 The G001 data is assigned a function, such as 011 indicating that it is used for EMZPS; the highest bit of G002 is the ESTB function bit, which is used to trigger the EMZPS function, and is triggered when the state of this bit changes from 0 to 1; the lowest bit of F60 is the EREND function bit, which is used to indicate the EMZPS trigger status and is read-only.

[0066] The process of implementing EMZPS is as follows Figure 8 As shown, effective triggering of EMZPS is used to send to G000 The process begins by writing a word of data to address G001, followed by writing the correct byte of data to address G002, setting the ESTB bit from 0 to 1 and triggering EMZPS. After EMZPS completes, the EREND bit at address F60 is automatically set to 1. Once this bit is read as 1, the ESTB bit can be restored to 0, preparing for the next EMZPS trigger. Because EMZPS is triggered by the ESTB bit changing from 0 to 1, the EREND bit automatically becomes 0 after ESTB is restored to 0, allowing the EMZPS value to be written to initiate the next trigger. Testing with a C# program calling the FOCAS function showed that the interval between two consecutive EMZPS triggers was approximately 64ms.

[0067] Since the minimum data structure for reading and writing data using the FOCAS function is byte data, modifying the ESTB bit requires writing a complete 8-bit binary number to the G002 address, and reading the EREND bit status also yields a complete 8-bit binary number. To accurately obtain the EREND status, a bitwise AND operation can be performed between 00000001 and this byte data.

[0068] The principle of EMZPS is as follows Figure 3As shown, suppose there is a target point on the workpiece. Initially, its coordinates in the workpiece coordinate system YZ (at this time, the working coordinate system YZ is near the workpiece coordinate system Y'Z') are P1. Due to thermal positioning error, after the machine tool has been running for a period of time, it is positioned at coordinate point P2. From the CNC's perspective, the target point is still in the correct position in the workpiece coordinate system YZ, and the workpiece coordinate system YZ is also in the correct position in the machine coordinate system YZ. However, in the physical world, the thermal behavior of mechanical components has caused the same target point in the machine coordinate system to undergo thermal drift in the positive Z-axis direction. This can be understood as the machine coordinate system undergoing thermal drift in the positive Z-axis direction for that target point. Now, if the tool or worktable is detected near the target point P2, the CNC's EMZPS function is triggered, causing the machine coordinate system YZ to shift a certain distance in the negative Z-axis direction, becoming the machine coordinate system Y'Z'. This allows the tool to be positioned at coordinate point P3, which is close enough to the target point's initial position, thus achieving thermal positioning error compensation. Therefore, after triggering the CNC's EMZPS function, the CNC system's mechanical coordinate system can be shifted a specified distance (compensation value) in the required direction, thereby repositioning the tool from the original thermally offset point to a new coordinate point, so as to get close enough to the precise target point required for machining, thus achieving thermally induced positioning error compensation.

[0069] The changes in thermally induced positioning error over time before and after compensation are as follows: Figure 18 As shown. Figure 18 Figure a shows the thermally induced positioning error before compensation for the fully closed-loop feed system, ranging from -2.53. 14.83μm. After compensation, as shown... Figure 18 As shown in b, the range is -1.47. 2.72 μm. It can be seen that the maximum thermally induced positioning error reduction of the fully closed-loop feed system reaches 81.66%, demonstrating a good compensation effect. Therefore, this proves the feasibility of the real-time thermally induced positioning error compensation method for the fully closed-loop feed system based on the thermally induced positioning error model proposed in this invention.

[0070] The prediction performance of the thermal positioning error model is compared with that of commonly used existing models such as LSTM, SVM, and ridge regression, as shown below. Figure 23 As shown, the thermally induced positioning error model produces the smoothest prediction surface for the thermally induced positioning error at each position in the fully closed-loop feed system, without the abrupt fluctuations seen in the prediction surfaces of LSTM, ridge regression, and SVM. Furthermore, the prediction surface of this method is closest to the original thermal error surface, and its RMSE and MAE indices are the best among all models.

[0071] In summary, the thermally induced localization error model combines two hierarchical mechanisms: a convolutional neural network module and a long short-term memory network module. It extracts temporal and spatial features through a three-layer attention mechanism, enabling the thermally induced localization error compensation model to more accurately characterize the multi-factor coupling characteristics of the thermally induced localization error in the fully closed-loop feeding system. This achieves high-precision thermal error prediction and controls the maximum prediction residual within ±1μm. The LSTM model's prediction accuracy for thermal errors is insufficient, with a maximum prediction residual of 1.79μm. This is because LSTM primarily extracts temporal features and lacks processing of spatial information. The SVM model cannot capture historical features or reflect the memory of thermal errors, resulting in lower prediction accuracy than the thermally induced localization error model and the LSTM model. The ridge regression algorithm has the lowest prediction accuracy due to its inability to reflect the memory of thermal errors and its limited nonlinear learning ability.

[0072] Example 2 This invention discloses a real-time compensation system for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, comprising a temperature acquisition module, a thermal error acquisition module, and a compensation module.

[0073] Temperature acquisition module: used to acquire the real-time temperature of the heat source of the fully closed-loop feed system; Thermal error acquisition module: used to input the real-time temperature into the thermally induced positioning error model to acquire the thermal error, the thermally induced positioning error model including a convolutional neural network module, a long short-term memory network module and a hybrid attention mechanism module; Compensation module: used to input the thermal error into the CNC system, and to compensate the thermally induced positioning error of the fully closed-loop feed system in real time by offsetting the mechanical coordinate origin using EMZPS.

[0074] The specific limitations of the real-time compensation system for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm can be found in the limitations of the real-time compensation method for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm described above. The corresponding technical effects can be obtained equally and will not be repeated here. Each module in the aforementioned real-time compensation system for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0075] It should be noted that the terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

Claims

1. A real-time compensation method for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, characterized in that, Includes the following steps: Obtain the real-time temperature of the heat source in the fully closed-loop feed system; The real-time temperature is input into the thermally induced localization error model to obtain the thermal error. The thermally induced localization error model includes a convolutional neural network module, a long short-term memory network module, and a hybrid attention mechanism module. The thermal error is input to the CNC system, and the thermally induced positioning error of the fully closed-loop feed system is compensated in real time by offsetting the mechanical coordinate origin using EMZPS.

2. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 1, characterized in that: The fully closed-loop feed system includes: a motor, a front / rear bearing assembly, a lead screw and nut pair, and a guide rail and slider pair; Obtain the real-time temperature of the heat source in the fully closed-loop feed system, including: The temperature sensor is attached to the heat source of the fully closed-loop feed system. The analog current signal output by the temperature sensor is converted into a digital signal by the data acquisition card and transmitted to the host computer.

3. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 2, characterized in that: The convolutional neural network module is used to extract spatial features under the coupling effect of heat source, heat flow structure response and different spatial error components. The Long Short-Term Memory (LSTM) network module is used to extract the temporal features of thermal evolution, hysteresis characteristics, and long-term memory. The hybrid attention mechanism module includes spatial attention, temporal attention, and fusion layer attention; the spatial attention is used to enhance the spatial thermal distribution features extracted by the convolutional neural network, the temporal attention is used to enhance the temporal variation features of thermal characteristics extracted by the long short-term memory network module, and the fusion layer attention is used to extract the comprehensive thermal characteristic patterns.

4. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 1, characterized in that: The input to the Long Short-Term Memory (LSTM) network module is a vector of independent variables. The output is the hidden state at the current time step. ; The hidden state at the current time step for: in, For output gate, For the previous time step ( The cell state at any given moment.

5. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 4, characterized in that: The output gate for: in, For input vectors The weight matrix, Here is the weight matrix of the hidden state. The hidden state at the current time step , For bias terms; in, for Cellular state at any given moment For the previous time step ( Cellular state at any given moment For the Gate of Oblivion For input gate, For input vectors The weight matrix, Let the input vector be the input vector at the current time. The hidden state of the previous moment The weight matrix, This is the hidden state from the previous moment. For bias terms; in, This is the Sigmoid activation function (used to map the output to between 0 and 1). In the forget gate, the input vector The weight matrix, Let the input vector be the input vector at the current time. Within the Forgotten Gate, the state was hidden in the previous moment. The weight matrix, This is the hidden state from the previous moment. For the bias term of the forget gate; in, In the input gate, the input vector The weight matrix, For the input gate, the hidden state in the previous time step. The weight matrix, This is the bias term for the input gate.

6. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 1, characterized in that: The convolutional neural network module extracts spatial features through convolutional layers and pooling layers; The convolution operation of the convolutional layer is as follows: in, For activation function, To experience the wild, For the next level (the first) The feature map of the layer (i.e., the local data input to the current layer). Convolutional kernels are used to extract specific features from the input data. The index (or channel number) of the output feature map for the current layer. This refers to the bias term corresponding to the current convolution operation; The pooling operation of the pooling layer is as follows: in, As weight, For downsampling function, For feature maps, This is the bias term for the current pooling operation.

7. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 1, characterized in that: The hybrid attention mechanism module will input the attention layer's input vector. with weight matrix Multiply to obtain the weighted reconstructed feature vector. .

8. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 7, characterized in that: The reconstructed feature vector for: in, The weight matrix, This is the input vector for the attention layer.

9. The method for real-time compensation of thermally induced positioning error in a fully closed-loop feed system based on the CALA algorithm according to claim 8, characterized in that: The weight matrix for: in, For normalized exponential functions, For the first The similarity value of each feature It is a natural constant. For the first The similarity value of each feature The dimension of the similarity between feature vectors. For activation function, As weight, For the first One input feature vector, This is the bias matrix.

10. A real-time compensation system for thermally induced positioning errors in a fully closed-loop feed system based on the CALA algorithm, characterized in that, include: Temperature acquisition module: used to acquire the real-time temperature of the heat source of the fully closed-loop feed system; Thermal error acquisition module: used to input the real-time temperature into the thermally induced positioning error model to acquire thermal error, the thermally induced positioning error model including a convolutional neural network module, a long short-term memory network module and a hybrid attention mechanism module; Compensation module: Used to input the thermal error to the CNC system and compensate the thermally induced positioning error of the fully closed-loop feed system in real time by offsetting the mechanical coordinate origin using EMZPS.