A spindle heating power ai prediction method and system based on g code analysis

CN123013665APending Publication Date: 2026-10-30因中智能科技(昆明)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611180921.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

现有主轴热预测方法主要分为三类:一是基于温度传感器的数据驱动方法,仅依赖温度历史数据进行时序外推,未考虑加工工艺参数变化,变工况下预测精度显著下降;二是基于实验G代码的离线建模方法,属于离线标定方式,无法在线实时适应工况变化;三是基于物理机理的计算方法,依赖大量材料参数和人工取值,计算复杂且难以在线运行

Benefits of technology

(1)电机发热功率的预测采用“当前实测校准+未来理论推算”的策略,以驱动器实测功率校准理论计算值,避免了纯理论估算的误差累积,预测精度显著提高。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_3
    Figure QLYQS_3
Patent Text Reader

Abstract

The application discloses a main shaft heating power AI prediction method and system based on G code analysis, relates to the technical field of numerical control machine tool thermal management, and calculates future theoretical cutting power and theoretical motor heating power by pre-reading and analyzing G code process parameters in a future time window in combination with motor efficiency characteristic curves; meanwhile, the theoretical motor heating power is online calibrated by real-time input power read from the main shaft driver at the current time, a future motor heating power prediction value is obtained, and then the theoretical heating power is synthesized. With the theoretical heating power, the current actual heating power, the main shaft rotating speed, the cooling liquid inlet temperature and the environmental temperature as input characteristics, a deviation prediction value between the theoretical value and the actual value is output by a pre-trained AI model, the future heating power prediction value is obtained by adding the theoretical heating power and the deviation prediction value, and a feedforward control amount is generated. The application combines physical mechanism and AI prediction, and realizes high-precision prediction of the main shaft heating power under variable working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of spindle heating power prediction methods and systems, and in particular to an AI prediction method and system for spindle heating power based on G-code parsing. Background Technology

[0002] CNC machine tool spindles generate significant cutting and frictional heat during high-speed, heavy-load machining, leading to thermal deformation and severely impacting machining accuracy. Accurate prediction of spindle heat generation is a prerequisite for thermal error compensation and thermal management. Existing spindle thermal prediction methods mainly fall into three categories: first, data-driven methods based on temperature sensors, which rely solely on historical temperature data for time-series extrapolation, failing to consider changes in machining process parameters, resulting in a significant decrease in prediction accuracy under varying operating conditions; second, offline modeling methods based on experimental G-code, which are offline calibration methods and cannot adapt to changes in operating conditions in real-time; and third, calculation methods based on physical mechanisms, which rely on numerous material parameters and manual values, making calculations complex and difficult to implement online. None of these methods deeply integrate G-code process parameter analysis with AI prediction, nor do they address the issue of online calibration of motor heat generation power, making it difficult to achieve high-precision real-time prediction under varying operating conditions. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide an AI prediction method and system for spindle heating power based on G-code parsing, which can accurately predict the heating power of the spindle at future moments.

[0004] To address the aforementioned technical problems, this invention provides an AI prediction method for spindle heating power based on G-code parsing, comprising the following steps: S1. Real-time acquisition of spindle operating data: Acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); S2. Calculate the actual heat generation power: Calculate the actual heat generation power Q carried away by the coolant according to the following formula. actual( t): ; Where c p This refers to the specific heat capacity of the coolant. S3. Pre-read and parse G-code process parameters: Pre-read the future time window Δt of the CNC system. window The G-code instructions within the code are parsed segment by segment to extract the process parameter vector, which includes at least the spindle speed n and the feed rate v. f Cutting depth a p Cutting width a e ; S4. Calculate the theoretical cutting power: Based on the process parameter vector, calculate the theoretical cutting power P at the future (t+τ) time. cut (t+τ); where τ is the prediction lead time; S5. Predict the motor heating power P at time (t+τ) motor (t+τ): S51. Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the current time t. motor_theory (t); S52. Based on the spindle speed and cutting parameters at the future time (t+τ), and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the future time (t+τ). motor_theory (t+τ); S53. The real-time input power P read from the spindle driver at the current time t. in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); S54, and based on the current measured motor heating power P motor_actual (t) and the current theoretical motor heating power P motor_theory The ratio of (t) is used as the calibration coefficient k. cal (t): ; S55, the calibration coefficient k cal (t) is applied to the theoretical motor heating power at time (t+τ), yielding the predicted motor heating power P at time (t+τ). motor (t+τ): ; S6. Calculate the theoretical heating power Q at time (t+τ). theory (t+τ): Q theory (t+τ)=P cut (t+τ)+P motor (t+τ); S7, AI thermal prediction model prediction bias: The theoretical heating power Q... theory (t+τ) and the current spindle speed n(t), and the current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb As input features, they are fed into a pre-trained AI thermal prediction model, which outputs a predicted deviation ΔQ(t+τ) between the theoretical and actual future thermal power. S8, The theoretical heating power Qtheory Adding (t+τ) to the predicted deviation ΔQ(t+τ) yields the predicted heating power Q at the future time (t+τ). pred (t+τ): Q pred (t+τ)=Q theory (t+τ)+ΔQ(t+τ); S9. Generate feedforward control quantity: based on the predicted future heating power value Q. pred (t+τ) and the current steady-state heating power Q steady Calculate the feedforward control quantity u based on the deviation ΔQ between them. FF (t); ΔQ=Q pred (t+τ)-Q steady ; If |ΔQ| is less than or equal to the preset dead zone threshold ΔQ th Then the feedforward control quantity u FF (t)=0, no feedforward adjustment is performed; If |ΔQ| is greater than the dead zone threshold ΔQ th Then the feedforward control quantity is calculated using the following formula: u FF (t)=K FF ·ΔQ / Q max ; When u FF When (t)>0, it indicates that the cooling capacity needs to be increased, and the controller will increase the cooling medium flow rate or decrease the cooling medium temperature in advance; When u FF When (t) < 0, it indicates that the cooling capacity needs to be reduced, and the controller reduces the cooling medium flow rate or increases the cooling medium temperature in advance; Right now ; Where K FF The preset feedforward gain coefficient is calibrated through a step response test; Q steady This represents the current steady-state heating power. Q max This is the preset maximum heating power; Q max Q is a fixed constant, determined based on the rated input power of the spindle motor and the safety factor. max =P rated_in ·β safe , where P rated_in Rated input power of the spindle motor, β safe For safety factors, the value ranges from 1.2 to 1.5; S10, Output feedforward control command: The feedforward control quantity u... FF(t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.

[0005] Furthermore, in step S51, the theoretical motor heating power P at the current time t... motor_theory (t) is calculated using the following formula: ; ; P mech (t) represents the mechanical power output by the motor at time t, which varies with the current process parameters and speed. P mech (t)=P cut (t)+P idle (t); P cut (t) represents the theoretical cutting power at time t; ; k c The specific cutting energy for machining the workpiece material; P idle (t) represents the power loss of the spindle during no-load operation at time t; η(n(t),M(t)) is the motor efficiency interpolation based on the current speed n(t) and load rate M(t) at time t; Furthermore, in step S52, the theoretical motor heating power P at time (t+τ) is... motor_theory (t+τ) is calculated according to the following formula: ; P mech (t+τ)=P cut (t+τ)+P idle (t+τ); ; P cut (t+τ) represents the theoretical cutting power at time (t+τ); ; P mech (t+τ) represents the mechanical power output by the motor at time (t+τ); P cut (t+τ) represents the theoretical cutting power at time (t+τ); P idle (t+τ) represents the power loss of the spindle during no-load operation at time (t+τ); η(n(t+τ),M(t+τ)) is the motor efficiency interpolation based on the rotational speed n(t+τ) and load factor M(t+τ) at time (t+τ); Furthermore, in step S53, the currently measured motor heating power P motor_actual (t) is calculated using the following formula: ; P in (t) represents the motor input power at time t, which is directly read by the spindle driver.

[0006] Current no-load loss P idle (t) is obtained from the no-load power curve calibrated at the factory based on the current spindle speed n(t).

[0007] Furthermore, in step S9, Q steady Calculated in real time by the following formula: Q steady (t)=α(t)·Q actual (t)+(1-α(t))·Q steady (t-1); in: Q actual (t) represents the actual heating power at time t; Q steady (t-1) represents the steady-state heating power at time (t-1); Q steady (0) represents the initial steady-state heating power; α(t) is the filter coefficient at time t.

[0008] Furthermore, α(t) is calculated according to the following formula: ; in: α min The preset minimum filter coefficient; α max The preset maximum filter coefficient; β is the preset attenuation coefficient; The initial value of α is determined based on the thermal state of the spindle when it starts up: when the spindle is cold, the initial value of α is α1; when the spindle is warm, the initial value of α is α2; and when the spindle is hot, the initial value of α is α3. α min ≦α1<α2<α3≦α max .

[0009] Furthermore, the Q steady (0) Determined based on the thermal state of the spindle at startup: When the spindle is in a cold state, with N cold The arithmetic mean of the measured heating power of each control cycle is used as the initial value; when the spindle is in a warm state, the previous N warmThe arithmetic mean of the measured heating power of each control cycle is used as the initial value; when the spindle is in a hot state, the previous N hot The arithmetic mean of the measured heating power over each control cycle is used as the initial value; N hot <N warm <N cold .

[0010] Furthermore, the method for determining the thermal state of the spindle during startup is as follows: Obtain spindle temperature T inner With ambient temperature T amb Calculate the temperature difference ΔT=T inner -T amb ; When ΔT < ΔT cold At that time, the spindle is determined to be in a cold state; When ΔT>ΔT hot At that time, the spindle is determined to be in a hot state; When ΔT cold ≤ΔT≤ΔT hot At that time, it is determined that the spindle is in a warm state; Where ΔT cold The preset first temperature difference threshold; ΔT hot The second preset temperature difference threshold; ΔT cold <ΔT hot Furthermore, the prediction lead time τ can be a preset fixed value, preferably ranging from 30 to 120 seconds.

[0011] Another further approach is to predict the lead time τ as dynamically adjusted; One dynamic adjustment scheme for the prediction lead time τ is based on the adjustment of the spindle speed and the rate of temperature change. The method is as follows: dynamically adjust according to the current spindle speed and / or the rate of temperature change: when the spindle speed increases or the spindle temperature rise rate increases, decrease the prediction lead time τ; when the spindle speed decreases or the spindle temperature tends to stabilize, increase the prediction lead time τ; the adjustment range of the prediction lead time τ does not exceed ±20% of its reference value.

[0012] Furthermore, another dynamic adjustment scheme for the prediction lead time τ is: online adaptive adjustment based on the temperature response effect, and τ0 is the baseline prediction lead time; the method is as follows: Record the actual response value of the spindle temperature after feedforward compensation in each control cycle; If temperature overshoot occurs for M consecutive cycles and the overshoot exceeds the preset overshoot threshold, the prediction lead time τ is determined to be too small, and τ is increased in steps of 2% to 5% of the current τ value. If insufficient temperature response occurs for M consecutive cycles and the deviation continues to exceed the preset insufficient response threshold, the prediction lead time τ is determined to be too large, and τ is reduced in steps of 2% to 5% of the current τ value. Repeat the above steps until the temperature response meets the preset evaluation criteria.

[0013] Furthermore, the preset overshoot threshold value range is preferably 0.5~2℃, and the response undershoot threshold value range is preferably 1~3℃, which can be set according to the target temperature accuracy requirements; the value range of M is preferably 3-5.

[0014] τ0 is calibrated through a step response test conducted under preset reference conditions.

[0015] Furthermore, the dead zone threshold ΔQ in step S9 th For Q max 2% to 5%.

[0016] Furthermore, the AI ​​thermal prediction model is a time series prediction model based on a Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), or Transformer architecture; the training samples of the model are the process parameter sequences and corresponding measured heat generation power sequences collected during historical processing.

[0017] Furthermore, it also includes an online model update step: updating the predicted future heating power value Q. pred (t+τ) and the actual heat generation power Q measured after arrival time t+τ actual Compare (t+τ) and calculate the prediction deviation δQ=Q pred -Q actual When the cumulative value of the prediction deviation exceeds a preset threshold, the incremental learning or fine-tuning of the AI ​​hot prediction model is triggered to update the model parameters.

[0018] This invention also provides an AI prediction system for spindle heating power based on G-code parsing, comprising: The data acquisition unit is used to acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); The G-code pre-reading and parsing unit is used to pre-read G-code instructions within a future time window of the CNC system, and parse and extract process parameter vectors segment by segment. These process parameters include at least the spindle speed n and feed rate v. f Cutting depth a p Cutting width a e ; The theoretical cutting power calculation unit is used to calculate the theoretical cutting power P at a future time (t+τ) based on the process parameter vector. cut (t+τ), where τ is the prediction lead time; The motor heating power prediction unit is used for: Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heat generation power P at the current time. motor_theory (t); Based on the spindle speed and cutting parameters at a future time (t+τ), the theoretical motor heating power P at that future time is calculated using the motor efficiency characteristic curve. motor_theory (t+τ); Based on the real-time input power P read from the spindle drive at the current moment in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); The ratio of the measured motor heating power to the theoretical motor heating power is used as the calibration coefficient k. cal (t), applying the calibration coefficient to the theoretical motor heating power at a future time, yields the predicted motor heating power P at the future time. motor (t+τ); The theoretical heating power synthesis unit is used to synthesize the theoretical cutting power P. cut (t+τ) and the predicted value of the motor's heating power P motor Adding (t+τ) together, we obtain the theoretical heating power Q at the future time. theory (t+τ); AI thermal prediction model, used to calculate the theoretical heating power Q theory (t+τ), current spindle speed (n(t)), current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb Using the input features, the output is a predicted deviation value ΔQ(t+τ) between the theoretical future heating power and the actual future heating power. The theoretical heating power is then added to the predicted deviation value to obtain the predicted future heating power value Q. pred (t+τ); The feedforward control quantity generation unit is used to generate the future heating power prediction value Q. pred (t+τ) and the current steady-state heating power Q steady The deviation between them is used to calculate the feedforward control quantity u. FF (t), when |Q pred (t+τ)-Qsteady | When u is less than or equal to the preset dead zone threshold FF (t)=0; when it is greater than the dead zone threshold, u FF (t)=K FF ·(Q pred (t+τ)-Q steady ) / Q max ; The execution interface unit is used to process the feedforward control quantity u FF (t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.

[0019] Beneficial effects of this invention: (1) The prediction of motor heating power adopts the strategy of "current measured calibration + future theoretical calculation". The theoretical calculation value is calibrated by the measured power of the driver, which avoids the accumulation of errors in pure theoretical estimation and significantly improves the prediction accuracy.

[0020] (2) By pre-reading the G code to obtain future process parameters, and combining the motor efficiency characteristic curve and the measured power for online calibration, the real-time prediction of future heat generation power is realized, overcoming the defect of traditional methods that cannot predict future heat load.

[0021] (3) The theoretical heating power is calculated by physical formula. The AI ​​model only needs to predict the residual between the theoretical value and the actual value, which reduces the difficulty of model training and the risk of overfitting, and enhances the interpretability and generalization ability of the model.

[0022] (4) A complete technical link from data acquisition, G-code parsing, heat generation power prediction to feedforward control has been constructed, which can directly output the feedforward control quantity of the cooling system and realize the closed-loop connection between prediction and control. Detailed Implementation

[0023] The specific embodiments of the present invention will be further described below. It should be noted that these descriptions are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0024] Example 1 A spindle heating power AI prediction method based on G-code parsing includes the following steps: S1. Real-time acquisition of spindle operating data: Acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); S2. Calculate the actual heat generation power: Calculate the actual heat generation power Q carried away by the coolant according to the following formula. actual( t): ; Where c p This refers to the specific heat capacity of the coolant. S3. Pre-read and parse G-code process parameters: Pre-read the future time window Δt of the CNC system. window The G-code instructions within the code are parsed segment by segment to extract the process parameter vector, which includes at least the spindle speed n and the feed rate v. f Cutting depth a p Cutting width a e ; S4. Calculate the theoretical cutting power: Based on the process parameter vector, calculate the theoretical cutting power P at the future (t+τ) time. cut (t+τ); where τ is the prediction lead time; S5. Predict the motor heating power P at time (t+τ) motor (t+τ): S51. Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the current time t. motor_theory (t); S52. Based on the spindle speed and cutting parameters at the future time (t+τ), and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the future time (t+τ). motor_theory (t+τ); S53. The real-time input power P read from the spindle driver at the current time t. in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); S54, and based on the current measured motor heating power P motor_actual (t) and the current theoretical motor heating power P motor_theory The ratio of (t) is used as the calibration coefficient k. cal (t): ; S55, the calibration coefficient k cal (t) is applied to the theoretical motor heating power at time (t+τ), yielding the predicted motor heating power P at time (t+τ). motor (t+τ): ; S6. Calculate the theoretical heating power Q at time (t+τ). theory (t+τ): Q theory (t+τ)=P cut (t+τ)+P motor (t+τ); S7, AI thermal prediction model prediction bias: The theoretical heating power Q... theory (t+τ) and the current spindle speed n(t), and the current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb As input features, they are fed into a pre-trained AI thermal prediction model, which outputs a predicted deviation ΔQ(t+τ) between the theoretical and actual future thermal power. S8, The theoretical heating power Q theory Adding (t+τ) to the predicted deviation ΔQ(t+τ) yields the predicted heating power Q at the future time (t+τ). pred (t+τ): Q pred (t+τ)=Q theory (t+τ)+ΔQ(t+τ); S9. Generate feedforward control quantity: based on the predicted future heating power value Q. pred (t+τ) and the current steady-state heating power Q steady Calculate the feedforward control quantity u based on the deviation ΔQ between them. FF (t); ΔQ=Q pred (t+τ)-Q steady ; If |ΔQ| is less than or equal to the preset dead zone threshold ΔQ th Then the feedforward control quantity u FF (t)=0, no feedforward adjustment is performed; If |ΔQ| is greater than the dead zone threshold ΔQ th Then the feedforward control quantity is calculated using the following formula: u FF (t)=K FF ·ΔQ / Q max ; When u FF When (t)>0, it indicates that the cooling capacity needs to be increased, and the controller will increase the cooling medium flow rate or decrease the cooling medium temperature in advance; When u FF When (t) < 0, it indicates that the cooling capacity needs to be reduced, and the controller reduces the cooling medium flow rate or increases the cooling medium temperature in advance; Right now ; Where K FFThe preset feedforward gain coefficient determines the system's response to predicted heat load and is typically calibrated using a "step response test." The specific procedure is as follows: (1) Set the initial feedforward gain coefficient K FF_initial The value ranges from 0.3 to 0.5; the target temperature change Δ is set. Ttarget The amount is determined based on the expected compensation effect; (2) When the spindle is running stably under typical operating conditions, apply a step disturbance to the coolant flow rate and record the spindle temperature T. inner The response curve is used to read the steady-state temperature change ΔT. ss ; (3) Calculate the corrected feedforward gain coefficient according to the following formula: K FF_new =K FF_initial ·ΔT ss / ΔT target ; (4) With K FF_new Repeat the above experiment and observe the compensation effect. If there is temperature overshoot or insufficient response, fine-tune the value in steps of 2% to 5% based on the current value, repeating 2 to 3 times until the temperature response meets the preset evaluation index. The final calibration value K is then determined. FF The value range is 0.3 to 0.9.

[0025] Q max To preset the maximum heating power, Q max Q is a fixed constant used for normalization. Its function is to map the varying heat power difference into a uniform range (usually [-1, 1]) when calculating the feedforward quantity, facilitating the superposition of control quantities. It is determined based on the rated input power of the spindle motor and the safety factor. max =P rated_in ·β safe , where P rated_in Rated input power of the spindle motor, β safe For safety, a value range of 1.2 to 1.5 is preferred; Q steady This represents the current steady-state heating power.

