CN117008536A - Internal thread tapping processing method based on feedback of spindle encoder - Google Patents

Internal thread tapping processing method based on feedback of spindle encoder Download PDF

Info

Publication number
CN117008536A
CN117008536A CN202310692121.6A CN202310692121A CN117008536A CN 117008536 A CN117008536 A CN 117008536A CN 202310692121 A CN202310692121 A CN 202310692121A CN 117008536 A CN117008536 A CN 117008536A
Authority
CN
China
Prior art keywords
tapping
encoder
distance
planning
main shaft
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310692121.6A
Other languages
Chinese (zh)
Inventor
苏毅勇
刘建群
郭强
高伟强
朱稳中
刘泓恺
方妤娜
李锐庆
李锐平
麦舜晖
吴清发
苏毅强
甘敬洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Yashu Intelligent Technology Co ltd
Guangdong University of Technology
Original Assignee
Guangdong Yashu Intelligent Technology Co ltd
Guangdong University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Yashu Intelligent Technology Co ltd, Guangdong University of Technology filed Critical Guangdong Yashu Intelligent Technology Co ltd
Priority to CN202310692121.6A priority Critical patent/CN117008536A/en
Publication of CN117008536A publication Critical patent/CN117008536A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/18Numerical control [NC], i.e. automatically operating machines, in particular machine tools, e.g. in a manufacturing environment, so as to execute positioning, movement or co-ordinated operations by means of programme data in numerical form
    • G05B19/4097Numerical control [NC], i.e. automatically operating machines, in particular machine tools, e.g. in a manufacturing environment, so as to execute positioning, movement or co-ordinated operations by means of programme data in numerical form characterised by using design data to control NC machines, e.g. CAD/CAM
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/32Operator till task planning
    • G05B2219/32153Exchange data between user, cad, caq, nc, capp

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Manufacturing & Machinery (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Automation & Control Theory (AREA)
  • Numerical Control (AREA)

Abstract

The invention discloses an internal thread tapping processing method based on feedback of a spindle encoder, which is characterized in that an absolute value of the encoder is mapped to a spindle position after being obtained, a starting point is judged and captured by judging the value of the encoder, and the starting point can be captured within one rotation of the spindle through interval and hysteresis capture; the overtaking alignment effect of starting and follow-up is realized by taking the tapping shaft displacement corresponding to the variation of the spindle encoder into the planned displacement for each cycle and carrying out each cycle re-planning; the dynamic speed planning can restrict the tapping highest speed in the whole course; the screw tap is started to start the machining, and the planned acceleration is adjusted through virtual operation, so that the screw tap enters a follow-up state in the clearance distance, and the screw tap is ensured to keep following with the rotating speed of the main shaft when screwed into the workpiece; correcting the thread lead in the directions of the attack and the withdrawal; and compensating the distance in the retracting direction when the main shaft is reversed. The invention can realize repeated thread processing and multi-head thread processing and has the advantages of simple operation, high processing precision and the like.

Description

Internal thread tapping processing method based on feedback of spindle encoder
Technical Field
The invention relates to the technical field of internal thread tapping in numerical control machining, in particular to an internal thread tapping method based on feedback of a spindle encoder, which can be applied to various numerical control machine tools with spindle encoders, such as lathes, turning and milling compound lathes and the like.
Background
Tapping is a machining mode of internal threads, and is usually the last step in machining a workpiece, and if the quality of the tapped threads is not qualified, the whole workpiece is to be reworked, so tapping is an important cutting function in a numerical control machine tool. The tapping research is earlier in abroad, but the technology is strictly kept secret, the current tapping is mainly divided into two modes of flexible tapping and rigid tapping, wherein the flexible tapping without encoder feedback usually uses a floating cutter handle to improve the thread precision, and the company has the defects of low precision, unrepeatable tapping and the like; the control system can control the tap and the main shaft to keep a strict synchronous relation according to the feedback of the main shaft encoder during rigid tapping, and a collet knife handle is not used generally, so that tapping quality is good.
However, in the application of traditional thread processing, when the same thread is cut for multiple times, each thread cutting and feeding start is performed according to the zero mark pulse of the encoder as a synchronous signal, and one rotation of the encoder generally only sends out one zero mark pulse, when a multi-head thread is processed, a thread cutter is firstly shifted by one pitch length on the basis of the original starting point, then the zero mark pulse is waited for again, and the acceleration parameters of a main shaft and the thread cutter can not be changed when the two-head thread is processed.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides an internal thread tapping processing method based on the feedback of a main shaft encoder, which adopts a tapping interpolation algorithm for dynamic speed planning according to the feedback of the main shaft encoder, and realizes repeated thread processing and multi-head thread processing in a mode of exceeding catch-up by mapping the absolute value of the main shaft encoder to the main shaft position to judge a starting point.
In order to achieve the above purpose, the technical scheme provided by the invention is as follows:
an internal thread tapping processing method based on spindle encoder feedback is realized based on a tapping instruction of a numerical control system G33, and comprises the following steps:
s1, performing tapping interpolation pretreatment;
s2, performing an overrun catch-up algorithm of dynamic speed planning according to feedback of a main shaft encoder, so that the tapping shaft is accelerated to a follow-up state within a clearance distance;
s3, carrying out follow-up tapping by the tapping shaft according to dynamic speed planning, and entering the next step when the target catch-up distance exceeds the tapping theoretical length;
s4, stopping the spindle in a decelerating way after tapping reaches a target end point;
the first interpolation period of the stage carries out main shaft deceleration stopping movement planning, the tapping shaft still keeps a follow-up state in the rest period, the main shaft deceleration stopping is completed when the state uclnpStatus of the main shaft single-shaft structural body is identified as INP_FINISHED, the pause time unG spindlePaueTimeBeforeRev before the main shaft inversion in the G33 main shaft of the system parameter structural body g_SSystemPara is judged to determine whether to pause, if the pause time is not zero, the main shaft pausing stage before the main shaft inversion is entered, and if the pause time is zero, the main shaft inverting stage is directly entered;
S5, the pause time before the inversion of the G33 spindle is decremented cycle by cycle, and when the change amount is 0, the main spindle inversion planning stage S6 is entered;
s6, reversing the main shaft, retracting the tapping shaft with the follow-up tool, decelerating and stopping until reaching a starting point;
the tapping reverse compensation function is completed according to the tapping reverse compensation distance of the parameter settable by the user after the direction of the main shaft encoder is recognized to be reverse in this stage, and the feedback corresponding displacement of the encoder is accumulated during compensation and added into the displacement of the dynamic speed planning after compensation; the tapping shaft retracting stage is always in a follow-up stage before the clearance distance, calculates the deceleration used for speed planning according to the distance from the tapping starting point after entering the clearance distance, does not completely follow the encoder to follow up, and is decelerated and stopped to the tapping starting point, and then enters S7;
s7, decelerating and stopping the main shaft;
in the stage, main shaft deceleration stop motion planning is carried out in a first interpolation period, a tapping shaft is still motionless in the rest period, the main shaft deceleration stop is completed when the state ucInpStatus of a main shaft single-shaft structure body is identified as INP_FINISHED, 1 is added to the number of processed heads ucAlreadlyL at the moment, G33 tapping is completed when the ucAlreadlyL is equal to G33 to be processed head number ucL, S8 is not entered, and the next period of the system directly executes a G code next line instruction; when ucAlreadlyL < ucL, proceeding to S8;
S8, accelerating a main shaft before feeding the multi-head thread tapping shaft;
in the first interpolation period, the acceleration planning of the main shaft in the forward tapping direction is carried out, the tapping shaft is not moved in the rest period, and when the state ucInpStatus of the main shaft single-shaft structure body is identified as INP_FINISHED, the main shaft acceleration is completed, and the S2 is returned.
Further, the tapping interpolation motion pretreatment includes:
judging the spindle rotating speed and the lead of a tapping instruction input by a user, and alarming when the spindle rotating speed and the lead exceed the tapping highest speed limit, wherein tapping movement is not performed;
judging whether the length of a starting point and a finishing point in the G33 code is zero, and directly changing the running state of the G33 tapping instruction into completion when the length is zero;
judging whether the main shaft finishes acceleration before tapping is started, and entering the next step until the acceleration is finished;
initializing a current speed and speed planning structure in the tapping structure;
judging whether the number of processed heads ucAlreadyL in the tapping structure body is zero, and if so, only initializing a driving point and a simulation time point in the tapping structure body as real-time points;
initializing each member variable in the tapping structure;
and starting the spindle to measure the speed.
Further, an overrun catch-up algorithm for dynamic speed planning according to spindle encoder feedback, so that the tapping shaft is accelerated to a follow-up state within a clearance distance, comprising:
Constructing a dynamic speed planning model for tapping interpolation motion planning;
performing tapping starting judgment and starting error compensation;
and correcting the chasing planning acceleration and deceleration through virtual operation, so that the tapping shaft completes chasing within the clearance distance and enters a follow-up state.
Further, the constructed dynamic speed planning model divides the target catch-up distance TargetL into a catch-up distance PreL and a residual catch-up distance CurLeftL, after the dynamic speed planning model is started, each interpolation period is added into the TargetL and CurLeftL simultaneously according to the displacement increment DeltaL calculated by encoder feedback, the dynamic speed planning is carried out by taking the residual catch-up distance CurLeftL which changes from cycle to cycle as a planning object, the current speed dCurrentSpeed is taken as an initial speed, the G33 catch-up maximum speed G33MaxVel is taken as a planning maximum speed, and the theoretical follow-up speed is taken as a final speed.
Further, the dynamic speed planning model adopts a trapezoidal acceleration and deceleration model, and specifically comprises the following steps:
the speed time formula is as follows:
the displacement time formula is as follows:
the calculation formulas of the acceleration displacement, the uniform displacement and the deceleration displacement are as follows:
the calculation formulas of the acceleration time, the constant-speed time node and the total time are as follows:
in the above, a ac And a de Acceleration and deceleration of trapezoid acceleration and deceleration respectively; v (V) max Target maximum speed V of trapezoid acceleration and deceleration curve s And V e The initial speed and the final speed are planned; s is S 1 And S is 2 、S 3 Acceleration displacement, uniform displacement and deceleration displacement respectively; t (T) 1 And T 2 、T 3 Respectively is acceleration time and uniform velocity time nodeAnd total time.
Further, performing tapping start-up determination and start-up error compensation includes:
the tapping shaft is started by taking the value of the encoder as a reference quantity, the usencodercllenum is taken as the increment of the encoder rotating one circle of the main shaft, the absolute value of the main shaft encoder, i.e. the value of the usencodercllenum is obtained, the value of the encoder and the main shaft position can be mapped by taking the positive value of the absolute value of the main shaft encoder, the value of the usencodercllenum is recorded as the processed head number, ucL is the processed head number, and the value of the starter is taken as the relative value of the encoder when the tapping shaft is started, and the calculation formula is as follows:
the calculated relative value StartERValue of the encoder is a double-shaped variable when the tapping shaft is started, the absolute value lEncoderAbsValue of the encoder is a long shaping variable, and in order to avoid the influence that the value fed back by the encoder always changes by taking the rotation speed of the main shaft as an increment, a capturing interval is set for starting and compensating errors of early walking and late walking in the following process.
Further, the mode of starting by setting the capturing interval comprises:
mode one: maintaining an absolute value lncoderLastAbsValue of the last periodic encoder and an absolute value lncoderAbsValue of the current periodic encoder in a structural body of the encoder to form a capturing interval, and judging whether the tapping shaft starting encoder corresponds to a relative value StartERValue in the interval or not by judging whether the tapping shaft starting encoder corresponds to the relative value StartERValue in the interval or not;
mode two:
determining a left section and a right section with the width of 1.1 times of the increment width of the encoder corresponding to the spindle rotating speed by taking the calculated relative value StartERValue corresponding to the tapping shaft start encoder as a center point to capture a start point;
after capturing the starting point, the compensation displacement Comp corresponding to the starting deviation encoderstartup device is calculated as follows:
when the starting deviation is negative, representing that the starting is earlier than the target starting point, subtracting the catch-up distance CompL corresponding to the early starting from the target catch-up distance TargetL and the residual catch-up distance CurLeftL; when the starting deviation is positive, the target catch-up distance is represented to be started later than the target starting point, and the catch-up distance CompL corresponding to the late start is added to the target catch-up distance TargetL and the residual catch-up distance CurLeftL.
Further, the following formula is used for correcting the catch-up planned acceleration and deceleration through virtual operation:
Wherein a is ac And a de Planning acceleration and deceleration, respectively, for chase, preL 0 For the original alignment distance, G33AvoidEmptyL is the clearance distance, and the system requires that the clearance distance is not less than 1mm.
Further, step S6 includes:
the first period of the stage carries out reverse programming with the same rotating speed and different directions of the main shaft; the tapping shaft has a reverse distance compensation function after the spindle is reversed, the distance is a system parameter dG33RevCompdistance and is different from the reverse gap compensation of the linear module, and when the distance is 0, compensation is not needed; when the compensation distance is not 0, the dynamic speed planning function is not used for planning in the compensation stage, the whole compensation distance is planned once, trapezoidal acceleration and deceleration are adopted by default, the accumulated spindle rotation angle in the compensation stage corresponds to the displacement of the tapping shaft, and the displacement is stored in a tapping structure member dspindleRevCompZAxisCumula; the tapping shaft is compensated once only when the encoder is recognized to be reverse for the first time in the reverse tool withdrawal stage, and if the subsequent abnormal reverse is not compensated;
the main shaft reverse identification is judged by means of the encoder direction cEncoderDir and whether the main shaft direction cTappingspindleDir is different from the G33 forward tapping main shaft direction cTappingspindleDir;
the main shaft reversal first period is judged by means of a main shaft reversal start flag bit bSpindleRevBegin of a G33 structural body member, and the reverse compensation planning post TRUE of the reversal first period;
And (3) judging the end of inversion compensation: when the motion planning residual displacement is 0, indicating that the reverse compensation is finished, setting a tapping structure member G33 reverse compensation finishing zone bit bSpindleRevCompEnd to TRUE;
in the inversion compensation stage, the corresponding displacement of the encoder feedback is accumulated and recorded in a tapping structure body variable dSpindle RevCompzaxis Cumuladis, the positive and negative directions of the encoder are identified, the positive direction of the tool withdrawal is the positive value, and the negative direction of the tapping is the negative value;
after compensation, a dynamic speed planning mode is still used for movement, at the moment, a current real time point is used as a starting point, a G33 tapping starting point is used as a final end point for reverse planning, wherein the accumulated spindle rotation angle in the compensation stage is added to the planning corresponding to the tapping shaft displacement, a reverse tool withdrawal planning model does not allow a target catch-up distance TargetL to exceed a G33 tapping starting point G33StartPoint, the target catch-up distance does not move in a follow-up mode after entering a clearance distance, the planned deceleration is calculated according to the distance from the tapping starting point, the planning is performed by taking the minimum speed of the system as a final speed, and the planning is performed until the deceleration stops to the tapping starting point G33StartPoint;
when the follow-up tool retracting enters the clearance distance, the distance DisToStartPoint between the current point and the tapping starting point is smaller than the clearance distance, and the attention is paid to the fact that the target catch-up distance TargetL cannot exceed the actual tapping length L' of G33; at this time, the dynamic programming is not planned according to the maximum acceleration and deceleration of the system parameter which is 5 times of the following time, but the deceleration is reversely pushed by a deceleration model according to the following distance DisToStartPoint between the current point and the tapping starting point:
Taking the deceleration as a planning parameter, and taking the minimum speed of the system as the final speed to carry out the regulationScribing until the tapping starting point is reached, wherein V min Is the minimum final speed of the system; when the distance DisToStartPoint between the current point and the tapping starting point is 0, the tool is retracted to the starting point G33, and the step S7 of decelerating and stopping the spindle is started.
Compared with the prior art, the scheme has the following principle and advantages:
in order to achieve repeated tapping and multi-thread tapping, the traditional method does not use the zero mark pulse of the encoder as a starting synchronous signal any more, but maps the absolute value of the encoder to the position of the main shaft after taking the rest, judges and captures the starting point by judging the value of the encoder, can achieve capturing the starting point in one rotation of the main shaft by two modes of left and right interval and lag capture, and does not need to process in one lead of a movable cutter when processing multi-threads, and only needs to calculate the starting value corresponding to the multi-thread; the overtaking alignment effect of starting and follow-up is realized by taking the tapping shaft displacement corresponding to the variation of the spindle encoder into the planned displacement for each cycle and carrying out each cycle re-planning; the dynamic speed planning can restrict the tapping highest speed in the whole course; the screw tap enters a follow-up state in the clearance distance through adjusting the planned acceleration by virtual operation before starting the machining, so that the screw tap is ensured to keep following with the rotating speed of the main shaft when being screwed into a workpiece; the thread lead can be corrected in both the tapping and the retracting directions; distance compensation in the retracting direction can be performed when the main shaft is reversed;
In general, when the scheme is used for tapping threads, the encoder value can be judged to perform spindle position identification and tapping acceleration start, overrun catch-up alignment can be realized within the clearance distance, the tapping shaft and the spindle can be ensured to keep a follow-up state during tapping cutting, and the tapping shaft is decelerated and stopped to a tapping starting point after entering the clearance distance during tool withdrawal; the multi-shaft thread processing and single-head thread repeated processing can be realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the services required in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the figures in the following description are only some embodiments of the present invention, and that other figures can be obtained according to these figures without inventive effort to a person skilled in the art.
FIG. 1 is a schematic flow chart of an internal thread tapping method based on spindle encoder feedback according to the present invention;
FIG. 2 is a schematic drawing of tapping;
FIG. 3 is a classification of internal threads (a single start thread, b multiple start thread);
FIG. 4 is a schematic diagram of a tapping overtaking algorithm (a is tap start-up, i.e. follow-up, b is schematic diagram of the overtaking algorithm);
Fig. 5 is a drawing of a tapping dynamic speed planning model (a is a forward tapping dynamic speed planning model, b is a retracting dynamic speed planning model);
FIG. 6 is a trapezoidal acceleration and deceleration graph;
FIG. 7 is a graph of first period acceleration characteristics of a trapezoidal acceleration and deceleration curve;
FIG. 8 is a chart of a start point of multi-start thread tapping;
FIG. 9 is a schematic diagram of a start point of a hysteretic capture tap (a is spindle forward rotation, b is spindle reverse rotation);
fig. 10 is a schematic diagram of the left and right section capture tapping starting point (a is the spindle forward rotation, b is the spindle reverse rotation);
FIG. 11 is a graph of a speed planning model for entering the clearance distance during tapping tool withdrawal;
FIG. 12 is a graph of the direction following model when the current encoder is forward and the previous periodic motion plan is reverse (a is that the current point does not exceed the tapping theoretical endpoint, b is that the current point exceeds the tapping theoretical endpoint);
FIG. 13 is a simulation graph of single-start internal thread tapping (a is a Z-axis versus spindle speed graph, b is tap Z-axis coordinates and encoder values);
FIG. 14 is a simulation diagram of double-ended internal thread tapping (a is a Z-axis versus spindle speed plot, b is tap Z-axis coordinates and encoder values);
FIG. 15 is a finished product diagram of a M10F1.5 tap tapping 6061 aluminum alloy material;
FIG. 16 is a schematic illustration of a finished M6F1 tap tapping 6061 aluminum alloy material;
Fig. 17 is a diagram of a finished product of the M6F1 tap tapping 45 steel material.
Detailed Description
The invention is further illustrated by the following examples:
as shown in fig. 1, the method for tapping internal threads based on feedback of a spindle encoder according to the present embodiment specifically includes:
s1, tapping interpolation motion pretreatment;
the invention is developed aiming at a G33 tapping instruction in a numerical control system, and a G33 tapping schematic diagram is shown in fig. 2. The instruction format is as follows: g33 Z (W) __ F (I) __ L __.
Instruction code interpretation: the motion trail of the tapping tap is from the starting point to the end point and then from the end point to the starting point. In the tapping cutting process, the Z axis moves by a lead every turn of the main shaft, the lead of the main shaft is always consistent with that of the tap, a spiral groove is formed in the inner hole of the workpiece, and the thread processing of the inner hole can be completed by one-time cutting.
Z (W): designating tapping end point coordinates, and entering a next row of G code program without thread cutting when Z or W is not input;
f: an internal thread lead to be processed;
i: thread count per inch;
l: the number of starts of the multi-start thread is 1 when L is omitted.
The S1 is used for checking and analyzing the G33 tapping instruction input to the numerical control panel by the G code analysis module for the interpolation module to plan the motion. The main content comprises:
(1) The G code analysis module judges spindle rotation dSpondLESpeed (r/min) and lead dF (mm) of a tapping instruction input by a user, and when the relation between the spindle rotation speed and the lead accords with the formula 1, namely the relation exceeds the limit of the tapping highest speed dG33MaxVel (mm/ms) in the system parameter structure body g_SSystemPara, the G code analysis module alarms and tapping movement does not occur.
(2) Judging whether the length of a starting point and an ending point in the G33 code is zero, and directly changing the running state of the G33 instruction into completion when the length is zero;
(3) Currently, there is a spindle switch delay in the procedure, but this delay time may be less than the spindle acceleration time, resulting in the spindle not yet accelerating to the required speed when entering G33 motion. Therefore, before the G33 is operated, whether the main shaft is accelerated is judged, and the next step is not performed until the main shaft is accelerated, and the judgment can be made by whether the state ucInpStatus of the single-shaft structure body in the main shaft is INP_FINISHED.
(4) The current speed dCurrentSpeed, SPlanData structure related variable in the tapped structure is initialized.
(5) Whether G33 is the pause resume processing is judged by whether the number of processed heads ucAlreadyL in the tapping structure is zero, if not, G33 motion is directly performed by initializing the tapping structure members G33StartRealTimePoint and G33AnalogRealTimePoint as real-time points.
(6) When all the above cases are excluded, the member variables in the tapping structure are initialized.
(7) And starting the spindle speed measurement, and setting a spindle speed measurement flag bit bCauculateSpodLeSpeedFlag as TRUE, wherein when the flag bit is TRUE, the system measures the average spindle rotating speed through a plurality of periods, and the rotating speed is used for calculating the maximum starting deviation of G33, and the spindle rotating speed variable is dSpondLeRealSpeed.
S2, accelerating the tapping shaft before follow-up;
s2 is a stage of the first running of the G33 tapping machining movement, the stage uses the overrun catch-up algorithm for dynamic speed planning according to the feedback of the main shaft encoder to finish the capturing of tapping starting points, the compensation of starting deviation and the acceleration of overrun catch-up entering follow-up in the clearance distance, and when the catch-up is finished, the running stage of the G33 is changed into the follow-up tapping of the tapping shaft, namely, the step 3 is started.
The screw thread processing is to ensure that the feed shaft where the screw tap is positioned moves by one screw thread lead every time the main shaft rotates, namely, the screw tap is fed according to the formula 2 when the screw tap follows the encoder to process the screw thread, and if the relation is not met, the screw thread spiral line of the screw thread is not standard, so that the screw thread is disordered.
Wherein DeltaL is tapping shaft feed amount, usDelta is cycle count change amount on a spindle encoder, usEncoderCircleNum is encoder increment for one turn of spindle rotation, dF is thread lead, dPercentageOfG33EnterLeadCorrect is tapping lead correction percentage parameter; dPercentageOfG33Return lead correction is a tapping tool withdrawal lead correction percentage parameter, and leads can be independently compensated and corrected in both the tapping and tool withdrawal directions.
The requirements and difficulties of G33 tapping are as follows:
first, the alignment requirement. As described above, the threading ensures that the spindle rotation and the tap shaft feed maintain a proportional relationship to the lead, but there is a need for repeated tapping and multi-start threading in the internal threads, which requires that the tap and workpiece entry point be defined, i.e., thread alignment, when the tap shaft is accelerated to a follow-up speed. The alignment requirements are as follows:
as shown in fig. 3 (a), for a G33 single-start internal thread (l=1) command, if a G33 command is executed, the spindle is rotated again, and the same G33 command is executed again, so that the tap is required to process the same spiral line twice before and after the tap; as shown in fig. 3 (b), for the G33 multi-start internal thread (L > 1) command, the first and second start threads are 180 ° apart at the point of entry of the workpiece end face, i.e., the two thread pitches (pitches) are equal.
Secondly, the following state is achieved in the clearance distance. As shown in fig. 2, a distance for acceleration is reserved between the tap head and the end face of the workpiece before machining, which is called a clearance distance, and the thread machining must enter a follow-up state after the acceleration is completed within the clearance distance to qualify the thread machining, so that an alignment algorithm must enter the follow-up state within the clearance distance.
Again, the retracting is finally slowed down and stopped to the starting point. The tap returns to the tapping start point after being withdrawn from the workpiece, but cannot always follow up to the start point, and is decelerated in advance.
Finally, the tapping is followed in the whole course direction. When the spindle is decelerated and reversely rotated, the direction of the spindle fed back by the encoder is not forward and reverse, but can be repeatedly changed forward and reverse, and the tap is withdrawn by adjusting the steering of the spindle when the tap is blocked or broken in the machining process, so that the whole tapping process should follow the direction of the encoder, and the spindle can move according to the direction of the spindle encoder no matter in forward tapping or reverse tool withdrawal.
When the traditional mode carries out multiple times of cutting of the same thread, each time the thread cutting feed is started according to the zero marking pulse of the encoder as a synchronous signal, but the encoder generally only sends one zero marking pulse after rotating, when the multi-head thread is machined, the thread cutter is firstly shifted by the length of one thread pitch on the basis of the original starting point, then the zero marking pulse is waited for to appear again, the acceleration parameters of the main shaft and the thread cutter can not be changed when the two threads are machined, the starting judgment mode can meet the precision and convenience when the single-head thread is machined, but the starting point position is also changed when the multi-head thread is machined, and the numerical control operation is complicated. In order to realize tapping alignment, the invention provides a tapping interpolation algorithm for dynamic speed planning according to feedback of a spindle encoder. The algorithm will now be described.
(1) Dynamic speed planning model
The acceleration stage of the tap is not considered, and if the tap can be started, namely, the tap can follow, as shown in fig. 4 (a), the thread line superposition of two processes can be ensured as long as the tap can be started at the position of the main shaft fed back by the same encoder each time.
As shown in fig. 4 (b), an override catch-up algorithm is proposed herein for achieving the same processing effect as the start-up, i.e., follow-up, with the following ideas:
the overtaking is realized by running the speed of the overtaking shaft beyond the theoretical follow-up speed in the acceleration process of the tapping shaft, so that the distance of the black filling part in the overtaking acceleration stage is reduced, the maximum speed after the overtaking is limited at the moment to be the system parameter dG33MaxVel so as to prevent the runaway, the displacement of the overtaking part just compensates the distance of the relative start-up follow-up processing in the acceleration process when the speed is reduced to the theoretical follow-up speed, and the purpose of tapping alignment can be achieved if the tap in the follow-up state after the overtaking is ensured to be positioned in the clearance distance.
Aiming at the thought of exceeding the catch-up speed curve, the embodiment provides a dynamic real-time speed planning model for tapping interpolation motion planning. The dynamic speed planning model structure is shown in fig. 5.
The dynamic speed planning is to achieve the processing effect of exceeding the catch-up start, namely follow-up, and to accumulate and record the corresponding target catch-up distance TargetL, targetL calculated according to the formula 1 from the start to increase along with the start of catch-up period, so that the object of the speed planning is changed every period, the planning model divides the target catch-up distance TargetL into two parts of the catch-up distance PreL and the residual catch-up distance CurLeftL, after the start, each interpolation period simultaneously accumulates the DeltaL into the TargetL and CurLeftL according to the displacement increment DeltaL calculated by the feedback of the encoder, the dynamic speed planning is to take the residual catch-up distance CurLeftL which changes along with the period as the planning object, the current speed dCurrenntSpeed is the initial speed, the G33 catch-up maximum speed G33MaxVel is the planning maximum speed, and the theoretical follow-up speed is the final speed for speed planning.
The dynamic speed planning is characterized in that each interpolation period carries out time division speed planning on CurLeftL once, and each time of planning only carries out planning displacement of the first division period. Because of re-planning once in each period, the dynamic speed planning adopts trapezoidal acceleration and deceleration planning with less occupied resources, and a trapezoidal acceleration and deceleration curve is shown as figure 6, wherein in the acceleration and deceleration model, a speed time formula is formula 3, a displacement time formula is formula 4, and a is shown as a ac And a de Acceleration and deceleration of trapezoid acceleration and deceleration respectively; v (V) max The maximum speed is the target maximum speed of a trapezoid acceleration and deceleration curve; v (V) s And V e The initial speed and the final speed are planned; s is S 1 And S is 2 、S 3 The acceleration displacement, the uniform displacement and the deceleration displacement are calculated by a method 5; t (T) 1 And T 2 、r 3 The acceleration time, the constant velocity time node, and the total time are calculated by equation 6, respectively.
As shown in the first-cycle acceleration feature of fig. 7, the initial velocity V is used in the acceleration phase s And acceleration a ac The actual speed change of the 1 st planning period after trapezoidal planning is as followsOnly from the second programming cycle, the speed can be according to the whole a ac The increment is carried out, and the dynamic programming model only walks the first period of programming every period, so that the acceleration and deceleration speed is increased to 2 times of the original speed for programming.
The judging condition of the catch-up success is that the residual catch-up distance CurLeftL after planning can be completely walked only by one period, then tapping enters a follow-up stage to feed according to formula 2, and the planning displacement CurLeftL is completely walked by one period in order to ensure the follow-up stage, and the planning acceleration a is obtained ac And deceleration a de Enlarging to 5 times of the original value.
The overtaking algorithm is limited by a maximum catch-up speed dG33MaxVel, and when the spindle rotation speed and the thread lead are too high, the theoretical follow-up speed exceeds the maximum catch-up speed dG33MaxVel, and at this time, the overtaking algorithm cannot realize the overtaking catch-up as shown in fig. 4, so that in S1, the spindle rotation speed and the lead of the G33 instruction are judged, and when the spindle rotation speed and the G33 thread lead satisfy the relation of formula 1, an alarm is given to prompt that the G code writer has too high speed to process.
(2) Judging tapping starting and compensating starting errors;
the override catch-up algorithm can achieve the same machining effect as "start-up, i.e. follow-up", but the spindle position must be constrained at start-up time to achieve alignment. In this embodiment, the tapping axis is started by taking the encoder value as a reference quantity, usencoderclerlenum is taken as an increment of the encoder rotating one turn around the main axis, the absolute value of the main axis encoder, i.e. the usencoderclerlenum is left right by taking the absolute value of the main axis encoder, the encoder value and the main axis position can be mapped, ucAlreadly L is taken as the machined head number (the machined head number is updated when one thread is tapped), ucL is the machined head number, startERValue is taken as the relative value of the encoder when the tapping axis is started, the calculation formula is 7, and fig. 8 is the thread line starting point position relationship of the multi-thread.
The calculated relative value StartERValue of the encoder is a double-shaped variable when the tapping shaft is started, the absolute value lEncoderAbsValue of the encoder is a long shaping variable, and the value fed back by the encoder always changes by taking the rotation speed of the main shaft as an increment, so that the start of the start ERValue value is difficult to directly capture, and only a capture interval can be set for starting and compensating errors of early walking and late walking in the catch-up process. The present embodiment uses two starting modes, and the following description will be given separately.
Mode one: as shown in fig. 9, the structure of the maintenance encoder stores an absolute value lncoderlastabsvalue of the previous period encoder and an absolute value lncoderabsvalue of the current period encoder to form a capturing interval, and whether the tapping shaft start encoder is started or not can be judged by judging whether the corresponding relative value starterrvalue of the tapping shaft start encoder is in the interval or not. The current spindle-to-one encoder increment usencoderclenum is 10000, the spindle position can be equally divided into 10000 parts, and the spindle position mapping can be performed with 0.036 degree precision. This way of start-up capture can only lag behind the ideal start-up point position, the maximum start-up deviation is one cycle encoder increment value, i.e. late start-up, and the encoder start-up deviation corresponding to late start-up is recorded in encoderStartupdevice.
Mode two: and determining a left section and a right section with the width of 1.1 times of the main shaft rotating speed corresponding to the increment width of the encoder by taking the calculated relative value StartERValue corresponding to the tapping shaft starting encoder as a center point to capture the starting point. The capturing mode is characterized in that the end points of a left section and a right section need to be calculated, and the early start and the late start are possible in actual start, and the maximum start deviation is 0.55 times of the increment of a periodic main shaft encoder, wherein the early start and the late start are forward and late walk as shown in fig. 10 (a) and reverse early walk as shown in fig. 10 (b). The encoder start-up bias is also recorded in encoderStartup device.
After capturing the start point, the compensation displacement CompL corresponding to the start offset EncoderStartupDeviation is calculated according to equation 8. When the starting deviation is negative, representing that the starting is earlier than the starting point of the target, subtracting the catch-up distance CompL corresponding to the early starting from the target catch-up distance TargetL and the residual catch-up distance CurLeftL; when the start deviation is positive, representing that the start is later than the target start point, the corresponding catch-up distance CompL of the late start should be added to the target catch-up distance TargetL and the residual catch-up distance CurLeftL.
(3) Entering into a follow-up state in the clearance distance;
the overtaking alignment algorithm completes the overtaking distance PreL when the overtaking is driven into the follow-up, and relates the G33 overtaking maximum speed dG33MaxVel, the main shaft rotating speed, the thread lead dF and the acceleration a of the trapezoid speed planning ac And deceleration a de Because of dynamic speed planning, the relation between the chased distance PreL and the variables above when the chased is completed to enter the follow-up cannot be quantified by a formula.
The virtual running aims at performing overrun catch-up acceleration according to the actual rotating speed of the current main shaft and the initial acceleration and deceleration, and obtaining the alignment distance under the initial acceleration and deceleration. The real operation of the machine tool is to calculate the pulse of each axis through interpolation planning and change the real-time coordinate point, the realization of virtual operation is to empty the pulse after each axis should run the pulse and update the real time point in the virtual operation process in each interpolation period, to save the virtual operation real time point and restore the real machine tool real time point by setting a variable, to replace the machine tool real time point with the virtual operation real time point in the next period for interpolation operation, and to repeat the steps until the virtual catch-up is completed. The following two cases are given for the following alignment distance required for the overtaking by using the initial acceleration and deceleration, which is called the alignment distance at this time:
case one: the alignment distance is smaller than the clearance distance, and the acceleration and deceleration of the acceleration stage are not required to be corrected;
And a second case: and if the alignment distance is larger than the clearance distance, the original acceleration and deceleration is required to be amplified and corrected.
Table 1 shows alignment distances (mm) corresponding to different rotational speeds (in r/min) at a lead of 1mm, a clearance distance of 1mm, and an original acceleration/deceleration of 0.001mm/ms 2. a, a ac1 And a de1 An acceleration and deceleration rate, a, of the approach clearance distance obtained by multiple simulation tests ac2 And a de2 To directly align the original alignment distance PreL 0 As the catch-up acceleration and deceleration after amplification of the amplification factor.
TABLE 1
It can be found that the alignment distance PreL is the original 0 Correction of the original acceleration and deceleration a as an amplification factor ac0 And a de0 Since the alignment displacement after the correction is satisfied within the clearance distance, the modification of the acceleration/deceleration by the virtual run is modified according to equations 9 and 10.
Wherein G33AvoidEmptyL is the clearance distance, and the clearance distance is not less than 1mm.
S3, follow-up tapping of a tapping shaft;
to ensure that the programmed displacement CurLeftL is completely walked out in one period of the follow-up stage, the programmed acceleration a is calculated ac And deceleration a de Enlarging to 5 times of the original value. As shown in the tapping dynamic speed planning model of fig. 5, the dynamic speed gauge is divided into two directions of forward tapping and retracting. In the forward tapping process, the spindle is required to be decelerated and reversely rotated after the spindle passes through the G33 theoretical end point, the process tap still needs to be overturned through the G33 theoretical end point, so that the planning model in the forward tapping stage allows the target catch-up distance TargetL to exceed the G33 theoretical length L, and when the system judges that the current catch-up distance PreL exceeds the G33 theoretical length L, the G33 interpolation motion state is changed into the state that the spindle is decelerated and stopped after the tapping reaches the target end point.
S4, stopping the spindle in a decelerating way after tapping reaches a target end point;
in this stage, the first interpolation period is used for planning the deceleration and stop motion of the spindle, the tapping shaft still keeps a follow-up state in the rest period, the completion of the deceleration and stop of the spindle is indicated when the state ucInpStatus of the spindle single-shaft structure body is identified as INP_FINISHED, at this time, the pause time unG and SpindlePauseTimeBeforeRev (ms) before the main shaft reversion of the G33 in the system parameter structure body g_SSystemPara is judged to determine whether to pause, if the pause time is not zero, the main shaft enters the pause stage before the main shaft reversion of S5, and if the pause time is 0, the main shaft enters the main shaft reversion stage of S6 directly.
S5, pausing before reversing the main shaft;
and (5) decrementing the pause time before the G33spindle inversion cycle by cycle after entering S5, and entering an S6 spindle inversion planning stage when the change amount is 0.
S6, reversing the main shaft, retracting the tapping shaft with the follow-up tool, decelerating and stopping until reaching a starting point;
and in the first period of the stage, reverse programming with the same rotating speed and different directions of the main shaft is carried out.
The tapping shaft has a reverse distance compensation function after the spindle is reversed, the distance is a system parameter dG33RevCompdistance and is different from the reverse gap compensation of the linear module, and when the distance is 0, compensation is not needed; when the compensation distance is not 0, the dynamic speed planning function is not used for planning in the compensation stage, the whole compensation distance is planned once, and as the compensation distance is small, trapezoidal acceleration and deceleration are adopted by default, the accumulated spindle rotation angle in the compensation stage corresponds to the displacement of the tapping shaft, and the displacement is stored in the tapping structure member dspindleRevCompZAxisCumula. The tapping shaft is compensated only once in the reverse tool withdrawal phase when the encoder reverse is first identified, and if the subsequent abnormal reverse is no longer compensated.
Wherein the spindle reverse identification is determined by means of the encoder direction cEncoderDir and whether the spindle direction cTappingspindleDir is different from the G33 forward tapping spindle direction cTappingspindleDir.
The first cycle of the spindle reversal is judged by means of a G33 structural member spindle reversal start flag bit bSpindleRevBegin (initial state is FALSE), and the first cycle of the reversal is reversed to compensate for the post-setting TRUE of the planning.
And (3) judging the end of inversion compensation: and when the motion planning residual displacement is 0, indicating that the inversion compensation is finished. At this time, the tapping structure member G33 reversely compensates for the end flag bit bpindlerevCompend to TRUE (initial state is FALSE).
In the inversion compensation stage, the corresponding displacement of the encoder feedback is accumulated and recorded in the tapping structure variable dSpondle RevCompzaxis Cumula, and the process also needs to identify the forward and reverse directions of the encoder, the tool withdrawal direction is positive, and the tapping direction is negative.
And after the compensation is finished, the motion is still performed by using a dynamic speed planning mode, at the moment, the current real time point is used as a starting point, the tapping starting point of the G33 is used as a final end point, reverse planning is performed, the accumulated spindle rotation angle of the compensation stage is added to the planning corresponding to the tapping shaft displacement, the reverse tool withdrawal planning model does not allow the target catch-up distance TargetL to exceed the tapping starting point G33StartPoint of the G33, the motion is not performed in a follow-up mode after the clearance distance is entered, the planned deceleration is calculated according to the distance from the tapping starting point, and the planning is performed by taking the minimum speed of the system as the final speed until the deceleration stops to the tapping starting point G33StartPoint.
As shown in fig. 11, when the follower retracting is within the clearance distance, distostrtpoint, which is the distance from the current point to the tapping start point, is smaller than the clearance distance, and it is to be noted that the target catch-up distance TargetL cannot exceed the G33 actual tapping length L'. At the moment, the dynamic programming is not planned according to the maximum acceleration and deceleration of the system parameter which is 5 times that of the follow-up, but the deceleration model is used for reversely pushing the deceleration according to 11 according to the distance DisToStartPoint between the current point and the tapping starting point, the deceleration is used as a programming parameter, the minimum speed of the system is used as the final speed, and the programming is carried out until the tapping starting point is operated, wherein V min Is the minimum terminal speed of the system. When the distance DisToStartPoint between the current point and the tapping starting point is 0, the tool is retracted to the starting point G33, and the step 7 is started in the spindle deceleration stop stage.
S7, decelerating and stopping the main shaft;
in the first interpolation period of the stage, main shaft deceleration stop motion planning is carried out, a tapping shaft is still motionless in the rest period, the main shaft deceleration stop is completed when the state ucInpStatus of the main shaft single-shaft structural body is identified as INP_FINISHED, 1 is added to the number of processed heads ucAlreadlyL at the moment, G33 tapping is completed when the ucAlreadlyL is equal to G33 to be processed head number ucL, S8 is not carried out, and the next period of the system directly executes a G code next line instruction; when ucAlreadlyL < ucL, proceed to S8.
S8, accelerating main shaft before feeding of multi-head thread tapping shaft
The step is used for multi-head thread processing, the first interpolation period of the stage carries out acceleration planning on the forward tapping direction of the main shaft, the tapping shaft is not moved in the rest period, and when the state ucInpStatus of the main shaft single-shaft structure body is identified as INP_FINISHED, the main shaft acceleration is completed, and the step returns to S2.
S9, following in the whole tapping direction
S9 is not an independent run phase in the tapping process, but is a description of how the G33 tapping process is done with full encoder direction follow.
The spindle encoder direction is to be judged at any time in the whole tapping and retracting process of the cone shaft, and fig. 1 is a whole tapping process, wherein only the stage (the acceleration before the tapping shaft is driven, the spindle is decelerated and stopped, and the spindle is reversed and retracted) that four taps move after the start of the G33 instruction operation needs to judge the encoder direction, and the encoder direction can be identified to reverse the spindle to enable the tap to retract when the tap is broken in the middle of the tap processing.
The tapping structure body stores the rotation direction information of the main shaft during forward tapping, the variable is cTappingspindleDir, and the forward and reverse directions of the encoder can be known through the comparison of the encoder structure body member cEncoderDir and the tapping structure body member cTappingspindleDir; the tapping structure also stores the direction information corresponding to the forward tapping, the variable is G33StartVector, and the direction of the previous cycle planning can be known by comparing the vector information SStartVector used for interpolation in the tapping structure with the G33 StartVector. Once the encoder direction does not coincide with the motion planning direction, the planning direction is optionally adjusted and planned using the tapping dynamic speed planning model corresponding to fig. 5. The following of the encoder direction will now be described in stages.
(1) Tapping shaft follow-up pre-acceleration stage
In this stage, to finish the overtaking alignment within the clearance distance, the spindle normally rotates in the direction recorded by the member cTappingspindleDir in the tapping structure, and if the abnormality reverses, the following processing is performed:
case 1: when the capture starting point is not acquired and the virtual operation is not completed, the virtual operation stage is disabled and the virtual operation is restarted.
Case 2: the start point is not captured but the virtual run has been completed, at which point it is not started even if the start condition is met.
Case 3: has been started, and then enters into the following stage directly.
(2) Follow-up tapping, spindle deceleration stopping and spindle reversing tool retracting stage
The encoder direction and the motion planning direction of the follow-up stage are divided into the following four cases:
(a) And in the case 1 and the case 2, the encoder direction is consistent with the motion planning direction, and the newly added displacement delta L is calculated directly according to the formula 2 and is calculated to be calculated into the dynamic planning model to operate.
(b) Case 3: the encoder is reverse and the previous cycle is planned to be forward
At this time, the relation between the forward residual distance CurLeftL and the corresponding displacement DeltaL fed back by the encoder is judged.
If CurLeftL is more than or equal to DeltaL, the newly added reverse distance DeltaL is removed from CurLeftL and TargetL, and the forward distance planning is still performed, and the forward tapping dynamic speed planning model in FIG. 5 (a) is adopted.
If CurLeftL is less than DeltaL, the motion planning direction needs to be changed, and the flow is as follows:
(1) setting the walked displacement PreL to 0; updating the target catch-up distance TargetL and the residual catch-up distance CurLeftL into delta L-CurLeftL;
(2) the current speed CurrentSpeed is set to 0;
(3) the vector information sstartvactor for interpolation in the G33 structure is recalculated by taking the current point as a starting point and the G33 tapping start point as an end point, and the reverse tool withdrawal dynamic speed planning model in fig. 5 (b) is adopted.
(c) Case 4: the forward and the previous cycle motion of the encoder are planned in the reverse direction
At this time, the magnitude relation between the reverse residual catch-up distance CurLeftL and the corresponding forward displacement DeltaL fed back by the encoder is judged.
If CurLeftL is greater than or equal to DeltaL, then the newly added forward distance DeltaL is removed from CurLeftL and TargetL, and the reverse distance is still planned, and the tool withdrawal dynamic speed planning model of FIG. 5 (b) is continuously used.
If CurLeftL is less than DeltaL, the planning direction needs to be changed to be positive, and the flow is as follows:
(1) setting the chase distance PreL to 0; updating the target catch-up distance TargetL and the residual catch-up distance CurLeftL into delta L-CurLeftL;
(2) the current speed CurrentSpeed is set to 0;
(3) since the tapping direction is to be planned reversely, the planning endpoint is to be determined again according to the current point position, and the two situations are classified. As shown in fig. 12 (a), the current point does not exceed the tapping theoretical endpoint at this time, and the current point and the tapping theoretical endpoint can be directly used as a planning interval at this time, and the forward tapping dynamic speed planning model in fig. 5 (a) is adopted for movement; as shown in fig. 12 (b), the current point has passed beyond the tapping theoretical endpoint, at which point a new planned endpoint is recalculated, using the forward tapping dynamic speed planning model motion of fig. 5 (a).
To verify the algorithm performance mentioned herein, a single-head thread tapping simulation is performed by using a starting point (0, 0), an end point (0, -10), a Z-axis acceleration of 0.002mm/ms2, a Z-axis deceleration of 0.002mm/ms2, a spindle rotation speed of 800r/min, a thread lead of 1.5mm, a thread head number of 1, a maximum acceleration and a maximum deceleration of a spindle adopting three S-shaped acceleration and deceleration curves of 0.0001 x 360 DEG/ms 2, and as a result, as shown in fig. 13, a triangular mark on an encoder numerical curve in a Z-axis coordinate diagram of the tap of fig. 13 (b) is a starting point, a theoretical starting value is 0, an encoder actual starting absolute value is 19968, a starting deviation is-32, and the starting deviation is small to capture the encoder starting point within one spindle rotation; the displacement required for actually completing the catch-up is 0.495mm, and the requirement of 1mm of the clearance distance is met.
Two-start thread machining simulation was performed with the same parameters, and a single-start internal thread tapping simulation curve is shown in fig. 14.
The theoretical starting value of the first head thread is 0, the actual starting absolute value of the encoder is 9974, the starting deviation is-26, and the starting deviation is small, so that the starting point of the encoder can be captured within one rotation of the main shaft; the displacement required for actually completing the catch-up is 0.495mm, and the requirement of 1mm of the clearance distance is met.
The theoretical starting value of the 2 nd thread is 5000, the actual starting absolute value of the encoder is 15028, the starting deviation is 28, and the starting deviation is small, so that the starting point of the encoder can be captured within one rotation of the main shaft; the displacement required for actually completing the catch-up is 0.543mm, and the requirement of 1mm of the clearance distance is met.
The simulation result shows that the algorithm can realize quick start capture under lower start error, can enter a follow-up state to tap in the clearance distance, and can keep the follow-up state until the tapping start point is stopped at a reduced speed.
FIG. 15 is a drawing showing a real object of tapping 6061 aluminum alloy material at a spindle 800r/mi n using a M10F1.5 tap; FIG. 16 is a pictorial view of a re-tap process for 6061 aluminum alloy material at a spindle of 800 r/min using an M6F16 tap; fig. 17 is a diagram showing a tapping process of a 45 steel material using an M6F16 tap at a spindle 500r/mi, without any tooth disorder.
The above embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, so variations in shape and principles of the present invention should be covered.

Claims (9)

1. The internal thread tapping processing method based on the feedback of the spindle encoder is characterized by comprising the following steps of:
s1, performing tapping interpolation pretreatment;
s2, performing an overrun catch-up algorithm of dynamic speed planning according to feedback of a main shaft encoder, so that the tapping shaft is accelerated to a follow-up state within a clearance distance;
s3, carrying out follow-up tapping by the tapping shaft according to dynamic speed planning, and entering the next step when the target catch-up distance exceeds the tapping theoretical length;
S4, stopping the spindle in a decelerating way after tapping reaches a target end point;
the first interpolation period of the stage carries out main shaft deceleration stopping movement planning, the tapping shaft still keeps a follow-up state in the rest period, the main shaft deceleration stopping is completed when the state ucInpStatus of the main shaft single-shaft structural body is identified as INP_FINISHED, the pause time unG spindlePaueTimeBeforeRev before the main shaft inversion in the G33 main shaft of the system parameter structural body g_SSystemPara is judged to determine whether to pause, if the pause time is not zero, the main shaft pausing stage before the main shaft inversion is entered, and if the pause time is zero, the main shaft inverting stage is directly entered;
s5, the pause time before the inversion of the G33spindle is decremented cycle by cycle, and when the change amount is 0, the main spindle inversion planning stage S6 is entered;
s6, reversing the main shaft, retracting the tapping shaft with the follow-up tool, decelerating and stopping until reaching a starting point;
the tapping reverse compensation function is completed according to the tapping reverse compensation distance of the parameter settable by the user after the direction of the main shaft encoder is recognized to be reverse in this stage, and the feedback corresponding displacement of the encoder is accumulated during compensation and added into the displacement of the dynamic speed planning after compensation; the tapping shaft retracting stage is always in a follow-up stage before the clearance distance, calculates the deceleration used for speed planning according to the distance from the tapping starting point after entering the clearance distance, does not completely follow the encoder to follow up, and is decelerated and stopped to the tapping starting point, and then enters S7;
S7, decelerating and stopping the main shaft;
in the stage, main shaft deceleration stop motion planning is carried out in a first interpolation period, a tapping shaft is still motionless in the rest period, the main shaft deceleration stop is completed when the state ucInpStatus of a main shaft single-shaft structure body is identified as INP_FINISHED, 1 is added to the number of processed heads ucAlreadlyL at the moment, G33 tapping is completed when the ucAlreadlyL is equal to G33 to be processed head number ucL, S8 is not entered, and the next period of the system directly executes a G code next line instruction; when ucAlreadlyL < ucL, proceeding to S8;
s8, accelerating a main shaft before feeding the multi-head thread tapping shaft;
in the first interpolation period, the acceleration planning of the main shaft in the forward tapping direction is carried out, the tapping shaft is not moved in the rest period, and when the state ucInpStatus of the main shaft single-shaft structure body is identified as INP_FINISHED, the main shaft acceleration is completed, and the S2 is returned.
2. The method for tapping internal threads based on feedback from a spindle encoder according to claim 1, wherein the performing of the tapping interpolation motion pre-process comprises:
judging the spindle rotating speed and the lead of a tapping instruction input by a user, and alarming when the spindle rotating speed and the lead exceed the tapping highest speed limit, wherein tapping movement is not performed;
Judging whether the length of a starting point and a finishing point in the G33 code is zero, and directly changing the running state of the G33 tapping instruction into completion when the length is zero;
judging whether the main shaft finishes acceleration before tapping is started, and entering the next step until the acceleration is finished;
initializing a current speed and speed planning structure in the tapping structure;
judging whether the number of processed heads ucAlreadyL in the tapping structure body is zero, and if so, only initializing a driving point and a simulation time point in the tapping structure body as real-time points;
initializing each member variable in the tapping structure;
and starting the spindle to measure the speed.
3. The method of claim 1, wherein the step-up algorithm for dynamic speed planning based on the spindle encoder feedback accelerates the tapping shaft to a follow-up state within the clearance distance, comprising:
constructing a dynamic speed planning model for tapping interpolation motion planning;
performing tapping starting judgment and starting error compensation;
and correcting the chasing planning acceleration and deceleration through virtual operation, so that the tapping shaft completes chasing within the clearance distance and enters a follow-up state.
4. The method for tapping the internal thread based on feedback of a spindle encoder according to claim 3, wherein a built dynamic speed planning model divides a target catch-up distance TargetL into a catch-up distance PreL and a residual catch-up distance CurLeftL, each interpolation period is started and then added into the TargetL and CurLeftL simultaneously according to a displacement increment delta L calculated by the feedback of the encoder, the dynamic speed planning takes the residual catch-up distance CurLeftL which changes from cycle to cycle as a planning object, takes a current speed dCurrentspeed as an initial speed, takes a G33 catch-up maximum speed G33 MaxVel as a planning maximum speed and takes a theoretical follow-up speed as a final speed to carry out dynamic speed planning.
5. The method for tapping internal threads based on feedback of a spindle encoder according to claim 4, wherein the dynamic speed planning model adopts a trapezoidal acceleration/deceleration model, and specifically comprises the following steps:
the speed time formula is as follows:
the displacement time formula is as follows:
the calculation formulas of the acceleration displacement, the uniform displacement and the deceleration displacement are as follows:
the calculation formulas of the acceleration time, the constant-speed time node and the total time are as follows:
in the above, a ac And a de Acceleration and deceleration of trapezoid acceleration and deceleration respectively; v (V) max Target maximum speed V of trapezoid acceleration and deceleration curve s And V e The initial speed and the final speed are planned; s is S 1 And S is 2 、S 3 Acceleration displacement, uniform displacement and deceleration displacement respectively; t (T) 1 And T 2 、T 3 Acceleration time, constant speed time node and total time, respectively.
6. A method of tapping internal threads based on spindle encoder feedback as recited in claim 3, wherein performing tapping start determination and start error compensation comprises:
the tapping shaft is started by taking the value of the encoder as a reference quantity, the usencodercllenum is taken as the increment of the encoder rotating one circle of the main shaft, the absolute value of the main shaft encoder, i.e. the value of the usencodercllenum is obtained, the value of the encoder and the main shaft position can be mapped by taking the positive value of the absolute value of the main shaft encoder, the value of the usencodercllenum is recorded as the processed head number, ucL is the processed head number, and the value of the starter is taken as the relative value of the encoder when the tapping shaft is started, and the calculation formula is as follows:
The calculated relative value StartERValue of the encoder is a double-shaped variable when the tapping shaft is started, the absolute value lEncoderAbsValue of the encoder is a long shaping variable, and in order to avoid the influence that the value fed back by the encoder always changes by taking the rotation speed of the main shaft as an increment, a capturing interval is set for starting and compensating errors of early walking and late walking in the following process.
7. The method for tapping internal threads based on feedback from a spindle encoder according to claim 6, wherein the means for starting by setting the capture zone comprises:
mode one: maintaining an absolute value lncoderLastAbsValue of the last periodic encoder and an absolute value lncoderAbsValue of the current periodic encoder in a structural body of the encoder to form a capturing interval, and judging whether the tapping shaft starting encoder corresponds to a relative value StartERValue in the interval or not by judging whether the tapping shaft starting encoder corresponds to the relative value StartERValue in the interval or not;
mode two:
determining a left section and a right section with the width of 1.1 times of the increment width of the encoder corresponding to the spindle rotating speed by taking the calculated relative value StartERValue corresponding to the tapping shaft start encoder as a center point to capture a start point;
after capturing the starting point, the compensation displacement Comp corresponding to the starting deviation encoderstartup device is calculated as follows:
When the starting deviation is negative, representing that the starting is earlier than the target starting point, subtracting the catch-up distance CompL corresponding to the early starting from the target catch-up distance TargetL and the residual catch-up distance CurLeftL; when the starting deviation is positive, the target catch-up distance is represented to be started later than the target starting point, and the catch-up distance CompL corresponding to the late start is added to the target catch-up distance TargetL and the residual catch-up distance CurLeftL.
8. A method of tapping internal threads based on feedback from a spindle encoder according to claim 3, wherein the equation for correcting the race plan acceleration and deceleration by virtual operation is as follows:
wherein a is ac And a de Planning acceleration and deceleration, respectively, for chase, preL 0 For the original alignment distance, G33AvoidEmptyL is the clearance distance, and the system requires that the clearance distance is not less than 1mm.
9. The method for tapping internal threads based on feedback from a spindle encoder as recited in claim 1, wherein step S6 includes:
the first period of the stage carries out reverse programming with the same rotating speed and different directions of the main shaft; the tapping shaft has a reverse distance compensation function after the spindle is reversed, the distance is a system parameter dG33RevCompdistance and is different from the reverse gap compensation of the linear module, and when the distance is 0, compensation is not needed; when the compensation distance is not 0, the dynamic speed planning function is not used for planning in the compensation stage, the whole compensation distance is planned once, trapezoidal acceleration and deceleration are adopted by default, the accumulated spindle rotation angle in the compensation stage corresponds to the displacement of the tapping shaft, and the displacement is stored in a tapping structure member dspindleRevCompZAxisCumula; the tapping shaft is compensated once only when the encoder is recognized to be reverse for the first time in the reverse tool withdrawal stage, and if the subsequent abnormal reverse is not compensated;
The main shaft reverse identification is judged by means of the encoder direction cEncoderDir and whether the main shaft direction cTappingspindleDir is different from the G33 forward tapping main shaft direction cTappingspindleDir;
the main shaft reversal first period is judged by means of a main shaft reversal start flag bit bSpindleRevBegin of a G33 structural body member, and the reverse compensation planning post TRUE of the reversal first period;
and (3) judging the end of inversion compensation: when the motion planning residual displacement is 0, indicating that the reverse compensation is finished, setting a tapping structure member G33 reverse compensation finishing zone bit bSpindleRevCompEnd to TRUE;
in the inversion compensation stage, the corresponding displacement of the encoder feedback is accumulated and recorded in a tapping structure body variable dSpindle RevCompzaxis Cumuladis, the positive and negative directions of the encoder are identified, the positive direction of the tool withdrawal is the positive value, and the negative direction of the tapping is the negative value;
after compensation, a dynamic speed planning mode is still used for movement, at the moment, a current real time point is used as a starting point, a G33 tapping starting point is used as a final end point for reverse planning, wherein the accumulated spindle rotation angle in the compensation stage is added to the planning corresponding to the tapping shaft displacement, a reverse tool withdrawal planning model does not allow a target catch-up distance TargetL to exceed a G33 tapping starting point G33StartPoint, the target catch-up distance does not move in a follow-up mode after entering a clearance distance, the planned deceleration is calculated according to the distance from the tapping starting point, the planning is performed by taking the minimum speed of the system as a final speed, and the planning is performed until the deceleration stops to the tapping starting point G33StartPoint;
When the follow-up tool retracting enters the clearance distance, the distance DisToStartPoint between the current point and the tapping starting point is smaller than the clearance distance, and the attention is paid to the fact that the target catch-up distance TargetL cannot exceed the actual tapping length L' of G33; at this time, the dynamic programming is not planned according to the maximum acceleration and deceleration of the system parameter which is 5 times of the following time, but the deceleration is reversely pushed by a deceleration model according to the following distance DisToStartPoint between the current point and the tapping starting point:
the deceleration is taken as a planning parameter, the minimum speed of the system is taken as the final speed to plan until the tapping starting point is reached, wherein V min Is the minimum final speed of the system; when the distance DisToStartPoint between the current point and the tapping starting point is 0, the tool is retracted to the starting point G33, and the step S7 of decelerating and stopping the spindle is started.
CN202310692121.6A 2023-06-12 2023-06-12 Internal thread tapping processing method based on feedback of spindle encoder Pending CN117008536A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310692121.6A CN117008536A (en) 2023-06-12 2023-06-12 Internal thread tapping processing method based on feedback of spindle encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310692121.6A CN117008536A (en) 2023-06-12 2023-06-12 Internal thread tapping processing method based on feedback of spindle encoder

Publications (1)

Publication Number Publication Date
CN117008536A true CN117008536A (en) 2023-11-07

Family

ID=88573548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310692121.6A Pending CN117008536A (en) 2023-06-12 2023-06-12 Internal thread tapping processing method based on feedback of spindle encoder

Country Status (1)

Country Link
CN (1) CN117008536A (en)

Similar Documents

Publication Publication Date Title
US11833613B2 (en) System for controlling overlapping in single-layer laser cladding of a shaft-like workpiece
US3854353A (en) Method and apparatus for performing a threading operation on a rotating workpiece
US4580225A (en) Method for producing multiple entry threads
US20110057599A1 (en) 3d-trajectory display device for machine tool
WO1993004817A1 (en) Numerical control device
US6539275B1 (en) Machine controller and process with two-step interpolation
EP0232305B1 (en) Machine tool control systems
CN101879636A (en) Method for machining a fence drum rope groove by using numerical control machine
KR910008244B1 (en) Wire cut electrical discharge machine
KR930002407B1 (en) Numerically controlled screw cutting method for fine screw surface finishing
CN108303952A (en) A kind of rate curve planing method of small line segment suitable for numerical control device cutter
US6759825B2 (en) Control method and control apparatus for feed system
JP4709588B2 (en) Thread cutting control method and apparatus
US4789943A (en) Thread cutting control method
US7613541B2 (en) Thread control method and system therefor
CN117008536A (en) Internal thread tapping processing method based on feedback of spindle encoder
US6111382A (en) Device for controlling tapping device provided with composite tool having boring and tapping sections
US7012215B2 (en) Laser machining apparatus
CN111857040B (en) Main shaft following synchronous control method for improving thread turning precision
US20220331894A1 (en) Method and tool for creating a through-thread
CN116300685A (en) Laser cutting machine lead screw error compensation method based on PLC control
JPS5939260B2 (en) Cutting feed control method for machine tools
JPH0223285B2 (en)
SU323766A1 (en) AUTOMATIC CONTROL SYSTEM FOR POSITION OF METAL CUTTING MACHINE TOOL
JPS6116569B2 (en)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination