A physical and data hybrid driving based thermal error modeling method for motorized spindle

By constructing an electric spindle thermal network model and an XGBoost residual prediction model, and combining the recursive least squares method for weight updates, the problem of balancing accuracy and real-time performance in electric spindle thermal error modeling is solved, achieving high-precision, real-time thermal error prediction and compensation control.

CN122174398APending Publication Date: 2026-06-09JILIN UNIVERSITY +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JILIN UNIVERSITY
Filing Date
2026-03-24
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing methods for modeling thermal errors in electric spindles cannot simultaneously satisfy accuracy, real-time performance, and physical interpretability. In particular, the prediction accuracy decays rapidly in small-batch, multi-condition scenarios, making it unable to effectively support real-time compensation control.

Method used

A physical and data-driven approach is adopted to construct an electric spindle thermal network model. Combined with the XGBoost residual prediction model, the weights are updated by recursive least squares method, and the residual model is dynamically adjusted to achieve data model optimization guided by physical mechanisms, which can adapt to the time-varying characteristics of thermal errors and sudden changes in operating conditions.

Benefits of technology

It improves the stability and prediction accuracy of the model under varying operating conditions and long-term operation scenarios, while taking into account both physical interpretability and real-time performance, thus meeting the real-time compensation control requirements of the electric spindle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122174398A_ABST
    Figure CN122174398A_ABST
Patent Text Reader

Abstract

The application discloses a kind of electric spindle thermal error modeling methods based on physical and data hybrid drive, it is related to numerical control machine tool high-end equipment manufacturing field, including: the structure and thermal analysis of electric spindle, constructs the thermal network model of electric spindle;According to the thermal network model, the temperature of thermal node is calculated, and then the thermal elongation deformation of electric spindle is calculated based on temperature-structure mapping model;Thermal error residual prediction model based on XGBoost is constructed;With preprocessed temperature signal and working condition parameter as input, the real residual error of thermal error is used as label, and the residual prediction model is trained;The residual prediction model is updated by recursive least squares method, and the dynamically adjusted residual model is output, and the self-adaptive dynamically updated thermal error model is further obtained.By the application, data model optimization under the guidance of physical mechanism is realized, the dependence of data-driven model on training data volume is reduced, and the prediction accuracy, physical consistency and stability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of high-end CNC machine tool manufacturing, and in particular to a method for modeling thermal errors of electric spindles based on a hybrid physical and data-driven approach. Background Technology

[0002] In the field of high-end equipment manufacturing, electric spindles, as core functional components of CNC machine tools and machining centers, directly determine the workpiece machining quality and equipment processing capabilities through their operational accuracy. With the advancement of intelligent manufacturing strategies, industries such as aerospace and precision molds have raised their demands for part machining accuracy to the micrometer level, making electric spindle thermal error a core bottleneck restricting precision breakthroughs. Industry statistics show that thermal error accounts for 40% to 70% of total machining error in electric spindles. Especially under high-speed, long-term continuous operation, the coupling effect of internal heat sources (motor losses, bearing friction) and external ambient temperature leads to intensified spindle thermal deformation, severely affecting equipment stability and machining consistency. Currently, global manufacturing is upgrading towards higher speeds, greater precision, and greater intelligence. Developing efficient and accurate electric spindle thermal error prediction technology has become a key issue in enhancing the core competitiveness of high-end equipment and an important prerequisite for achieving intelligent compensation control of equipment.

[0003] Thermal errors in electric spindles originate from the coupling of multiple heat sources and complex heat transfer processes, exhibiting nonlinear, time-varying, and multi-factor coupling characteristics in their generation mechanism. Structurally, electric spindles consist of components such as stators, rotors, bearings, and housings. The thermophysical properties of the materials in these components vary significantly, and the contact thermal resistance at the interfaces fluctuates easily with changes in rotational speed and load, increasing the difficulty of modeling thermal deformation patterns. Currently, thermal error prediction technologies are mainly divided into three categories: physical modeling methods, data-driven methods, and hybrid modeling methods. Each method has certain applicable scenarios in engineering applications, but due to limitations in their technical principles, they cannot simultaneously meet the comprehensive requirements of accuracy, real-time performance, and physical interpretability. Especially in small-batch, multi-condition machining scenarios, existing technologies struggle to adapt to dynamic changes in thermal characteristics, leading to rapid decay in prediction accuracy and an inability to effectively support real-time compensation control.

[0004] Current methods for modeling thermal errors in CNC machine tool electric spindles have the following drawbacks: 1. Pure physical modeling methods (such as thermal resistance networks and finite element methods): These methods build models based on the principles of heat transfer and have strong physical interpretability. However, the modeling process is complex and requires precise setting of geometric parameters, thermophysical properties, and boundary conditions. They are not adaptable to nonlinear factors such as contact thermal resistance and time-varying heat sources. Furthermore, the finite element method has a large computational load and cannot meet the needs of online real-time prediction. The thermal resistance network method suffers from the problem of modeling error accumulation.

[0005] 2. Pure data-driven methods (such as multinomial regression and neural networks): These methods rely on a large amount of experimental data to train the model. They do not require a clear physical mechanism and have a strong ability to fit nonlinear errors. However, they lack physical interpretability. The generalization ability of the model is limited by the amount of data and the coverage of operating conditions. The accuracy drops significantly in small sample and variable operating condition scenarios. Furthermore, it is impossible to trace the source of error, which is not conducive to model optimization and engineering verification.

[0006] 3. Traditional hybrid modeling method: This method simply combines physical and data models, often using the data model to correct static errors in the physical model. It does not consider the time-varying characteristics of thermal errors, has insufficient dynamic adaptability, and the connection between models is loose. The weight adjustment lacks an adaptive mechanism and it is difficult to cope with the thermal characteristic decay (such as bearing wear and component aging) during long-term operation of the electric spindle. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention provides a method for modeling thermal errors of electric spindles based on a hybrid physical and data-driven approach. This invention focuses on resolving the following core technical issues, addressing the pain points of existing technologies: 1. The limited integration of physical models and data models and the failure to fully leverage their respective advantages are specifically manifested in the following ways: the physical mechanism provides insufficient guidance to the data model, making it difficult to balance model prediction accuracy and physical interpretability; relying solely on data-driven approaches is prone to "black box" defects, while relying purely on physical models makes it difficult to fully adapt to complex nonlinear relationships.

[0008] 2. To address the issue of adapting to time-varying thermal error characteristics, a dynamic weight optimization mechanism is constructed to correct prediction biases caused by factors such as fluctuations in contact thermal resistance and sudden changes in operating conditions in real time, thereby improving the stability of the model under varying operating conditions and long-term operation scenarios.

