Abstract: Acceleration and deceleration control is one of the key technologies in the development of motion control systems. Traditional trapezoidal acceleration/deceleration algorithms suffer from abrupt acceleration changes at the start and end points of the acceleration/deceleration phases, resulting in shocks during motor operation. The traditional seven-segment S-shaped acceleration/deceleration algorithm divides the acceleration/deceleration phase into three parts, utilizing the different acceleration patterns of these three parts to generate an S-shaped velocity curve. However, this algorithm is computationally complex and produces discontinuous acceleration. Therefore, this paper proposes a novel S-shaped curve acceleration/deceleration algorithm. This method uses trigonometric functions to fit an S-shaped velocity curve onto the trapezoidal velocity trajectory. This algorithm is computationally simple and can output continuous velocity and acceleration. Finally, simulations using Matlab demonstrate that this algorithm can achieve smooth velocity and acceleration with relatively low computational complexity.
1. Introduction
In general automated equipment, in order to ensure that the equipment does not generate shocks, step loss, overtravel, oscillations, etc. during startup and shutdown, it is necessary to design special acceleration and deceleration control laws to control the acceleration and deceleration motion of the motor during speed planning [1]. Smooth and precise speed control is a prerequisite for the smooth operation and accurate positioning of the entire system [2]. Therefore, acceleration and deceleration control is an important component of motion control system and one of the key technologies in motion controller development [3].
Traditional motion control systems commonly use trapezoidal acceleration/deceleration, exponential acceleration/deceleration, and piecewise acceleration/deceleration. These acceleration/deceleration algorithms have sudden acceleration changes during the start-stop phase and the beginning and end phases of acceleration/deceleration, resulting in shocks [3], and are therefore unsuitable for use in high-speed and high-precision motion control systems. The commonly used seven-segment S-curve acceleration/deceleration, although it can provide smooth speed and acceleration, is not suitable for use in general embedded systems due to its complicated steps, large amount of calculation, and very high requirements for the CPU of the controller. Therefore, this paper proposes a very simple S-curve acceleration/deceleration algorithm. A simple trapezoidal acceleration/deceleration algorithm is used in trajectory planning, and a trigonometric function is used to fit the S-curve of speed in interpolation control. Due to the continuous differentiability of trigonometric functions, continuous acceleration and jerk can be obtained. Finally, we verified the method proposed in this paper in Matlab. The results show that the obtained speed curve and acceleration curve are very smooth, and there are no sudden speed or acceleration changes.
2. Limitations of traditional acceleration/deceleration algorithms
In current equipment, trapezoidal or exponential acceleration/deceleration are generally used in applications with less stringent requirements. The advantages of these two methods are low computational complexity and simple implementation; the disadvantage is that sudden changes in speed and acceleration can occur during the acceleration/deceleration start-stop phases, causing shocks to the mechanical system. For applications with higher requirements, a seven-segment S-shaped acceleration/deceleration system is typically used. The advantage of this method is that it can produce smooth speed and acceleration curves; the disadvantage is that the steps are cumbersome and the calculations are complex.
2.1 Trapezoidal Acceleration/Deceleration Algorithm
The trapezoidal acceleration/deceleration control algorithm is as follows: when the system accelerates, the speed increases along a straight line with a fixed slope, the acceleration remains constant, and the speed increases uniformly; when decelerating, the speed decreases along a straight line with a certain slope, the deceleration remains constant, and the speed decreases uniformly, as shown in Figure 1.
Trapezoidal acceleration and deceleration consist of three processes:
(1) During the acceleration phase, the speed increases along a straight line with a fixed slope.
In the formula, Vi+1 is the velocity of the (i+1)th interpolation cycle, Vi is the velocity of the ith interpolation cycle; a is the user-defined acceleration; and T is the interpolation cycle.
(2) Uniform speed stage: During this process, the speed remains constant.
(3) Deceleration process stage During the deceleration process, the speed decreases in a straight line.
The advantage of this trapezoidal acceleration/deceleration algorithm is its simplicity in implementation and low computational load, making it suitable for low-speed, low-cost system solutions. However, because it uses a constant acceleration, with the jerk and its derivative being zero, there are abrupt changes in acceleration at the start and end points of acceleration/deceleration. This leads to various vibrations and noises from the servo motor in actual systems, resulting in less stable system operation.
2.2 Exponential Acceleration/Deceleration Algorithm
The exponential acceleration/deceleration algorithm involves the velocity increasing or decreasing exponentially with time as the horizontal axis during the acceleration/deceleration phase, as shown in Figure 2.
The acceleration and deceleration of the exponential growth also have three stages:
(1) The speed curve during the acceleration phase changes exponentially.
In the formula, T is the execution time of the acceleration phase, t is the current execution time, and Vc is the speed during constant speed operation.
(2) The speed remains constant during the uniform speed phase.
(3) During the deceleration phase, the speed decreases along the exponential curve.
Compared to trapezoidal acceleration and deceleration, exponential acceleration and deceleration have improved smoothness, but require more computation. Moreover, abrupt changes in velocity and acceleration still exist at the start and end points of acceleration and deceleration.
2.3 Seven-segment S-shaped acceleration and deceleration
The currently popular seven-segment acceleration/deceleration algorithm is based on the original three-segment trapezoidal acceleration/deceleration algorithm. It further divides the acceleration and deceleration stages into three segments, thus dividing an acceleration/deceleration process into: acceleration stage, uniform acceleration stage, deceleration stage, uniform speed stage, acceleration/deceleration stage, uniform deceleration stage, and deceleration/deceleration stage, as shown in Figure 3.
From Figure 3, we can express the acceleration a, velocity f, and displacement l as:
From Figure 3, we can express the acceleration a, velocity f, and displacement l as:
Integrating the acceleration at each stage yields the velocity function for that stage.
As can be seen from the above formula, the jerk (including deceleration, the same below) is constant during acceleration (t1, t3) and deceleration (t5, t7), and the jerk is 0 during constant acceleration (t2, t4, t6).
Compared with the previous two acceleration/deceleration algorithms, the seven-segment S-shaped acceleration/deceleration control algorithm can achieve S-shaped acceleration and deceleration without sudden changes in acceleration during the start-up and stop phases, resulting in less impact on the system. However, this algorithm has cumbersome steps, complex calculations, and the problem of discontinuous acceleration still exists during the acceleration/deceleration process.
2.4 Traditional cosine acceleration and deceleration
Traditional cosine acceleration and deceleration [11] does not make full use of the fact that the trigonometric function acceleration and deceleration algorithm and the trapezoidal acceleration and deceleration algorithm have the same calculation results in the trajectory planning stage. Instead, it directly calculates the execution time and running displacement of each execution stage step by step from the velocity function.
This cosine acceleration/deceleration algorithm can obtain continuous velocity, acceleration, and jerk, making it a relatively ideal acceleration/deceleration algorithm. However, it is more complex in the trajectory planning stage compared to the algorithm described in this paper.
3. Novel S-type acceleration/deceleration algorithm
In response to the speed planning requirements of needle motion control systems, and considering the advantages and disadvantages of the algorithms mentioned above, this section will explain this acceleration/deceleration algorithm. This algorithm combines the traditional trapezoidal acceleration/deceleration algorithm and the traditional cosine acceleration/deceleration algorithm. Specifically, during trajectory planning, the trapezoidal method is still used to divide acceleration/deceleration into three stages: acceleration, constant speed, and deceleration. The execution times t1, t2, and t3 for these three stages are first calculated. During interpolation control, the current interpolation period is substituted into the function of the cosine acceleration/deceleration algorithm for curve fitting.
In the above formula, t1, t2, and t3 are the running times of the acceleration phase, the constant speed phase, and the deceleration phase, respectively. Vs is the initial velocity of motion, Vc is the constant speed, Ve is the final velocity, a is the set acceleration, d is the set deceleration, and S1, S2, and S3 are the displacements of the three phases, respectively.
During acceleration, a corresponding position function is fitted using time as the variable. During deceleration, time is again used as the variable, and the positional relationship for the corresponding deceleration stage is fitted using a function.
The fitted velocity curve is shown in Figure 4.
After calculating the execution time of the three stages and the displacement, time t is substituted into the function as the independent variable to count the displacement of the system at the current moment.
In the above formula, the function used is different for different stages of the system. The current stage is determined by comparing the current system running time t with the t1, t2 and t3 obtained from the previous counts, and then different calculation functions are selected.
The velocity function can be obtained by differentiating the position function.
The acceleration curve of the algorithm can be obtained using the function above, as shown in Figure 5.
This algorithm is well-suited for precise position control, and can be obtained by integrating the displacement function at each stage.
As can be seen from the above formula, after integrating the displacement, the calculation formula is still the same as that for trapezoidal acceleration and deceleration. This greatly simplifies the computational workload of trajectory planning and velocity look-ahead, thereby achieving the goal of simplifying the algorithm and realizing the function.
Compared with the previous algorithms, this algorithm not only meets the requirements of motion control systems for speed, acceleration, and jerk, but also has a relatively small computational load, making it very suitable for motion control systems in embedded systems.
4. Verification of S-curve acceleration/deceleration algorithm
Now, we will implement the S-curve verification in Matlab using the method described above. The flowchart of this algorithm is shown in Figure 6.
1) When the parameters are set to: , all three stages of S-shaped acceleration and deceleration are executed, and the starting speed and ending speed are the same. The corresponding acceleration and velocity curves are shown in Figure 7.
1) When the parameters are set as follows: Since the running distance is relatively short, the S-shaped acceleration and deceleration only have acceleration and deceleration segments. The corresponding acceleration and velocity curves are shown in Figure 8.
1) When the set parameters are:
At this point, the velocity at the end point is different from the velocity at the beginning point, so the duration of acceleration and deceleration is also different. The corresponding acceleration and velocity curves are shown in Figure 9.
5. Conclusion
In motion control systems, the position of the axis must be as smooth as possible, requiring high flexibility in acceleration and deceleration. Traditional trapezoidal and exponential acceleration/deceleration algorithms suffer from abrupt shocks during the feed process, making them unsuitable for high-speed feed systems. Traditional seven-segment S-curve acceleration/deceleration is cumbersome and computationally complex, unsuitable for controllers based on embedded systems. Therefore, this paper conducts an in-depth study of a novel S-curve acceleration/deceleration algorithm, focusing on its principle and formula calculations, and verifying the algorithm in Matlab. Experimental data shows that this novel S-curve acceleration/deceleration algorithm overcomes the shortcomings of traditional algorithms and achieves smooth velocity and acceleration.