[0026] S10, Output feedforward control command: The feedforward control quantity u... FF (t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.

[0027] The aforementioned AI prediction method for spindle heating power based on G-code parsing obtains future process parameters by pre-reading G-code, combines the motor efficiency curve with the measured power for online calibration to predict motor heating power, superimposes AI deviation correction to predict total heating power, and generates feedforward control quantity. This constructs a complete "prediction-feedforward" technical link, solves the problem of inaccurate prediction of future heating power under varying operating conditions, and realizes the transformation from "post-event feedback" to "advanced compensation".

[0028] Furthermore, in step S51, the theoretical motor heating power P at the current time t... motor_theory (t) is calculated using the following formula: ; ; P mech (t) represents the mechanical power output by the motor at time t, which varies with the current process parameters and speed. P mech (t)=P cut (t)+P idle (t); P cut (t) represents the theoretical cutting power at time t; ; k c The specific cutting energy for machining the workpiece material; P idle (t) represents the power loss of the spindle during no-load operation at time t; η(n(t),M(t)) is the motor efficiency interpolation based on the current speed n(t) and load rate M(t) at time t; The theoretical motor heating power P at time (t+τ) in step S52 motor_theory (t+τ) is calculated according to the following formula: ; P mech (t+τ)=P cut (t+τ)+P idle (t+τ); ; P cut (t+τ) represents the theoretical cutting power at time (t+τ); ; P mech (t+τ) represents the mechanical power output by the motor at time (t+τ); P cut (t+τ) represents the theoretical cutting power at time (t+τ); Pidle (t+τ) represents the power loss of the spindle during no-load operation at time (t+τ); η(n(t+τ),M(t+τ)) is the motor efficiency interpolation based on the rotational speed n(t+τ) and load factor M(t+τ) at time (t+τ); Furthermore, in step S53, the currently measured motor heating power P motor_actual (t) is calculated using the following formula: ; P in (t) represents the motor input power at time t, which is directly read by the spindle driver.

[0029] Current no-load loss P idle (t) Based on the current spindle speed n(t), the no-load power curve is obtained through the factory-calibrated no-load power curve. The method is as follows: before leaving the factory, the no-load power test is conducted to calibrate the no-load loss at different speeds, and a functional relationship P between the no-load loss and the spindle speed is established. idle =f idle (n); During actual operation, the current no-load loss P is calculated in real time by looking up the table or substituting the function relationship based on the current spindle speed n(t). idle (t).

[0030] The above process defines the specific calculation methods for theoretical and measured motor heating power, as well as the formation of calibration coefficients. Online calibration of theoretical calculations using measured power solves the problem that future motor heating power cannot be directly measured, resulting in prediction accuracy significantly better than pure theoretical estimation.

[0031] Furthermore, in step S9, Q steady Calculated in real time by the following formula: Q steady (t)=α(t)·Q actual (t)+(1-α(t))·Q steady (t-1); in: Q actual (t) represents the actual heating power at time t; Q steady (t-1) represents the steady-state heating power at time (t-1); Q steady (0) represents the initial steady-state heating power; α(t) is the filter coefficient at time t.

[0032] The above process limits the current steady-state heat generation power to be obtained recursively from a first-order low-pass filter. This makes Q... steady Able to smoothly track Q actualThe changes in the value are filtered out to eliminate measurement noise and provide a stable and reliable reference value for feedforward control.

[0033] Furthermore, α(t) is calculated according to the following formula: ; in: α min The minimum preset filtering coefficient is set; in this embodiment, it is preferably 0.05~0.10. α max The maximum preset filtering coefficient is set; in this embodiment, it is preferably 0.40~0.60. β is a preset attenuation coefficient, preferably 0.5~2.0 in this embodiment, to control the sensitivity of α to the change rate of temperature; The initial value of α is determined based on the thermal state of the spindle when it starts up: when the spindle is cold, the initial value of α is α1; when the spindle is warm, the initial value of α is α2; and when the spindle is hot, the initial value of α is α3. α min ≦α1<α2<α3≦α max .

[0034] The above process limits the filter coefficient α to continuous dynamic adjustment based on the temperature change rate. When the temperature changes rapidly, α takes a small value to smooth the filter; when the temperature is stable, α takes a large value to ensure a fast response, achieving an adaptive balance between filter smoothness and response speed. When the spindle temperature T... inner When changes are rapid, α≈α min Filtering and smoothing effectively suppress measurement noise and control fluctuations during transient processes; when the spindle temperature T inner When it tends to stabilize, α≈α max The filter response is fast, making Q steady It can track minute changes in the actual heat load in a timely manner.

[0035] Furthermore, the Q steady (0) Determined based on the thermal state of the spindle at startup: When the spindle is in a cold state, with N cold The arithmetic mean of the measured heating power of each control cycle is used as the initial value; when the spindle is in a warm state, the previous N warm The arithmetic mean of the measured heating power of each control cycle is used as the initial value; when the spindle is in a hot state, the previous N hot The arithmetic mean of the measured heating power over each control cycle is used as the initial value; N hot <N warm <N cold .

[0036] In this embodiment, N cold The value ranges from 10 to 20; N warm The value ranges from 5 to 10; Nhot The value ranges from 3 to 5.

[0037] The above process defines Q under three startup states: cold, warm, and hot. steady The initial value is taken as the average of different cycle numbers. This allows the steady-state heating power to converge quickly to the true value during the startup phase, shortening the startup transition time and avoiding feedforward control malfunctions caused by initial value deviations.

[0038] Furthermore, the method for determining the thermal state of the spindle during startup is as follows: Obtain spindle temperature T inner With ambient temperature T amb Calculate the temperature difference ΔT=T inner -T amb ; When ΔT < ΔT cold At that time, the spindle is determined to be in a cold state; When ΔT>ΔT hot At that time, the spindle is determined to be in a hot state; When ΔT cold ≤ΔT≤ΔT hot At that time, it is determined that the spindle is in a warm state; Where ΔT cold The preset first temperature difference threshold is taken in this embodiment, ranging from 2 to 5°C; ΔT hot The second temperature difference threshold is a preset value, which in this embodiment ranges from 15 to 25°C; ΔT cold <ΔT hot The above process defines specific threshold conditions for determining the start-up state based on the difference between the spindle temperature and the ambient temperature. These are the initial values ​​of α and Q in claims 4 and 5. steady The differentiated setting of initial values ​​provides a clear basis for judgment, ensuring that the startup strategy is executed accurately.

[0039] Furthermore, another dynamic adjustment scheme for the prediction lead time τ is: online adaptive adjustment based on the temperature response effect, and τ0 is the baseline prediction lead time; the process includes the following steps: Record the actual response value of the spindle temperature after feedforward compensation in each control cycle; If temperature overshoot occurs for M consecutive cycles and the overshoot exceeds the preset overshoot threshold, the prediction lead time τ is determined to be too small, and τ is increased in steps of 2% to 5% of the current τ value. If insufficient temperature response occurs for M consecutive cycles and the deviation continues to exceed the preset insufficient response threshold, the prediction lead time τ is determined to be too large, and τ is reduced in steps of 2% to 5% of the current τ value. Repeat the above steps until the temperature response meets the preset evaluation criteria.

[0040] Furthermore, the preset overshoot threshold value range is preferably 0.5~2℃, and the response undershoot threshold value range is preferably 1~3℃, which can be set according to the target temperature accuracy requirements; the value range of M is preferably 3-5.

[0041] τ0 is calibrated through a step response test under a preset benchmark condition; in actual operation, the prediction lead time τ is adjusted online adaptively based on the temperature response effect, with τ0 as the initial value, to match the current operating condition.

[0042] The method for calibrating τ0 through a step response test under a preset reference condition is as follows: With the spindle running stably (constant speed), a sudden increase in coolant flow (step disturbance) or a step decrease in coolant inlet temperature (e.g., from 30°C to 25°C) is applied. Starting from the moment the step is applied (denoted as t0), the spindle temperature Tinner response curve is recorded. The inflection point at which the temperature begins to decrease significantly (denoted as t1) is found on the response curve. The time difference τ0 = t1 - t0 is calculated, and τ0 is used as the reference value for τ under this operating condition. After τ0 is calibrated, it is written to the controller as the initial value of the prediction lead time τ. When online adaptive adjustment is enabled, τ is dynamically adjusted within the range of 0.5τ0 to 1.5τ0 based on τ0. The above process defines an adaptive optimization method that continuously judges and adjusts τ step by step based on temperature overshoot or insufficient response. This allows τ to automatically match the optimal lead time under the current operating conditions, avoiding premature precooling due to an excessively large τ or compensation lag due to an excessively small τ, thus continuously optimizing the feedforward control effect.

[0043] In another embodiment, the prediction lead time τ can be a preset fixed value, preferably ranging from 30 to 120 seconds.

[0044] In another embodiment, the prediction advance time τ is adjusted based on the spindle speed and the rate of temperature change. The method is as follows: when the spindle speed increases or the spindle temperature rise rate increases, the prediction advance time τ is decreased; when the spindle speed decreases or the spindle temperature tends to stabilize, the prediction advance time τ is increased; the adjustment range of the prediction advance time τ does not exceed ±20% of its reference value.

[0045] Furthermore, the dead zone threshold ΔQ in step S9 th For Q max 2% to 5%.

[0046] Dead zone threshold ΔQ th Its functions are: to filter out measurement noise and prediction errors; to reduce the frequent operation of actuators; and to improve system stability.

[0047] Furthermore, the AI ​​thermal prediction model is a time series prediction model based on a Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), or Transformer architecture; the training samples of the model are the process parameter sequences and corresponding measured heat generation power sequences collected during historical processing.

