Summary of the invention
To the above-mentioned weak point that exists in the prior art, the technical matters that the present invention will solve provides a kind of SPL real-time interpolation algorithm that can realize speed smooth transition, guaranteeing the even running of each kinematic axis, thereby satisfies the requirement of flexibility processing.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is:
A kind of SPL real-time interpolation of the present invention method may further comprise the steps:
SPL section pre-service: job sequence is carried out the pre-service of SPL section, obtain length of curve and catastrophe point information;
Real time forward looking: carry out speed planning according to above-mentioned length of curve and catastrophe point information, obtain process velocity;
Interpolation is calculated: calculate next point coordinate according to the process velocity that obtains, export Servocontrol device to.
Saidly job sequence is carried out the pre-service of SPL section may further comprise the steps:
Import job sequence, the initial velocity of current curves section is set;
Based on error constraint, acceleration constraint and acceleration constraint planning present speed;
Is the present speed of judging planning a catastrophe point?
If catastrophe point then adds the catastrophe point array with this catastrophe point;
Obtain next interpolated point coordinate;
Judge whether the current curves section finishes;
As finishing, export result to the real-time interpolation module, and read in next section of job sequence;
Return the initial velocity step that the present procedure section is set.
Said real time forward looking may further comprise the steps:
The initial velocity of processing is set;
Retrain and be programmed into constraint speed according to error constraint, acceleration constraint, acceleration to constraint of velocity condition calculating processing;
Ask down some positions according to constraint speed;
According to being programmed into to Velocity Updating catastrophe point array;
Whether the residual paths length under judging between some positions and all catastrophe points is all greater than required deceleration distance;
, then reduce speed now, and recomputate present speed for not like above-mentioned judged result from current point;
Export present speed to the interpolation calculation procedure, and go to according to error constraint, acceleration constraint, acceleration constraint and be programmed into constraint speed step to constraint of velocity condition calculating processing.
Whether the residual paths length under judging between some positions and all catastrophe points all may further comprise the steps greater than required deceleration distance:
From the catastrophe point array, take out catastrophe point successively;
The length of curve information calculations that obtains based on preliminary treatment from some positions down to the distance of this catastrophe point;
Judge successively that according to the acceleration of down any acceleration and speed, catastrophe point and speed whether the residual paths length between some positions and catastrophe point is greater than required deceleration distance down.
If the residual paths length between some positions and all catastrophe points is all greater than required deceleration distance; Then continuing exports present speed to the interpolation calculation procedure, and goes to according to error constraint, acceleration constraint, acceleration constraint and be programmed into the constraint speed step to constraint of velocity condition calculating processing.
If the current curves section does not finish, then go to based on error constraint, acceleration constraint and acceleration constraint planning present speed step.
If not catastrophe point, then directly get into and obtain next interpolated point coordinate step.
The present invention has following beneficial effect and advantage:
1. real-time is good.In conjunction with prediction and pretreated advantage; Adopt the implementation of pre-service+prediction; Being repaiied the work of transferring operating influence to calculated amount greatly and not is placed on pre-service and accomplishes; Thereby reduced the calculated amount of real time forward looking, made the prediction hop count long enough in each cycle, can guarantee each interpolation cycle reliable interpolated point of output in real time.
2. ask the deceleration point precision high.Employing avoids technology such as deviation accumulation and real time forward looking to make the position of the deceleration point of asking more accurate, can not occur not satisfying the phenomenon of machining precision because of deceleration distance causes part point inadequately.
3. interaction is good, can real-time response repair the accent operation.
Embodiment
Below in conjunction with accompanying drawing the present invention is done further explain.
The inventive method may further comprise the steps:
SPL section pre-service: job sequence is carried out the pre-service of SPL section, obtain length of curve and catastrophe point information;
Real time forward looking: carry out speed planning according to above-mentioned length of curve and catastrophe point information, obtain process velocity;
Interpolation is calculated: calculate next point coordinate according to the process velocity that obtains, export Servocontrol device to.
As shown in Figure 1; In this embodiment; The job sequence of from the CAD/CAM device, exporting at first gets into the interpreter of numerical control device; Interpreter is divided into job sequence explains and SPL section pre-service two parts that it makes an explanation and pre-service to job sequence, and will handle data well and issue motion controller through shared buffer memory.Motion controller is real-time, and it carries out each interpolation cycle speed planning and calculate next interpolated point coordinate through real time forward looking and interpolation calculating, at last this coordinate is sent to servomechanism installation, the drive motor motion.
With reference to shown in Figure 2, there be the curvature discrete point in the SPL, and when curved transition is too fast, the point of lathe slowing down power(SDP) also can occur exceeding.In order to guarantee that actual to add man-hour be continuous at these acceleration, need these points be noted at SPL section pretreatment stage.
The pretreated system flowchart of SPL section is as shown in Figure 3, saidly job sequence is carried out the pre-service of SPL section may further comprise the steps:
S1: import job sequence, the initial velocity of current curves section is set;
S2: according to error constraint, acceleration constraint and acceleration constraint planning present speed;
Is S3: the present speed of judging planning a catastrophe point? If catastrophe point then adds the catastrophe point array with this catastrophe point;
S4: obtain next interpolated point coordinate;
S5: judge whether the current curves section finishes;
S6: as finishing, export result to the real-time interpolation module, and read in next section of job sequence, return the initial velocity step that the present procedure section is set.
Because SPL is segmentation, and the catastrophe point of curvature is present in segmentation link place mostly, and for fear of owing to repair pre-service that operation such as accent causes Problem of Failure as a result, we regard SPL as segmentation independently when pre-service.
In each segmentation starting point, step S1 thinks that initial velocity is the maximal rate that a last segmentation last point error allows.If ER is (u
i), ρ (u
i) and V (u
i) be respectively interpolated point u
iBow high level error, radius-of-curvature and the speed at place, T
sBe the interpolation cycle of lathe, the bow high level error maximal value of ER for allowing, J
MaxBe the maximum acceleration that allows, A
MaxBe the peak acceleration that allows.u
iThe maximal rate V that place's error, peak acceleration, acceleration allow
e(u
i), V
a(u
i) and V
j(u
i) be respectively:
The error constraint formulations:
Acceleration constraint formulations: V
a(u
i)=V (u
I-1)+A
MaxT
s(2)
Acceleration constraint formulations: V
j(u
i)=V (u
I-1)+(a (u
I-1)+J
MaxT
s) T
s(3)
When step S2 asks constraint speed according to above-mentioned each formula, not consider to be programmed into to constraint of velocity, present speed is V (u
i)=min (V
e(u
i), V
a(u
i), V
j(u
i)).Note the knot vector of this point simultaneously, acceleration, speed and starting point are to the cumulative path length of this point.Step S3 is judged to be catastrophe point with the point that meets the following conditions simultaneously: the speed of 1) obtaining according to constraint conditions such as machining precision, peak acceleration, accelerations is got minimum value as current point speed, and this speed is compared the lathe acceleration and deceleration ability that exceeds with last spot speed; 2) current point speed needs to slow down less than last spot speed.If current interpolated point is a catastrophe point, the nodal information that then will put, information such as speed, acceleration record in another array, add successively in the catastrophe point array by the interpolation order.
Said real time forward looking may further comprise the steps:
P1: the initial velocity that processing is set; Retrain and be programmed into constraint speed according to error constraint, acceleration constraint, acceleration to constraint of velocity condition calculating processing;
P2: ask down some positions based on constraint speed;
P3: according to being programmed into to Velocity Updating catastrophe point array;
P4: whether the residual paths length under judging between some positions and all catastrophe points is all greater than required deceleration distance;
P5: for not, then reduce speed now, and recomputate present speed from current point like above-mentioned judged result;
P6: export present speed to the interpolation calculation procedure, and go to according to error constraint, acceleration constraint, acceleration constraint and be programmed into constraint speed step to constraint of velocity condition calculating processing.
Real time forward looking carries out accurate speed planning according to the information that pre-service is noted; As shown in Figure 4; It is 0 that initial velocity is set, and supposes that the programming speed of feed is F, and each cycle is at first calculated constraint speed V (u according to constraint conditions such as error, programming speed of feed, peak acceleration, accelerations
i)=min (F, V
e(u
i), V
a(u
i), V
j(u
i)), and obtain down some position P according to this speed
I+1
Owing in real time forward looking, will limit real-time interpolation speed according to the programming speed of feed, can produce new catastrophe point, therefore need in step P3, upgrade the catastrophe point array, promptly increase new catastrophe point.Because this catastrophe point only maybe be near the maximum point of speed can be occurred, concrete implementation method is: remember first point that surpasses the speed of feed of programme for going into a little, last surpasses the point of the speed of feed of programming for going out a little.Be made as zero to the acceleration of going into a little and going out a little, speed is made as the programming speed of feed.If the acceleration change amount absolute value of going into a little or go out next one point a little is greater than J
MaxT then joins it in catastrophe point array.
Step P4 judges P
I+1Whether the residual paths length between all catastrophe points on point and the prediction segment of curve satisfies required deceleration distance, and concrete decision method is following:
At first calculate required deceleration distance, suppose that Fig. 5 is one section SPL to be processed, wherein u
iA catastrophe point that obtains when being the pre-service of SPL section, its next interpolated point acceleration is a
I+1, u
jBe sampled point u
iDeceleration point, its previous interpolated point acceleration is a
J-1Realize the continuity of whole machining process process acceleration, as shown in Figure 6, need to guarantee that braking section starting point and terminal point acceleration all are continuous.Therefore be to judge whether what needs slowed down at step P2 according to the speed and required minimum process path and the relation between the residual paths length between them of acceleration that carry out the transition to catastrophe point from current speed and acceleration.The computing method of required minimum process path are as follows:
Suppose that present speed is V
i, acceleration is a
i, the required speed of catastrophe point is V
j, acceleration is a
jPossibly there are four kinds of transient modes shown in Fig. 7 (a)~(d) in the speed and the acceleration that carry out the transition to catastrophe point from current speed and acceleration.If catastrophe point is the acceleration catastrophe point shown in Fig. 7 (a), from V
iCarry out the transition to V
jRequired apart from S and time t is:
If carry out the transition to the catastrophe point accelerating curve shown in Fig. 7 (b), from V from current point
iCarry out the transition to V
jRequired apart from S and time t is:
If bigger, there are Fig. 7 (c) and two kinds of situation of Fig. 7 (d) when then slowing down from the velocity variations of this catastrophe point and current point.At first existence is with acceleration-A
MaxEven situation of slowing down, in order to guarantee the continuity of acceleration, whole moderating process is divided into acceleration and is-J
MaxChange acceleration, acceleration be-A
MaxEven acceleration and acceleration are J
MaxThe change accelerator.Wherein acceleration is-J
MaxThe displacement S1 of change boost phase, terminal velocity V
1With time t
1Be respectively:
Acceleration is-A
MaxThe displacement S of even boost phase
2With terminal velocity V
2Be respectively:
V
2=V
1-A
maxt
2 (12)
Acceleration is J
MaxThe displacement S of change boost phase
3With this duration in stage t
3For:
The speed increment sum in each stage satisfies following relational expression:
Therefore can get the time t of subordinate phase
2:
The required total displacement S that slows down equals:
S=S
1+S
2+S
3 (16)
Shown in Fig. 7 (d), when there not being acceleration-A
MaxWhen sparing braking section, suppose that it is a that the phase one finishes the brief acceleration value
p, then above-mentioned formula should be rewritten as:
S=S
1+S
2 (21)
After obtaining the required minimum process path of the speed that carries out the transition to all catastrophe points from the speed and the acceleration of current point and acceleration respectively; If find to exist current point to arrive residual paths length between any catastrophe point less than required deceleration distance, then proof need reduce speed now from the i cycle; Otherwise, according to the speed operation of step P1 planning.The speed well of will planning is at last issued the interpolation computing module, calculates the position of next interpolated point, issues servomechanism installation, the drive motor motion.
The inventive method combines the advantage of pre-service and real time forward looking; Adopt pre-service to add the method for prediction; With calculated amount greatly but do not repaiied and transfer the data influence to be placed in the pre-service to calculate; Real time forward looking carries out accurate speed planning according to the data that pre-service calculates, and repaiies the requirement of transferring operation to satisfy real-time and real-time response simultaneously.The path information of each interpolated point of noting when real time forward looking is according to pre-service is simultaneously dynamically revised the residual paths length between current point and the catastrophe point, can effectively avoid the generation of cumulative errors, improves the precision of the deceleration point of asking.
Because SPL is segmentation; And the catastrophe point of curvature is present in segmentation link place mostly; For fear of owing to repair and transfer pre-service that operation causes Problem of Failure as a result; When pre-service, regard SPL as segmentation independently, and think that the initial velocity of each section is the maximal rate that a last segmentation last point error allows.When needing deceleration like this and exceeding lathe acceleration and deceleration ability, this point is noted as the velocity jump point; If need to quicken, then upwards quicken according to the actual acceleration and deceleration ability of lathe.The path of obtaining is so neither repaiied the accent operating influence, again closing to reality machining path length as much as possible.
Can find out that from above pretreated purpose is not to cook up actual rate curve, required catastrophe point information of knowing and comparatively accurate path are convenient in real time forward looking, carry out speed planning when just calculating real-time interpolation.At each interpolation cycle of real time forward looking module, retrain the speed V that obtains current interpolation cycle according to machining precision and acceleration, acceleration
i, to guarantee the continuity of acceleration.
Suppose prediction k section SPL, think that then the terminal velocity of k section curve is 0.Judgement is from location point P
I+1And whether the residual paths length between all catastrophe points and the k section End of Curve satisfies required deceleration distance, and less than required deceleration distance, then proof needs i cycle to reduce speed now as if the residual paths length that has any point-to-point transmission; Otherwise,, get into next interpolation cycle according to the top speed operation of obtaining.
Because path that pre-service is asked less than actual path length, though can guarantee can not occur the not enough problem of deceleration distance, may get into deceleration area too early.In order to reduce the negative effect of slowing down in advance and bringing to working (machining) efficiency, the accumulative total routing information of each interpolated point that the prediction stage preserves during according to pre-service calculates the residual paths of current point, can eliminate the cumulative errors of machining path.Like this in the actual problem and of just can in time finding man-hour to slow down too early that adds to its dynamic correction.
The test of the inventive method is at the three-axis numerical control milling machine, and representative workpiece test procedure accomplishes through processing.Equipment therefor adopts encoder feedback, forms closed-loop control system, drives AC servo motor.The major parameter of device is following:
Digital control system: CPU Pentium M-1.6GHz, RAM-512M, HD-40G, I/O-32/24, scrambler input-4, D/A output-4, demonstration-10.4 " Color Liquid Crystal Display; Servo and the motor of peace river ∑-2;
Feed rate F=24m/min; Peak acceleration A
Max=5000m/s
2Maximum acceleration J
Max=500m/s
3Interpolation cycle T=1ms; Profile errors E
Max=0.000001m.
The inventive method and implement device Evaluation on effect serve as the evaluation and test foundation to process curve shown in Figure 8.And adopt the inventive method and implement device, and graph of errors is as shown in Figure 9, and the speed planning curve is shown in figure 10, and accelerating curve and part enlarged drawing are shown in figure 11.From above-mentioned processing effect figure, can see:
1. described spline interpolation method can satisfy the requirement of machining precision, has handled the velocity jump point preferably, has solved because the part point machining precision that deceleration distance causes inadequately exceeds the problem of permissible value;
2. promptly shown in Figure 12 like the part enlarged drawing of accelerating curve among Figure 11, said method adopts the method for eliminating cumulative errors to improve the deceleration point precision of asking, and when finding to get into deceleration area in advance, can constantly in time revise present speed;
3. the accelerating curve that said method obtains is continuous basically, and rate curve is level and smooth.