[0009] 3. To resolve the conflict between online real-time performance and prediction accuracy, the model's computational logic was optimized. While ensuring micron-level prediction accuracy, the computational latency was controlled to the millisecond level, meeting the engineering requirements for real-time compensation control of the electric spindle.

[0010] 4. To address the issue of model generalization ability in small sample scenarios, the physical model provides prior knowledge, reducing the dependence of data-driven models on the amount of training data and adapting to the processing needs of small to medium batches under multiple working conditions.

[0011] The technical solution of this invention is as follows: A method for modeling the thermal error of an electric spindle based on a hybrid physics and data approach includes: performing structural and thermal analysis on the electric spindle; constructing a thermal network model of the electric spindle; determining thermal resistance, heat source parameters, and the distribution of heat conduction and convection; calculating the hot node temperatures based on the thermal network model; and calculating the thermal elongation deformation of the electric spindle based on a temperature-structure mapping model, wherein the thermal elongation deformation is equivalent to the thermal error of the electric spindle; acquiring the actual temperature and actual thermal error of the electric spindle under time-varying operating conditions; calculating the temperature residual and the actual thermal error residual based on the calculated hot node temperatures and the thermal error of the electric spindle; and constructing a thermal network model based on XGBoost. An error residual prediction model is trained using preprocessed temperature signals and operating parameters as inputs and the actual thermal error residuals as labels. The predicted thermal error residuals are then weighted and updated using a recursive least squares method, resulting in a dynamically adjusted residual model. This dynamically adjusted residual model is the product of the predicted thermal error residuals and a scalar gain, which is adjusted in real-time based on the temperature residuals. Based on the dynamically adjusted residual model and the thermal elongation deformation of the electric spindle, an adaptively updated thermal error model is obtained, used to predict the thermal error of the electric spindle based on the temperature signals and operating parameters.

[0012] Optionally, the structural and thermal analysis of the electric spindle, the construction of a thermal network model of the electric spindle, and the determination of thermal resistance, heat source parameters, and the distribution of heat conduction and heat convection include: decomposing the physical structure of the motor spindle and the cooling and natural convection system into multiple units, assigning each unit a number and a degree of freedom, i.e., its average temperature, to form a thermal network; ignoring thermal radiation, dividing the thermal resistance in the thermal network into thermal convection resistance between solids and fluids, thermal conduction resistance within the solids, and thermal contact resistance between solid contact surfaces; dividing the thermal distribution of the thermal network into thermal conduction, thermal convection, and thermal contact; for thermal conduction, setting the geometric center of the unit as the representative position of the average temperature, and heat flows from the geometric center to the central node of adjacent units through the contact surface; for thermal convection, setting the surface temperature as the central temperature, and heat exchange between the surface and the cooling fluid occurs through the surface area in a convection manner; for thermal contact, setting the temperature of the contact surface as the central temperature, and heat is transferred in the actual contact points and contact gaps between adjacent nodes; and ignoring the temperature changes of ambient air and cooling water caused by heat transfer, setting the thermal network to have a constant temperature boundary.

[0013] Optionally, the calculation of the hot node temperature based on the thermal network model includes: establishing a thermal balance equation at the hot node based on Kirchhoff's voltage and current laws, where the sum of the heat flowing into the hot node and the heat generated by the hot node equals the heat change corresponding to the temperature change of that hot node; dividing the thermal conduction resistance in the thermal network model into axial thermal resistance and radial thermal resistance, and calculating the axial and radial thermal resistance of the hot node based on the component's inner diameter, outer diameter, shaft length, and thermal conductivity; calculating the thermal convection resistance between the component surface and adjacent fluids based on the heat dissipation area and the corresponding heat dissipation coefficient of the fluid; calculating the motor's heat generation power based on the actual input power of the motor, the output power of the electric spindle, and the heat generated by bearing friction; calculating the stator heat generation rate and rotor heat generation rate of the electric spindle based on empirical formulas and the model scale of the three-dimensional stator and rotor of the electric spindle; calculating the bearing's heat generation power based on the bearing's resistance torque during operation, using the Palmgren empirical formula based on the energy conservation theory; and calculating the hot node temperature by substituting the heat generation power generated by each heat source node and the thermal resistances of each component in the thermal network model into the thermal balance equation.

[0014] Optionally, the first The heat balance equations for the hot nodes are: ; In the formula, This is the total number of hot nodes; It is the first The temperature of each hot node; It is the first The total number of adjacent hot nodes of a hot node; Is with the first The adjacent hot nodes are the first The temperature of each hot node; It is the first The hot node and the first The sum of different types of thermal resistance between each thermal node; It is the first The heat generated per unit time at the first thermal node, if the first... If a node is not a heat source node, then ; It is the first Temperature change rate at each node; It is the first Specific heat capacity of each node; It's density. It is volume; Among different types of thermal resistance, axial thermal resistance radial thermal resistance Thermal convection resistance In the formula, Outer diameter; Inner diameter; for The length of the cylinder For heat dissipation area; Heat dissipation coefficient.

[0015] Optionally, the heat dissipation coefficient includes the heat transfer coefficient between the stator and the water-cooled channel, the air heat transfer coefficient between the stator and the rotor, and the heat transfer coefficient between the rotor end and the air. The heat transfer coefficient between the stator and the water-cooled channel is calculated by introducing the Reynolds number and Prandtl number to calculate the Nusselt number, which is related to the convective heat transfer coefficient between the motor stator and the cooling water. Then, the heat transfer coefficient between the stator and the water-cooled channel is obtained by dividing the product of the Nusselt number and the static thermal conductivity of the fluid by the equivalent diameter of the cooling water channel. The calculation of the air heat transfer coefficient between the stator and the rotor... The calculation methods are as follows: First, the ratio of the air gap thickness between the stator and rotor to the radius of the electric spindle rotor is calculated; second, the ratio of the air thermal conductivity to the axial gap length between the stator and rotor is calculated; and the air heat transfer coefficient between the stator and rotor gap is calculated using a power function with Reynolds number, the first ratio, and the second ratio as bases. The calculation of the heat transfer coefficient between the rotor end and the air is as follows: the average air velocity in the stator-rotor gap is calculated based on the axial and radial air velocities between the motor rotor and stator; and the heat transfer coefficient between the rotor end and the air is calculated based on the average air velocity in the stator-rotor gap.

