Research on the S-shaped time-rounding series feedrate scheduling based on NURBS curve

The inconsistency between continuous feedrate scheduling and discrete interpolation of Non-Uniform Rational B-Splines (NURBS) curves as toolpath interpolation affects the interpolation accuracy and motion smoothness of computer numerical control (CNC) machining. The S-shaped series feedrate scheduling method of the NURBS curve is presented to meet the consistency between feedrate scheduling and interpolation, and the needs of the motor to receive accurate discrete pulses to avoid chatter. The acceleration and deceleration margin factor models are respectively established in the acceleration and deceleration stages to compensate for the velocity loss in the discrete process, so that the feedrate scheduling can be accurately reached in each acceleration and deceleration stage. Based on this, 17 kinds of acceleration and deceleration situations are summarized according to the comparison of displacement, start and end velocity, and the number of interpolation cycles. The butterfly three-segment trajectories are selected for simulation in Matlab. The experimental platform is built based on the Codesys platform programing, and the series feedrate scheduling of the proposed method for a NURBS toolpath is carried out. Both simulations and experiments have verified the effectiveness of the algorithm.


Introduction
The International Organization for Standardization (ISO) defined NURBS 1 as the only mathematical representation for free curve surfaces, defined in the Standard for the Exchange of Product Model Data (STEP) in 1991. Subsequently, it is incorporated into the international standard of Programmers Hierarchical Interactive Graphics System (PHIGS). After this, the NURBS has been extensively applied in numerical control machining of complex parts. [2][3][4][5] In order to effectively reduce the impact, desynchronization, overtravel or oscillation of the machine tool during CNC machining, acceleration and deceleration control is required for the feedrate scheduling. 6 Feedrate scheduling is divided into pre-interpolation and post-interpolation scheduling. With the development of computer technology, pre-interpolation feedrate scheduling is mainly used. 1 The curve and surface represented by NURBS have full flexibility, and at the same time, the representation of elementary curve and surface, free-form curve and surface are unified. But it still has shortcomings: the parameters have no geometric meaning and there is no analytical expression for calculating arc length. Usually arc length calculation of free-form curve is to approximate the arc length with the chord length, but the error is large. Jeon and Ha 7 calculates the radius of curvature of the point and approximates the length of the curve with the arc length. The solution process is an iterative method, which requires a large amount of calculation and is not conducive to real-time calculation. Jun et al. 8 proposed a high stationary control strategy for the theoretical basis of the kinematic stability of numerical control equipment. Lin et al. 9 studied the five-section S-shaped acceleration and deceleration control algorithm for real-time interpolation of NURBS curves. Pan et al. 10 studied the S-shaped acceleration and deceleration control algorithm, and 17 Sshaped type acceleration and deceleration modes were given to achieve continuous acceleration and deceleration, and to reduce shock and oscillation. Sun et al. 11 used the real-time interpolation algorithm for flexible high-speed machining via adjusting the acceleration of the axis of motion up to the requirement of continuous transition. Adaptive feedrate scheduling for continuous parametric toolpath with confined contour error and axis jerks was proposed by Chen et al. 12 Liu et al. 13,14 proposed adaptive feedrate scheduling on parametric toolpath with geometric and kinematic constraints for CNC machining. Lee et al. 15 proposed an off-line feedrate scheduling method for CNC machines constrained by chord tolerance, acceleration and jerk limitations. Su et al.'s team has developed successively the trajectory is partitioned into feedrate restricted intervals (FRIs) determining the target feedrate and the positions of tool acceleration and deceleration on the toolpath, 16 and proposed a feedrate optimization method of end milling using the internal data of the CNC system, that is, the spindle power, the block number, and the combined speed of feed axes. 17 A novel jerk minimization algorithm in the context of multi-axis flank CNC machining is proposed by Hashemian et al.,18 in which the total jerk of the tool's motion is minimized, implying the tool is moving as smoothly as possible, without changing the geometry of the given toolpath. Zhong et al. 19 proposed a novel real-time interpolator for parametric curves (RTIPC), which provides a time-optimal solution and limits the machine dynamics (axial velocities, accelerations and jerk) and contour error through feedrate look ahead and acceleration look ahead operations. Sun et al. 20 present a state-of-the-art review: path, feedrate and trajectory planning for free-from surface machining. Lin et al. 21 proposed a combined feedrate scheduling model with error constraints as well as dynamic constraints, and an efficient algorithm is designed to solve this model.
As discussed above, the feedrate scheduling algorithm is proposed using the continuous integration approach. Furthermore, the motion factors such as velocity at the time of actual interpolation are solved from the step changes of the corresponding discreteness. A time-rounding-up based feedrate scheduling method is proposed to consider the round-off error while restricting the motion parameters within their specified ranges by Ni et al. 22 In this paper, a new ''S-shaped Series'' feedrate scheduling algorithm is developed to compensate for the velocity losses in the discrete process based on the relevant velocity margin factor. The purpose is to use known acceleration and deceleration in the acceleration and deceleration stages when the toolpath is sufficiently long under normal circumstances, and add an acceleration interpolation cycle in which the velocity reaches the known maximum velocity.
In the first section, the acceleration and deceleration modes with the discrete process under various circumstances are summarized. Secondly, acceleration, velocity, and displacement of discretization are solved from the interpolation cycle as the velocity step changes. The velocity losses of the discrete process can be compensated by the velocity margin factor. In addition, the Sshaped series acceleration and deceleration motion is proposed based on the NURBS curve. This method has fulfilled the discreteness requirement of the actual interpolation which can further improve the computational efficiency and real-time requirement for CNC machining.

