Share this

Application of continuous interpolation small line segment look-ahead function in PLC

2026-04-06 04:30:36 · · #1

01. Function Introduction

When equipment requires high-precision, high-speed machining of complex curved workpieces, the machining trajectory is typically broken down into a series of position points and transmitted to the controller. Traditional trajectory planning methods require frequent starts and stops at each of these points to complete the task. This method not only reduces accuracy but also causes damage to the equipment structure and motors. To improve machining accuracy and reduce damage to the equipment's mechanical structure, Leadshine Intelligent has leveraged 23 years of accumulated experience in the motion control industry to develop a small-segment look-ahead function that supports path smoothing and trajectory planning. This function supports linear interpolation, circular interpolation, helical interpolation, and IO control.

Features

1) It realizes a continuous path that combines line segments and curves, enhancing the smoothness of motion.

2) Supports 8-axis circular interpolation (3-axis spatial, 5-axis following) and linear interpolation. The contour error of each trajectory segment and the connection speed of trajectory segments can be set separately.

3) During interpolation, equal-interval control IO operations (time or distance mode) are supported.

4) The interpolation buffer of each coordinate system can cache up to 5000 instruction segments (IO/position/delay), and new position and velocity instructions can be written during interpolation motion (FIFO mode).

5) Supports mixed look-ahead and non-look-ahead interpolation.

02. Usage Scenarios

Small-segment look-ahead technology is widely used in complex trajectory machining scenarios such as CNC machining, gluing, and laser engraving. Its efficiency and stability directly affect whether machining is possible and the quality of the work. With social development, the demand for machining workpieces with higher precision and more complex shapes will increase. Therefore, Leadshine Intelligent has launched a small-segment velocity look-ahead interpolation algorithm library to meet the application needs of Leadshine LC, MC, and SC series motion control PLCs in such high-precision and high-speed machining scenarios.

03. Usage Examples

A certain adhesive coating equipment process requires 3-axis continuous linear interpolation, supporting the setting of start and end speeds for each interpolation position. The control level signal output (controlling adhesive switching) is based on the interpolation position of each segment. It is required to complete the adhesive coating of a pattern within 1.6 seconds, with uniform adhesive in the middle segment (without wavy lines), no adhesive accumulation at corners, and an accuracy within ±0.75mm.

Command Introduction

Library name: MCLA_CONTI_INPOL_ver46.compiled-library

The interpolation instruction table is shown below:

Implementation logic

You can start the program directly by pushing the list without closing the buffer first, using dynamic pushing.

It is generally recommended to adjust the parameters of the command_set_config_paras block (TrojecityError for look-ahead interpolation, MaxAcc for look-ahead maximum cornering acceleration) and the parameters of the command_set_speed_paras block (Acc_Time for acceleration and Dec_Time for deceleration) in the following order to improve machining efficiency:

1. According to the processing technology and precision requirements, set a reasonable allowable corner trajectory error (TrojecityError) for look-ahead interpolation. After setting the corner trajectory error value according to the process requirements, proceed with the subsequent adjustment steps.

2. Next, set the maximum allowable turning acceleration (MaxAcc). Generally, follow the principle of adjusting from small to large (e.g., starting from 1000, increasing by 2 or 10 times each time). Then, debug the program on the equipment according to the pre-set acceleration/deceleration times (Acc_Time and Dec_Time). At this time, carefully observe the vibration of the equipment under different maximum turning acceleration settings (especially at sharp corners). When the maximum turning acceleration (MaxAcc) increases to a certain value, the equipment vibration becomes more obvious, indicating that the equipment has reached its acceleration limit. The acceleration can be appropriately reduced by one level, and the final value can be determined. Additionally, if the turning acceleration (MaxAcc) is set very small, the equipment will also vibrate. It is recommended to check if the set acceleration/deceleration times (Acc_Time and Dec_Time) are too small. Too small acceleration/deceleration times can easily lead to rapid acceleration and deceleration, which may also cause equipment vibration. In this case, you can first appropriately increase the acceleration/deceleration times (e.g., set them between 100 and 200 ms), and then readjust the maximum turning acceleration (MaxAcc).

3. After confirming the contour error and look-ahead acceleration, you can start adjusting the interpolation acceleration and deceleration times to further improve efficiency.

Usage steps

1. Create a new global variable table, define an input/output variable (as shown in Figure 1), which is used to bind the input/output ports of the PLC body (as shown in Figure 2), and allocate a small line segment look-ahead function data buffer in the PLC's memory;

Figure 1: Defining input and output variables

Figure 2: Binding PLC body IO

2. Create a POU, instantiate an FB, and associate pin variables to facilitate parameter passing in the main control program. The main functions used in this case are shown in the figure below.

• Call the command_MCLA_Init_Module function block to allocate look-ahead interpolation space resources in the PLC. Similarly, when the program finishes operating on the motion control card, the command_Conti_Close function block must be called to release the PLC system resources occupied by the motion control card, so that the occupied resources can be used by other devices.