[0016] Optionally, the heat generation power of the motor The calculation formula is: ; In the formula, Actual input power of the motor; Heat is generated by friction in the bearings; This refers to the heat power loss of the motor. This refers to the output power of the electric spindle; This refers to the motor voltage; This refers to the motor current. Electromagnetic torque; This refers to the motor speed; Phase angle; Electric spindle stator heat generation rate and rotor heat generation rate The calculation formula is: ; ; In the formula, This refers to the thermal power of the motor. This refers to the motor's volume; For motor efficiency; Outer diameter; Inner diameter; For length; heat generation rate of bearings The calculation formula is: ; In the formula, This refers to the bearing volume; The volume of the inner ring; The volume of the outer ring; The volume of the rolling element; Number of rolling elements; bearing friction generates heat. ; This refers to the bearing speed; Torque that resists the rotation of the bearing ,in, ; In the formula, , Both are resistance torques; the former is affected by bearing lubrication strategy, while the latter is affected by shaft preload. The bearing pitch circle diameter; The coefficient of performance is the lubrication factor. Load factor; Weighted load; This refers to the viscosity of the lubricant.

[0017] Optionally, the temperature-structure mapping model is: ; In the formula, The coefficient of thermal expansion of the material; This refers to the axial length. For the first Instantaneous temperature of the hot spot; For the first Reference temperature of the hot node; This represents the total number of hot nodes.

[0018] Optionally, training the residual prediction model includes: defining a training set of input features and target variables; gradually constructing a set of decision trees to approximate the true target value to achieve the task objective; adding decision trees to build a strong learner, with the final prediction result coming from the cumulative sum of predictions from multiple base learners; during the solution process, XGBoost parameter optimization is achieved by minimizing the objective function, which includes a loss function and a regularization term, the loss function being the mean squared error between the true value and the predicted value; XGBoost continuously adds and trains new decision trees to fit the residuals of the previous iteration, and obtains the predicted value of each sample by summing the scores of the leaf nodes of each decision tree; when a sample is input into the model, different samples are assigned to different leaf nodes, each leaf node calculates a node value, and the loss of each leaf node is obtained by using the loss function, minimizing the cumulative loss value of all leaf nodes, thereby minimizing the objective function.

[0019] Optionally, updating the weights of the thermal error residuals predicted by the residual prediction model using the recursive least squares method includes: The thermal error residual model is set as follows: ; In the formula, The gain is scalar, and is adjusted in real time based on changes in the real-time temperature sensor. This represents the actual thermal error residual. The thermal error residuals predicted by the XGBoost model; Calculate the real-time temperature residual : ; In the formula, This is real-time temperature sensor data; These are the predicted node temperatures for the thermal resistance network. Based on the aforementioned thermal error residual model and the online regression model for real-time temperature residual updates: ; For the bias of the linear model; Construct a linear model of the system's input and output. When the system receives N sets of data, the matrix form of the model is: ; In the formula, The input vector; For data matrices; These are weight parameters; This is the noise vector; The parameters are found by batch processing the least squares method. To minimize the sum of squared residuals, i.e.: ; Represents discrete time points; pass right Taking the derivative and setting it to zero yields the objective function: ; Solving for parameter estimates using batch least squares method : ; Define the covariance matrix: ; The parameter estimates for the original batch processing least squares method can then be expressed as: ; Estimate using the estimate at time N and Combined with the new data at time N+1 We obtain the estimated value at time N+1. and The gain is updated as follows: ; The parameters are updated as follows: ; Covariance updated to: ; In the formula, ; Forgetting factor; The model weights are then updated as follows: .

[0020] Optionally, the adaptively dynamically updated thermal error model is: ; In the formula, This refers to the thermal elongation calculated based on the temperature-structure mapping model. This is the dynamically adjusted residual model, where, For scalar gain, This represents the thermal error residual predicted by the XGBoost model.

[0021] The beneficial effects of this invention are: This invention constructs an end-to-end electric spindle thermal error prediction system based on "physical model benchmark + data model residual learning + dynamic weight optimization". It employs recursive least squares to update the weights of the prediction model, achieving data model optimization guided by physical mechanisms, balancing prediction accuracy and physical consistency, and taking into account physical interpretability, prediction accuracy, and real-time performance. The physical model provides prior knowledge, reducing the dependence of the data-driven model on the amount of training data. To address the adaptation problem of time-varying thermal error characteristics, a dynamic weight optimization mechanism is constructed to correct prediction deviations caused by factors such as fluctuations in contact thermal resistance and sudden changes in operating conditions in real time, improving the model's stability under varying operating conditions and long-term operation scenarios. Attached Figure Description

[0022] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a schematic diagram of the electric spindle thermal error modeling method based on physical and data hybrid drive of the present invention; Figure 2 This is a schematic diagram of the electric spindle thermal network model of the present invention; Figure 3 A schematic diagram of the XGBoost basic learner; Figure 4 This is the RLS adaptive flowchart. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.

[0024] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0025] The terms “comprising” and “having”, and any variations thereof, in the specification and claims of this application are intended to cover non-exclusive inclusion, for example, a process, method, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or apparatus.

[0026] Explanation of related terms: Thermal error: Error caused by structural deformation due to temperature changes, resulting in changes in relative position.

[0027] Thermal error residual: The difference between the theoretically estimated / model-predicted thermal error and the actual thermal error.

[0028] Temperature residual: The difference between the theoretically estimated / model-predicted temperature and the actual temperature.

[0029] Hot nodes: These are key locations where temperature needs to be obtained when modeling the temperature field of an electric spindle. They are defined based on the network partitioning and can be either temperature nodes or heat source nodes.

[0030] Example 1: This embodiment of the invention provides a method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach, referring to... Figure 1 It includes the following steps: Step 1: Establish a high-speed electric spindle thermal network model and end-to-end thermal error modeling (mechanism model); Reference Figure 2 This invention establishes a global thermal network analysis model for the motor spindle system. Figure 2A thermal resistance network model of the motor spindle, composed of coaxial cylindrical tube units, is shown, with heat transfer occurring in both the axial and radial directions. Figure 2 As shown, the physical structure of the cooling and natural convection system and the motor spindle is decomposed into multiple units, forming a thermal resistance network. Each unit is assigned a number, and each unit has one degree of freedom (degree of freedom is a fundamental parameter in thermodynamics characterizing the number of independent variable intensity parameters of a phase equilibrium system; in this invention, the degree of freedom is the average temperature). In this model, thermal resistance mainly includes the thermal convection resistance between the solid and the fluid, the thermal conduction resistance within the solid, and the thermal contact resistance between the solid contact surfaces. For thermal conduction, the model assumes that the geometric center of the unit is the representative location of the average temperature, and heat flows from this location to the central node of the adjacent unit through the contact surface. For thermal convection, the model assumes that the surface temperature is close to the center temperature, and heat exchange between the surface and the cooling fluid occurs via convection through the surface area. For thermal contact, the temperature of the contact surface constructed in this model is close to the center temperature, and heat is transferred at the actual contact points and contact gaps between adjacent nodes. Thermal radiation has a small effect on the temperature field of the motor spindle and can be ignored. We assume that ambient air and cooling water can quickly remove heat, and ignore the temperature changes of ambient air and cooling water caused by heat transfer. Therefore, the thermal resistance network model has an isothermal boundary.