[0048] Furthermore, it also includes an online model update step: updating the predicted future heating power value Q. pred (t+τ) and the actual heat generation power Q measured after arrival time t+τ actual Compare (t+τ) and calculate the prediction deviation δQ=Q pred -Q actual When the cumulative value of the prediction deviation exceeds a preset threshold, the incremental learning or fine-tuning of the AI ​​thermal prediction model is triggered to update the model parameters. This allows the AI ​​model to continuously update as spindle performance degrades or operating conditions drift, maintaining long-term prediction accuracy and achieving an adaptive closed loop of "running, learning, and optimizing simultaneously".

[0049] Example 2 A spindle heating power AI prediction system based on G-code parsing, comprising: The data acquisition unit is used to acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); The G-code pre-reading and parsing unit is used to pre-read G-code instructions within a future time window of the CNC system, and parse and extract process parameter vectors segment by segment. These process parameters include at least the spindle speed n and feed rate v. f Cutting depth a p Cutting width a e ; The theoretical cutting power calculation unit is used to calculate the theoretical cutting power P at a future time (t+τ) based on the process parameter vector. cut (t+τ), where τ is the prediction lead time; The motor heating power prediction unit is used for: Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heat generation power P at the current time. motor_theory (t); Based on the spindle speed and cutting parameters at a future time (t+τ), the theoretical motor heating power P at that future time is calculated using the motor efficiency characteristic curve. motor_theory (t+τ); Based on the real-time input power P read from the spindle drive at the current moment in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); The ratio of the measured motor heating power to the theoretical motor heating power is used as the calibration coefficient k. cal (t), applying the calibration coefficient to the theoretical motor heating power at a future time, yields the predicted motor heating power P at the future time. motor (t+τ); The theoretical heating power synthesis unit is used to synthesize the theoretical cutting power P. cut (t+τ) and the predicted value of the motor's heating power P motor Adding (t+τ) together, we obtain the theoretical heating power Q at the future time. theory (t+τ); AI thermal prediction model, used to calculate the theoretical heating power Q theory (t+τ), current spindle speed (n(t)), current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb Using the input features, the output is a predicted deviation value ΔQ(t+τ) between the theoretical future heating power and the actual future heating power. The theoretical heating power is then added to the predicted deviation value to obtain the predicted future heating power value Q. pred (t+τ); The feedforward control quantity generation unit is used to generate the future heating power prediction value Q. pred (t+τ) and the current steady-state heating power Q steady The deviation between them is used to calculate the feedforward control quantity u. FF (t), when |Q pred (t+τ)-Q steady When | is less than or equal to the preset dead zone threshold, u FF (t)=0; when it is greater than the dead zone threshold, u FF (t)=K FF ·(Q pred (t+τ)-Q steady ) / Q max ; The execution interface unit is used to process the feedforward control quantity u FF (t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.

[0050] The embodiments of the present invention have been described in detail above, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.

Claims

1. A spindle heating power AI prediction method based on G-code parsing, characterized in that: Includes the following steps: S1. Real-time acquisition of spindle operating data: Acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); S2. Calculate the actual heat generation power: Calculate the actual heat generation power Q carried away by the coolant according to the following formula. actual( t): ; Where c p This refers to the specific heat capacity of the coolant. S3. Pre-read and parse G-code process parameters: Pre-read the future time window Δt of the CNC system. window The G-code instructions within the code are parsed segment by segment to extract the process parameter vector, which includes at least the spindle speed n and the feed rate v. f Cutting depth a p Cutting width a e ; S4. Calculate the theoretical cutting power: Based on the process parameter vector, calculate the theoretical cutting power P at the future time (t+τ). cut (t+τ); where τ is the prediction lead time; S5. Predict the motor heating power P at time (t+τ) motor (t+τ): S51. Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the current time t. motor_theory (t); S52. Based on the spindle speed and cutting parameters at the future time (t+τ), and combined with the motor efficiency characteristic curve, calculate the theoretical motor heating power P at the future time (t+τ). motor_theory (t+τ); S53. The real-time input power P read from the spindle driver at the current time t. in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); S54, and based on the current measured motor heating power P motor_actual (t) and the current theoretical motor heating power P motor_theory The ratio of (t) is used as the calibration coefficient k. cal (t): ; S55, the calibration coefficient k cal (t) is applied to the theoretical motor heating power at time (t+τ), and the predicted value P of the motor heating power at time (t+τ) is obtained. motor (t+τ): ; S6. Calculate the theoretical heating power Q at time (t+τ). theory (t+τ): Q theory (t+τ)=P cut (t+τ)+P motor (t+τ); S7, AI thermal prediction model prediction bias: The theoretical heating power Q... theory (t+τ) and the current spindle speed n(t), and the current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb As input features, they are fed into a pre-trained AI thermal prediction model, which outputs a predicted deviation ΔQ(t+τ) between the theoretical and actual future thermal power. S8, The theoretical heating power Q theory Adding (t+τ) to the predicted deviation ΔQ(t+τ) yields the predicted heating power Q at the future time (t+τ). pred (t+τ): Q pred (t+τ)=Q theory (t+τ)+ΔQ(t+τ); S9. Generate feedforward control quantity: based on the predicted future heating power value Q. pred (t+τ) and the current steady-state heating power Q steady Calculate the feedforward control quantity u based on the deviation ΔQ between them. FF (t); ΔQ=Q pred (t+τ)-Q steady ; If |ΔQ| is less than or equal to the preset dead zone threshold ΔQ th Then the feedforward control quantity u FF (t)=0, no feedforward adjustment is performed; If |ΔQ| is greater than the dead zone threshold ΔQ th Then the feedforward control quantity is calculated using the following formula: u FF (t)=K FF ·ΔQ / Q max ; When u FF When (t)>0, it indicates that the cooling capacity needs to be increased, and the controller will increase the cooling medium flow rate or decrease the cooling medium temperature in advance; When u FF When (t) < 0, it indicates that the cooling capacity needs to be reduced, and the controller reduces the cooling medium flow rate or increases the cooling medium temperature in advance; Right now ; in: K FF The preset feedforward gain coefficient; Q steady This represents the current steady-state heating power. Q max The preset maximum heating power; S10, Output feedforward control command: The feedforward control quantity u... FF (t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.

2. The spindle heating power AI prediction method based on G-code parsing according to claim 1, characterized in that: In step S51, the theoretical motor heating power P at the current time t motor_theory (t) is calculated using the following formula: ; ; P mech (t) represents the mechanical power output by the motor at time t, which varies with the current process parameters and speed. P mech (t)=P cut (t)+P idle (t); P cut (t) represents the theoretical cutting power at time t; ; k c The specific cutting energy for machining the workpiece material; P idle (t) represents the power loss of the spindle during no-load operation at time t; η(n(t),M(t)) is the motor efficiency interpolation based on the current speed n(t) and load rate M(t) at time t; The theoretical motor heating power P at time (t+τ) in step S52 motor_theory (t+τ) is calculated according to the following formula: ; P mech (t+τ)=P cut (t+τ)+P idle (t+τ); ; P cut (t+τ) represents the theoretical cutting power at time (t+τ); ; P mech (t+τ) represents the mechanical power output by the motor at time (t+τ); P cut (t+τ) represents the theoretical cutting power at time (t+τ); P idle (t+τ) represents the power loss of the spindle during no-load operation at time (t+τ); η(n(t+τ),M(t+τ)) is the motor efficiency interpolation based on the rotational speed n(t+τ) and load factor M(t+τ) at time (t+τ); In step S53, the measured motor heating power P is currently... motor_actual (t) is calculated using the following formula: ; P in (t) represents the motor input power at time t, which is directly read by the spindle driver.

3. The spindle heating power AI prediction method based on G-code parsing according to claim 1, characterized in that: In step S9, Q steady Calculated in real time by the following formula: Q steady (t)=α(t)·Q actual (t)+(1-α(t))·Q steady (t-1); in: Q actual (t) represents the actual heating power at time t; Q steady (t-1) represents the steady-state heating power at time (t-1); Q steady (0) represents the initial steady-state heating power; α(t) is the filter coefficient at time t.

4. The spindle heating power AI prediction method based on G-code parsing according to claim 3, characterized in that: α(t) is calculated according to the following formula: ; in: α min The preset minimum filter coefficient; α max The preset maximum filter coefficient; β is the preset attenuation coefficient; The initial value of α is determined based on the thermal state of the spindle when it starts up: when the spindle is cold, the initial value of α is α1; when the spindle is warm, the initial value of α is α2; and when the spindle is hot, the initial value of α is α3. α min ≦α1<α2<α3≦α max 。 5. The spindle heating power AI prediction method based on G-code parsing according to claim 3, characterized in that: The Q steady (0) Determined based on the thermal state of the spindle at startup: When the spindle is in a cold state, with N cold The arithmetic mean of the measured heating power of each control cycle is used as the initial value; When the spindle is at a warm state, the previous N warm The arithmetic mean of the measured heating power of each control cycle is used as the initial value; When the spindle is hot, the previous N hot The arithmetic mean of the measured heating power over each control cycle is used as the initial value; N hot <N warm <N cold .

6. The spindle heating power AI prediction method based on G-code parsing according to claim 4 or 5, characterized in that: The method for determining the thermal state of the spindle during startup is as follows: Obtain spindle temperature T inner With ambient temperature T amb Calculate the temperature difference ΔT=T inner -T amb ; When ΔT < ΔT cold At that time, the spindle is determined to be in a cold state; When ΔT>ΔT hot At that time, it is determined that the spindle is in a hot state; When ΔT cold ≤ΔT≤ΔT hot At that time, it is determined that the spindle is in a warm state.

7. The spindle heating power AI prediction method based on G-code parsing according to claim 1, characterized in that: The prediction lead time τ can be adaptively adjusted online based on the temperature response effect, and τ0 is the baseline forecast lead time; Includes the following steps: Record the actual response value of the spindle temperature after feedforward compensation in each control cycle; If temperature overshoot occurs for M consecutive cycles and the overshoot exceeds the preset overshoot threshold, the prediction lead time τ is determined to be too small, and τ is increased in steps of 2% to 5% of the current τ value. If insufficient temperature response occurs for M consecutive cycles and the deviation continues to exceed the preset insufficient response threshold, the prediction lead time τ is determined to be too large, and τ is reduced in steps of 2% to 5% of the current τ value. Repeat the above steps until the temperature response meets the preset evaluation criteria.

8. The spindle heating power AI prediction method based on G-code parsing according to claim 1, characterized in that: The AI ​​thermal prediction model is a time series prediction model based on a Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), or Transformer architecture; the training samples of the model are the process parameter sequences and corresponding measured heat power sequences collected during historical processing.