• Call the Command_Conti_Open_List function block to open and initialize the interpolation buffer. If bDone=TRUE, it indicates that opening the list was successful. This instruction requires two task cycles to complete.

• Call the Conti_Set_Cmp_Config function block to set the IO output mode in continuous interpolation, including parameters such as comparison source, output level logic, and level signal inversion time.

• Call the Conti_Set_Cmp_Enable function block to enable the IO output function in continuous interpolation.

The `command_set_config_paras` function block is called to set the continuous interpolation look-ahead parameters. Small line segment look-ahead supports both circular and non-circular transitions. Setting the trajectory error range to zero disables circular transitions; otherwise, circular transitions are enabled by default. Ordinary continuous interpolation does not support circular transitions. The maximum allowed turning acceleration (`MaxAcc`) controls the speed during corner transitions. Generally, a higher acceleration results in a higher corner speed and higher processing efficiency. This acceleration typically refers to the acceleration allowed by the mechanical system; setting it too high can easily cause mechanical vibration.

• Call the Command_Conti_Get_List_RemainSpace function block to query the remaining interpolation space in the continuous interpolation buffer to accommodate the required interpolation point data.

• Call the command_set_speed_paras function block to set the acceleration time, deceleration time, starting speed, target interpolation speed, and stopping speed.

• Call the command_Conti_Add_Io_Action function block to configure the IO output status of each continuous interpolation position.

• Call the command_Conti_Add_Line function block to push each interpolation position point into an array.

• Call the command_Conti_Start function block to begin continuous interpolation.

• Call the command_Conti_Close function block to close the continuous interpolation buffer.

• Call the `get_list_state` function block to read the interpolator state in the specified coordinate system. 0 - Running, 1 - Paused, 2 - Normally stopped, 3 - Not started, 4 - Idle. Calling `open list` sets the interpolator state to 3; calling `conti start` sets the interpolator state to 0; the interpolator state is 2 when the motion is complete and no `conti colse` has been called; other states are 4.

• Call the Command_Conti_Pause function block to insert pause instructions.

3. For the operation of the editing control section, it is recommended to use the CASE multi-branch selection statement for control.

Step 1: Initialization

Step 2: Open the buffer

Step 3: Configuring look-ahead interpolation parameters

Step 4: Set the speed

Step 5: Set the position of each axis in each interpolation segment, including the start speed, acceleration/deceleration, initial speed, and end speed.

4. IO output relative to the starting point of the trajectory segment during continuous interpolation (executed within the segment).

5. Start the look-ahead interpolator, interpolator coordinate system number and

6. Close the continuous interpolation buffer.

04. Track Effect

Example: Perform four positions on the X and Y axes, and use look-ahead and non-look-ahead interpolation to achieve a gluing process with a square side of 5cm.

1. Preview testing is not enabled.

The first set of parameters is as follows: acceleration is 162 mm/s², cornering speed is 0 mm/s², and velocity is 16.2 mm/s². The velocity curve without velocity look-ahead is shown in Figure 3.

Figure 3

2. Start preview testing

The second set of parameters is as follows: acceleration is 100 mm/s², cornering speed is 0 mm/s², and velocity is 16.2 mm/s². The velocity curve with speed look-ahead enabled is shown in Figure 4 below.

Figure 4

By comparing the curves under the two modes, it can be observed that without speed look-ahead, the speed at the start and end points of each line segment decelerates to 0, with an interpolation time of approximately 3.5 seconds. With speed look-ahead enabled, the controller pre-identifies the angle between trajectory changes between commands, compares it with the allowable corner trajectory error, and decelerates to 0 for larger angles while appropriately decelerating for smaller angles, ensuring the speed does not drop to 0, thus guaranteeing a smooth transition at the position command connection point, with an interpolation time of approximately 1.5 seconds. It is evident that speed look-ahead improves motion smoothness and increases machining efficiency.

Precautions

1. The Plan_Mode speed planning type parameter of the command_set_config_paras function block only supports symmetrical trapezoidal geometry in look-ahead mode, and supports trapezoidal and S-shaped geometry in non-look-ahead mode.

2. In look-ahead mode, the target speed is valid, while the set start and end speeds are invalid. The look-ahead parameters for the connection point speed are calculated. In non-look-ahead mode, the user-defined speed parameters are used.

3. After all parameters are pushed into the buffer, the buffer should be actively closed so that the interpolator can switch to idle mode. 4. When executing a large number of short line segment trajectories, it is best to push in a certain number of position commands before starting interpolation, such as 100-200 segments.

— END —

Read next

CATDOLL 139CM Tami Silicone Doll

Height: 139 Silicone Weight: 25kg Shoulder Width: 33cm Bust/Waist/Hip: 61/56/69cm Oral Depth: N/A Vaginal Depth: 3-15cm...

Articles 2026-02-22