Velocity, displacement, and interpolation cycles based on S-shaped series algorithm
Interpolation cycles of the S-shaped series algorithm During CNC interpolation, NURBS curve interpolation can be performed to guarantee the discreteness of velocity. Moreover, displacement, velocity, acceleration and deceleration motion of the seven-section S-shaped is shown in Figure 1.
In this figure, J m , A m , V m , V t0 , and V d refer to the maximum jerk, the maximum acceleration, the maximum velocity, the start velocity, and the end velocity, respectively. Basic types of motions such as constant velocity, constant acceleration, increasing acceleration, decreasing acceleration, acceleration margin, constant deceleration, increasing deceleration, decreasing deceleration, and deceleration margin are referred to as CV, CA, ACC_ia, ACC_da, AM, CD, DEC_id, DEC_dd, DM, respectively. T 0 , T 1 , T 2 , T 3 , T 4 , T 5 , and T 6 are respectively the interpolation duration of increasing acceleration, constant acceleration, decreasing deceleration, constant velocity, increasing deceleration, constant deceleration, and decreasing deceleration. The corresponding interpolation cycles are denoted as n 0 , n 1 , n 2 , n 3 , n 4 , n 5 and n 6 . T i = n i T p , i 2 ½0, 1, :::, 6, T p is the interpolation cycle. The identification parameters of NURBS curve acceleration and deceleration are given in Table 1.
Suppose N 1 and N 2 are multiples of velocity changes, relative to jerk, then, ffi When N 1 .n 2 0 , n 0 = n 2 = A m J m T p and n 1 = (N 1 Àn 2 0 ) n 0 ; n 0 , n 1 , and n 2 are obtained by rounding down respectively. ffl When N 1 ł n 2 0 , n 1 = 0 and n 0 = n 2 = ffiffiffiffiffi ffi N 1 p , n 0 , n 1 , and n 2 are obtained by rounding down respectively.
If Y 1 and Y 2 are rounding margins of N 1 and N 2 , then, Where, Y 1 is the acceleration margin factor. In the case of Y 1 .0, an interpolation cycle with the acceleration of a = Y 1 J m T p can be added at the end of the corresponding acceleration section. On the other hand, Y 2 is the deceleration margin factor and if Y 2 .0, an interpolation cycle with the acceleration of a = Y 2 J m T p should be added at the end of the corresponding deceleration section.
Displacements at acceleration and deceleration sections of S-shaped series algorithm J m ,V m ,V t0 ,V d T p refer to the maximum jerk, maximum velocity, start velocity, the end velocity and the interpolation cycle, respectively. The n i (i = 0, :::, 6) are denoted corresponding interpolation cycle numbers in different stages. Y 1 and Y 2 are the acceleration margin factor and the deceleration margin factor. The displacement S 1 of non-uniform acceleration at the acceleration section can be expressed in the following equation (3).
S 2 is the displacement for constant acceleration at the acceleration section and can be expressed in the following equation (4).
Moreover, S 3 represents the displacement of the acceleration margin factor section which can be expressed in the following equation (5).
After that, the displacement S p at the acceleration section consists of S 1 , S 2 , and S 3 .
Similarly, the displacement S 0 1 for non-uniform deceleration at the deceleration section can be expressed in equation (7).
The displacement of constant deceleration at the deceleration section such as S 0 2 , can be expressed in equation (8).
The displacement of the deceleration margin factor section (S 0 3 ) can be expressed in equation (9).
Finally, S q denotes the deceleration section which consists of S Moreover, the non-uniform velocity section has a displacement of S pq and can be expressed as Arc length and maximum velocity of S-shaped series algorithm The arc length of the NURBS curve adopts the Gaussian integration method. Gaussian numerical integration is an effective high-precision numerical calculation method. In the field of engineering numerical calculations, it is commonly used to perform numerical calculations on integrals that are difficult to obtain analytical solutions. At the same time, the Gaussian integral is widely used due to their computational stability and convergence. The Gaussian integral of n nodes can be expressed as 23 : The larger the value of n, the more accurate the calculation result. Literature 11 introduced the method of selecting nodes and weighting factors of the Gaussian integral formula.
From the differential geometry, the interval between two adjacent sampling points C(u i ) and C(u i + 1 ) the corresponding parameter is ½u i , u i + 1 , and the arc length between adjacent sampling points is: Velocity V i1 (mm/s) under the control of chord error is Where d c (mm) is the chord error, r (mm) the radius of curvature, and T p (ms) is the interpolation cycle. On the opposite side, the velocity V i2 (mm/s) under the control of normal acceleration a r (mm/s 2 ) is The maximum velocity V m can be expressed in the following formula.
Where V i0 is the command velocity of the corresponding system.

Method for S-shaped series acceleration and deceleration modes
17 Acceleration and deceleration modes of seven-section S curve An integral velocity curve mode is presented in Figure 1, obtained at long processing distance where the corresponding velocity reaches its maximum value. When the start velocity V s , and the end velocity V d and length L of the piecewise curve have different values, various acceleration and deceleration modes may be applied. Specifically, the seven-section S curve acceleration and deceleration control algorithm is applied to all S-shaped acceleration and deceleration modes, which are comprehensively shown in Figure 2. The symbol represents the uniform acceleration stages, the symbol represents the variable acceleration stages, and the symbol represents the uniform velocity stages.
Computational formulas for the interpolation cycles of the corresponding 17 acceleration and deceleration modes are listed in Table 2.
Flow chart analysis of 17 acceleration and deceleration modes J m , T p , V m , and A m of the interpolation curve are investigated. Based on the equations (12)-(14), V s and V d of the piecewise point are simultaneously investigated. In addition, the segmented curve length L is obtained from interpolation preprocessing.
To analyze the 17 acceleration/deceleration modes, the following procedure is employed.  (1) and (2)  (5) Select the acceleration/deceleration mode, to complete planning for curves.
Detailed judgment procedures are considered for four situations Vs = Vd = Vm, Vs \ Vd = Vm, Vd \Vs = Vm and V s 6 ¼ V m 6 ¼ V d . The following focuses on the general situation V s 6 ¼ V m 6 ¼ V d as shown in Figure 3. The rest of the situation can be derived similarly in the Appendix.

