The application of multi axis CNC system in surface machining
This article derives the translation matrix and rotation matrix in the form of homogeneous coordinates, and mathematically models the position and attitude changes at any joint of a multi axis linkage system. A feedback form RTPA algorithm was constructed based on comparator components, counter components, and generator components for practical control in multi axis linkage CNC system machining processes, and the influence of sampling frequency was analyzed. Finally, taking surface simulation machining as an example for experimental research, the results show that under the control of the RTPA algorithm, the multi axis linkage CNC system can effectively complete surface machining.
Keywords: Multi axis linkage; CNC system; Surface machining; RTPA algorithm
The level of integration and automation in the manufacturing industry has become an important criterion for measuring a country's scientific and technological strength. China is a major manufacturing country, covering the vast majority of mechanical processing categories in the world [1], in which CNC technology and CNC systems play a very important role. For various complex types of machining tasks, only CNC machining techniques and methods with more axis linkage can be completed more efficiently. Therefore, the design of multi axis linkage CNC systems and the multi axis linkage CNC machining methods have become the core content for judging the competitiveness of the mechanical processing and manufacturing industry [3]. At present, there is a certain gap between China and the world's advanced level in the development of 5-axis and above linkage CNC systems and CNC machining methods, which has become a bottleneck problem that restricts the deep development of China's mechanical processing industry. Therefore, this article takes a 5-axis linkage CNC system as the research object, and through mathematical model analysis and control process research, provides its specific application in surface machining.
1. A mathematical model for the pose of multi axis CNC systems
The key to the control function and machining effect of a multi axis linkage CNC system lies in the accurate characterization of position and posture, as well as reasonable dynamic connection. Therefore, this article first mathematically models the position and attitude of a multi axis linkage CNC system in the form of homogeneous coordinates.
The completion of a series of actions in a multi axis linkage CNC machining system is manifested as the cumulative effect of rotational and translational movements of various joints and axes in three-dimensional space. Therefore, to describe a multi axis linkage CNC system from a mathematical perspective, it depends on the characterization of the rotation matrix and translation matrix.
If any point A in space is transformed into the position of point A 'through translation, and it is translated a, b, and c units on the x, y, and z coordinate axes, then there exists a translation relationship as shown in formula (1).

If any point A in space is transformed into the position of point A 'through rotation, and its angle of rotation around z is θ, So there exists a rotation relationship as shown in formula (2).

Similarly, the rotation matrices around the y-axis and x-axis at any point can also be obtained, as well as the homogeneous expressions of these two matrices. By further promoting this approach, a rotation matrix can be obtained for any point around any axis in space, which will also be manifested as a combination of rotational motion around the x, y, and z axes. By obtaining the translation matrix and rotation matrix of the position change at any point in space, a mathematical model of the position change at that point can be established. This approach also applies to any coordinate system in space and any object in space. The multi axis linkage CNC machining process is the combination effect of multiple translational movements and rotational movements around multiple axes at the operating end that undertakes the machining task.
Assuming the position transformation of the end effector of a multi axis linkage system is shown in Figure 1. As shown in Figure 1, the end effector of the multi axis linkage system underwent two transformations, one of which was a translation motion along the x and y axes, and the other was a 90 ° rotation around the z axis.

Figure 1 Position transformation of the end effector of a multi axis linkage system
It can be seen that with the above modeling method, a combination of translational and rotational motion can be described for any joint and action in a multi axis linkage system.
2. Process Control of Multi axis CNC System
After being able to describe a multi axis linkage CNC system through mathematical models, the difficulty of the entire CNC process is how to set up the CNC program and enable the system to complete machining tasks according to the established route. This article designs a pulse control algorithm with good real-time performance for the machining process of multi axis linkage CNC systems, abbreviated as RTPA (Real time pulse algorithm) algorithm.
The process of CNC machining is generally achieved and completed through interpolation algorithms, and the control of each axis in CNC machining is based on the pulse of the stepper motor, which requires the formation of a corresponding relationship between the interpolation process and the pulse generation timing. However, the real-time performance of traditional interpolation processes based on pulse frequency is not ideal. Therefore, this article designs a new pulse generation algorithm with better real-time performance from the perspective of V-F transformation algorithm (voltage frequency). The pulse sequence generated by this algorithm can achieve more effective control of multi axis linkage CNC systems.
This algorithm uses comparator components, counter components, and generator components to jointly generate pulse sequences with good real-time performance. The schematic diagram of the algorithm is shown in Figure 2.

Figure 2 Principle Block Diagram of RTPA Control Algorithm for Multi axis Linkage System
According to Figure 2, it can be seen that the displacement of a joint or end device in a multi axis linkage system is sampled and used as input for the RTPA algorithm, with a sampling frequency of f. After inputting the sampled displacement value, it is compared with the pulse equivalent formed by the pulse counter on the feedback branch, and the difference between the two is entered into the pulse generator as the judgment basis for the generation of the pulse sequence. The pulse generator will generate two outputs, namely forward pulse and reverse pulse, which also correspond to the forward and reverse rotation of the stepper motor.
The determination of whether a pulse generator generates forward or reverse pulses depends on the comparison between the accumulated error between the input and feedback branches and the set threshold value. The comparison rules are as follows. Rule 1: If the sum of accumulated errors between the input and feedback branches is greater than the set threshold value, the pulse generator generates a forward pulse and outputs it. Rule 2: If the sum of accumulated errors between the input and feedback branches is less than the opposite of the set threshold value, the pulse generator generates a reverse pulse and outputs it.
The key parameter that determines the algorithm in this article is the sampling frequency f before using displacement as input. In order to determine the impact of sampling frequency f on the performance of the RTPA algorithm, this article sets the sampling frequencies to 5 kHz and 20 kHz respectively, and plots their displacement response curves and velocity response curves. The results are shown in Figure 3.

Figure 3 Impact of sampling frequency on the algorithm performance of multi axis linkage system
The left side of Figure 3 (a) represents the displacement response curve of the RTPA algorithm at a sampling frequency of 5kHz, while the right side represents the displacement response curve of the RTPA algorithm at a sampling frequency of 20kHz; The left side of Figure 3 (b) represents the speed response curve of the RTPA algorithm at a sampling frequency of 20kHz, while the right side represents the speed response curve of the RTPA algorithm at a sampling frequency of 20kHz.
From Figure 3 (a), it can be seen that the larger the sampling frequency and the smaller the sampling period, the faster the displacement response speed of the RTPA algorithm. From the comparison of the left and right figures, it can be seen that when the sampling frequency is 5kHz, the displacement response of the RTPA algorithm takes 0.58s, and the actual displacement of the multi axis linkage system can only match the ideal displacement; When the sampling frequency is 20kHz, the displacement response of the RTPA algorithm is 0.16s, and the actual displacement of the multi axis linkage system matches the ideal displacement. This indicates that the displacement response at a sampling frequency of 20kHz is 0.42s faster than that at a sampling frequency of 5kHz.
From Figure 3 (b), it can be seen that the larger the sampling frequency and the smaller the sampling period, the faster the speed curve response of the RTPA algorithm. From the comparison of the left and right graphs, it can be seen that when the sampling frequency is 5 kHz, the speed response of the RTPA algorithm takes 0.5 seconds for the actual speed of the multi axis linkage system to match the ideal speed; When the sampling frequency is 20 kHz, the speed response of the RTPA algorithm is 0.13 seconds, and the actual speed of the multi axis linkage system matches the ideal speed. This indicates that the speed response at a sampling frequency of 20 kHz is 0.37 seconds faster than that at a sampling frequency of 5 kHz.
3. Simulation experiment of surface machining in multi axis CNC system
In the previous work, position and attitude modeling and RTPA control algorithm design were respectively carried out for the multi axis linkage CNC system, and the effective control strategy of the multi axis linkage CNC system was determined through the analysis of the influence of key parameters. Next, simulation experiments will be conducted to verify the RTPA algorithm control performance of the multi axis linkage system proposed in this paper. The simulation experiment selects surface machining as the machining object of the multi axis linkage CNC system. Curved surfaces have a certain degree of complexity in various machining units and require precise control algorithms. The machining of the entire surface is completed through continuous curve machining trajectories. The simulation results of the surface to be processed in this article are shown in Figure 4.

