When performing machine measurements using CNC machine tools, the measurement can be completed using the machine tool body and the probe. Digital signal processors (DSPs) can establish complex algorithms through hardware to perform calculations. Because they integrate a variety of peripherals on-chip, they have efficient control and calculation capabilities, meeting the application requirements of high-efficiency processing and high precision. Some researchers have also added complex algorithms to DSPs to achieve real-time testing of physical quantities and compensation for error parameters.
Research in this area has attracted many scholars. Liu Kuo et al. established a time-varying error prediction model for the feed axis based on the mechanism-driven principle, finding that it could accurately predict the lead screw temperature under different motion states, achieving ideal temperature prediction performance and significantly improving the machining dimensional accuracy of the machine tool. Wang Yong et al. conducted experimental research on the QMB125 CNC grinding machine, then constructed a low-order volume array to describe the topology, tested the sampling results of geometric error sources during the grinding machine's operation, and constructed a dynamic model for the machine tool's motion system, significantly improving the machine tool's accuracy. Wang Wu et al. established a double-closed-loop control model for the AC synchronous servo motor using a vector motor, designed the motor model and the electromechanical coupling model of the gear and rack according to a series structure, and verified that the gear and rack error is one of the most critical error sources in the feed system.
This paper develops a method to optimize a backpropagation (BP) network using a genetic algorithm (GA), and uses a DSP hardware system to accurately predict errors and set compensation measures.
1. Positioning Error System Design
1.1 System Hardware Design
The CNC machine tool testing system comprises two parts: the CNC machine tool body and the testing sensors. The errors in these two structures significantly affect the system's testing accuracy. Considering that the positioning error of the XY system platform is a critical factor affecting the machine tool's error, and is also closely related to the coordinates and speed of the actual motion process, resulting in complex variations, the 2835DSP was selected. This 32-bit microcontroller, composed of high-performance integrated peripherals, has a main frequency of 150 MHz and can meet the requirements of real-time control.
The positioning error prediction and compensation system established in this study comprises three parts: the CNC system feed axis feedback structure, the DSP modeling and prediction system, and the CNC system itself, as shown in Figure 1. Positioning error prediction and compensation are performed using a feedback interruption method. The compensation method involves embedding the DSP module's prediction error into the servo system's grating position feedback loop. The DSP establishes communication with the machine tool's CNC system, collects position parameters and speed signals, and inputs them into the DSP positioning error prediction model. The predicted positioning error is then converted into a compensation pulse signal, which is added to the servo feedback loop to achieve the compensation effect.
1.2 System Software Design
First, a GA-BP model is constructed using Matlab software. After obtaining the optimized weights and thresholds, the results are then ported to a DSP for modeling and prediction, thereby significantly improving the prediction speed.
This paper designs a three-layer BP network, training the hidden and output layers 2000 times each, controlling the learning rate at 0.1 and setting the training target at 0.001. The GA algorithm is used to optimize the weights and thresholds of the BP network's localization error prediction model. The GA algorithm parameters are set as follows: genetic generation number 50, population size 80, mutation probability 0.05, and crossover probability 0.8. A GA-BP simulation model is then constructed using Matlab based on these parameters.
In Matlab software, a GA-BP model is constructed and then trained to obtain the optimal weights and thresholds. Then, a simulation model for the DSP is established according to the process shown in Figure 2.
The first step is to normalize the calculation to obtain the initial data; then, the GA-BP model is constructed through the expression, and the initial parameters are substituted into the model to carry out prediction; finally, the prediction results are inversely normalized and the results are output.
Comparing the time required for error prediction using the optimized weights and the GA-BP network established by the DSP software, the time required for prediction of each error is 251us. The prediction system set up by the DSP takes 29.5us to predict each error and 915us to complete all error predictions. Although MATLAB can obtain prediction results in a shorter time than DSP, considering that MATLAB is only suitable for simulation calculations on a computer, a complex compensation structure needs to be set up later.
This paper presents the design and analysis of a DSP positioning error system for a CNC machine tool worktable, yielding the following beneficial results:
1) The positioning error model prediction and compensation system established in this study includes the CNC system feed axis feedback structure, DSP modeling and prediction system, and CNC system.
2) Error prediction using the GA-BP network established with optimized weights and thresholds obtained through Matlab software takes 251µs. The model built using the GA-BP network achieves higher accuracy in prediction.