[0031] According to Kirchhoff's voltage and current laws, the first... The heat balance equations for each hot node can be determined in the following way: ; Where, in the formula, This is the total number of hot nodes; It is the first The temperature of each hot node; It is the first The total number of adjacent hot nodes of a hot node; Is with the first The adjacent hot nodes are the first The temperature of each hot node; It is the first The hot node and the first The sum of the three different types of thermal resistance between each thermal node; Indicates the time interval from the first... The node to the first Heat flow at each node; It is the first The heat generated by the first thermal node per unit time; if the first If a node is not a heat source node, then ; It is the first Temperature change rate at each node; It is the first Specific heat capacity of each node; It is the first The quality of each node It's density. It is volume; Indicates the first Each node corresponds to a change in the amount of heat generated by its temperature change.

[0032] The above thermal balance equation demonstrates that the thermal resistance network satisfies the law of conservation of energy. The thermal resistance network can be likened to a circuit system, where the heat source is equivalent to the power source, the heat flow is equivalent to the current, the thermal resistance is equivalent to the resistance, and the temperature is equivalent to the voltage. Based on the heat power generated by the heat source nodes and the thermal resistances in the thermal network model, the temperature of each heat node can be calculated (wherein, the heat power can be solved based on the heat generation rate of the motor and bearings, and the thermal resistances such as heat conduction and heat convection can be calculated based on the material properties and morphology. The specific calculation methods for heat power and thermal resistance are as follows).

[0033] 1. Heat conduction: After partitioning the electric spindle into a thermal network, thermal resistance calculations are required. Based on the thermal characteristics of the electric spindle, heat can be generated through either conduction or convection. Here, we assume the materials in the thermal network model are isotropic and neglect the effect of temperature changes on thermal conductivity. Based on a one-dimensional heat conduction model, the conductive thermal resistance is divided into axial thermal resistance. and radial thermal resistance There are two types of thermal resistance. Axial thermal resistance refers to the resistance encountered when heat is conducted along the axis of the spindle, mainly describing the transfer of heat from the high-temperature area in the middle of the spindle (mainly the motor rotor area) to both ends (front bearing / tool ​​holder, rear bearing). Radial thermal resistance refers to the resistance encountered when heat is conducted along the radius of the spindle (perpendicular to the axis), mainly describing the transfer of heat from the inside to the outside, and from the heat source to the cooling medium. The formula is as follows: ; In the formula, Outer diameter; Inner diameter; Thermal conductivity; The length of the cylinder.

[0034] 2. Heat convection: Convective heat transfer is divided into natural convection and forced convection. The convective heat transfer in a motor spindle system includes three types. The first is natural convection heat transfer between the outer surfaces of the entire machine (cylindrical outer surface and vertical end face) and the air. The second is forced convection heat transfer between the outer surfaces of rotating components (cylindrical outer surface and vertical end face) and the surrounding air. The third is forced convection heat transfer between the cooling jacket and cooling water, and between bearing balls and grease. Thermal convection resistance characterizes the thermal interaction between component surfaces and adjacent fluids. It can be represented as: ; In the formula, For heat dissipation area; This refers to the heat dissipation coefficient (each heat dissipation coefficient is calculated as follows).

[0035] (a) Cooling water channel heat dissipation: Here, we introduce two physical quantities: the Reynolds number (Re) and the Prandtl number (Pr). The Reynolds number assesses the flow state of the cooling water, while the Prandtl number assesses the relative thickness between the flow boundary layer of the cooling water and the thermal boundary layer of the cooling water jacket.

[0036] ; In the formula, Where is the diameter of the cooling water jacket, in meters (m). Specific heat capacity of the cooling medium, J / kg / K; The velocity of the cooling water in the spiral water jacket is m / s; Where is the dynamic viscosity of cooling water, Pa·s; m is the kinematic viscosity of the cooling water. 2 / s; is the thermal conductivity, W / (m·K).

[0037] Calculate the Reynolds number of each fluid. And Prandtl Then the Nusselt number, which is related to the convective heat transfer coefficients of the motor stator and cooling water, can be calculated: ; In the formula, Represents the Nusselt number; Let be the equivalent diameter of the spiral water jacket cooling water channel, in meters (m). The length of the spiral pipe is in meters (m). Substituting the Nusselt number into the following formula, the heat transfer coefficient between the stator and the water-cooled channel can be calculated. : ; In the formula, is the static thermal conductivity of the fluid, W / (m·K).

[0038] (b) Air heat transfer coefficient between stator and rotor: In an electric spindle structure, an air gap exists between the rotor and stator. The rotor transfers heat through this gap gas; therefore, the convective heat transfer coefficient of the gap gas can be expressed as: : ; In the formula, The thickness of the air gap between the stator and rotor, in meters (m). Let be the radius of the electric spindle rotor, in meters. The thermal conductivity of air is W / (m·K); denoted as the axial clearance length between the stator and rotor, in meters (m).

[0039] (c) Heat transfer coefficient between rotor end and air: The front and rear end faces of the motor rotor come into contact with the outside air for convective heat transfer. Therefore, it is necessary to analyze and calculate the average air velocity between the motor stator and the motor rotor, and then calculate the heat transfer coefficient between the motor rotor and the air using a formula. : ; In the formula, The average air velocity between the stator and rotor of the motor, in m / s; denoted as the axial air velocity of the motor rotor and stator, in m / s; The average radial velocity of the air between the motor rotor and stator is denoted as m / s.

[0040] The cylindrical outer surface of the electric spindle dissipates heat from the surrounding air through natural convection. The asymmetric airflow distribution on the cylindrical surface causes a radial variation in the local heat transfer coefficient. The Nusselt number corresponding to the thermal convection resistance between the cylindrical outer surface and the surrounding air can be calculated as follows: ; Convective heat transfer between a stationary outer surface and the ambient air is typically constant. The indoor airflow rate is close to zero, and the heat transfer coefficient corresponding to the thermal convection resistance between the entire stationary outer surface of the machine and the ambient air can be 9.7 W / (m·K).

