A thread cutting method based on dynamic programming

Through the dynamic programming thread cutting method, the problem of insufficient accuracy and stability in traditional thread cutting is solved, high-precision and stable thread cutting processing is achieved, and multi-stage continuous thread transition processing is simplified.

CN116300698BActive Publication Date: 2025-09-02GUANGDONG UNIV OF TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310143568.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2025-09-02
Estimated Expiration
2043-02-21

AI Technical Summary

Technical Problem

In the existing thread cutting technology, the interpolation method has low accuracy and limited feed speed. Traditional speed planning is prone to vibration and damage of the equipment, and the multi-stage continuous thread transition treatment is complicated.

Method used

The thread cutting method based on dynamic programming is adopted to establish a connection with the spindle encoder through the dynamic speed curve model, adjust the actual starting entry position, and achieve smooth transition interpolation of multiple continuous threads, making up for the shortcomings of the traditional method.

Benefits of technology

It improves the stability and accuracy of thread cutting, reduces the risk of equipment vibration, simplifies algorithm processing, and realizes a smooth transition of variable pitch and variable direction threads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116300698B_ABST
    Figure CN116300698B_ABST
Patent Text Reader

Abstract

The present invention discloses a thread cutting processing method based on dynamic programming, and proposes a cutting starting point scheme for recalculating the actual cutting position and then judging whether to send a synchronization signal; a dynamic programming method in which the spindle encoder value is obtained in each interpolation cycle, and preprocessing and speed planning are performed according to the encoder value to realize that the entire speed model is connected to the spindle; a thread transition compensation algorithm for variable pitch and variable direction threads is proposed based on the dynamic programming method; the algorithm proposed in the present invention can not only smoothly transition until a preset position relationship with the spindle is established again when the spindle speed fluctuates greatly, but also ensure that the tool enters the same cutting point when the spindle speed is set to different times with the same thread instruction. Compared with the traditional thread interpolation method, in addition to higher stability and precision, the process of realizing variable pitch and variable direction thread transition is more convenient and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of thread cutting in numerical control machining, and in particular to a thread cutting method based on dynamic programming, which can be applied to various machine tools such as lathes, turning-milling composite equipment, etc. Background Art

[0002] In existing thread cutting technologies, interpolation methods are mostly based on pulse increments or standard data sampling interpolation methods. Compared with the pulse increment method, which has low precision and feed speeds limited by the computer interpolation speed, the best interpolation method for achieving high-speed thread cutting is data sampling interpolation. However, thread interpolation is different from general linear and circular interpolation. A standard thread turning speed curve model consists of three stages: acceleration, following, and deceleration. The entire process needs to be linked to the rotation of the spindle. If a general speed planning method is used, only the following stage can dynamically move in real time according to the numerical value of the spindle encoder. To ensure that the tool enters the same entry point, a more complex algorithm is required to compensate for fluctuations in the spindle speed, otherwise the thread will be buckled. Moreover, when the speed fluctuations are relatively large, the traditional speed planning method is prone to large speed jumps, causing equipment vibration or even equipment damage. In addition, in the process of performing multiple continuous thread transitions, traditional speed planning also requires relatively complex processing. Summary of the Invention

[0003] The purpose of the present invention is to overcome the shortcomings of the existing technology and provide a thread cutting processing method based on dynamic planning with higher stability and precision than the traditional planning method to realize thread interpolation, and on this basis to realize smooth transition interpolation of variable pitch and variable direction threads.

[0004] To achieve the above objectives, the technical solutions provided by the present invention are:

[0005] A thread cutting method based on dynamic programming includes the following steps:

[0006] Step 1: Initialize the algorithm flow; set the performance parameters of the motion platform including the pulse equivalent and the performance parameters of the spindle encoder; retrieve the motion parameters specified by the current thread instruction from the instruction buffer, and modify the continuous thread instruction flag bit according to whether the instruction mode has changed; based on the motion parameters specified by the thread instruction, determine the major and minor axis numbers of the motion axis and calculate the corresponding motion parameters of the major and minor axes;

[0007] Step 2, preprocessing of multiple continuous threads; determine whether the next instruction in the instruction buffer is a thread instruction. If it is a thread instruction, perform continuous thread preprocessing on it. After the preprocessing is completed or the next instruction in the instruction buffer is a non-thread instruction, according to the assignment result of step 1, if it is a continuous thread, jump to step 6, otherwise execute the next step;

[0008] Step 3: Calculate the actual starting cut-in position. Based on the theoretical starting cut-in position of the spindle, the actual starting cut-in position of the spindle is calculated in combination with the performance parameters of the spindle encoder, the current spindle speed, and the motion parameters corresponding to the long axis. The planning parameters of the long axis acceleration to the following stage are recorded during this process.

[0009] Step 4: Determine whether to send a synchronization signal; determine whether the current spindle encoder position is within the starting range of the initial cut-in position. If not, execute step 4 for each interpolation cycle. Otherwise, send a synchronization signal and record the starting deviation, and then execute the next step.

[0010] Step 5: Movement and compensation in the acceleration phase; according to the acceleration time planned in step 3, if the current time node is greater than the acceleration time, jump directly to step 8; otherwise, calculate the theoretical additional distance of the long axis with the planning parameters of step 3, and compensate the pulse fluctuation of the main axis at the current time node based on the theoretical additional distance, as well as the component of the starting deviation obtained in step 4 at the current time node, and finally obtain the additional distance S of the long axis at the current spindle speed. Delta , after the calculation is completed, jump to step 8;

[0011] Step 6: Processing of continuous threads. Perform corresponding processing and compensation based on the type of continuous thread being cut. If it is an acceleration type continuous thread, skip to step 8. If it is another type of continuous thread, determine whether speed planning for the deceleration stage has been performed. If so, proceed to step 7. If not, perform speed planning and calculate the ideal encoder value at the thread end point.

[0012] Step 7: Movement and compensation of non-accelerated continuous threads; according to the deceleration time planned in step 6, if the current time node is less than the deceleration time, the planned value is used as the distance S that the long axis should add at the current spindle speed. Delta , otherwise proceed to the next step;

[0013] Step 8: Dynamic speed planning; if the previous step has obtained S Delta , then only the motion speed V of the long axis at the current spindle speed is calculated Delta Otherwise, calculate the standard S according to the parameters of step 1 Delta ; Combined with V Delta 、S Delta , the motion parameters corresponding to the long axis and whether it is a continuous thread, pre-process the speed planning, and then perform speed planning based on the pre-processed values ​​to obtain the displacement interpolation points of the long axis;

[0014] Step 9: Output of displacement interpolation points; round the result after long axis planning according to the pulse equivalent set in step 1, and then calculate the interpolation point corresponding to the short axis according to the ratio of long axis to short axis, and output the interpolation points of long axis and short axis, and update S at the same time. Pre and V Curr If the interpolation is completed, return to step 1. If it is a continuous thread, the starting compensation value S corresponding to the target thread major axis needs to be calculated according to the description of step 6. SPComp If the interpolation is not completed and the thread is discontinuous, return to step 5. If the interpolation is not completed and the thread is continuous, return to step 6.

[0015] Furthermore, in step 1, the performance parameters of the motion platform also include: interpolation period T c , the initial speed V of the lathe sL , limit speed V maxL , final velocity V eL , limit acceleration Acc L , limit deceleration Dec L ;The performance parameters of the spindle encoder include: line number L n , frequency multiplication number N;

[0016] The motion parameters specified by this thread instruction include lead F, spindle speed V Spindle , short axis back-off amount J, long axis back-off amount K, cutting starting angle A; the motion parameters corresponding to the long and short axes include the total interpolation distance S of the long axis, the ratio R between the long and short axes LS 、The direction of movement of the long axis Vector L , the end position P of the major axis End .

[0017] Furthermore, in step 2, the continuous thread pretreatment includes:

[0018] Compare the lead value and major axis movement direction of the next thread instruction in the instruction buffer with the current thread instruction to determine the type of continuous thread; if the lead value of the next thread instruction is greater than that of the current instruction under the premise of the same major axis movement direction, it is an acceleration type continuous thread, otherwise it is a deceleration type continuous thread; if the major axis direction of the next thread instruction is opposite to the current one, it is a reversing type continuous thread; among them, the deceleration type continuous thread and the reversing type continuous thread are both non-acceleration type continuous threads.