Simulation and experiment
Assuming NURBS curve 20,000 mm, it is known that the start velocity V s = 2mm=s, the end velocity V e = 2mm=s mm/s, the maximum velocity V max = 400mm=s, the maximum acceleration A = 20mm=s 2 , the maximum deceleration D = 30mm=s 2 , jerk = 2mm=s 3 , and interpolation cycle T p = 1s.
Using the S-shaped series feedrate scheduling proposed in this paper, it is calculated that increasing acceleration n 1 = 10, decreasing acceleration n 3 = 9, and the constant acceleration n 2 = 9 in the acceleration stage, and increasing deceleration n 5 = 14, decreasing deceleration n 7 = 13, constant deceleration n 6 = 0 in the deceleration stage. acceleration and deceleration mode is Type XVI. The specific feedrate scheduling information is as follows in Table 3. The acceleration, velocity and displacement trajectory are shown in the Figure 4.
It can be obtained from the table that in the acceleration phase, the acceleration as the rounding loss is realized by compensating the acceleration Y 1 J m T p = 18 in the 9 line. In the constant velocity stage, the velocity as the rounding loss is compensated by increasing by the velocity 30 in the deceleration stage. The deceleration as the rounding loss in the acceleration stage is realized by compensating for the acceleration Y 2 J m T p = À6 in the 53 line. Therefore, the discrete acceleration and deceleration in units of interpolation period in order to make up for the loss of rounding, the acceleration and deceleration must be compensated in the S-shaped series feedrate scheduling so as to reach the end point accurately.
In order to further verify the effectiveness of the algorithm, the butterfly is used as the tool path for feedrate scheduling as shown in Figure 5. The specific butterfly fitting parameters are listed in the Appendix. The I, II, and III trajectories are chosen as the planning trajectories, and the previous formula (13) is used to calculate of each arc. The formulas (14)-(16) calculate the start and end velocity. During the Matlab simulations, the S-shaped series acceleration/deceleration mode judgment methods of NURBS butterfly curves are determined. The motion parameters are defined as the values of maximum velocity V max = 50mm=s, maximum acceleration A max = 1200mm=s 2 , maximum deceleration D max = 2000mm=s 2 , jerk J max = 60000mm=s 3 , and the interpolation cycle T p = 2ms.
I trajectory is calculated with start velocity V s = 0, end velocity V e = 6:13, and a length of L = 6:73mm.Y 1 = 8:33 and Y 2 = 11:29 are calculated to increase accelerations with Y 1 J m T s = 1000mm=s 2 and Y 2 J m T s = 1355mm=s 2 , and compensation velocity as velocity rounding is V = 26:13mm=s. n 4 = 31 and n 6 = 0 indicate that there is constant acceleration in the acceleration stage, and there is no constant deceleration in the deceleration stage, and the corresponding acceleration and deceleration mode is Type XV. II trajectory is calculated with start velocity V s = 6:13mm=s, end velocity V e = 23:64mm=s, and the length L = 13:54mm.Y 1 = 7:56 and Y 2 = 9:35 are calculated to increase accelerations with Y 1 J m T s = 907mm=s 2 and Y 2 J m T s = 1122mm=s 2 , and compensation velocity as velocity rounding is V = 28:7mm=s. n 4 = 31 and n 6 = 0 indicate that there is constant acceleration in the acceleration stage, and there is no constant deceleration in the deceleration stage, and the corresponding acceleration and deceleration mode is Type XV.
III trajectory is calculated with start velocity V s = 23:64mm=s, end velocity V e = 12:92mm=s, and the The rounding down bc, the start velocity V s , and the end velocity V d , S p the acceleration displacement, S q deceleration displacement, S pq acceleration and deceleration displacement. V x actual maximum velocity.
length L = 28:97mm.Y 1 = 9:83 and Y 2 = 10:5 are calculated to increase accelerations with Y 1 J m T s = 1180mm=s 2 and Y 2 J m T s = 1260mm=s 2 , and compensation velocity as velocity rounding is V = 25mm=s. n 4 = 0 and n 6 = 0 indicate that there is no constant acceleration in the acceleration stage, and constant deceleration in the deceleration stage, and the corresponding acceleration and deceleration mode is Type XIV. The acceleration, velocity and displacement trajectories are shown in the Figures 6 to 8 respectively. The symbol o means adding an acceleration caused by rounding acceleration in an interpolation cycle to make the velocity reach the known maximum velocity in the acceleration stage. The symbol performs compensated velocity caused by rounding velocity to reach accurately the end.
The test platform is composed of programing software, a master station, a slave station, a real-time Ethernet bus, a drive and a motor as shown in Figure 9. Real-time Ethernet adopts the highperformance NCUC 2.0 bus protocol with a communication cycle of 1 ms. Logic programing software and HMI monitoring software run on the upper computer, and perform Modbus or TCP/IP communication with the system master to complete the control program code download and real-time data interaction. The master station module is the core of the system logic program execution and task scheduling. It mainly performs the calculation of the compiled IEC 61131 logic program, the data communication between the slave nodes based on real-time Ethernet, and the data exchange of the human-computer interaction interface. The slave station is the main part of  Figure 3. The general situation V s 6 ¼ V m 6 ¼ V d of S-shaped velocity curves.
the system that directly completes the control of the peripheral equipments. It mainly performs real-time communication with the master station, and realizes real-time control functions such as digital/analog data acquisition and output, and motor servo. The digital AC servo drive is a high-end AC servo system with high performance, intelligence, high reliability, and small size. It adopts a dedicated digital signal processor (DSP) and an intelligent power module (IPM), an advanced and optimized control algorithms that can achieve accurate digital control of torque, velocity and position. Huada LDD series servo motors have a short dynamic response time, stable operation at low velocity, and realizes closedloop control of position, velocity and torque. The semicircle curve is shown in Figure 10(a) and constructed by a 2nd degree B-Spline with control points = (0 0 0,0 100 0,2100 100 0,2100 0 0), knot vector = (0 0 0 0 1 1 1 1), and weights = (1 1/3 1/3 1). The acceleration, velocity and displacement planning with the proposed method is shown in Figure 11. Figure 10(b) shows the interpolation results of the semicircle curve, and the interpolation points can be zoomed on the trajectory for the partial view. Through the trace function of codesys, the velocity and displacement trajectory of the X axis and Y axis are shown in Figure 12.  Figure 4. Acceleration, velocity, and displacement trajectory.

Conclusions
In the acceleration and deceleration stage, in order to compensate for the loss of acceleration and deceleration rounding, the acceleration Y 1 J m T s and deceleration Y 2 J m T s are added to ensure that scheduling feedrate reaches the maximum velocity and the end point. The butterfly three-segment trajectories are selected for simulation in Matlab, and the series feedrate scheduling is operated on I, II, and III trajectories by compensating for velocity and acceleration to verify the effectiveness of the proposed method.
The experimental platform is built and programing is based on the CODESYS platform. The series feedrate scheduling of the proposed method for the semicircle curve is carried out through the software configuration. The interpolation trajectory shows that the proposed method feedrate scheduling can guide the toolpath trajectory to reach the end point accurately  Figure 11. Acceleration, velocity and displacement trajectory.

Contributions
Wu Jichun is mainly responsible for writing and revising papers and algorithm design. Xu Ke mainly writes papers and experimental platform construction and experimental verification. Ren Guang is mainly responsible experimental guidance. Fan Dapeng is mainly responsible for overall guidance. I would like to take this opportunity to thank the reviewers for their comments and the editors for their revisions to the article.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.  Figure A2. Class II of S-shaped velocity curves.  Figure A1. Integrated classification of S-shaped velocity curves.  Figure A3. Class III of S-shaped velocity curves.