9. The spindle heating power AI prediction method based on G-code parsing according to claim 1, characterized in that: It also includes a model online update step: updating the predicted future heating power value Q. pred (t+τ) and the actual heat generation power Q measured after arrival time t+τ actual Compare (t+τ) and calculate the prediction deviation δQ=Q pred -Q actual When the cumulative value of the prediction deviation exceeds a preset threshold, the incremental learning or fine-tuning of the AI ​​hot prediction model is triggered to update the model parameters.

10. A spindle heating power AI prediction system based on G-code parsing, characterized in that: include: The data acquisition unit is used to acquire the real-time input power P of the spindle motor. in (t), Coolant inlet temperature T in Coolant outlet temperature T out The coolant mass flow rate q and the current spindle speed n(t); The G-code pre-reading and parsing unit is used to pre-read G-code instructions within a future time window of the CNC system, and parse and extract process parameter vectors segment by segment. These process parameters include at least the spindle speed n and feed rate v. f Cutting depth a p Cutting width a e ; The theoretical cutting power calculation unit is used to calculate the theoretical cutting power P at a future time (t+τ) based on the process parameter vector. cut (t+τ), where τ is the prediction lead time; The motor heating power prediction unit is used for: Based on the spindle speed and cutting parameters at the current time t, and combined with the motor efficiency characteristic curve, calculate the theoretical motor heat generation power P at the current time. motor_theory (t); Based on the spindle speed and cutting parameters at the future time (t+τ), and combined with the motor efficiency characteristic curve, the theoretical motor heating power P at the future time is calculated. motor_theory (t+τ); Based on the real-time input power P read from the spindle drive at the current moment in (t) and the theoretical mechanical power P at the current moment mech (t) Calculate the current measured motor heating power P motor_actual (t); The ratio of the measured motor heating power to the theoretical motor heating power is used as the calibration coefficient k. cal (t), applying the calibration coefficient to the theoretical motor heating power at a future time, yields the predicted motor heating power P at the future time. motor (t+τ); The theoretical heating power synthesis unit is used to synthesize the theoretical cutting power P. cut (t+τ) and the predicted value of the motor's heating power P motor Adding (t+τ) together, we obtain the theoretical heating power Q at the future time. theory (t+τ); AI thermal prediction model, used to calculate the theoretical heating power Q theory (t+τ), current spindle speed (n(t)), current actual heat generation power Q actual (t), Coolant inlet temperature T in and ambient temperature T amb Using the input features, the output is a predicted deviation value ΔQ(t+τ) between the theoretical future heating power and the actual future heating power. The theoretical heating power is then added to the predicted deviation value to obtain the predicted future heating power value Q. pred (t+τ); The feedforward control quantity generation unit is used to generate the future heating power prediction value Q. pred (t+τ) and the current steady-state heating power Q steady The deviation between them is used to calculate the feedforward control quantity u. FF (t), when |Q pred (t+τ)-Q steady When | is less than or equal to the preset dead zone threshold, u FF (t)=0; when it is greater than the dead zone threshold, u FF (t)=K FF ·(Q pred (t+τ)-Q steady ) / Q max ; The execution interface unit is used to process the feedforward control quantity u FF (t) is converted into a coolant flow rate regulation command or a temperature regulation command and output to the actuator.