[0019] Furthermore, for non-accelerated continuous threads, according to the limit deceleration Dec L Decelerate to target speed V Target The required distance is used to calculate the ideal deceleration position P of the long axis. IdealDec , the calculation process is as follows:

[0020] The speed of the current thread instruction in the follow-up stage is calculated using formula 1 as V Follow :

[0021] V Follow =V Spindle =F Formula 1

[0022] V Spindle is the spindle speed, target speed V Target The target speed of the reversing type continuous thread is the final speed V specified by the lathe. eL , and the target speed of the continuous deceleration type is the speed V of the next thread instruction in the follow-up stage Follow ', using formula 2 and formula 3, calculate V Follow '、V Target :

[0023] V Follow '=V Spindle =F Formula 2

[0024]

[0025] Based on V Follow 、V Target Use formula 4 and formula 5 to calculate the deceleration distance and P IdealDec :

[0026]

[0027]

[0028] Furthermore, the step 3 includes:

[0029] Assume that the pulse increment of each interpolation node is ΔPulse. After the spindle reaches the rated speed, obtain the ΔPulse of M interpolation cycles and take the average value as the actual spindle speed V. RSpinlde ; Use formula 6 to calculate the spindle speed as V RSpinlde When the long axis follows the velocity V RFollow :

[0030]

[0031] Use equations 7, 8, and 9 to calculate the long axis velocity from the starting speed V sL Accelerate to V RFollow Plan and get the acceleration distance of this section and exercise time And record the planned parameters:

[0032]

[0033]

[0034]

[0035] Assuming that the long axis enters the following stage at the beginning, then Corresponding to the only ideal spindle pulse increment ΔSpindle, from ΔSpindle and the theoretical starting position Q of the spindle, the spindle motion in the long axis can be obtained. The corresponding position Q' is calculated using Equations 10 and 11:

[0036]

[0037] Q'=(Q+ΔSpindle)%(N×L n ) Formula 11

[0038] According to V RSpinlde and The long axis motion is calculated using Equation 12 After the distance, the actual pulse increment of the spindle is ΔSpindle':

[0039]

[0040] From Q' and ΔSpindle', we can see that if the long axis wants to achieve the following effect during the acceleration phase, the actual starting cutting position of the main axis should be Q", and Q" can be calculated using formula 13:

[0041] Q”=(Q’-ΔSpindle’)%(N×L n ) Equation 13.

[0042] Furthermore, the step 4 includes:

[0043] Assume the current spindle encoder position is Q now When the spindle speed is constant, the spindle encoder increment obtained by a single timer interrupt is Delta. When the starting range is greater than or equal to Delta, it can be guaranteed that the synchronization signal can be sent when the spindle passes the starting cut-in position for the first time. Taking into account the fluctuations during spindle rotation and reducing the deviation value EncodeDev caused by the difference between the actual spindle position and the starting cut-in position when sending the synchronization signal, the starting range interval StartRange of the synchronization signal is calculated using Formula 14:

[0044] StartRange=1.1=Delta Equation 14

[0045] The value of EncodeDev is related to the spindle speed and direction. If EncodeDev>0, it means the spindle position is ahead. In order to ensure that the interpolation distance of the moving axis is F after the spindle rotates one circle, the long axis will increase the interpolation distance. If EncodeDev<0, it means the spindle position is lagging, and the long axis will reduce the interpolation distance. Start deviation S Comp The distance that needs to be interpolated is calculated using Equation 15 and Equation 16. Comp :

[0046]

[0047]

[0048] If Q now If it is not within the start range, then step 4 is executed in each interpolation cycle until it is within the start range and the synchronization signal is sent and S is recorded. Comp .

[0049] Furthermore, the calculation process of step 5 includes:

[0050] Current time node T n The total interpolation distance is S n , the previous time node T n-1 The total interpolation distance is S n-1 , use formula 17 and formula 18 to calculate S n and S n-1 :

[0051]

[0052]

[0053] The startup deviation is evenly distributed to the acceleration stage, and the pulse fluctuation of the main axis at the current time node is compensated.

[0054] Formula 19 calculates the total compensation value S at the current time node AllComp :

[0055]

[0056] In the acceleration phase, the current time node T is calculated using formula 20. n S for dynamic programming Delta :

[0057] S Delta =S n -S n-1 +S AllComp Formula 20.

[0058] Furthermore, in step 6, the processing schemes for different types of continuous threads are as follows:

[0059] (1) Acceleration type continuous thread

[0060] Let the current thread maintain the speed V of the following stage calculated in step 2 Follow Arrived at the end point, the target thread is V Follow As the starting speed and combined with S SPComp Perform dynamic speed planning; Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread long axis is V Follow As the starting speed, the current thread is allowed to exceed the theoretical end point, and the excess distance is compensated to the target thread; let the excess distance of the major axis be S Over , calculate S using formula 21 SPComp ; Due to S Over It is obtained at the end of the current thread interpolation, so the calculation of formula 21 is performed after the thread interpolation in step 9 is completed:

[0061]

[0062] (2) Reducer type continuous thread

[0063] At the current position P on the major axis Now Greater than or equal to the theoretical deceleration position P calculated in step 2 IdealDec The deceleration speed planning is performed once; the various parameters used for deceleration speed planning include: initial speed Final velocity Limit deceleration Dec'; if P is used during deceleration speed planning Now >P IdealDec , suppose the planning time axis exceeds P IdealDec The distance is S OverDec , use formula 22 to calculate the actual distance S between the current position of the long axis and the theoretical end point DecReal :

[0064]

[0065] Assume the actual speed of the long axis at the current time node is V Curr ,make Combined with S DecReal , use Equation 23 to calculate Dec':

[0066]

[0067] Use Equation 24 to calculate the deceleration time And round up the deceleration time:

[0068]

[0069] After rounding, use Equation 25 and Equation 26 to recalculate the deceleration Dec' and the total interpolation distance S of the deceleration speed plan. PlanDec :

[0070]

[0071]

[0072] Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread major axis is V Follow ' is used as the starting speed, allowing the current thread to exceed the theoretical end point; let the value of the major axis exceeding the theoretical end point be ΔS, and use formula 27 to calculate ΔS:

[0073] ΔS=S PlanDec -S DecReal Formula 27

[0074] In order to prevent the same thread from being screwed up when cutting the same thread segment multiple times, an ideal spindle encoder position P is calculated at the end point of each thread segment. IdealSpindle , used to compensate for the deviation caused by the fluctuation of spindle speed and the different positions of deceleration speed planning during multiple cutting of each thread segment; P IdealSpindle The calculation steps are as follows:

[0075] (a) Calculate the major axis at P IdealDec The value of the spindle encoder Q1

[0076] When starting to plan the deceleration, the current value Q2 of the spindle encoder is obtained. Since there is a one-to-one correspondence between the long axis position and the spindle position before deceleration during thread cutting, the long axis position at P is calculated by using formula 28. IdealDec The value of the spindle encoder Q1:

[0077]

[0078] (b) Calculate the ideal deceleration time t DecIdeal

[0079] In the same thread segment, if the deceleration time is different, the ideal spindle encoder position P IdealSpindle Different, so cannot be used As the deceleration time; use formula 29 to calculate from V Follow Slow down to V Follow 'The time required is t DecIdeal , and round up the time:

[0080]

[0081] Since VFollow 、V' Follow The same in the same thread segment, so in the process of cutting the same thread segment multiple times, t DecIdeal same;

[0082] (c) Compensate for the distance the major axis exceeds the theoretical end point

[0083] From steps (a) and (b), we can obtain the ideal value of the spindle encoder when the thread major axis is at the theoretical end point of the current thread. Since the deceleration type continuous thread allows the current thread major axis to exceed the theoretical end point, it is necessary to compensate the value ΔS by which the major axis exceeds the theoretical end point to obtain the theoretical value P of the spindle encoder at the end of the current thread interpolation. IdealSpindle ; Use formula 30 to calculate P IdealSpindle :

[0084]

[0085] At the end of the current thread interpolation, obtain the actual value P of the spindle encoder RealSpindle , use formula 31 to calculate the S of the continuous thread of the reduction type SPComp ; Due to P RealSpindle It is obtained at the end of the current thread interpolation, so the calculation of formula 31 is performed after the thread interpolation is completed in step 9:

[0086]

[0087] (3) Reversing type continuous thread

