Made in China 2025 is a manufacturing upgrading strategy released by the State Council in December 2015. Its goal is to build China into a world manufacturing power in three stages over the next thirty years. The core of this strategy is to promote the transformation and upgrading of the manufacturing industry, with innovation as the driving force, focusing on quality, green development and structural optimization, while emphasizing talent training. Its action program focuses on the combination of market dominance and government guidance, focuses on long-term development, emphasizes overall advancement and key breakthroughs, and advocates independent development and open cooperation.
Smart manufacturing is one of the key points of "Made in China 2025". It aims to develop smart equipment and products through the integration of new-generation information technology and manufacturing technology, enhance the intelligence level of enterprises in R&D, production, management and services, and realize the deep integration of informatization and industrialization.
In the field of motion control, interpolation motion technology is crucial, as it enables equipment to move precisely along a predetermined trajectory. This technology is used in many industries, such as lithium battery equipment, automobile manufacturing, canning machinery, logistics equipment, machining, rubber industry, 3C products, and CNC machine tools. In the rubber industry in particular, the use of G-code and the trajectory tracking function of the interpolator can efficiently complete delicate operations such as dispensing.
The manufacturing and processing functions of mechanical equipment are usually achieved through the movement of parts. Whether it is metal cutting, welding, forging or 3D printing, they all rely on precise motion control. Different processes have specific requirements for motion control. For example, robots and CNC machine tools focus on path planning and coordination of motion parameters, while printing and packaging machinery pays more attention to the synchronization of the main axis and the slave axis and the process beat.
Motion control systems are key to ensuring efficient operation of CNC machine tools, robots and other advanced equipment. They require not only a deep understanding of the motion trajectory and shape of the equipment, but also the solution of complex mechanical kinematics and dynamics problems.
Motion control technology generally refers to the control of basic motion elements such as position, speed, acceleration, rate of change of acceleration and torque of mechanical equipment or processing tools through driving components (such as hydraulic pumps, linear drives or motors) during the processing process. This technology plays an important role in many fields of the national economy and has brought significant economic benefits. Motion control technology is the practical application of control theory in mechanical and electrical engineering. It integrates technologies from multiple fields such as microelectronics technology, electronic power technology, computer information technology, sensor detection technology and motor science. It is a highly comprehensive technical discipline.
The following is a detailed introduction and implementation method of the interpolation motion function of LicOS PLC/PAC based on G code and interpolator:
1 Motion Controller PAC
1.1 MC500 Series
Figure 1 MC500 Series PAC
1.2 MC600 Series
Figure 2 MC600 series PAC
2 G-code
2.1 Introduction to G-code
Figure 3 DIN66025 G code programming language standard
Figure 4 G code example
Figure 5 G code function
Figure 6 Building an aircraft model using G code
Figure 7 Circular interpolation through G code
Figure 8 Linear interpolation through G code
Figure 9 Auxiliary axis
In addition to supporting 3-axis interpolation motion, the CNC motion control part of Liancheng PLC also supports positioning control of 8 auxiliary axes, such as A/B/C/P/O/U/V/W, so that the auxiliary axes can cooperate with the interpolation motion axes of mechanical equipment during motion. The start and end times of these auxiliary axes can be determined by the user's G-Code program, but they are not completely synchronized with the XYZ axis motion.
Figure 10 Auxiliary axis
In the user program, the programming method of auxiliary axis motion is the same as that of XYZ axis: the value following the variables such as A/B/C/P/Q/U/V/W is the target position of the corresponding auxiliary axis. During trajectory interpolation operation, each auxiliary axis operates in positioning mode, and its execution completion time is the same as that of XYZ, as shown in the figure.
G code paths can realize straight path, arc path, curve path, and elliptical path. In addition to path planning, G code can be used to assign values, including running speed, running acceleration, running deceleration, etc. In fact, G code is based on point description. The interpolator mixes the points described by G code into corresponding path segments, and stores these mixed path segments in the path planning buffer area, and outputs the path segments according to the path loading to drive the servo system to run.
Figure 11 Three formats of G code storage
The G-Code trajectory program is in the form of a text string. Some of the trajectory information needs to be analyzed in context to accurately restore the control characteristics required by the user. In order to improve the computational efficiency of trajectory interpolation and achieve smooth control of the running trajectory, it needs to be compiled into a code sequence suitable for processor execution. The typical format is OutOfMemoryError format.
The OutQueue format compiles the G-Code source file into a data table that is convenient for the interpolator to execute, such as the start and end coordinates and line type of the trajectory, acceleration and deceleration parameters, mode command parameters, auxiliary axis motion parameters, M and H command parameters, and other auxiliary information, etc., and parses it into an ordered regular table array that does not require context analysis.
When the interpolator is executed, it can directly interpolate and output according to the table data and line type; based on this table array, it can realize bidirectional movement of the trajectory, continuous buffering (Buffer) of multiple continuous line segments, etc. Therefore, the OutQueue format can be understood as a regular G code file. Because the OutQueue format has more complete trajectory segment coordinates and line type information, it is convenient for smooth chamfering of the trajectory (Smooth), running speed analysis adjustment (CheckVelocity), and even tool compensation (ToolCorrect) required for CNC machining trajectory control. Therefore, the preprocessing of trajectory control is generally based on the OutQueue format of the trajectory. The above-mentioned preprocessing has provided corresponding FB function blocks in the Smart Control system, which can be instantiated and called according to control needs.
2.2 G code compilation process:
Figure 12 G code compilation process in three formats
2.3 Other functions of G code:
M command (pause function):
Liancheng PLC supports the M auxiliary function of the G-Code program. During the interpolation operation, the operation of the interpolation trajectory can be suspended according to the M instruction, and the execution will continue only after receiving the corresponding confirmation signal.
H command (logic switch function):
The H auxiliary function that supports the G-Code program can output the specified logic control signal for logic control when passing the track point specified by the H instruction during the interpolation operation of the continuous track. The H instruction is different from the M instruction. When passing the monitoring point position, the logic signal is output, and there is no deceleration or pause of the track operation. With this function, the system can be informed that the track operation has reached a specific position, or it can be used to trigger the corresponding control logic, such as the control of the nozzle of the dispensing machine.
Smoothing and chamfering of tracks:
In practical applications, chamfering and rounding may be required at the turning points of the trajectory. The smooth path processing can be started using the G51/G52 command, and continuous interpolation can be achieved by changing the corner position to continuous.
Tool compensation processing of trajectory:
Users generally design the required workpiece shape or the pattern shape they want to process, but the equipment controls the motion trajectory of the processing tool. Processing tools generally have their own external dimensions, such as boring machines, milling machines, and grinding machines. Therefore, the movement trajectory of the processing tool needs to consider the tool size on the basis of the tool trajectory and reserve an offset for the tool radius, which is tool compensation. G41, G42, and G40 in the G-Code instruction set are tool radius left compensation, right compensation, and cancel radius compensation, respectively.
Figure 13 M function of G code
Figure 14 M function of G code
Figure 15 H function of G code
Figure 16 H function of G code
3. MC Interpolator
3.1 Interpolation technology
The contour control of the motion system is based on the known starting point coordinates, end point coordinates, curve type and direction of the motion trajectory, and the motion control system calculates the coordinates of each intermediate point in real time. The technology of inserting and supplementing the coordinates of the intermediate points is called interpolation technology. Interpolation technology is an algorithm in the motion controller. It is an algorithm for data density between a curve with a known starting point and end point. According to the mathematical model, it can be divided into first-order (straight line) interpolation, second-order (arc, parabola, circle, hyperbola, quadratic spline) interpolation and higher-order (spline) interpolation. According to the interpolation method, it can be divided into pulse incremental interpolation and digital incremental interpolation.
Pulse incremental interpolation is an interpolation method that controls the output rule of a single pulse. For each pulse output, the moving part moves a certain distance (called pulse equivalent). Therefore, it is also called stroke scalar interpolation. Commonly used methods include point-by-point comparison method and digital integration method.
Digital incremental interpolation is to calculate the increment and other data of each coordinate direction within a specified time (called interpolation time).
The system completes the travel given by the interpolation calculation within the next interpolation time. It is also called time scalar interpolation. The principle of linear interpolation is simple and the error is easy to control. Usually, the error is estimated approximately by the curvature arc to calculate the interpolation straight line segment parameter variables that meet the accuracy requirements. However, the approximation curve generated by linear interpolation is not first-order continuous. When high accuracy is expected, too many interpolation points are generated, which makes data storage and transmission difficult.
Circular interpolation can make up for the shortcomings of linear interpolation to a certain extent, and can generate a first-order geometrically continuous approximation curve with a small number of interpolation arc segments. However, the calculation of the interpolation arc control error is complicated, and it is difficult to analytically solve the distance between the target curve and the approximation curve. It is necessary to use numerical analysis methods to solve the interpolation arc parameters that meet the accuracy requirements. At present, interpolation is generally implemented by software. Commonly used interpolation is linear interpolation and circular interpolation. The linear interpolation algorithm is simple and the error is easy to control. The curvature arc approximation error method is usually used to calculate the interpolation line segment parameter variables that meet the accuracy requirements. However, the approximation curve generated by linear interpolation is discontinuous, and the number of interpolation points is large when the accuracy requirements are high. Therefore, the data storage and transmission burden is heavy. Circular interpolation can generate a first-order geometrically continuous approximation curve with a small number of interpolation arc segments, but the calculation of circular interpolation is complex.
3.2 MC Interpolator
Figure 17 MC Interpolator
MC Interpolator is the core interpolation function block in CNC trajectory control. It is powerful but easy to use. Compared with the interpolation principle of the previous pulse control method, the interpolation based on EtherCAT control method is much simpler, because the controller only needs to interpolate a finite number of discrete intermediate points in the specified trajectory curve, and use mathematical methods to calculate the coordinates (dx, dz) of these intermediate points, so that the synthetic trajectory can run at the set acceleration, deceleration, set speed, etc. The interpolator supports the analysis and execution of all G, M, and H instructions in the DIN66025 standard.
After the necessary coordinate transformation, the coordinates of these intermediate points are sent to the servos driving the X, Y, and Z axes in the form of position commands, so that the three axes move simultaneously. The composite trajectory of the motion of these three axes is the desired motion trajectory.
The left picture is a schematic diagram of CNC interpolation of a straight line segment. Because there are acceleration and deceleration processes in the trajectory movement of the line segment, the insertion spacing in the middle will have a situation where the acceleration time distance gradually increases and the deceleration time distance gradually decreases.
EtherCAT tasks are executed at a fixed cycle, such as the cycle is generally set to 1ms/4ms, etc. The interpolation cycle is the same as the EtherCAT cycle. After the interpolation operation starts, the MC_Interpolator function block is executed once each time the EtherCAT is interrupted. This function block calculates the distance that each axis needs to run in the next cycle according to the trajectory speed set by the user and the allowed acceleration and deceleration time within an EtherCAT cycle. With the G code coordinate system as a reference, the vertical coordinate system target absolute position coordinates (dx, dy, dz) are used as the position instructions for the servo operation. While interpolating, the corresponding positioning control processing is performed on auxiliary axes such as ABCPQUVW at the same time.
Figure 18 MC Interpolator
Figure 19 Line segment interpolation
The interpolation function block SMC_Interpolator calculates the position of a given path at a certain time interval and discretizes the path. The position of the Cartesian coordinate system is output through piSetPosition in pulse equivalents.
3.3 Linear interpolation algorithm
3.4 Circular interpolation algorithm
3.5 Spline interpolation
Commonly used spline curves are cubic B-spline curves and cubic non-uniform rational B-spline curves (NURBS curves). Spline curves are curves connected by polynomial curve segments. Each curve boundary meets specific continuity conditions, and its shape is determined by a set of control points.
Spline curves can accurately represent analytical curves and free curves. In CNC technology, high-precision CNC machining is required to process complex streamlined covers, such as aircraft wings and forming molds. The use of traditional surface CNC machining technology not only processes a large amount of data, but also has low machining efficiency. Therefore, in 1991, the International Organization for Standardization stipulated that the CNC system data standard should be used as the industrial product model data exchange standard, which became the only mathematical method to define the geometric shape of industrial products. According to the CNC system data standard ISO14649, spline curve interpolation is to directly use the processing information that conforms to the three-dimensional geometric model as the input of the CNC system, that is, to directly interpolate the parametric curve.
4 Main processes of CNC functions
4.1 Main Process of CNC Implementation
Figure 20 G code analysis
4.2 Path preprocessing function
Figure 21 Speed ​​preprocessing
Figure 22 Path preprocessing
Figure 23 Preprocessing
Figure 24 Spline curve path preprocessing
Figure 25 Tool pretreatment
Figure 26 Preprocessing function block
Figure 27 Management function block
Figure 28 Kinematic transformation
Figure 29 Supported kinematic models
5 Appendix
5.1 Kinematic model
Figure 30 Supported kinematic models
5.2 5-axis kinematic model
Figure 31 Five-axis kinematic model
5.3 Kinematic model and corresponding function blocks
Figure 32 Algorithm function blocks corresponding to the kinematic model
As mentioned above, G-Code describes spatial position and trajectory in a three-dimensional vertical coordinate system. The following figure is an interpolation execution program for a simple three-axis vertical coordinate system (also known as a gantry structure), given in CFC graphical language. The user's trajectory data has been compiled into the SMC OutQueue format. The most simplified interpolation control program is as follows: