A g-code reconstruction method for frequency domain characteristic constraint of a numerical control machine tool servo system
Patent Information
- Application Number
- CN202610992873.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-10-23
AI Technical Summary
在伺服系统环节(Huynh HN,Altintas Y. Multibody dynamic modeling of five-axis machine tool vibrationsand controller[J]. CIRP Annals,2022,71(1):325-328.),通过优化伺服控制策略提高系统带宽,以增强伺服跟踪性能,但是算法优化效果高度依赖机械动态特性,若机械系统自身存在模态缺陷,算法仅能进行有限的性能微调,无法带来质的突破
本发明提出一种数控机床伺服系统频域特性约束的G代码重构方法,基于伺服系统频域特性,在频域上修正指令,并在此基础上重构G代码,可以在不牺牲效率的前提下,保证和提高机床联动轨迹轮廓精度,对具有大曲率、高速加工特征的复杂曲面零件加工精度提升效果尤为显著。
Smart Images

Figure CN122963069A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of CNC machine tool technology, and specifically relates to a G-code reconstruction method for frequency domain characteristic constraints of CNC machine tool servo systems. Background Technology
[0002] Numerical control (NC) machining involves CAM, CNC, and servo control. CAM discretizes complex surfaces into toolpaths and tool positions; CNC densifies these tool positions, further generating interpolation command points; and the servo control system receives these interpolation commands and drives the tool's feed motion relative to the workpiece. The tool position, as the data source for machining parts on a CNC machine tool, directly affects the machining accuracy and efficiency. However, current CAM algorithms, when generating G-code tool positions, only consider geometric constraints such as bow height error, neglecting the servo system's responsiveness. While CNC systems can smooth commands through functions like small-segment fitting, improving servo responsiveness, this comes at the cost of efficiency, failing to achieve a balance between accuracy and efficiency.
[0003] Existing research mainly proposes optimization schemes for various aspects of CNC machining. In the servo system stage (Huynh HN, Altintas Y. Multibody dynamic modeling of five-axis machine tool vibrations and controller[J]. CIRP Annals,2022,71(1):325-328.), the system bandwidth is improved by optimizing the servo control strategy to enhance servo tracking performance. However, the optimization effect of the algorithm is highly dependent on the dynamic characteristics of the machine. If the mechanical system itself has modal defects, the algorithm can only make limited performance fine-tuning and cannot bring about a qualitative breakthrough. In the CNC interpolation stage (YanGW, Zhang DS, Xu JT, et al. Corner smoothing for CNC machining of linear toolpath: a review[J]. Journal of Advanced Manufacturing Science and Technology,2023,3(2):2023001.), the command response characteristics are improved by smoothing the command. However, when smoothing the geometric trajectory and speed curve, it will indirectly limit the motion parameters such as machine tool acceleration, sacrificing machining efficiency. In the CAM and post-processing stages (SunHJ, Altintas Y. A G3 continuous tool path smoothing method for 5-axis CNCmachining[J]. CIRP Journal of Manufacturing Science and Technology, 2021, 32:529-549.), considering the factors affecting machine tool accuracy, the tool path and G-code generation strategies are improved to enhance machining quality. However, this introduces new fitting errors and also tends to limit the feed rate, leading to reduced machining efficiency. Summary of the Invention
[0004] In order to overcome the shortcomings of the prior art, the present invention aims to provide a G-code reconstruction method based on the frequency domain characteristics of CNC machine tool servo system. Based on the frequency domain characteristics of the servo system, the instructions are corrected in the frequency domain, and the tool position is reconstructed on this basis. Without sacrificing efficiency, the accuracy of the machine tool linkage trajectory contour is guaranteed and improved.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A G-code reconstruction method for frequency domain characteristic constraints of a CNC machine tool servo system includes the following steps: 1) Design and acquire identification signals, identify the transfer function of the servo feed system, and calculate the frequency domain correction curve; 2) Acquire the original G-code interpolation instructions and perform frequency domain feature solving; 3) Correct the instructions by combining the system frequency domain correction curve and the instruction frequency domain characteristics; 4) Reconstruct the G code based on frequency domain correction instructions.
[0006] Step 1) specifically involves: using a pseudo-random signal as the identification signal, inputting it into the CNC system, and collecting the command position and grating detection position; identifying the numerator and denominator coefficients of the transfer function using the least squares algorithm; and using a delay compensation search method for order identification, specifically by setting the order search range, performing delay compensation on the least squares identification results of each order, and selecting the order with the smallest estimation error.
[0007] Delay compensation can eliminate the impact of system delay on order identification. The specific method is as follows: First, the normalized cross-correlation method is used to calculate the delay step size of the identification model. Let the actual acquired signal be... x 0, the identification model predicts the signal as x 1. Both are of length. N The discrete signal, after normalization, yields: (1) in, μ 0、 μ 1 represents the mean of the signal. σ 0、 σ 1 represents the corresponding standard deviation; then, cross-correlation calculations are performed: (2) in k For the lagging step size, R ( k The range of () is [0,1], and the closer to 1, the stronger the correlation; select R ( k Lag step size when taking the maximum value k That is x 1 relative to x The actual lag of 0; Secondly, delay compensation is performed on the identification model: (3) in, T s The sampling period is G 2( s () is the least squares identification model. G 1( s () represents the compensated model; After identifying the transfer function, the frequency domain correction curves, namely the amplitude amplification curve and the phase advance curve, can be calculated: (4) in, G 1( jω (This is the compensated model) G 1( s The frequency domain characteristics of ) A G ( ω () represents the amplitude amplification curve. φ G ( ω () represents the phase advance curve.
[0008] Step 2) specifically involves: acquiring the interpolation instruction data of the original G code. x The frequency, corresponding amplitude, and phase of the command are determined using the Discrete Fourier Transform method: (5) In the formula X for x Corresponding to the Fourier spectrum, f s Sampling frequency, f ( k ) is the instruction number k The frequency corresponding to each instruction point A ( k )and φ ( k ) represents the amplitude and phase corresponding to the command point.
[0009] Step 3) specifically involves: based on the frequency domain solution results of the command, and combined with the amplitude amplification curve and phase advance curve, correcting the amplitude and phase of each frequency component of the command. The correction process is as follows: (6) in A * ( k )and φ * ( k The corrected amplitude and phase; according to the inverse Fourier transform, the corrected time-domain command can be obtained: (7).
[0010] Step 4) specifically involves: reconstructing the G code according to the correction instruction. Since the frequency domain correction instruction manifests as a change in trajectory shape in the time domain, the G code trajectory is changed through the reconstruction algorithm to achieve the frequency domain correction effect. 4.1) For linear interpolation G-code (G01 instruction), a method of taking points on the correction instruction is adopted to filter and generate new tool positions, and to form the reconstructed G-code; Establish the relationship between the tool position distance and the interpolation command speed as a constraint model: (8) in, F Set the feed rate for the G-code. M c For the minimum interpolation period, Δ x Distance between the tool and the tool point v This refers to the speed of the interpolation instruction.
[0011] Let the correction instruction position sequence (of length N) be: (9) The original command speed sequence was: (10) The generated knife point sequence is as follows: (11) Starting point of the correction instruction p 1 is the first knife point, i.e. P 1= p 1, serving as the initial reference; simultaneously, as the starting point of the velocity sequence. v 1 is the initial velocity reference, and the positions of subsequent correction commands are traversed. p i ( i >1); If the currently reserved tool position is P j Then P j Based on this, traverse the positions of subsequent correction instructions. p i ( i >idx( P j ), where idx( P j )express P j The velocity reference is the index corresponding to the position sequence of the correction instruction. v idx(Pj) At this time, the distance between the tool points is: (12) Substituting the blade position spacing into the constraint formula yields the predicted velocity. vp i for: (13) Compared with the speed reference, if vp i = v idx(Pj) If so, the current command position is retained as the new tool position. P j+1 = p i If they are not equal, continue traversing backwards; repeat the above process until all instruction sequences have been traversed, finally obtaining the tool position sequence that satisfies the speed constraint. P j}; Finally, based on this sequence, the reconstructed G code is generated according to the format of G01 linear interpolation G code; 4.2) For NURBS spline interpolation G-code, a nonlinear programming algorithm is used to optimize the position of control points in spline interpolation G-code, so that the curve corresponding to the new control point coincides with the correction instruction in step 3), and finally the reconstructed G-code is formed; The objective function in the nonlinear programming algorithm is: (14) in, x c Let be the variable to be optimized, i.e., the curve control points; ce is the function for solving the contour error between the two trajectories; nbs is the function for solving the spline curve. x * The target curve is the correction command; the trajectory contour error solution function is specifically the shortest distance from a point on the spline curve to be optimized to the target curve. The nonlinear constraint function is: (15) in, x c0 For the original control point, C ( u i ) represents the corresponding spline curve, n i The unit normal vector at the corresponding position. δ i Used for initial position determination. δ i When = 1, the control point is located on the positive side of the normal vector. δ i = -1 is on the negative side; this constraint is used to avoid spline curve distortion caused by control points going out of bounds; The bounded constraint function is: (16) in, ω max and ω minThe maximum and minimum values of the original spline weights are used to limit the adjustment range of the control points and ensure convergence.
[0012] Finally, based on the control point optimization results of the algorithm, the reconstructed G-code is generated according to the format of NURBS spline interpolation G-code.
[0013] Compared with the prior art, the present invention has the following beneficial effects: This invention proposes a G-code reconstruction method based on the frequency domain characteristics of a CNC machine tool servo system. Based on the frequency domain characteristics of the servo system, the instructions are modified in the frequency domain, and the G-code is reconstructed on this basis. This method can guarantee and improve the accuracy of the machine tool linkage trajectory without sacrificing efficiency. The improvement effect is particularly significant for complex curved surface parts with large curvature and high-speed machining characteristics. Attached Figure Description
[0014] Figure 1 The image shows the outline of the G-code before and after reconstruction in Example 1.
[0015] Figure 2 This is an error distribution diagram before and after G-code reconstruction in Example 1.
[0016] Figure 3 This is a schematic diagram of NURBS spline interpolation in Example 2.
[0017] Figure 4 This is a silhouette diagram of G-code before and after reconstruction in Example 2.
[0018] Figure 5 This is an error distribution diagram before and after G-code reconstruction in Example 2. Detailed Implementation
[0019] The present invention will now be described in detail with reference to the embodiments and accompanying drawings.
[0020] Example 1, using an impeller blade as an example, describes a G-code reconstruction method for frequency domain characteristic constraints of a CNC machine tool servo system, comprising the following steps: 1) A pseudo-random signal is used as the identification signal, which is input into the CNC system to collect the command position and grating detection position. The numerator and denominator coefficients of the transfer function are identified using the least squares algorithm; the order is identified using the delay compensation search method, which involves setting the order search range, performing delay compensation on the least squares identification results of each order, and selecting the order with the smallest estimation error.
[0021] Delay compensation can eliminate the impact of system delay on order identification. The specific method is as follows: First, the normalized cross-correlation method is used to calculate the delay step size of the identification model. Let the actual acquired signal be... x 0, the identification model predicts the signal as x 1. Both are of length.N The discrete signal, after normalization, yields: (1) in, μ 0、 μ 1 represents the mean of the signal. σ 0、 σ 1 represents the corresponding standard deviation. Then, cross-correlation calculations are performed: (2) in k For the lagging step size, R ( k The range of () is [0,1], with values closer to 1 indicating a stronger correlation. Select... R ( k Lag step size when taking the maximum value k That is x 1 relative to x The actual lag of 0.
[0022] Secondly, delay compensation is performed on the identification model: (3) in, T s The sampling period is G 2( s () is the least squares identification model. G 1( s () represents the compensated model.
[0023] After identifying the transfer function, the frequency domain correction curves, namely the amplitude amplification curve and the phase advance curve, can be calculated: (4) in, G 1( jω (This is the compensated model) G 1( s The frequency domain characteristics of ) A G ( ω () represents the amplitude amplification curve. φ G ( ω () represents the phase advance curve.
[0024] 2) Acquire interpolation instruction data from the original G-code x The frequency, corresponding amplitude, and phase of the command are determined using the Discrete Fourier Transform method: (5) In the formula X for x Corresponding to the Fourier spectrum, fs Sampling frequency, f ( k ) is the instruction number k The frequency corresponding to each instruction point A ( k )and φ ( k ) represents the amplitude and phase corresponding to the command point.
[0025] 3) Based on the frequency domain solution results of the command, and in conjunction with the amplitude amplification curve and phase advance curve, the amplitude and phase of each frequency component of the command are corrected. The correction process is as follows: (6) in A * ( k )and φ * ( k The corrected amplitude and phase. Based on the inverse Fourier transform, the corrected time-domain command can be obtained: (7) 4) In this embodiment, linear interpolation G code (G01 instruction) is executed. Step 4.1) The method of taking points on the correction instruction is used to select and generate new tool points and form the reconstructed G code.
[0026] Establish the relationship between the tool position distance and the interpolation command speed as a constraint model: (8) in, F Set the feed rate for the G-code. M c For the minimum interpolation period, Δ x Distance between the tool and the tool point v This refers to the speed of the interpolation instruction.
[0027] Let the correction instruction position sequence (of length N) be: (9) The original command speed sequence was: (10) The generated knife point sequence is as follows: (11) Starting point of the correction instruction p 1 is the first knife point, i.e. P 1= p 1, serving as the initial reference; simultaneously, as the starting point of the velocity sequence. v 1 is the initial velocity reference, and the positions of subsequent correction commands are traversed. pi ( i >1). If the currently reserved tool position is P j Then P j Based on this, traverse the positions of subsequent correction instructions. p i ( i >idx( P j ), where idx( P j )express P j The velocity reference is the index corresponding to the position sequence of the correction instruction. v idx(Pj) At this time, the distance between the tool points is: (12) Substituting the blade position spacing into the constraint formula yields the predicted velocity. vp i for: (13) Compared with the speed reference, if vp i = v idx(Pj) If so, the current command position is retained as the new tool position. P j+1 = p i If they are not equal, continue traversing the sequence. Repeat the above process until all instruction sequences have been traversed, finally obtaining the tool position sequence that satisfies the speed constraint. P j}
[0028] Finally, based on this sequence, the reconstructed G-code is generated according to the format of G01 linear interpolation G-code.
[0029] For Example 1, the contour changes before and after G-code reconstruction are as follows: Figure 1 As shown, the contour error distribution before and after reconstruction is as follows: Figure 2 As shown in the figure, the maximum profile error is concentrated at the leading edge of the blade. After reconstruction, the profile error at this position is significantly reduced.
[0030] Example 2, using an S-shaped specimen as an example, differs from Example 1 in the following ways from the G-code reconstruction method for frequency domain characteristic constraints of a CNC machine tool servo system: Example 2 uses NURBS spline interpolation G-code, such as... Figure 3As shown in the figure, the ruled surface A of the S-shaped specimen is shown, where P0-P15 are the upper baseline control points and Q0-Q15 are the lower baseline control points. Step 4.2) is executed, using a nonlinear programming algorithm to optimize the position of the control points in the spline interpolation G-code, so that the curve corresponding to the new control points coincides with the correction command in step 3), and finally, the reconstructed G-code is formed.
[0031] The objective function in the nonlinear programming algorithm is: (14) in, x c Let be the variable to be optimized, i.e., the curve control points; ce is the function for solving the contour error between the two trajectories; nbs is the function for solving the spline curve. x * The target curve is the correction command. The trajectory contour error solution function is specifically the shortest distance from a point on the spline curve to be optimized to the target curve.
[0032] The nonlinear constraint function is: (15) in, x c0 For the original control point, C ( u i ) represents the corresponding spline curve, n i The unit normal vector at the corresponding position. δ i Used for initial position determination. δ i When = 1, the control point is located on the positive side of the normal vector. δ i = -1 is on the negative side. This constraint is used to avoid spline curve distortion caused by control points going out of bounds.
[0033] The bounded constraint function is: (16) in, ω max and ω min These are the maximum and minimum values of the original spline weights. This constraint is used to limit the adjustment range of the control points and ensure convergence.
[0034] Finally, based on the control point optimization results of the algorithm, the reconstructed G-code is generated according to the format of NURBS spline interpolation G-code.
[0035] For Example 2, the spline control point optimization results are shown in Table 1, and the contour changes before and after G-code reconstruction are as follows: Figure 4 As shown, the contour error distribution before and after reconstruction is as follows: Figure 5As shown in the figure, the maximum contour error is concentrated at the transition of the curved surface with large curvature in the contours corresponding to control points P5 and P12. After reconstruction, the contour error at this position is greatly reduced.
[0036] Table 1. Changes in control point coordinates before and after G-code reconstruction of S-shaped specimens. serial number Before reconstruction coordinates Reconstructed coordinates serial number Before reconstruction coordinates Reconstructed coordinates P0 (131, -95.5) (131, -95.488) Q0 (-137, -95.5) (-137, -95.534) P1 (-126, -41) (-126.001, -41.005) Q1 (-134, -41) (-134, -40.970) P2 (-131, 23) (-131.001, 22.966) Q2 (-138, 23) (-138.003, 22.938) P3 (-116, 78) (-116, 78) Q3 (-118, 87) (-118.014, 86.975) P4 (-51, 77) (-51.014, 77.003) Q4 (-49, 84) (-49.111, 84.019) P5 (-20, 46) (-19.991, 45.984) Q5 (-23, 58) (-23.015, 58.073) P6 (-11, 10) (-10.998, 9.997) Q6 (-11, 10) (-10.990, 9.950) P7 (-9, 2) (-8.996, 2.007) Q7 (-9, 2) (-8.991, 1.984) P8 (-7, -6) (-7.016, -5.993) Q8 (-7, -6) (-7.012, -6.007) P9 (-5, -14) (-4.992, -14.0166) Q9 (-5, -14) (-5.002, -13.986) P10 (3, -46) (3.003, -46.004) Q10 (3, -46) (2.991, -45.979) P11 (32, -80) (32.010, -80.002) Q11 (36, -88) (35.993, -88.002) P12 (103, -81) (102.987, -80.996) Q12 (111, -84) (111.004, -84) P13 (116, -13) (116.005, -13.028) Q13 (119, -13) (119.002, -12.966) P14 (110, 43) (109.998, 42.997) Q14 (118, 43) (117.998, 42.966) P15 (115, 99.5) (115, 99.506) Q15 (121, 99.5) (121, 99.505)
Claims
1. A G-code reconstruction method for frequency domain characteristic constraints of a CNC machine tool servo system, characterized in that, Includes the following steps: 1) Design and acquire identification signals, identify the transfer function of the servo feed system, and calculate the frequency domain correction curve; 2) Acquire the original G-code interpolation instructions and perform frequency domain feature solving; 3) Correct the instructions by combining the system frequency domain correction curve and the instruction frequency domain characteristics; 4) Reconstruct the G code based on frequency domain correction instructions.
2. The 1G code refactoring method according to claim 1, characterized in that, Step 1) is specifically as follows: a pseudo-random signal is used as the identification signal, which is input into the CNC system and the command position and grating detection position are collected; the numerator and denominator coefficients of the transfer function are identified using the least squares algorithm; the order identification is carried out using the delay compensation search method, which specifically involves setting the order search range, performing delay compensation on the least squares identification results of each order, and selecting the order with the smallest estimation error. The delay compensation specifically involves: firstly, calculating the delay step size of the identification model using the normalized cross-correlation method, assuming the actual acquired signal is... x 0, the identification model predicts the signal as x 1. Both are of length. N The discrete signal, after normalization, yields: (1) in, μ 0、 μ 1 represents the mean of the signal. σ 0、 σ 1 represents the corresponding standard deviation; then, cross-correlation calculations are performed: (2) in k For the lagging step size, R ( k The range of () is [0,1], and the closer to 1, the stronger the correlation; select R ( k Lag step size when taking the maximum value k That is x 1 relative to x The actual lag of 0; Secondly, delay compensation is performed on the identification model: (3) in, T s The sampling period is G 2( s () is the least squares identification model. G 1( s () represents the compensated model; After identifying the transfer function, the frequency domain correction curves are calculated, namely the amplitude amplification curve and the phase advance curve: (4) in, G 1( jω (This is the compensated model) G 1( s The frequency domain characteristics of ) A G ( ω () represents the amplitude amplification curve. φ G ( ω () represents the phase advance curve.
3. The G-code refactoring method according to claim 1, characterized in that, Step 4) specifically involves: reconstructing the G code according to the correction instructions; changing the trajectory of the G code through the reconstruction algorithm to achieve a frequency domain correction effect; For linear interpolation G-code, i.e. G01 instruction, a method of taking points on the correction instruction is adopted to filter and generate new tool positions and form reconstructed G-code; Establish the relationship between the tool position distance and the interpolation command speed as a constraint model: (5) in, F Set the feed rate for the G-code. M c For the minimum interpolation period, Δ x Distance between the tool and the tool point v For interpolation instruction speed; Let the sequence of correction instruction positions be: (6) N is the length; The original command speed sequence was: (7) The generated knife point sequence is as follows: (8) Starting point of the correction instruction p 1 is the first knife point, i.e. P 1= p 1, serving as the initial reference; simultaneously, as the starting point of the velocity sequence. v 1 is the initial velocity reference, and the positions of subsequent correction commands are traversed. p i , i >1; If the currently reserved tool position is P j Then P j Based on this, traverse the positions of subsequent correction instructions. p i , i >idx( P j ), where idx( P j )express P j The velocity reference is the index corresponding to the position sequence of the correction instruction. v idx(Pj) At this time, the distance between the tool points is: (9) Substituting the blade position spacing into the constraint formula yields the predicted velocity. vp i for: (10) Compared with the speed reference, if vp i = v idx(Pj) If so, the current command position is retained as the new tool position. P j+1 = p i If they are not equal, continue traversing backwards; repeat the above process until all instruction sequences have been traversed, finally obtaining the tool position sequence that satisfies the speed constraint. P j }; Finally, based on this sequence, the reconstructed G-code is generated according to the format of G01 linear interpolation G-code.
4. The G-code refactoring method according to claim 1, characterized in that: For NURBS spline interpolation G-code, a nonlinear programming algorithm is used to optimize the position of control points in spline interpolation G-code, so that the curve corresponding to the new control point coincides with the correction instruction in step 3), and finally the reconstructed G-code is formed; The objective function in the nonlinear programming algorithm is: (11) in, x c Here, represents the control points to be optimized, i.e., the curve control points; ce is the function for solving the contour error between the two trajectories; nbs is the function for solving the spline curve. x * The target curve is the correction command; the trajectory contour error solution function is specifically the shortest distance from a point on the spline curve to be optimized to the target curve. The nonlinear constraint function is: (12) in, x c0 For the original control point, C ( u i ) represents the corresponding spline curve, n i The unit normal vector at the corresponding position. δ i Used for initial position determination. δ i When = 1, the control point is located on the positive side of the normal vector. δ i = -1 is on the negative side; The bounded constraint function is: (13) in, ω max and ω min These are the maximum and minimum values of the original spline weights. Finally, based on the control point optimization results of the algorithm, the reconstructed G-code is generated according to the format of NURBS spline interpolation G-code.