[0088] This type of continuous thread is similar to the reduction type continuous thread. Then, use equations 22, 23, 24, 25, and 26 to plan the deceleration speed. Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, after calculating ΔS using equation 27, this value needs to be evenly distributed to the deceleration stage to ensure that the current thread is at the theoretical end point after the interpolation is completed after the deceleration planning.

[0089] The continuous thread of the reversing type also needs to be calculated, and the ideal spindle encoder position P at the end of each thread segment IdealSpindle ; Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, the calculation of P IdealSpindle Only steps (a) and (b) need to be performed, and in step (b), the ideal deceleration time t is calculated using formula 32. DecIdeal Finally, the ideal spindle encoder position P at the end point of each thread segment can be obtained by formula 33 for continuous thread of reversing type. IdealSpindle :

[0090]

[0091] P IdealSpindle =Q1+tDecIdeal ×V Spindle Formula 33.

[0092] Furthermore, in step 7, if the current time node of the deceleration segment Greater than It means that the long axis has completed deceleration and jumps directly to step 8. Otherwise, when the dynamic programming algorithm is used after this stage, the current time node T n The distance S that the long axis should add at the spindle speed Delta It is no longer obtained through the spindle encoder, but is related to the value of the deceleration plan. The calculation process is as follows:

[0093] Assume that the current time node of the deceleration section is The total interpolation distance is Previous time node of deceleration segment The total interpolation distance is Calculate using Equation 34 and Equation 35 and

[0094]

[0095]

[0096] Where: The starting speed for the deceleration plan;

[0097] If it is a reversing type continuous thread, it is also necessary to amortize the ΔS obtained by the deceleration plan to the deceleration process, and use formula 36 to calculate the current time node T n S for dynamic programming Delta :

[0098]

[0099] Furthermore, in step 8, the dynamic speed planning includes:

[0100] Step 8.1 Preprocessing: If the previous step has obtained S Delta , then only the motion speed V of the long axis at the current spindle speed is calculated Delta Otherwise, the standard S Delta ; According to the lead F and interpolation period T specified in step 1 c , and the number of encoder pulses per spindle rotation N×L n , and the current interpolation time node T n The pulse increment ΔPulse of the spindle encoder is obtained, when the interpolation time node is T n When using Equations 37 and 38 to calculate the theoretical movement distance S of the long axis Delta , theoretical motion speed VDelta :

[0101]

[0102]

[0103] From step 1, we know that the total interpolation distance of the long axis is S. Let the total interpolation length actually completed by the current long axis be S. Pre 、The theoretical distance between the current position and the end point is S Left ; S obtained at each interpolation time node Delta By accumulating, the theoretical total interpolation length S of the current major axis can be obtained. Ideal If it is a continuous thread of acceleration type or deceleration type, the compensation of step 6 can be known to S Ideal There is no limit on the value of S Ideal The maximum is S; and by S Pre The current interpolation node T can be obtained n Interpolation length S for speed planning Plan ; If the starting compensation value S corresponding to the target thread major axis SPComp ≠0, indicating that the current thread is continuous and the deviation from the previous thread to the current thread needs to be compensated, that is, S SPComp Compensation to S Ideal 、S Plan , after compensation S SPComp Initialized to 0;

[0104] The maximum speed V allowed by the long axis from the point back to the current point BCmax , and according to the actual speed V of the long axis at the current time node Curr With V BCmax The size of the long axis is used to determine the movement stage, and V is calculated using formula 39. BCmax :

[0105]

[0106] Let V s =V Curr , when V Curr ≤V BCmax When V curr >

[0107] V BCmax When the speed is in the deceleration stage, the speed planning parameter V is recalculated using formula 40 and formula 41 at different stages. max 、V e :

[0108]

[0109]

[0110] Step 8.2 Speed ​​planning: Based on the parameters obtained in the preprocessing stage, use Equations 42 and 43 to calculate the displacement S of the acceleration and deceleration sections. a 、S d :

[0111]

[0112]

[0113] If S a +S d >S Plan , indicating that the interpolation distance is insufficient for acceleration and deceleration, and the maximum speed V is recalculated using formula 44. max , and then according to V max Recalculate S using Equation 42 and Equation 43 a 、S d :

[0114]

[0115] Determine V max 、S a 、S d Then, use Equations 45, 46, and 47 to calculate the number of time nodes T corresponding to the acceleration, uniform speed, and deceleration segments. a 、T d 、T const :

[0116]

[0117]

[0118]

[0119] If T const ≤0 while T a <0||T d <0, it means that the interpolation distance is insufficient and this planning only has the acceleration or deceleration stage; when V s >V e When it is pure acceleration, otherwise it is pure deceleration; according to V s 、V e The size of V is recalculated using formula 48 and formula 49. e 、V max Then use Equation 45 and Equation 46 to recalculate T a 、T d And let T const =0;

[0120]

[0121]

[0122] If T const >0 while T a<0 , it means that the interpolation distance is sufficient, but there is no acceleration stage; a , Acc is inverted to turn the acceleration section into a deceleration section;

[0123] Determine T a 、T d 、T const Finally, in order to reduce unnecessary acceleration and deceleration processes and shorten the entire processing cycle, T a 、T d Round off the values ​​respectively. If the number of time nodes is 0, use formula 50 to recalculate V. s 、V e If it is not 0, then the time node T a 、T d recovery;

[0124]

[0125] Complete T a 、T d After judging whether it is 0, T a 、T d Round up; if T a ≠0, in order to ensure that the acceleration Acc remains unchanged, use formula 51 to calculate V max To recalculate:

[0126] V max =Acc×T a ×T c +V s Formula 51

[0127] If T d ≠0, then judge V curr With V BCmax The size of the corresponding content is recalculated; if V curr >V BCmax , indicating that the motion axis is not in the deceleration stage. At this time, what needs to be guaranteed is the deceleration Dec, so use formula 52 to recalculate V e Otherwise, it means that the motion axis is in the deceleration stage. At this time, in order to ensure that it can decelerate smoothly to the specified speed, the deceleration Dec is recalculated using formula 53;

[0128] V e =V max -Dec×(T d ×T),V curr >V BCmax Formula 52

[0129]

[0130] Complete T a 、T d The rounding and modification of the corresponding parameters after rounding are performed, and T is recalculated using formula 54. const And round it up, and the speed planning ends here.

[0131]

[0132] Compared with the existing technology, the principles and advantages of this solution are as follows:

[0133] This solution adjusts the actual starting entry position according to the different spindle speeds so that the tool can enter the same entry point for thread cutting only when the spindle speeds are different, which makes up for the deficiency of the classic method of using the spindle encoder zero position Z signal as the cutting starting point; the proposed dynamic planning speed curve model can realize that the entire model is connected to the spindle encoder, and when the spindle speed fluctuates greatly, the moving axis can also smoothly transition until the preset position relationship with the spindle is established again. Compared with the traditional speed curve model that only establishes a connection with the spindle encoder in the thread interpolation follow-up stage, it has stronger stability and accuracy, and the multi-segment continuous thread smooth transition interpolation proposed based on dynamic planning is more convenient to implement in algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0134] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the services required for use in the embodiments or the prior art descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0135] Figure 1 A schematic diagram for calculating the actual starting cut-in position;

[0136] Figure 2 It is the relationship diagram of key parameters of pre-processing steps;

[0137] Figure 3 It is a model diagram of dynamic programming speed curve;

[0138] Figure 4 For thread trajectory lines L1, L 1.1 , L 1.2 Speed ​​curve model diagram;

[0139] Figure 5 It is the simulation diagram of thread trajectory line L1~L3;

[0140] Figure 6It is the top view of the simulation of the thread trajectory lines L1 to L3;

[0141] Figure 7 It is the actual turning diagram of the thread trajectory lines L1 and L2;

[0142] Figure 8 This is a physical picture of the accelerated type continuous thread tested;

[0143] Figure 9 This is the speed curve model diagram of the acceleration type continuous thread long axis;

[0144] Figure 10 This is a physical picture of the tested reduction type continuous thread;

[0145] Figure 11 This is a speed curve model diagram of a continuous threaded long shaft of a deceleration type;

[0146] Figure 12 This is a physical picture of the tested reversing type continuous thread;

[0147] Figure 13 This is the speed curve model diagram of the reversing type continuous thread long shaft;

[0148] Figure 14 The following is a physical picture of the threaded screw being tested. DETAILED DESCRIPTION