[0041] 3. Heat generation rate of motor and bearings: Ignoring motor wind resistance, all power losses occur as heat generation. Based on the law of conservation of energy, the motor heat generation can be calculated indirectly. The motor's input power is then distributed among bearing friction heat, motor heat generation, and power used to resist electromagnetic torque. The motor's output torque consists of load torque and electromagnetic torque. Under no-load conditions, the output torque is entirely used to resist electromagnetic torque. Therefore, the motor's heat generation power can be expressed by the following formula: ; In the formula, Actual input power of the motor, W; Heat is generated by friction in the bearing, W; The heat power loss of the motor is expressed in W. The output power of the electric spindle is kW; The voltage of the motor is V; Motor current, A; for……; Electromagnetic torque, N / m; The motor speed is expressed in rpm.

[0042] Based on empirical formulas and the scale of the three-dimensional stator and rotor model of the electric spindle, the heat generation rate of the electric spindle stator is calculated. and rotor heat generation rate Then we can obtain the result from the following formula: ; ; In the formula, The thermal power of the motor is expressed in W. The motor volume is in mm. 3 ; For motor efficiency, ∈[0.89,0.92]; Outer diameter, mm; Inner diameter, mm; Length, in mm.

[0043] During spindle operation, the motion of the bearing rollers is complex, but it is essentially a form of frictional heat generation influenced by force and speed. Therefore, the specific amount of heat generated by the bearing depends on the rotational speed and the preload. Based on the law of conservation of energy, the Palmgren empirical formula is used to calculate the bearing's heat generation power: ; In the formula, The torque that resists the rotation of the bearing is Nm.