Figure 4 Simulation results of the surface to be machined in this article
From Figure 4, it can be seen that the surface to be processed in this article is a segment of surface that forms an axial width in the x-direction and a radial width in the y-direction, with the curvature radius of the surface located in the z-axis direction. Figure 4 also shows the initial position of the tool, which is the starting point, and the parallel curve on the surface indicates the machining trajectory under the control of the RTPA algorithm.
There are many CNC machining methods for surfaces, such as trajectory based parameter generation machining route method, CC path based cross-sectional data machining route method, and path based cross-sectional machining route method. This article chooses the section data processing route method based on CC path, and combines it with Z-shaped cutting to complete the processing. During the machining process, the control effect of the displacement and velocity curves obtained by the RTPA algorithm in the x-axis, y-axis, and z-axis directions is shown in Figure 5.

Figure 5 Control effect of RTPA algorithm on displacement and velocity curves in three directions
From Figure 5 (a), it can be seen that the RTPA algorithm forms a triangular wave curve for controlling displacement in the x-axis direction. Due to the limitations of processing tasks, the maximum displacement of the RTPA algorithm in the x-axis direction is 0 mm, and the minimum value is close to -150 mm. The triangular wave period of the displacement curve is 4.17 seconds. The RTPA algorithm forms a rectangular square wave curve for speed control in the x-axis direction, but there is some jitter due to the influence of the machining process. The maximum velocity of the RTPA algorithm in the x-axis direction is close to 80 mm/s, and the minimum value is close to -80 mm/s. The rectangular square wave period of the velocity curve is 4.17 seconds. From Figure 5 (b), it can be seen that the RTPA algorithm forms a curved form of step waves in controlling displacement in the y-axis direction. Due to the limitations of processing tasks, the maximum displacement of the RTPA algorithm in the y-axis direction is 0 mm, and the minimum value is close to the position of -6 mm. The step wave period of the displacement curve is 4.17 seconds. The RTPA algorithm controls velocity in the y-axis direction in the form of pulse waves. The maximum velocity of the RTPA algorithm in the y-axis direction is 0 mm/s, and the minimum value is -10 mm/s. The rectangular square wave period of the velocity curve is 4.17 seconds.
From Figure 5 (c), it can be seen that the RTPA algorithm forms a sinusoidal half wave curve for displacement control in the z-axis direction. Due to the limitations of processing tasks, the RTPA algorithm has a maximum displacement of 6.2 mm and a minimum displacement of 0 mm in the z-axis direction. The sine half wave period of the displacement curve is 2.08 seconds. The RTPA algorithm forms a sawtooth wave curve for controlling velocity in the z-axis direction. The maximum velocity of the RTPA algorithm in the z-axis direction is close to 15 mm/s, and the minimum value is close to -15 mm/s. The sawtooth wave period of the velocity curve is 2.08 seconds.
4. Conclusion
This article investigates a multi axis linkage CNC system. Firstly, in the form of homogeneous coordinates, mathematical modeling is performed on the position and attitude changes at any joint of a multi axis linkage system, and the generation process of translation matrix and rotation matrix is derived. Secondly, a feedback form RTPA algorithm was constructed based on comparator components, counter components, and generator components for practical control in multi axis linkage CNC system machining processes, and the influence of sampling frequency was analyzed. Finally, a validation experiment was conducted using surface simulation machining as an example, and the experimental results showed that the section data machining route method based on CC path adopted in this paper, combined with Z-shaped tool walking, can successfully complete the machining. Meanwhile, the RTPA algorithm effectively controls displacement and velocity in all three coordinate axis directions.