[0149] The present invention will be further described below in conjunction with specific embodiments:

[0150] The thread cutting method based on dynamic programming described in this embodiment includes:

[0151] Step 1: Initialize the algorithm flow

[0152] Set the performance parameters of the motion platform and the performance parameters of the spindle encoder; in the embodiment of the present invention, the various performance parameters of the motion platform include: interpolation period T c , Set the initial velocity V of the lathe according to the motion performance of the motion platform sL , limit speed V maxL , final velocity V eL , limit acceleration Acc L , limit deceleration Dec L , pulse equivalent P; the performance parameters of the spindle encoder include: line number L n , frequency multiplication number N;

[0153] Take out the motion parameters specified by this thread instruction from the instruction buffer, including: lead F, spindle speed V Spindle (r / ms), short axis back-off amount J, long axis back-off amount K, cutting starting angle A;

[0154] And modify the continuous thread instruction flag Flag according to whether the instruction mode changes Cont If the value is not changed, it is True, otherwise it is False; according to the motion parameters specified by the thread instruction, the major and minor axis numbers of the motion axis are determined and the motion parameters corresponding to the major and minor axes are calculated. The motion parameters corresponding to the major and minor axes include: the total interpolation distance S of the major axis, the ratio between the major and minor axes (the vector with the minor axis direction) R LS 、The direction of movement of the long axis Vector L , the end position P of the major axis End .

[0155] Step 2: Pre-processing of multiple continuous threads

[0156] Determine whether the next instruction in the instruction buffer is a thread instruction. If it is a thread instruction, perform continuous thread preprocessing on it. The specific content of the preprocessing is as follows:

[0157] Compare the lead value and major axis motion direction of the next thread instruction in the instruction buffer with the current thread instruction to determine the type of continuous thread. If it is an accelerated continuous thread, due to the characteristics of the dynamic programming speed curve model, no pre-processing is required, see step 7 for details; if it is a non-accelerated continuous thread, it is necessary to calculate the maximum deceleration Dec. L Decelerate to target speed V Target The required distance is used to calculate the ideal deceleration position P of the long axis. IdealDec , the calculation process is as follows:

[0158] The speed of the current thread instruction in the follow-up stage is calculated using formula 1 as V Follow :

[0159] V Follow =V Spindle ×F type 1

[0160] Target speed V Target The target speed of the reversing type continuous thread is the final speed V specified by the lathe. eL , and the target speed of the continuous deceleration type is the speed V of the next thread instruction in the follow-up stage Follow ', using formula 2 and formula 3, calculate V Follow '、V Target :

[0161] V Follow '=V Spindle ×F type 2

[0162]

[0163] Based on VFollow 、V Target Use formula 4 and formula 5 to calculate the deceleration distance and P IdealDec End of preprocessing:

[0164]

[0165]

[0166] After the preprocessing is completed or the next instruction in the instruction buffer is a non-threaded instruction, according to the continuous thread instruction flag Flag in step 1 Cont , determine the subsequent execution order. If Flag Cont = True, indicating that it is a discontinuous thread or the first segment of a continuous thread. It is necessary to calculate the starting cut-in position and send a synchronization signal to execute the next step. Otherwise, jump directly to step 6.

[0167] Step 3: Calculate the actual starting position

[0168] Figure 1 This is a schematic diagram of the present invention for calculating the actual starting cutting position. Q' and Q" in the figure are both expressed in the form of spindle encoder values. The specific calculation process is as follows:

[0169] Assume that the pulse increment of each interpolation node is ΔPulse. After the spindle reaches the rated speed, obtain the ΔPulse of M interpolation cycles and take the average value as the actual spindle speed V. RSpinlde (pulse / ms), in this CNC system, M=30; the spindle speed is calculated using formula 6 as V RSpinlde When the long axis follows the velocity V RFollow :

[0170]

[0171] Use equations 7, 8, and 9 to calculate the long axis velocity from the starting speed V sL Accelerate to V RFollow Plan and get the acceleration distance of this section and exercise time And record the planned parameters:

[0172]

[0173]

[0174]

[0175] Assuming that the long axis enters the following stage at the beginning, Corresponding to the only ideal spindle pulse increment ΔSpindle, from ΔSpindle and the theoretical starting position Q of the spindle, the spindle motion in the long axis can be obtained. The corresponding position Q' is calculated using Equations 10 and 11:

[0176]

[0177] Q'=(Q+ΔSpindle)%(N×L n ) Formula 11

[0178] According to V RSpinlde and The long axis motion is calculated using Equation 12 After the distance, the actual pulse increment of the spindle is ΔSpindle':

[0179]

[0180] From Q' and ΔSpindle', we can see that if the long axis wants to achieve the following effect during the acceleration phase, the actual starting cutting position of the main axis should be Q", and Q" can be calculated using formula 13:

[0181] Q”=(Q’-ΔSpindle’)%(N×L n ) Formula 13

[0182] Step 4: Determine whether to send a synchronization signal

[0183] Assume the current spindle encoder position is Q now If the synchronization signal is sent only when the encoder position is completely consistent with the starting cut-in position, it will take a very long time to wait, so the starting range needs to be added based on the starting cut-in position.

[0184] Assuming the spindle speed is constant, the spindle encoder increment obtained by a single timer interrupt is Delta. When the start range is greater than or equal to Delta, the synchronization signal can be sent the first time the spindle passes the starting cut-in position. Taking into account the fluctuations during spindle rotation and reducing the deviation value EncodeDev caused by the difference between the actual spindle position and the starting cut-in position when sending the synchronization signal, the start range interval StartRange of the synchronization signal is calculated using Equation 14:

[0185] StartRange = 1.1 × Delta Equation 14

[0186] The value of EncodeDev is related to the spindle speed and direction. If EncodeDev>0, it means the spindle position is ahead. In order to ensure that the interpolation distance of the moving axis is F after the spindle rotates one circle, the long axis needs to increase the interpolation distance. If EncodeDev<0, it means the spindle position is lagging, and the long axis needs to reduce the interpolation distance. Start deviation S Comp The distance that needs to be interpolated is calculated using Equation 15 and Equation 16. Comp :

[0187]

[0188] If Q now If it is not within the start range, then step 4 is executed in each interpolation cycle until it is within the start range and the synchronization signal is sent and S is recorded. Comp .

[0189] Step 5: Movement and compensation during acceleration

[0190] The thread cutting starting point scheme in this paper specifies the interpolation distance of the long axis acceleration section in step 3. Exercise time If the current time node T n Greater than The theoretical acceleration phase has been completed and the process jumps directly to step 8. Otherwise, when the dynamic programming algorithm is used in this phase, the current time node T n The distance S that the long axis should add at the spindle speed Delta It is no longer obtained through the spindle encoder, but is related to the value of the thread cutting starting point plan. The long axis also needs to compensate for the pulse fluctuation of the spindle at the current time node and the starting deviation S obtained in step 4. Comp After the calculation of the component at the current time node, jump to step 8. The calculation process is as follows:

[0191] Current time node T n The total interpolation distance is S n , the previous time node T n-1 The total interpolation distance is S n-1 , use formula 17 and formula 18 to calculate S n and S n-1 :

[0192]

[0193] The startup deviation is evenly distributed to the acceleration stage, and the pulse fluctuation of the main axis at the current time node is compensated. The total compensation value S at the current time node is calculated using formula 19. AllComp :

[0194]

[0195] Therefore, in the acceleration phase, the current time node T is calculated using formula 20. n S for dynamic programming Delta :

[0196] S Delta =S n -S n-1 +S AllComp Formula 20

[0197] Step 6: Processing of continuous threads

[0198] Based on the type of continuous thread being cut, corresponding processing and compensation are performed. If it is an acceleration type continuous thread, skip to step 8. If it is another type of continuous thread, determine whether speed planning for the deceleration stage has been performed. If so, proceed to step 7. If not, proceed to speed planning. The continuous thread determination and specific processing are as follows:

[0199] From formula 1, we can see that the speed of the long axis following stage is related to the lead F. At the same spindle speed V Spindle Under the following conditions, according to the different lead values ​​F of the two thread instructions and the different movement directions, continuous threads can be divided into three types: "acceleration", "deceleration" and "reversal". For the sake of convenience, the current thread instruction is called "current thread" and the next thread instruction in the instruction buffer is called "target thread". In order to prevent the thread from buckling after the current thread transitions to the target thread, it is necessary to calculate the starting compensation value S corresponding to the long axis of the target thread according to the type of continuous thread. SPComp From step 8, we can know that the dynamic speed planning curve model records the interpolation distance S of the moving axis corresponding to the current position of the main axis during the interpolation process. Delta , and the current time node T n The uninterpolated distance is retained until the next time T n+1 To interpolate, we only need to SPComp By placing it in the dynamic speed planning curve model, the value can be smoothly compensated according to the preset acceleration and deceleration. The specific processing solutions for different types of continuous threads are as follows:

[0200] (1) Acceleration type continuous thread

[0201] If the movement direction is the same and the lead value F of the current thread is smaller than the lead value F of the target thread Target , which is called the acceleration type continuous thread. This type of continuous thread only needs to keep the current thread at the follow-up speed V calculated in step 2. Follow Arrived at the end point, the target thread is V Follow As the starting speed and combined with S SPCompPerform dynamic speed planning. Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread long axis is V Follow As the starting speed, the current thread is allowed to exceed the theoretical end point and the excess distance is compensated to the target thread. Let the excess distance of the major axis be S Over , calculate S using formula 21 SPComp . Due to S Over It is obtained at the end of the current thread interpolation, so the calculation of formula 21 is performed after the thread interpolation is completed in step 9;

[0202] (2) Reducer type continuous thread

[0203] If the movement direction is the same and F>F Target , which is called a deceleration type continuous thread. This type of continuous thread needs to be at the current position P of the long axis. Now Greater than or equal to the theoretical deceleration position P calculated in step 2 IdealDec The various parameters used for deceleration speed planning include: initial speed Final velocity Limit deceleration Dec'; the speed unit is mm / ms, the acceleration unit is mm / ms 2

[0204] If P is used during deceleration speed planning Now >P IdealDec , suppose the planning time axis exceeds P IdealDec The distance is S OverDec , use formula 22 to calculate the actual distance S between the current position of the long axis and the theoretical end point DecReal :

[0205]

[0206] Assume the actual speed of the long axis at the current time node is V Curr ,make Combined with S DecReal , use Equation 23 to calculate Dec':

[0207]

[0208] Use Equation 24 to calculate the deceleration time And round up the deceleration time

[0209]

[0210] After rounding, use Equation 25 and Equation 26 to recalculate the deceleration Dec' and the total interpolation distance S of the deceleration speed plan.PlanDec :

[0211]

[0212]

[0213] Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread major axis is V Follow ' is used as the starting speed, allowing the current thread to exceed the theoretical end point. Let the value of the major axis exceeding the theoretical end point be ΔS, and use formula 27 to calculate ΔS:

[0214] ΔS=S PlanDec -S DecReal Formula 27

[0215] In order to prevent the same thread from buckling when cutting multiple times, an ideal spindle encoder position P needs to be calculated at the end point of each thread segment. IdealSpindle , used to compensate for the deviation caused by the fluctuation of spindle speed and the different positions of deceleration speed planning during multiple cutting of each thread segment. IdealSpindle The calculation steps are as follows:

[0216] (a) Calculate the major axis at P IdealDec The value of the spindle encoder Q1

[0217] When starting to plan the deceleration, the current value Q2 of the spindle encoder is obtained. Since there is a one-to-one correspondence between the long axis position and the spindle position before deceleration during thread cutting, the long axis position at P is calculated by using formula 28. IdealDec The value of the spindle encoder Q1:

[0218]

[0219] (b) Calculate the ideal deceleration time t DecIdeal

[0220] In the same thread segment, if the deceleration time is different, the ideal spindle encoder position P IdealSpindle Different, so cannot be used As the deceleration time. Use formula 29 to calculate from V Follow Slow down to V Follow 'The time required is t DecIdeal , and round up the time:

[0221]

[0222] Since V Follow 、V' Follow The same in the same thread segment, so in the process of cutting the same thread segment multiple times, t DecIdealsame

[0223] (c) Compensate for the distance the major axis exceeds the theoretical end point

[0224] From steps (a) and (b), we can get the ideal value of the spindle encoder when the thread major axis is at the theoretical end point of the current thread. Since the deceleration type continuous thread allows the current thread major axis to exceed the theoretical end point, it is necessary to compensate the value ΔS by which the major axis exceeds the theoretical end point in order to obtain the theoretical value P of the spindle encoder at the end of the current thread interpolation. IdealSpindle Calculate P using Equation 30 IdealSpindle :

[0225]

[0226] At the end of the current thread interpolation, obtain the actual value P of the spindle encoder RealSpindle , use formula 31 to calculate the S of the continuous thread of the reduction type SPComp . Due to P RealSpindle It is obtained when the current thread interpolation ends, so the calculation of formula 31 is performed after the thread interpolation ends in step 9.

[0227]

[0228] (3) Reversing type continuous thread

[0229] If the movement direction is opposite, regardless of F and F Target Regardless of the numerical relationship, it is called a reversing type continuous thread. This type of continuous thread is similar to the deceleration type continuous thread. Then, use Equations 22, 23, 24, 25, and 26 to plan the deceleration speed. Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, after calculating ΔS using Equation 27, this value needs to be evenly distributed to the deceleration section to ensure that after deceleration planning, the current thread is at the theoretical end point after the interpolation is completed.

[0230] The continuous thread of the reversing type also needs to be calculated, and the ideal spindle encoder position P at the end of each thread segment IdealSpindle Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, the calculation of P IdealSpindle Only steps (a) and (b) need to be performed, and in step (b), the ideal deceleration time t is calculated using formula 32. DecIdeal Finally, the ideal spindle encoder position P at the end point of each thread segment can be obtained by formula 33 for continuous thread of reversing type. IdealSpindle :

[0231]

[0232] P IdealSpindle =Q1+t DecIdeal ×VSpindle Formula 33

[0233] The actual value P of the spindle encoder can only be obtained when the current thread interpolation is completed. RealSpindle , so it is consistent with the deceleration type continuous thread. After the thread interpolation in step 9 is completed, the calculation of formula 31 is performed to obtain the starting compensation value S SPComp .

[0234] Step 7: Movement and compensation of non-accelerated continuous thread

[0235] In step 6, the deceleration section of this type of continuous thread has been planned. If the current time node of the deceleration section Greater than It means that the long axis has completed deceleration and jumps directly to step 8. Otherwise, when the dynamic programming algorithm is used after this stage, the current time node T n The distance S that the long axis should add at the spindle speed Delta It is no longer obtained through the spindle encoder, but is related to the value of the deceleration plan. The calculation process is as follows:

[0236] Assume that the current time node of the deceleration section is The total interpolation distance is Previous time node of deceleration segment The total interpolation distance is Calculate using Equation 34 and Equation 35 and

[0237]

[0238]

[0239] Where: The starting speed for the deceleration plan in step 6.

[0240] If it is a reversing type continuous thread, it is also necessary to amortize the ΔS obtained by the deceleration planning in step 6 to the deceleration process, and use formula 36 to calculate the current time node T n S for dynamic programming Delta :

[0241]

[0242] Step 8: Dynamic speed planning

[0243] In the embodiment of the present invention, various parameters used for speed planning include: initial speed V s , limit speed V max , final velocity V e, limit acceleration Acc, limit deceleration Dec; the speed unit is mm / ms, the acceleration unit is mm / ms 2 And use the lathe parameters set in step 1 to initialize the value of the speed planning above; the two steps of dynamic speed planning are explained below:

[0244] Step 8.1 Preprocessing: If the previous step has obtained S Delta , then we only need to calculate the movement speed V of the long axis at the current spindle speed Delta Otherwise, the standard S Delta According to the lead F and interpolation period T specified in step 1 c , and the number of encoder pulses per spindle rotation N×L n , and the current interpolation time node T n The pulse increment ΔPulse of the spindle encoder is obtained, when the interpolation time node is T n When using Equations 37 and 38 to calculate the theoretical movement distance S of the long axis Delta , theoretical motion speed V Delta :

[0245]

[0246]

