1. Introduction
In 2020, China announced that it will strive to achieve carbon peak by 2030 and carbon neutrality by 2060, and for the first time to include carbon peak and carbon neutrality in the government work report [
1]. The impact of the machine tool construction, regarding raw materials and energy consumption, is understood to be relatively small, as it is amortized over numerous products during the long lifetime of the machine. The full LCA revealed the significant contribution of the machine-tool structure to the global lifecycle environmental impact of the machine (about 40%), while electricity during use phase contributes about 46% to the total impact [
2]. As the basic energy-consuming equipment of the manufacturing industry, CNC machine tools have the characteristics of large quantity and wide range, large total energy consumption, and low efficiency, etc., and have great energy-saving potential. Therefore, fast and accurate prediction of its machining energy consumption is an effective way to achieve optimal management of energy consumption and achieve carbon peak and carbon neutrality [
3]. However, CNC machine tools are a complex multi-source energy consumption system. Different machine tool losses, machining parameters, and workpiece materials, tools, etc. have varying degrees of impact on machining energy consumption [
4]. Therefore, how to accurately and efficiently predict the energy consumption of CNC machine tools has become a difficult hot spot within energy research [
5]. Sihag conducted a systematic literature review on machine tool energy consumption and a six-level hierarchical model was proposed for better understanding of machining energy classification [
6]. After analyzing the existing literature, the existing CNC machine tools energy consumption model research can be roughly classified into cutting force-based, electromechanical system-based, Therblig-based and data-driven-based.
The CNC machine tools energy consumption model based on cutting force is mainly based on the theoretical cutting force model proposed by MERCHANT [
7,
8]. These methods calculate the cutting power through the physical relationship between the cutting force and the chip speed, and calculate the energy consumption in combination with the cutting time [
9,
10], such as the specific energy method [
11,
12], the cutting force method [
13], and the exponential function method [
14]. This type of method only considers the cutting force parameters such as the rake angle of the tool and the amount of material removal. The theoretical calculation value and the actual machining energy consumption have a large deviation, and the application effect is not ideal [
15]. In order to improve its accuracy, Zhong introduced correction coefficients in the model, combined with the cutting force and real energy consumption under different processing parameters obtained by orthogonal experiments, and corrected the coefficients through data fitting methods [
16]; thereby, effectively reducing the error between the theoretical calculation value and the actual value. However, in the orthogonal experiment, only machining parameters such as spindle speed, feed rate, cutting width and depth are considered; other factors affecting machining energy consumption depend on the correction factor. At the same time, due to the relatively cumbersome calculation process, this method still has certain drawbacks in forecast accuracy and efficiency.
The CNC machine tool is a typical complex mechatronics product. Its energy consumption is essentially the process of converting the input electrical energy into kinetic energy, thermal energy and other forms of energy through various electromechanical equipment. Liu [
17,
18,
19], Hu [
20] and Shi [
21] performed in-depth research on no-load energy consumption, cutting energy consumption and additional load energy consumption from the perspective of the machine tool mechanical main drive system and motor energy consumption. In view of the characteristics of multiple energy sources of CNC machine tools, Wang comprehensively modeled the entire energy flow of the machine tool from the perspective of the system, and divided the energy sources of the CNC machine tools into four categories: machining power system, machining-related auxiliary system, power-related auxiliary system and others, and established the corresponding power balance equation [
22]. On this basis, Xie started from the energy consumption mechanism, and studied the predictable characteristics and prediction methods of energy consumption at various periods of the machine tool operation process [
23]. Based on this energy consumption calculation method, Hu considered the influence of a part feature processing sequence on energy consumption [
24]. He analyzed the relationship between CNC commands and the energy consumption of each part of the machine tool, and thus proposed a new energy consumption prediction method for CNC machine tool [
25]. This kind of method analyzes and calculates the energy consumption of various subsystems in different operating stages in detail. The accuracy of energy consumption prediction has been greatly improved, but the calculation process is complicated. At the same time, it is difficult to obtain the load loss coefficient in the model, and there are very few existing methods to obtain it. Therefore, there are certain limitations in the practical applications [
26].
With the deepening of research, in order to overcome the above shortcomings, Jia proposed an energy demand modeling methodology of machining processes based on Therbligs, which refer to the fundamental operations of the machine tools [
27]. The machining processes are divided into a series of activities, and Therblig, as one of the basic concepts of motion study, is introduced to represent the basic energy demand unit. On this basis, Lv developed Therblig power models for calculating the energy supply of computer numerical control (CNC) machine tools using machining process parameters [
28]. Then, a finite state machine (FSM)-based energy consumption modeling method of machining transient state was proposed by Jia [
29] as well as the Therblig-embedded value stream mapping method for lean energy machining [
30]. These methods provide more convenient new ideas for the research of machine tool energy consumption. However, because the method is based on the micro motions in the machine tool, it is still slightly complicated in the specific operation process.
With the development of machine learning and deep learning technology, the energy consumption model based on a data-driven approach has attracted the attention of scholars. Xie used a back propagation neural network (BPNN) and takes cutting speed, feed rate, and depth of cut as input parameters to construct a numerical control machine tool energy consumption prediction model, which simplifies the cumbersome calculation process of empirical formulas and achieves better prediction results [
31]; Chen considered cutting speed, feed and depth of cut and other parameters, and constructed a support vector machine-based cutting energy prediction model for CNC machine tools [
32]. He proposed a data-driven energy prediction approach using deep learning algorithms [
33]. This method is simple and efficient, and has achieved good prediction accuracy. However, due to the few considerations of processing process parameters, it is only effective for simple processing of specific types of workpieces, and the generality and refinement of the model need to be improved. Shin proposes a predictive modeling approach based on historical data collected from machine tool operations [
34].
In summary, the current energy consumption prediction of CNC machine tools has mainly the following problems. First, the calculation process of energy consumption based on cutting force or electromechanical system is complicated, and the cutting force and correlation coefficient are difficult to accurately obtain. Second, the load loss of different machine tools is different, it is difficult to obtain the load loss coefficient, and it is difficult to establish a general energy consumption calculation model. Third, the data-driven energy consumption prediction method could solve the above two problems well, but the current research is insufficient and it is difficult to adapt to the wide range of production needs. In response to the above problems, a novel CNC milling energy consumption prediction method based on program parsing and parallel neural network is proposed. First of all, the tool path, processing parameters and other machine energy consumption parameters are automatically extracted from the processing program through the constructed CNC program parser. Then the parameters are classified based on energy consumption characteristics of CNC machine tools. For each type of parameter, the corresponding neural network is used to predict its machining energy consumption. The sum of the parallel operation results of multiple neural networks is the total machining energy consumption. This method directly establishes the mapping relationship between the CNC program and the energy consumption of the CNC machine tool, and comprehensively considers the factors affecting the energy consumption of the CNC machine tool. Moreover, the prediction accuracy and efficiency can be effectively improved by parallel neural networks. Based on the proposed method, the energy consumption prediction of CNC machine tools can be realized more efficiently and accurately, which lays the foundation for efficient and low-consumption process planning and energy efficiency improvement of machine tools.
The remainder of this paper is organized as follows. The energy consumption characteristics of CNC machine tools are analyzed in
Section 2.
Section 3 presents the general framework of the proposed model, and provides an introduction to the CNC program parser and parallel neural network used for the energy prediction model. Case verification and comparative analysis of results are given in
Section 4. Finally, conclusions are drawn in
Section 5.
2. Analysis of Energy Consumption Characteristics of CNC Machine Tool Machining
CNC machine tools processing common features such as planes, grooves, and holes, etc., mainly include states such as start-up, standby, spindle start and stop, rapid feed, linear interpolation, tool change, and drilling. As shown in
Figure 1, the left side is a simplified diagram of the power change curve under different processing conditions. The horizontal axis is power (P), the vertical axis is time (T), and on the right is the CNC programs corresponding to each machining stage.
It can be seen from
Figure 1 that the power of the machine tool is different under different CNC instructions. When the instruction changes, its power will suddenly change in a short time and quickly stabilize until the command is executed. In stages ① and ⑮, the machine tool is in a stopped state, and the power at this stage is 0. During phase ② and ⑭, the machine tool starts to enter the standby state; at this time, only the control system, display system and other machine tool auxiliary systems are running. After executing the instruction M03, the spindle rotates forward and enters phase ③; phases ④, ⑥, ⑫, ⑧, ⑩, and ⑬ are all rapid traverse movements of the tool after G00 instruction is executed, and their movement speeds are set by the machine tool by default. However, due to the different starting and ending points, the number of servo motors involved in the work in the
X,
Y, and
Z directions of the machine tool is different, which ultimately leads to different powers at each stage. During ④, ⑥, and ⑫ stages only the
Z coordinate changes, and the
X and
Y coordinates remain unchanged. Therefore, only the
Z-axis servo motor participates in the work, and the
X and
Y-axis servo motors do not participate in the work. However, in the stages ⑧, ⑩, and ⑬, the coordinates in the three directions of
X,
Y, and
Z have changed. The servo motors in the three directions of the process participate in the work, so the power is higher. Stages ⑤, ⑦, and ⑪ are all linear interpolation movements of the tool after executing the G01 command. At this stage, the tool contacts the workpiece and starts cutting. Due to the cutting depth of stage ⑦ being deeper than the cutting depth of stage ⑤, stage ⑦ is more powerful than stage ⑤. Stage ⑪ is milling only in
Z direction, and the feed rate is reduced, so the power of stage ⑪ is different from stages ⑤ and ⑦. In stage ⑨, the tool is changed after executing the tool change command.
Through the above analysis and literature [
35,
36] research, it can be seen that CNC instructions determine the motion mode of CNC machine tools. CNC machine tools have different energy consumption characteristics under different CNC instructions (such as G00 and G01, etc.). The energy consumption of CNC machine tools under the same CNC instruction and different processing parameters is also different, but they have similar energy consumption characteristics. Therefore, the mapping relationship between the machining process parameters and the energy consumption of the CNC machine tool under each CNC command can be established, so as to predict the energy consumption of the workpiece machining. The corresponding relationship between commonly used CNC instructions and energy consumption parameters is shown in
Table 1. The row is all the energy consumption parameters, and the column is the commonly used CNC instructions. “●” indicates that the row of commands is related to the energy consumption parameters in corresponding column.
In the process of general parts processing, the machine tool is in one of four states: standby, tool change (T), rapid positioning (G00), and linear interpolation (G01). Among them, the power of the machine in the standby state is a constant value, and its energy consumption is only related to the standby time. The tool change process is divided into two steps: rapid positioning to the tool change point (G00) and tool change. Therefore, the energy consumption of this process is mainly related to the current tool number and the end tool number. The energy consumption of linear interpolation is the most complicated in the whole machining process. It mainly includes cutting energy consumption and auxiliary energy consumption. Cutting energy consumption mainly includes spindle speed, tool material, tool diameter, number of cutting edges, back-cutting amount, side-cutting amount, feed speed, workpiece material and other process parameters. Therefore, the energy consumption
in the entire part processing process can be expressed as:
where
is the energy consumption under the
-th type of CNC instruction,
is the type of CNC instruction in the machining program,
is the
-th processing parameter when the
-th type of instruction appears for the
-th time,
,
,
are the processing parameters of the
-th instruction,
is the number of occurrences of the
-th instruction,
is the difference between the energy consumption of the CNC machine tool and the processing technological parameters under the
-th instruction mapping relations.
3. Energy Consumption Prediction Model of CNC Machine Tool
3.1. Process of Energy Consumption Prediction
The energy consumption prediction process of CNC machine tools based on program decomposition and multiple neural networks is shown in
Figure 2, which mainly includes the following three steps. First, combining the numerical control processing knowledge base and the machine tool knowledge base to analyze the numerical control program, obtain the kth group of processing technology parameter set corresponding to the
-th type numerical control instruction
. Second, for each group of processing process parameters, the energy consumption
is predicted through the corresponding neural network, and sum the energy consumption values of group
in the
-th type of CNC instructions to obtain the energy consumption
corresponding to each type of numerical control instruction. In order to improve the efficiency of prediction, the process uses multiple neural networks to calculate in parallel. Finally, sum the energy consumption of N types of CNC instructions
, which is the predicted value of total energy consumption
for CNC machine tool processing. Among them, CNC program analysis and multi-neural network parallel calculation are the key to the energy consumption prediction method of numerical control machine tools.
3.2. Parsing Method of CNC Program
The CNC program is a structured text document, which mainly includes three parts: the program number, the program content and the end of the program. The program content is the core of the entire CNC program, and it is also the content that this article needs to analyze. Each line of the program content is a block, and each block is composed of one or more instruction words. The general format is “block number CNC instruction coordinates other parameters”. Each instruction word is separated by a space, which is easy to parse. The pseudo code of the CNC parsing program is shown in Algorithm 1.
Algorithm 1. CNC program parsing pseudo code. |
Input: CNC programProcess knowledge set , Machine tool knowledge set Output: parameter value matrix of classified CNC instruction |
1. Initialize the CNC instruction set , CNC instruction parameter set , machine tool status parameter set , flag set
2. read first line
3. while (‘M30’ not in Row)
4. cnc = obtain the instruction in Row
5. n = find(CNC==cnc)
6. params = P(n)
7. for a = 1:size(params)
8. pv = calculate the value of params(a) according
9. PV(n,a,K(n)) = pv
10. end for
11. update
12. K(n) = K(n) + 1
13. Row = read next line
14. end while |
The input of Algorithm 1 is the numerical control program, the machining process knowledge collection and the numerical control machine tool knowledge collection , among which the numerical control program is the algorithm analysis object. includes machining process knowledge such as machine preparation time, workpiece material and size, CNC machining workpiece coordinate system, etc. This knowledge can be obtained directly from the part processing process card and stored in the form of key-value pairs, which is convenient for program reading; also stores basic information such as the rated power of the machine tool and the torque, power, and speed of the servo motor in the form of key-value pairs. The algorithm output is the parameter matrix corresponding to various CNC commands.
3.3. Improved BPNN
BPNN is a parallel information processing method that can calculate complex nonlinear relationships by learning models and using experimental data. It has been widely used in prediction, data classification, feature recognition and nonlinear function approximation [
37]. The training process of BPNN is shown in
Figure 3.
Step1: Network initialization. According to the system input and output , determine the number of input layer nodes, the number of hidden layer nodes, and the number of output layer nodes, and initialize the connection weights between the input layer, hidden layer and output layer neurons, initialize hidden layer threshold , output layer threshold , given learning rate and neuron activation function.
Step2: Hidden layer output calculation. The hidden layer output
is calculated according to the input vector
, the connection weight
between the input layer and the hidden layer, and the hidden layer threshold
.
In the formula,
is the number of hidden layer nodes;
is the hidden layer activation function, which has many expressions. The selected function as follows:
Step3: Calculation of the output layer. According to the hidden layer output
, the weight
and the threshold
, the BPNN predictive output
is calculated as follows.
Step4: Error calculation. According to the predicted output of the network and the expected output , the network predicted error is calculated.
Step5: Weight update. The network connection weights
are updated according to the network prediction error
.
In the formula, is the learning rate.
Step6: Update the threshold. Update the network node thresholds
according to the network prediction error
.
Step7: Judge whether the algorithm iteration is over, if it is not over, go back to step 2.
In order to improve the training efficiency and prediction accuracy of neural network, it is optimized through additional momentum method and adaptive learning rate.
- (1)
Additional momentum method
BPNN uses a gradient correction method as the update strategy of weights and thresholds. The weights and thresholds are corrected from the negative gradient direction of the network prediction error. The accumulation of previous experience is not considered, and the learning process converges slowly. In response to this problem, the additional momentum method is used to optimize it, and the weight learning formula with additional momentum is as follows.
In the formula, are the weights at , respectively; is the momentum learning rate.
- (2)
Adaptive learning rate
The value of BPNN learning rate
is between
, the larger the learning rate
, the greater the modification of the weights, and the faster the network learning speed. However, a too large learning rate
will cause oscillations in the weight learning process, and a too small learning rate will cause the network to converge too slowly, and the weights will be difficult to stabilize. The adaptive learning rate method means that the learning probability
is relatively large in the early stage of BPNN evolution, and the network converges quickly. As the learning process progresses, the learning rate continues to decrease, and the network tends to stabilize. The formula for calculating the adaptive learning rate is as follows.
In the formula, is the maximum learning rate; is the minimum learning rate; is the maximum number of iterations; is the current number of iterations.
3.4. Energy Consumption Prediction Model of CNC Machine Tools Based on IPBPNN
It can be seen from
Table 1 that the process parameters corresponding to different numerical control instructions are quite different. If energy consumption is predicted for all numerical control instructions through a large neural network, the neural network input layer is all the process parameters in
Table 1, and the input matrix is a relatively large one. A large sparse matrix is not conducive to network training and prediction accuracy. Therefore, a small neural network is constructed for each type of CNC instruction. The input layer of each neural network is the process parameter corresponding to the type of CNC instruction. The containing layer is determined by empirical formula (12) [
38].
In the formula,
is the number of input layer nodes,
is the number of hidden layer nodes,
is the number of output layer nodes, and
is constant between 0 and 10. In this article, the selection of the number of hidden layer nodes first refers to the formula to determine the approximate range of the number of nodes, and then cross-validation is used to determine the optimal number of nodes in the hidden layer. The energy consumption prediction model of CNC machine tools based on improved parallel
BPNN (
IPBPNN) is shown in
Figure 4, where the input matrix
is the output of Algorithm 1.
5. Conclusions
In this paper, a novel CNC milling energy consumption prediction method based on program decomposition and IPBPNN is presented. The effectiveness and superiority of this method have been verified by experiments. First of all, the extraction and classification of the instructions and parameters of the CNC program are effectively completed through the proposed automatic parsing algorithm. Then, based on the parallel neural network, the mapping relationship between the CNC command parameters and energy consumption was established, and the hyperparameters and parameters of each neural network were determined through cross-validation.
Compared with the method in the literature, the efficiency is improved by nearly 50%. Moreover, the proposed method can refine the energy consumption prediction to each line of the CNC program. The experimental results show that the prediction error of energy consumption per line of instruction is within 5%, and the prediction error of total program energy consumption is 0.85%. The efficiency and high precision of the proposed method have been proven. During the industrial application, the methodology proposed in this paper provides help for the energy consumption prediction of CNC milling, and can provide support for the optimization of CNC machining tool trajectory and CNC program optimization for high-efficiency and low-consumption. It is also conducive to the sustainable development of the environment.
However, there are still some limitations in our research. First, the process of obtaining processing data for training neural networks through experiments is cumbersome, and automatic acquisition methods need to be studied. Then, at present, only common instructions such as T, G00 and G01 have been studied, and there are more complex instructions that need to be studied in depth, such as G02, G03, G71 and other instructions.