[0044] The main parameters affecting bearing torque are rotational speed and lubrication conditions, which can be expressed by the following formula: ; ; In the formula, , The resistance torque during bearing operation ( The torque is generated by the change in rotational speed. The torque generated by the preload (Nm) is affected by the bearing lubrication method and the preload, respectively. The bearing pitch circle diameter is in mm. The coefficient of performance is the lubrication factor. Load factor; Weighted load; This refers to the viscosity of the lubricant.

[0045] The heat generation rate of the bearing can then be obtained. : ; In the formula, The bearing volume is in mm. 3 ; The volume of the inner ring; The volume of the outer ring; The volume of the rolling element; This represents the number of rolling elements.

[0046] Temperature changes cause thermal expansion of the structure. Therefore, by constructing a thermal resistance network to represent the temperature changes at key locations, the axial thermal expansion deformation of the electric spindle can be calculated using the following temperature-structure mapping model. : ; In the formula, The coefficient of thermal expansion of the material; This refers to the axial length. For the first Instantaneous temperature of the node; For the first The reference temperature of the node (i.e., the initial temperature, generally referring to room temperature); This represents the total number of nodes.

[0047] Step 2: Construct a thermal error residual model based on XGBoost (data-driven); In its axial thermal error prediction system, the XGBoost model does not directly predict the axial thermal error itself, but focuses on "residual prediction." This involves learning the deviation between the baseline axial thermal error output by the thermal resistance network and the actual axial thermal error. This is because, in actual operation, individual differences and degradation of different electric spindles cause deviations in the physical model's predictions. This invention improves overall accuracy by predicting this thermal error residual. Its core role is to supplement the physical model. Through the strong nonlinear fitting capability of ensemble learning, it captures factors that the physical model struggles to cover, such as contact thermal resistance fluctuations, bearing axial friction thermal nonlinear coupling, and component micro-deformation, thus improving the axial thermal error prediction accuracy to the μm level. Its applicable scenarios focus on the axial thermal deformation control of electric spindles, especially suitable for high-end CNC machine tool scenarios requiring real-time compensation. It can cover the entire operating stage, including cold start, thermal rise, thermal equilibrium, and operating condition switching (speed / axial load changes), and is compatible with typical workshop operating environments of 15℃~35℃. It exhibits strong robustness to temperature acquisition noise and small fluctuations in operating conditions.

[0048] Input feature data prioritizes parameters strongly correlated with axial residuals: temperature signals include front bearing temperature, rear bearing temperature, stator front end temperature, and ambient temperature (front bearing temperature is the core, accounting for over 70%, directly related to axial frictional heat and deformation); operating parameters include spindle speed, axial load torque, and running time (speed and axial load couple and affect bearing frictional heat, while running time reflects the degree of axial heat accumulation). The data acquisition device uses a PT1000 high-precision temperature sensor (response time <10ms, accuracy ±0.1℃), with a sampling frequency of 10~50Hz, synchronized with the electric spindle control system.

[0049] The label data is the true residual of axial thermal error, and the acquisition process is as follows: The true value of axial thermal error is acquired using a laser interferometer (such as Renishaw XL-80) or an eddy current displacement sensor; the synchronous temperature and operating parameters are input into a thermal resistance network to calculate the baseline value of axial thermal error (in this invention, thermal elongation deformation is used as an equivalent to thermal error); the true residual is calculated according to the following formula and used as the model training label: ; In the formula, Indicates the true thermal error; This represents the thermal error predicted by the physical model (i.e., the amount of thermal elongation deformation in step one). This represents the thermal error residual.

[0050] During computation (e.g., when finding the minimum value of a function), XGBoost continuously builds new decision trees (i.e., base learners) to calculate and fit the residuals predicted by the previous subtree. This process gradually reduces the residual error between the predicted and actual values, thereby improving prediction performance.

[0051] When dealing with regression prediction tasks, we define a training set. : ; In the formula, n samples and h features form the training dataset. Represents input features, For the target variable, The set is real numbers. The process of achieving the task objective involves progressively constructing a set of decision trees to approximate the true target value. In XGBoost, we build strong learners by adding decision trees (i.e., base learners). In other words, the final prediction is the cumulative sum of the predictions from multiple base learners. A diagram of each base learner is shown below. Figure 3 As shown.

[0052] During the solution process, XGBoost optimizes its parameters by minimizing them; The following objective function is implemented: ; This represents the loss function, used to calculate the deviation between the predicted and actual values. This represents the regularization term, which measures the complexity of the model and helps prevent overfitting. For regression prediction tasks, we choose the mean squared error (MSE) as the loss function for the objective function, which can be described as follows: ; In the formula, Let represent the loss function, where These are the true values ​​in the training set. It is the first The predicted value for each iteration. In each iteration, XGBoost continuously adds and trains new decision trees to fit the residuals of the previous iteration. Therefore, the predicted value for each sample is obtained by summing the scores of each leaf node of the decision tree. This process is described as follows: ; in, This represents the total number of trees. Indicates the first A tree, This indicates that when the input is Time Output of the tree. Function Indicates each sample The mapping relationship between each leaf node and the sample point. Specifically, for a leaf node in XGBoost, we need to calculate the mapping relationship between each sample point and the sample point. The probability of belonging to that leaf node. Therefore, It provides a mapping relationship (the probability that a sample point belongs to a certain leaf node). Essentially, it is a matrix where the number of rows equals the number of sample points and the number of columns equals the number of leaf nodes. Represents each sample The weights at each leaf node. In other words, it is the weight of each sample. The loss value is obtained at a leaf node using the loss function. When minimizing the loss, these weights are aggregated to predict each sample. The value of each true target value Therefore, the objective function can be further expressed as: ; ; in, Represents the loss function; Indicates the predicted value; Indicates the first A decision tree; Indicates weight; and These represent the splitting threshold and the L2 regularization factor, respectively. They are both regularization coefficients used in XGBoost to prevent or reduce overfitting. It represents the total number of leaf nodes. This indicates the iteration number, and also indicates that the current calculation is for the i-th iteration. tree (number) (a base learner). Therefore, the optimization objective of the objective function can be expressed as follows: ; ; ; in, It is a constant that does not affect the minimum solution. In the... In the next iteration, the predicted value Compared with the previous round ( Predicted value The relationship between them can be expressed by the following equation: ; Therefore, we obtain the optimization objective of the objective function. Generally, we can use gradient descent for multiple iterations to optimize the parameters. However, tree models are stair-like and discontinuous, making this approach unsuitable. When samples are input into the model, different samples are assigned to different leaf nodes. Each leaf node computes a node value (predicted value). Subsequently, using the loss function L, we obtain the loss for each leaf node. Therefore, minimizing the objective function can be viewed as minimizing the sum of the losses for each leaf node. For each leaf node, its own loss value is determined solely by its predicted value (the magnitude of each actual target value y is constant). Therefore, as long as the deviation between the predicted value and the true value for each leaf node is minimized, the cumulative loss value of all leaf nodes will be minimized, thus minimizing the objective function. The deviation between the predicted value and the true value is calculated using the MSE (Mean Separation of Predicted and True Values).

[0053] The number of samples assigned to each leaf node can vary from one to multiple. We define the node sample set as I, which establishes a mapping between the node set I and the samples: ; Furthermore, since the expression for the cumulative loss values ​​of all leaf nodes is also a quadratic equation, we rewrote the minimization of the objective function: ; ; ; Since we cannot know the specific expression of the loss function L in advance each time we build the model, we cannot directly derive the formula for the minimum value. To obtain an approximate loss function, we use the second-order Taylor expansion of the function L: ; ; in and They represent the first The first and second gradients of the decision tree are obtained. ; ; ; ; ; in and Representing leaf nodes respectively The sum of all first gradients and all second gradients. The loss function L is a convex function with a second derivative greater than zero. Therefore, Since the regularization coefficient λ is greater than zero, the upward take-off of this univariate quadratic equation yields its minimum value: ; ; Step 3: Adaptive update model based on recursive least squares (RLS);

[0054] An adaptive gain G(t) update mechanism is designed based on the recursive least squares (RLS) method. The core objective is to solve the engineering pain points of XGBoost model parameters being fixed and unable to adapt to time-varying thermal characteristics and the difficulty in collecting online real thermal error values. By dynamically adjusting the weight ratio of the initial residual of XGBoost, high-precision thermal error closed-loop prediction relying solely on temperature signals is achieved, taking into account both real-time performance and feasibility.

[0055] The adaptive gain G(t) is defined as a single scalar weight estimated in real time by the RLS algorithm, serving as a dynamic bridge between the static residual of XGBoost and the physical baseline value of the thermal resistance network. By dynamically tracking the time-varying law of G(t) through RLS recursion, the initial residual output by XGBoost is adaptively weighted and corrected, ultimately optimizing the accuracy of thermal error prediction and bridging the gap between the static model and dynamic operating conditions. Simultaneously, it adheres to four core design principles, balancing engineering feasibility and technical adaptability: using only easily acquired temperature signals and operating parameters throughout the process, and constructing alternative feedback quantities... This approach avoids the challenge of online acquisition of real thermal error values ​​to adapt to industrial environments. The RLS algorithm is simplified to a single scalar update logic, containing only basic arithmetic operations to ensure millisecond-level latency, meeting the real-time compensation control requirements of electric spindles. By balancing historical patterns with current data weights through a forgetting factor, it accurately tracks time-varying thermal characteristics such as contact thermal resistance fluctuations, sudden changes in operating conditions, and component aging, prioritizing dynamic adaptability. It requires no modification to the original thermal resistance network and XGBoost model structure, achieving dynamic correction only through gain weighting, and can be seamlessly integrated into existing thermal error prediction technologies, exhibiting extremely high compatibility. The method's flow is as follows: Figure 4 As shown.

[0056] The initial parameters of RLS and gain are calibrated based on offline experimental data under multiple operating conditions to ensure stability and sensitivity during online startup. The initial gain G(0) is set to 1.0 by default, which means that the effectiveness of the XGBoost residual is recognized in the initial state. The optimal initial value can also be calibrated through offline real thermal error data to reduce the correction deviation in the startup stage and accelerate the convergence of the algorithm. Since G(t) is a single scalar gain, the covariance matrix is ​​simplified to a scalar, and the initial covariance P(0) is set to 1000 (a large positive number) to ensure that the weight update in the initial stage is sensitive to the feedback signal and quickly adapts to the initial changes in thermal characteristics. The forgetting factor λ is determined by offline data optimization, with a value range of 0.96~0.99. Among them, λ=0.98~0.99 is suitable for stable operating conditions, focusing on historical update experience to ensure stability, and λ=0.96~0.97 is suitable for sudden operating conditions and contact thermal resistance fluctuations, which enhances the timeliness of the current data to improve the tracking capability.

[0057] Using composite bias derived from temperature signals to replace the uncollectible true residuals as feedback for RLS updates, this section first explains the problem that recursive least squares aims to solve. Its main purpose is to estimate unknown parameters in real time for a linear parametric model when data arrives point by point. ; In the formula, For observation; The regression vector is known; The parameter to be estimated; This is the input noise.

[0058] Here, RLS updates parameters through real-time input data. It's important to note that in this invention, RLS does not update the parameters of the entire XGBoost model. Instead, the model parameters are fixed during offline runtime, and updates are only made using data from temperature sensors at sensitive points. Therefore, the thermal error residual model can be approximated as: ; In the formula, It is a scalar gain that is unknown and updates slowly. Its core function is to adjust the gain in real time based on changes from the real-time temperature sensor. This represents the actual thermal error residual. This represents the thermal error residual predicted by the XGBoost model.

[0059] Because it is difficult to obtain accurate thermal error values ​​of the electric spindle in real time during actual model deployment, and the displacement measurements currently available are costly and noisy, but real-time temperature values ​​are relatively easy to obtain, thus enabling the calculation of real-time temperature residuals. : ; In the formula, This is real-time temperature sensor data; This represents the predicted node temperature for the thermal resistance network. Physically, since thermal deformation is derived from the integration of the temperature field, deviations in the temperature field inevitably lead to deviations in the structural field (i.e., thermal errors are caused by temperature changes, and there is a correlation between the two). Therefore, by mapping temperature changes to structural changes, the core online regression model of this invention can be constructed: ; This is the bias (i.e., the bias of the linear model).

[0060] This constructs a linear model of the system's input and output. When the system receives N sets of data, the model can be rewritten in matrix form: ; In the formula, The input vector; For data matrices; , which is a noise vector; the parameters are found by batch processing using LS (least squares). To minimize the sum of squared residuals, i.e.: ; Represents discrete time points; here right By taking the derivative and setting it to zero, we can obtain the objective function: ; Solving for parameter estimates in batch processing LS : ; Define the covariance matrix: ; The parameter estimates for the original batch processing LS can then be expressed as: ; The above describes the parameter identification process using the least squares method. However, when a large amount of new data arrives (k=N+1), the system needs to recalculate. Conversely, the computational load of the system increases, and data from N time points ago needs to be stored in real time, making it impossible to perform real-time estimation online.

[0061] Therefore, the core of RLS is recursive updating, using the estimate at time N to estimate... and Combined with the new data at time N+1 We can directly obtain the estimated value at time N+1. and .

[0062] The main process of real-time updating of thermal error is as follows: Gain Update: ; Parameter update: ; Covariance update: ; In the above formula: ; The forgetting factor is set to (0.95, 1).

[0063] The overall update process is as follows: ; The above process can be used to adaptively update the thermal error of the electric spindle.

[0064] Step 4: Finally, output the adaptively dynamically updated thermal error model; The final output is an adaptively dynamically updated thermal error model. for: ; in, This refers to the thermal elongation calculated from the thermal resistance network based on the temperature-structure mapping in step one (i.e., the thermal error predicted by the physical model). This refers to the thermal error residuals predicted by the XGBoost model in step two (i.e., the thermal error residuals predicted by data-driven methods). Step three involves adaptively weighting and correcting the initial residuals output by XGBoost using the RLS method. Through these three main parameters, this invention achieves a hybrid physical and data-driven approach, adapting the static model to dynamic operating conditions and optimizing the accuracy of thermal error prediction.

[0065] Understandably, although the methods described above are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and conceived.

[0066] Furthermore, this embodiment of the invention also provides a computer device for implementing the above embodiments and preferred embodiments, and details already described will not be repeated. The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements the steps described in the method embodiments.

[0067] Specific examples in this embodiment can be found in the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0068] Embodiments of the present invention also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in the above method embodiments when running.

[0069] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0070] The sequence numbers of the above embodiments are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The descriptions of each embodiment in the above embodiments have different emphases; for parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0071] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach, characterized in that, include: Structural and thermal analyses were performed on the electric spindle to construct a thermal network model of the electric spindle and determine the thermal resistance, heat source parameters, and distribution of heat conduction and heat convection. The thermal node temperature is calculated based on the thermal network model, and the thermal elongation deformation of the electric spindle is calculated based on the temperature-structure mapping model. The thermal elongation deformation of the electric spindle is equivalent to the thermal error of the electric spindle. The actual temperature and actual thermal error of the electric spindle under time-varying conditions are collected. The temperature residual and the actual thermal error residual are calculated based on the calculated hot node temperature and the electric spindle thermal error. A thermal error residual prediction model based on XGBoost is constructed, with preprocessed temperature signals and operating parameters as inputs and the actual thermal error residuals as labels, and the residual prediction model is trained. The residual predicted by the residual prediction model is updated by weighting the residual predicted by the recursive least squares method, and a dynamically adjusted residual model is output. The dynamically adjusted residual model is the product of the predicted thermal error residual and the scalar gain, and the scalar gain is adjusted in real time according to the temperature residual. Based on the dynamically adjusted residual model and the thermal elongation deformation of the electric spindle, an adaptive dynamically updated thermal error model is obtained, which is used to predict the thermal error of the electric spindle according to the temperature signal and operating parameters.

2. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, The structural and thermal analysis of the electric spindle, the construction of its thermal network model, and the determination of thermal resistance, heat source parameters, and the distribution of heat conduction and convection include: The physical structure of the motor spindle and the cooling and natural convection system are decomposed into multiple units, each of which is assigned a number and a degree of freedom, namely its average temperature, to form a thermal network. Ignoring thermal radiation, the thermal resistance in the thermal network is divided into thermal convection resistance between the solid and the fluid, thermal conduction resistance inside the solid, and thermal contact resistance between the solid contact surfaces. The heat distribution of the thermal network is divided into heat conduction, heat convection and heat contact. For heat conduction, the geometric center of the unit is set as the representative position of the average temperature. Heat flows from the geometric center to the central node of the adjacent unit through the contact surface. For thermal convection, the surface temperature is set as the core temperature, and the heat exchange between the surface and the cooling fluid occurs through the surface area in a convection manner. For thermal contact, the temperature of the contact surface is set as the center temperature, and heat is transferred in the actual contact points and contact gaps between adjacent nodes. And ignore the temperature changes of ambient air and cooling water caused by heat transfer, and set the thermal network to have a constant temperature boundary.

3. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, The calculation of hot node temperatures based on the thermal network model includes: Based on Kirchhoff's voltage and current laws, the heat balance equation at the hot node is established by summing the heat flowing into the hot node and the heat generated by the hot node, which is equal to the heat change due to the temperature change at the hot node. The thermal resistance in the thermal network model is divided into axial thermal resistance and radial thermal resistance. The axial thermal resistance and radial thermal resistance of the thermal node are calculated based on the inner diameter, outer diameter, shaft length and thermal conductivity of the component. Calculate the thermal convection resistance between the component surface and the adjacent fluid based on the heat dissipation area and the corresponding heat dissipation coefficient of the fluid. The heat generation power of the motor is calculated based on the actual input power of the motor, the output power of the electric spindle, and the heat generated by bearing friction. The heat generation rate of the electric spindle stator and the heat generation rate of the rotor are calculated based on empirical formulas and the scale of the three-dimensional stator and rotor model of the electric spindle. Based on the resistance torque of the bearing during operation, and in accordance with the law of conservation of energy, the heat generation power of the bearing is calculated using the Palmgren empirical formula. The temperature of the heat node is calculated by substituting the heat power generated by each heat source node and the thermal resistance of each heat network model into the heat balance equation.

4. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 3, characterized in that, No. The heat balance equations for the hot nodes are: ; In the formula, This is the total number of hot nodes; It is the first The temperature of each hot node; It is the first The total number of adjacent hot nodes of a hot node; Is with the first The adjacent hot nodes are the first The temperature of each hot node; It is the first The hot node and the first The sum of different types of thermal resistance between each thermal node; It is the first The heat generated per unit time at the first thermal node, if the first... If a node is not a heat source node, then ; It is the first Temperature change rate at each node; It is the first Specific heat capacity of each node; It's density. It is volume; Among different types of thermal resistance, axial thermal resistance radial thermal resistance Thermal convection resistance In the formula, Outer diameter; Inner diameter; Thermal conductivity; The length of the cylinder For heat dissipation area; Heat dissipation coefficient.

5. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 4, characterized in that, The heat dissipation coefficient includes the heat transfer coefficient between the stator and the water-cooling channel, the air heat transfer coefficient between the stator and the rotor, and the heat transfer coefficient between the rotor end and the air. The heat transfer coefficient between the stator and the water-cooled channel is calculated as follows: by introducing the Reynolds number and Prandtl number, the Nusselt number related to the convective heat transfer coefficient between the motor stator and the cooling water is calculated; then, the heat transfer coefficient between the stator and the water-cooled channel is obtained by dividing the product of the Nusselt number and the static thermal conductivity of the fluid by the equivalent diameter of the cooling water channel. The calculation of the air heat transfer coefficient between the stator and rotor is as follows: calculate the first ratio of the air gap thickness between the stator and rotor to the radius of the electric spindle rotor, calculate the second ratio of the air thermal conductivity to the axial gap length between the stator and rotor, and use a power function with Reynolds number, the first ratio and the second ratio as the base to calculate the air heat transfer coefficient between the stator and rotor. The heat transfer coefficient between the rotor end and the air is calculated as follows: the average air velocity between the motor rotor and stator is calculated based on the axial and radial air velocities of the air between the motor rotor and stator, and the heat transfer coefficient between the rotor end and the air is calculated based on the average air velocity between the motor rotor and stator.

6. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 3, characterized in that, The heat generation power of the motor The calculation formula is: ; In the formula, Actual input power of the motor; Heat is generated by friction in the bearings; This refers to the heat power loss of the motor. This refers to the output power of the electric spindle; This refers to the motor voltage; This refers to the motor current. Electromagnetic torque; This refers to the motor speed; Phase angle; Electric spindle stator heat generation rate and rotor heat generation rate The calculation formula is: ; ; In the formula, This refers to the thermal power of the motor. This refers to the motor's volume; For motor efficiency; Outer diameter; Inner diameter; For length; heat generation rate of bearings The calculation formula is: ; In the formula, This refers to the bearing volume; The volume of the inner ring; The volume of the outer ring; Let the volume be the volume of the rolling element; Number of rolling elements; bearing friction generates heat. ; This refers to the bearing speed; The torque that resists the rotation of the bearing, ,in, ; In the formula, , Both are resistance torques; the former is affected by bearing lubrication strategy, while the latter is affected by shaft preload. The bearing pitch circle diameter; The coefficient of performance is the lubrication factor. Load factor; Weighted load; This refers to the viscosity of the lubricant.

7. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, The temperature-structure mapping model is as follows: ; In the formula, The coefficient of thermal expansion of the material; This refers to the axial length. For the first Instantaneous temperature of the hot spot; For the first Reference temperature of the hot node; This represents the total number of hot nodes.

8. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, Training the residual prediction model includes: Define a training set of input features and target variables, and gradually construct a set of decision trees to approximate the true target value to achieve the task objective; Adding a decision tree to build a strong learner, the final prediction result comes from the cumulative sum of the predictions of multiple base learners; During the solution process, XGBoost parameter optimization is achieved by minimizing an objective function, which includes a loss function and a regularization term. The loss function is the mean squared error between the true and predicted values. XGBoost continuously adds and trains new decision trees to fit the residuals of the previous iteration. The predicted value for each sample is obtained by summing the scores of the leaf nodes of each decision tree. When samples are input into the model, different samples are assigned to different leaf nodes. Each leaf node calculates a node value. By using a loss function, the loss of each leaf node is obtained. By minimizing the cumulative loss value of all leaf nodes, the objective function is minimized.

9. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, The step of updating the weights of the thermal error residuals predicted by the residual prediction model using the recursive least squares method includes: The thermal error residual model is set as follows: ; In the formula, The gain is scalar, and is adjusted in real time based on changes in the real-time temperature sensor. This represents the actual thermal error residual. The thermal error residuals predicted by the XGBoost model; Calculate the real-time temperature residual : ; In the formula, This is real-time temperature sensor data; These are the predicted node temperatures for the thermal resistance network. Based on the aforementioned thermal error residual model and the online regression model for real-time temperature residual updates: ; For the bias of the linear model; Construct a linear model of the system's input and output. When the system receives N sets of data, the matrix form of the model is: ; In the formula, The input vector; For data matrices; These are weight parameters; This is the noise vector; The parameters are found by batch processing the least squares method. To minimize the sum of squared residuals, i.e.: ; Represents discrete time points; pass right Taking the derivative and setting it to zero yields the objective function: ; Solving for parameter estimates using batch least squares method : ; Define the covariance matrix: ; The parameter estimates for the original batch processing least squares method can then be expressed as: ; Estimate using the estimate at time N and Combined with the new data at time N+1 The estimated value at time N+1 is obtained. and The gain is updated as follows: ; The parameters are updated as follows: ; Covariance updated to: ; In the formula, ; Forgetting factor; The model weights are then updated as follows: .

10. The method for modeling thermal errors of an electric spindle based on a hybrid physical and data-driven approach according to claim 1, characterized in that, The adaptively dynamically updated thermal error model is as follows: ; In the formula, This refers to the thermal elongation calculated based on the temperature-structure mapping model. This is the dynamically adjusted residual model, where, For scalar gain, This represents the thermal error residual predicted by the XGBoost model.