[0247] From step 1, we know that the total interpolation distance of the long axis is S. Let the total interpolation length actually completed by the current long axis be S. Pre 、The theoretical distance between the current position and the end point is S Left ; S obtained at each interpolation time node Delta By accumulating, the theoretical total interpolation length S of the current major axis can be obtained. Ideal If it is a continuous thread of acceleration type or deceleration type, the compensation of step 6 can be known to S Ideal There is no limit on the value of S Ideal The maximum is S; and by S Pre The current interpolation node T can be obtained n Interpolation length S for speed planning Plan The relationship between the above parameters is as follows: Figure 2 If the starting compensation value S corresponding to the target thread major axis is SPComp ≠0, indicating that the current thread is continuous and the deviation from the previous thread to the current thread needs to be compensated, that is, S SPComp Compensation to S Ideal 、S Plan , after compensation S SPComp Initialized to 0.

[0248] In order to ensure that the planned curve can be decelerated at the speed set by the system parameters,L To decelerate to the end point, it is necessary to calculate the maximum speed V allowed by the long axis from the end point to the current point. BCmax , and according to the actual speed V of the long axis at the current time node Curr With V BCmax The size of the long axis is used to determine the movement stage, and V is calculated using formula 39. BCmax :

[0249]

[0250] Let V s =V Curr , when V Curr ≤V BCmax When V curr >

[0251] V BCmax When the speed is in the deceleration stage, the speed planning parameter V is recalculated using formula 40 and formula 41 at different stages. max 、V e :

[0252]

[0253] Step 8.2 Speed ​​planning: A standard trapezoidal acceleration and deceleration speed curve model consists of acceleration, constant speed and deceleration. Usually, only one planning is needed to determine the total number of time nodes and the node intervals corresponding to different speed stages. However, the trapezoidal speed curve model under dynamic programming is different. No matter how many time nodes t i Only the planning content of the first time node t1 is output, and the interpolation distances of the remaining nodes are accumulated to the next segment S Plan , depending on the parameters obtained by preprocessing, t1 may be an acceleration, constant speed or deceleration segment. If the time node T required for the motion axis to reach the end point n The number is i, then the planning content of i time nodes t1 obtained by the i-th speed planning constitutes a dynamic planning speed curve model. This model does not correspond to fixed node intervals in different speed stages, but dynamically divides the entire model according to the planning parameters obtained by preprocessing, so that the entire speed model is connected to the main axis. The model is as follows Figure 3 shown.

[0254] The specific steps of speed planning are as follows: Based on the parameters obtained in the preprocessing stage, the displacement S of the acceleration and deceleration sections are calculated using Equations 42 and 43. a 、S d :

[0255]

[0256]

[0257] If S a +S d >S Plan , indicating that the interpolation distance is insufficient for acceleration and deceleration, and the maximum speed V needs to be recalculated using formula 44 max , and then according to V max Recalculate S using Equation 42 and Equation 43 a 、S d .

[0258]

[0259] Determined V max 、S a 、S d Then, use Equations 45, 46, and 47 to calculate the number of time nodes T corresponding to the acceleration, uniform speed, and deceleration segments. a 、T d 、T const :

[0260]

[0261]

[0262]

[0263] If T const ≤0 while T a <0||T d <0, it means that the interpolation distance is insufficient and this planning only has the acceleration or deceleration stage; when V s >V e When it is pure acceleration, otherwise it is pure deceleration; according to V s 、V e The size of V is recalculated using formula 48 and formula 49. e 、V max Then use Equation 45 and Equation 46 to recalculate T a 、T d And let T const =0.

[0264]

[0265]

[0266] If T const >0 while T a<0 , it means that the interpolation distance is sufficient, but there is no acceleration stage; a , Acc is inverted to turn the acceleration section into a deceleration section.

[0267] Confirmed Ta 、T d 、T const Finally, in order to reduce unnecessary acceleration and deceleration processes and shorten the entire processing cycle, T a 、T d Round off the values ​​respectively. If the number of time nodes is 0, use formula 50 to recalculate V. s 、V e If it is not 0, then the time node T a 、T d recovery;

[0268] Complete T a 、T d After judging whether it is 0, T a 、T d Round up. If T a ≠0, in order to ensure that the acceleration Acc remains unchanged, it is necessary to use formula 51 to calculate V max Recalculate: V max =Acc×T a ×T c +V s Formula 51

[0269] If T d ≠0, then it is necessary to judge V curr With V BCmax The size of the corresponding content is recalculated. If V curr >V BCmax , indicating that the motion axis is not in the deceleration stage. At this time, what needs to be guaranteed is the deceleration Dec, so use formula 52 to recalculate V e Otherwise, it means that the motion axis is in the deceleration stage. At this time, in order to ensure that it can decelerate smoothly to the specified speed, it is necessary to use formula 53 to recalculate Dec.

[0270] V e =V max -Dec×(T d ×T),V curr >V BCmax Formula 52

[0271]

[0272] Complete T a 、T d The rounding and modification of the corresponding parameters after rounding need to be recalculated using formula 54. const And round it up, and the speed planning ends here.

[0273]

[0274] Step 9: Output of displacement interpolation points

[0275] The result after long axis planning is rounded according to the pulse equivalent P set in step 1, and then the long axis and short axis ratio R are calculated. LS , calculate the interpolation point corresponding to the minor axis, and output the interpolation points of the major and minor axes, and update S Pre and V Curr If the interpolated distance S of the major axis Pre ≥S, indicating that the interpolation is completed, return to step 1, if it is a continuous thread, it is necessary to calculate the starting compensation value S corresponding to the target thread major axis according to the description of step 6. SPComp If the interpolation is not completed and the thread is discontinuous, return to step 5. If the interpolation is not completed and the thread is continuous, return to step 6.

[0276] In order to verify the performance of the algorithm mentioned in this paper, simulation and physical processing are carried out according to the following parameters: interpolation period T c is 1ms, set the initial speed of the lathe V sL The maximum speed is 200mm / min and the maximum speed is V maxL 25000mm / min, final speed V eL 200mm / min, limit acceleration Acc L 8000mm / s 2 , limit deceleration Dec L 8000mm / s 2 , the pulse equivalent P is 0.001mm; set the number of lines L of the spindle encoder n The multiplication factor N is 4.

[0277] Figure 4 For thread trajectory lines L1, L 1.1 , L 1.2 To verify the characteristics of the dynamic programming model, the thread trajectory line L1 is generated according to the following procedure and the cutting starting point scheme of this article:

[0278] M3 S2000

[0279] G0 X10 Z0;

[0280] G32 Z22 F2 M30;

[0281] Based on the dynamic programming speed curve model of the thread trajectory line L1, the spindle speed is set to 3000r / min at the current time node T5 and continues for five interpolation cycles to simulate the spindle jump. The speed curve model in this state is L 1.1 Due to the need to compensate for the starting deviation and spindle speed deviation, the lathe limit speed V maxL Must be greater than V at rated spindle speed DeltaOtherwise, it will not be able to compensate for the extra movement distance of the motion axis, causing the thread to be screwed. maxL The larger the value, the shorter the time required for the long axis to follow the upper spindle. Therefore, when the compensation amount is large, its V maxL Cannot be too small. 1.1 When the spindle jumps in unison, the maximum speed V maxL =4200mm / min, then the speed curve model in this state is L 1.2 ; such as Figure 4 Thread trajectory lines L1, L 1.1 , L 1.2 As shown in the speed curve model diagram, if V maxL If it is too small, it will take a long time for the long axis to follow the upper spindle to perform correct thread interpolation.

[0282] Figure 5 The simulation diagram of thread trajectory lines L1~L3 is shown below. To verify the correctness of the cutting starting point scheme in this paper, the program and parameters of L1 are modified as follows to generate thread trajectory lines L2 and L3: the spindle speed of L2 is 200r / min, and the same as L1, the cutting starting point scheme of this paper is used; while L3 uses the classic scheme, with a spindle speed of 2000r / min. The generated thread trajectory lines L1~L3 are shown below. Figure 5 As shown, the top view of the thread trajectory is as follows Figure 6 As shown. Figure 6 It is easy to see that the threads under the classic scheme are already screwed when the spindle speed is different. However, after the acceleration is completed, the trajectory lines of the cutting starting point scheme proposed in this paper coincide with each other, and the deviation between the front and back trajectories is less than 0.001mm, that is, less than the deviation of one pulse. Based on the CNC system developed in this project, under this motion parameter, the actual cutting effect of L1 and L2 is as follows Figure 7 As shown, the cutting paths overlap, the machined surface is smooth, and the threads are complete without any loose threads.

[0283] Figure 8 The following is a real picture of the accelerated continuous thread tested. To verify the correctness of the transition compensation algorithm between threads of this type of continuous thread, the following G code is used to increase the cutting depth by 0.2mm each time and cycle 4 times for cutting. The speed curve of its long axis is as follows: Figure 9 As shown, comprehensive Figure 8 、 Figure 9 It can be seen that by using this transition compensation algorithm, the thread transition section is smooth and the thread is complete without any loose threads.

[0284] M03 S2000

[0285] G00 X23 Z5

[0286] G34 Z-25F1 R0.5

[0287] Figure 10 The figure below shows the actual object of the tested deceleration type continuous thread. To verify the correctness of the transition compensation algorithm between threads of this type of continuous thread, the following G code is used to increase the cutting depth by 0.2mm each time and to cycle 4 times for cutting. The speed curve of its long axis is as follows: Figure 11 As shown, comprehensive Figure 10 、 Figure 11 It can be seen that by using this transition compensation algorithm, the thread transition section is smooth and the thread is complete without any loose threads.

[0288] M03 S1000

[0289] G00 X23 Z5

[0290] G34 Z-22F5 R-0.5

[0291] Figure 12 The following is a picture of the tested reversing type continuous thread. To verify the correctness of the transition compensation algorithm between threads of this type of continuous thread, the following G code is used to increase the cutting depth by 0.2mm each time and to cycle 4 times for cutting. When the cutting angle Q is 0, the speed curve of the long axis is as follows: Figure 13 As shown, comprehensive Figure 12 、 Figure 13 It can be seen that by using this transition compensation algorithm, the thread transition section is smooth and the thread is complete without any loose threads.

[0292] M03 S100

[0293] G00 X24.3 Z6

[0294] G32 Z-24F30 Q0

[0295] G32 Z6 F30

[0296] G32 Z-24F30 Q600000

[0297] G32 Z6 F30

[0298] G32 Z-24F30 Q120000

[0299] G32 Z6 F30

[0300] G32 Z-24F30 Q180000

[0301] G32 Z6 F30

[0302] G32 Z-24F30 Q240000

[0303] G32 Z6 F30

[0304] G32 Z-24F30 Q300000

[0305] G32 Z6 F30

[0306] Figure 14 The actual picture of the threaded screw being tested is shown in Figure 1. The G code generated by the software MASTERCAM is used for turning. Figure 14 It can be seen that the surface of the cut threaded screw is smooth and the thread is complete without any loose threads.

[0307] The method of the present invention has been demonstrated through simulation and machining experiments. When thread turning is performed using this method, not only can the tool smoothly transition to reestablish a preset positional relationship with the spindle even when the spindle speed fluctuates significantly, but it can also ensure that the tool enters the same entry point even when the spindle speed varies. Compared to traditional thread interpolation methods, this method offers greater stability and precision, and is more convenient and efficient in achieving variable pitch and direction thread transition compensation. This has been applied in this CNC system and achieved relatively ideal results. This research is of great reference value for the development of CNC systems with independent intellectual property rights in my country.

[0308] The embodiments described above are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, any changes made based on the shape and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A thread cutting method based on dynamic programming, characterized in that: The following steps are involved: Step 1: Initialize the algorithm flow; set the performance parameters of the motion platform including the pulse equivalent and the performance parameters of the spindle encoder; retrieve the motion parameters specified by the current thread instruction from the instruction buffer, and modify the continuous thread instruction flag bit according to whether the instruction mode has changed; based on the motion parameters specified by the thread instruction, determine the major and minor axis numbers of the motion axis and calculate the corresponding motion parameters of the major and minor axes; Step 2, preprocessing of multiple continuous threads; determine whether the next instruction in the instruction buffer is a thread instruction. If it is a thread instruction, perform continuous thread preprocessing on it. After the preprocessing is completed or the next instruction in the instruction buffer is a non-thread instruction, according to the assignment result of step 1, if it is a continuous thread, jump to step 6, otherwise execute the next step; Step 3: Calculate the actual starting cut-in position. Based on the theoretical starting cut-in position of the spindle, the actual starting cut-in position of the spindle is calculated in combination with the performance parameters of the spindle encoder, the current spindle speed, and the motion parameters corresponding to the long axis. The planning parameters of the long axis from acceleration to the following stage are recorded during the process. Step 4: Determine whether to send a synchronization signal; determine whether the current spindle encoder position is within the starting range of the initial cut-in position. If not, execute step 4 for each interpolation cycle. Otherwise, send a synchronization signal and record the starting deviation, and then execute the next step. Step 5: Movement and compensation in the acceleration phase; according to the acceleration time planned in step 3, if the current time node is greater than the acceleration time, jump directly to step 8; otherwise, calculate the theoretical additional distance of the long axis with the planning parameters of step 3, and compensate the pulse fluctuation of the main axis at the current time node based on the theoretical additional distance, as well as the component of the starting deviation obtained in step 4 at the current time node, and finally obtain the additional distance S of the long axis at the current spindle speed. Delta , after the calculation is completed, jump to step 8; Step 6: Processing of continuous threads. Perform corresponding processing and compensation based on the type of continuous thread being cut. If it is an acceleration type continuous thread, skip to step 8. If it is another type of continuous thread, determine whether speed planning for the deceleration stage has been performed. If so, proceed to step 7. If not, perform speed planning and calculate the ideal encoder value at the thread end point. Step 7: Movement and compensation of non-accelerated continuous threads; according to the deceleration time planned in step 6, if the current time node is less than the deceleration time, the planned value is used as the distance S that the long axis should add at the current spindle speed. Delta , otherwise proceed to the next step; Step 8: Dynamic speed planning; if the previous step has obtained S Delta , then only the motion speed V of the long axis at the current spindle speed is calculated Delta Otherwise, calculate the standard S according to the parameters of step 1 Delta ; Combined with V Delta 、S Delta , the motion parameters corresponding to the long axis and whether it is a continuous thread, pre-process the speed planning, and then perform speed planning based on the pre-processed values ​​to obtain the displacement interpolation points of the long axis; Step 9, output of displacement interpolation points; The result of the long axis planning is rounded according to the pulse equivalent set in step 1, and then the interpolation point corresponding to the short axis is calculated according to the ratio of the long and short axes, and the interpolation points of the long and short axes are output, and S is updated at the same time. Pre and V Curr If the interpolation is completed, return to step 1. If it is a continuous thread, the starting compensation value S corresponding to the target thread major axis needs to be calculated according to the description of step 6. SPComp If the interpolation is not completed and the thread is discontinuous, return to step 5. If the interpolation is not completed and the thread is continuous, return to step 6.

2. The thread cutting method based on dynamic programming according to claim 1, characterized in that: In step 1, the performance parameters of the motion platform also include: interpolation period T c , the initial speed V of the lathe sL , limit speed V maxL , final velocity V eL , limit acceleration Acc L , limit deceleration Dec L ;The performance parameters of the spindle encoder include: line number L n , frequency multiplication number N; The motion parameters specified by this thread instruction include lead F, spindle speed V Spindle , short axis back-off amount J, long axis back-off amount K, cutting starting angle A; the motion parameters corresponding to the long and short axes include the total interpolation distance S of the long axis, the ratio R between the long and short axes LS 、The direction of movement of the long axis Vector L , the end position P of the major axis End .

3. The thread cutting method based on dynamic programming according to claim 2, characterized in that: In step 2, the continuous thread pretreatment includes: Compare the lead value and major axis movement direction of the next thread instruction in the instruction buffer with the current thread instruction to determine the type of continuous thread; if the lead value of the next thread instruction is greater than that of the current instruction under the premise of the same major axis movement direction, it is an acceleration type continuous thread, otherwise it is a deceleration type continuous thread; if the major axis direction of the next thread instruction is opposite to the current one, it is a reversing type continuous thread; among them, the deceleration type continuous thread and the reversing type continuous thread are both non-acceleration type continuous threads.

4. The thread cutting method based on dynamic programming according to claim 3, characterized in that: For non-accelerated continuous threads, according to the limit deceleration Dec L Decelerate to target speed V Target The required distance is used to calculate the ideal deceleration position P of the long axis. IdealDec , the calculation process is as follows: The speed of the current thread instruction in the follow-up stage is calculated using formula 1 as V Follow : V Follow =V Spindle ×F Formula 1 V Spindle is the spindle speed, target speed V Target The target speed of the reversing type continuous thread is the final speed V specified by the lathe. eL , and the target speed of the continuous deceleration type is the speed V of the next thread instruction in the follow-up stage Follow ', using formula 2 and formula 3, calculate V Follow '、V Target : V Follow ′=V Spindle ×F Formula 2 Based on V Follow 、V Target Use formula 4 and formula 5 to calculate the deceleration distance and P IdealDec :

5. The thread cutting method based on dynamic programming according to claim 4, characterized in that: The step 3 comprises: Assume that the pulse increment of each interpolation node is ΔPulse. After the spindle reaches the rated speed, obtain the ΔPulse of M interpolation cycles and take the average value as the actual spindle speed V. RSpinlde ; Use formula 6 to calculate the spindle speed as V RSpinlde When the long axis follows the velocity V RFollow : Use equations 7, 8, and 9 to calculate the long axis velocity from the starting speed V sL Accelerate to V RFollow Plan and get the acceleration distance of this section and exercise time And record the planned parameters: Assuming that the long axis enters the following stage at the beginning, then Corresponding to the only ideal spindle pulse increment ΔSpindle, from ΔSpindle and the theoretical starting position Q of the spindle, the spindle motion on the long axis can be obtained. The corresponding position Q' is calculated using Equations 10 and 11: According to V RSpinlde and The long axis motion is calculated using Equation 12 After the distance, the actual pulse increment of the spindle is ΔSpindle': From Q' and ΔSpindle', we can see that if the long axis wants to achieve the following effect during the acceleration phase, the actual starting cutting position of the main axis should be Q", and Q" can be calculated using formula 13: Q” = (Q' - ΔSpindle') % (N × L n ) Equation 13.

6. The thread cutting method based on dynamic programming according to claim 5, characterized in that: The step 4 comprises: Assume the current spindle encoder position is Q now When the spindle speed is constant, the spindle encoder increment obtained by a single timer interrupt is Delta. When the starting range is greater than or equal to Delta, it can be guaranteed that the synchronization signal can be sent when the spindle passes the starting cut-in position for the first time. Taking into account the fluctuations during spindle rotation and reducing the deviation value EncodeDev caused by the difference between the actual spindle position and the starting cut-in position when sending the synchronization signal, the starting range interval StartRange of the synchronization signal is calculated using formula 14: StartRange=1.1×DeltaEquation 14 The value of EncodeDev is related to the spindle speed and direction. If EncodeDev>0, it means the spindle position is ahead. In order to ensure that the interpolation distance of the moving axis is F after the spindle rotates one circle, the long axis will increase the interpolation distance. If EncodeDev<0, it means the spindle position is lagging, and the long axis will reduce the interpolation distance. Start deviation S Comp The distance that needs to be interpolated is calculated using Equation 15 and Equation 16. Comp : If Q now If it is not within the start range, then step 4 is executed in each interpolation cycle until it is within the start range and the synchronization signal is sent and S is recorded. Comp .

7. The thread cutting method based on dynamic programming according to claim 6, characterized in that: The calculation process of step 5 includes: Current time node T n The total interpolation distance is S n , the previous time node T n-1 The total interpolation distance is S n-1 , use formula 17 and formula 18 to calculate S n and S n-1 : The startup deviation is evenly distributed to the acceleration stage, and the pulse fluctuation of the main axis at the current time node is compensated. The total compensation value S at the current time node is calculated using formula 19. AllComp : In the acceleration phase, the current time node T is calculated using formula 20. n S for dynamic programming Delta : S Delta =S n -S n-1 +S AllComp Formula 20.

8. The thread cutting method based on dynamic programming according to claim 7, characterized in that: In step 6, the processing schemes for different types of continuous threads are as follows: (1) Acceleration type continuous thread Let the current thread maintain the speed V of the following stage calculated in step 2 Follow Arrived at the end point, the target thread is V Follow As the starting speed and combined with S SPComp Perform dynamic speed planning; Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread long axis is V Follow As the starting speed, the current thread is allowed to exceed the theoretical end point, and the excess distance is compensated to the target thread; let the excess distance of the major axis be S Over , calculate S using formula 21 SPComp ; Due to S Over It is obtained at the end of the current thread interpolation, so the calculation of formula 21 is performed after the thread interpolation in step 9 is completed: (2) Reducer type continuous thread At the current position P on the major axis Now Greater than or equal to the theoretical deceleration position P calculated in step 2 IdealDec The deceleration speed planning is performed once; the various parameters used for deceleration speed planning include: initial speed Final velocity Limit deceleration Dec'; if P is used during deceleration speed planning Now >P IdealDec , suppose the planning time axis exceeds P IdealDec The distance is S OverDec , use formula 22 to calculate the actual distance S between the current position of the long axis and the theoretical end point DecReal : Assume the actual speed of the long axis at the current time node is V Curr ,make Combined with S DecReal , use Equation 23 to calculate Dec': Use Equation 24 to calculate the deceleration time And round up the deceleration time: After rounding, use Equation 25 and Equation 26 to recalculate the deceleration Dec' and the total interpolation distance S of the deceleration speed plan. PlanDec : Due to the spindle speed fluctuation during the following process and the discretization of the speed curve, in order to ensure that the target thread major axis is V Follow ' is used as the starting speed, allowing the current thread to exceed the theoretical end point; let the value of the major axis exceeding the theoretical end point be ΔS, and use formula 27 to calculate ΔS: ΔS=S PlanDec -S DecReal Formula 27 In order to prevent the same thread from being screwed up when cutting the same thread segment multiple times, an ideal spindle encoder position P is calculated at the end point of each thread segment. IdealSpindle , used to compensate for the deviation caused by the fluctuation of spindle speed and the different positions of deceleration speed planning during multiple cutting of each thread segment; P IdealSpindle The calculation steps are as follows: (a) Calculate the major axis at P IdealDec The value of the spindle encoder Q1 When starting to plan the deceleration, the current value Q2 of the spindle encoder is obtained. Since there is a one-to-one correspondence between the long axis position and the spindle position before deceleration during thread cutting, the long axis position at P is calculated by using formula 28. IdealDec The value of the spindle encoder Q1: (b) Calculate the ideal deceleration time t DecIdeal In the same thread segment, if the deceleration time is different, the ideal spindle encoder position P IdealSpindle Different, so cannot be used As the deceleration time; use formula 29 to calculate from V Follow Slow down to V Follow The time required for t DecIdeal , and round up the time: Since V Follow 、V Follow ' is the same in the same thread segment, so in the process of cutting the same thread segment multiple times, t DecIdeal same; (c) Compensate for the distance the major axis exceeds the theoretical end point From steps (a) and (b), we can obtain the ideal value of the spindle encoder when the thread major axis is at the theoretical end point of the current thread. Since the deceleration type continuous thread allows the current thread major axis to exceed the theoretical end point, it is necessary to compensate the value ΔS by which the major axis exceeds the theoretical end point to obtain the theoretical value P of the spindle encoder at the end of the current thread interpolation. IdealSpindle ; Use formula 30 to calculate P IdealSpindle : At the end of the current thread interpolation, obtain the actual value P of the spindle encoder RealSpindle , use formula 31 to calculate the S of the continuous thread of the reduction type SPComp ; Due to P RealSpindle It is obtained at the end of the current thread interpolation, so the calculation of formula 31 is performed after the thread interpolation is completed in step 9: (3) Reversing type continuous thread This type of continuous thread is similar to the reduction type continuous thread. Then, use equations 22, 23, 24, 25, and 26 to plan the deceleration speed. Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, after calculating ΔS using equation 27, this value needs to be evenly distributed to the deceleration stage to ensure that after deceleration planning, the current thread is at the theoretical end point after interpolation. The continuous thread of the reversing type also needs to be calculated, and the ideal spindle encoder position P at the end of each thread segment IdealSpindle ; Since the reversing type continuous thread does not allow the current thread to exceed the theoretical end point, the calculation of P IdealSpindle Only steps (a) and (b) need to be performed, and in step (b), the ideal deceleration time t is calculated using formula 32. DecIdeal Finally, the ideal spindle encoder position P at the end point of each thread segment can be obtained by formula 33 for continuous thread of reversing type. IdealSpindle : P IdealSpindle =Q1+t DecIdeal ×V Spindle Formula 33.

Citation Information

Patent Citations

  • A infrared ray monitoring system for industrial process

    CN207301698U

  • Object tracking-based control of manufacturing processes in the metalworking industry

    US20200209836A1