# A Novel CNC Milling Energy Consumption Prediction Method Based on Program Parsing and Parallel Neural Network

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Analysis of Energy Consumption Characteristics of CNC Machine Tool Machining

## 3. Energy Consumption Prediction Model of CNC Machine Tool

#### 3.1. Process of Energy Consumption Prediction

#### 3.2. Parsing Method of CNC Program

Algorithm 1. CNC program parsing pseudo code. |

Input: CNC programProcess knowledge set $PK$, Machine tool knowledge set $MK$Output: parameter value matrix of classified CNC instruction $P{V}_{i{J}_{i}{K}_{i}}$ |

1. Initialize the CNC instruction set $CN{C}_{1\times N}$, CNC instruction parameter set ${P}_{N\times {J}_{max}}$, machine tool status parameter set $S{T}_{1\times M}$, flag set ${K}_{1\times N}=ones\left(1,N\right)$ 2. $Row=$ 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 $ST,PK\text{}\mathrm{and}\text{}MK$ 9. PV(n,a,K(n)) = pv 10. end for 11. update $ST$ 12. K(n) = K(n) + 1 13. Row = read next line 14. end while |

#### 3.3. Improved BPNN

- (1)
- Additional momentum method

- (2)
- Adaptive learning rate

#### 3.4. Energy Consumption Prediction Model of CNC Machine Tools Based on IPBPNN

## 4. Results

#### 4.1. Experimental Design and Data Acquisition

#### 4.2. IPBPNN Training and Testing

#### 4.3. Prediction and Analysis of Sample Energy Consumption

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Conflicts of Interest

## References

- Jia, Z.; Lin, B. How to achieve the first step of the carbon-neutrality 2060 target in China: The coal substitution perspective. Energy
**2021**, 233, 121179. [Google Scholar] [CrossRef] - Santos, J.P.; Oliveira, M.; Almeida, F.G.; Pereira, J.P.; Reis, A. Improving the environmental performance of machine-tools: Influence of technology and throughput on the electrical energy consumption of a press-brake. J. Clean. Prod.
**2011**, 19, 356–364. [Google Scholar] [CrossRef] - Zhao, L.; Fang, Y.; Lou, P.; Yan, J.; Xiao, A. Cutting Parameter Optimization for Reducing Carbon Emissions Using Digital Twin. Int. J. Precis. Eng. Manuf.
**2021**, 22, 933–949. [Google Scholar] [CrossRef] - Liu, G.; Liu, F.; Liu, P.; Wu, P. On-line detection method and detection system for multi-source energy consumption status of machine tools. Comput. Integr. Manuf. Syst.
**2016**, 22, 1150–1157. [Google Scholar] [CrossRef] - Li, B.; Tian, X.; Zhang, M. Modeling and Multi-objective Optimization Method of Machine Tool Energy Consumption Considering Tool Wear. Int. J. Precis. Eng. Manuf. Technol.
**2021**, 1–15. [Google Scholar] [CrossRef] - Sihag, N.; Sangwan, K.S. A systematic literature review on machine tool energy consumption. J. Clean. Prod.
**2020**, 275, 123125. [Google Scholar] [CrossRef] - Merchant, M.E. Mechanics of the Metal Cutting Process. I. Orthogonal Cutting and a Type 2 Chip. J. Appl. Phys.
**1945**, 16, 267–275. [Google Scholar] [CrossRef] - Ertnst, H.; Merchant, M. Chip formation, friction and high quality machined surfaces. Trans. Am. Soc. Met.
**1941**, 29, 299–378. [Google Scholar] - Zhao, G.; Zhao, Y.; Meng, F.; Guo, Q.; Zheng, G. Prediction model of machine tool energy consumption in hard-to-process materials turning. Int. J. Adv. Manuf. Technol.
**2020**, 106, 4499–4508. [Google Scholar] [CrossRef] - Li, T.; Kong, L.; Zhang, H. Research status and development trend of energy consumption models for typical cutting machine tools. J. Mech. Eng.
**2014**, 50, 102–111. [Google Scholar] [CrossRef] - Sealy, M.; Liu, Z.; Zhang, D.; Guo, Y. Energy consumption and modeling in precision hard milling. J. Clean. Prod.
**2016**, 135, 1591–1601. [Google Scholar] [CrossRef] - Proteau, A.; Tahan, A.; Thomas, M. Specific cutting energy: A physical measurement for representing tool wear. Int. J. Adv. Manuf. Technol.
**2019**, 103, 101–110. [Google Scholar] [CrossRef] - Zhou, X.; Liu, F.; Cai, W. An energy-consumption model for establishing energy-consumption allowance of a workpiece in a machining system. J. Clean. Prod.
**2016**, 135, 1580–1590. [Google Scholar] [CrossRef] - Lv, J.; Tang, R.; Tang, W.; Jia, S.; Liu, Y.; Cao, Y. An investigation into methods for predicting material removal energy consumption in turning. J. Clean. Prod.
**2018**, 193, 128–139. [Google Scholar] [CrossRef] [Green Version] - Sun, X.; Zhang, T.; Liu, P.; Li, G. Research review of energy consumption modeling and optimization in milling. J. Tianjin Vocat. Tech. Norm. Univ.
**2017**, 27, 38–42. [Google Scholar] [CrossRef] - Zhong, Q.; Tang, R.; Peng, T. Decision rules for energy consumption minimization during material removal process in turning. J. Clean. Prod.
**2017**, 140, 1819–1827. [Google Scholar] [CrossRef] - Liu, F.; Liu, S. Time-period energy model of electromechanical main drive system of machine tool in service. J. Mech. Eng.
**2012**, 48, 132–140. [Google Scholar] [CrossRef] - Liu, S.; Liu, F.; Wang, Q. Energy efficiency acquisition method of machine tool electromechanical main drive system in service process. Chin. J. Mech. Eng.
**2012**, 48, 111–117. [Google Scholar] [CrossRef] - Liu, F.; Xu, Z.; Dan, B. Mechanical Processing System Energy Characteristics and Its Application; Mechanical Industry Press: Beijing, China, 1995. [Google Scholar]
- Hu, S.; Liu, F.; He, Y.; Hu, T. Research on the no-load energy parameter characteristics of the frequency conversion main drive system of CNC machine tools. Comput. Integr. Manuf. Syst.
**2012**, 18, 326–331. [Google Scholar] [CrossRef] - Shi, J.; Liu, F.; Xu, D.; Xie, D. The power balance equation of the main drive system of the frequency conversion and speed regulation CNC machine tool. Chin. J. Mech. Eng.
**2010**, 46, 118–124. [Google Scholar] [CrossRef] - Wang, Q.; Liu, F. System mathematical model of multi-source energy flow of CNC machine tools. J. Mech. Eng.
**2013**, 49, 5–12. [Google Scholar] [CrossRef] - Xie, J.; Liu, F.; Cai, W. Research on predictable characteristics and prediction methods of energy efficiency of machine tools in service. J. Mech. Eng.
**2019**, 55, 172–184. [Google Scholar] [CrossRef] [Green Version] - Hu, L.; Liu, Y.; Peng, C.; Tang, W.; Tang, R.; Tiwari, A. Minimising the energy consumption of tool change and tool path of machining by sequencing the features. Energy
**2018**, 147, 390–402. [Google Scholar] [CrossRef] [Green Version] - He, Y.; Liu, F.; Wu, T.; Zhong, F.-P.; Peng, B. Analysis and estimation of energy consumption for numerical control machining. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf.
**2011**, 226, 255–266. [Google Scholar] [CrossRef] - Liu, P.; Liu, S.; Liu, F. Calculation and Obtaining Method of Load Energy Loss Coefficient of Main Power System of CNC Machine Tool. Chin. J. Mech. Eng.
**2016**, 52, 121–128. [Google Scholar] [CrossRef] - Jia, S.; Tang, R.; Lv, J. Therblig-based energy demand modeling methodology of machining process to support intelligent manufacturing. J. Intell. Manuf.
**2013**, 25, 913–931. [Google Scholar] [CrossRef] - Lv, J.; Tang, R.; Jia, S. Therblig-based energy supply modeling of computer numerical control machine tools. J. Clean. Prod.
**2014**, 65, 168–177. [Google Scholar] [CrossRef] - Jia, S.; Tang, R.; Lv, J.; Yuan, Q.; Peng, T. Energy consumption modeling of machining transient states based on finite state machine. Int. J. Adv. Manuf. Technol.
**2016**, 88, 2305–2320. [Google Scholar] [CrossRef] - Jia, S.; Yuan, Q.; Lv, J.; Liu, Y.; Ren, D.; Zhang, Z. Therblig-embedded value stream mapping method for lean energy machining. Energy
**2017**, 138, 1081–1098. [Google Scholar] [CrossRef] [Green Version] - Xie, D.; Chen, G.; Shi, J.; Xu, D.; Wamg, F. Research on cutting energy consumption of CNC machine tools based on BP neural network. Mach. Tool Hydraul.
**2012**, 40, 54–57. [Google Scholar] [CrossRef] - Chen, W.; Zhang, H.; Xiang, Q.; Zhng, Y. Research on Energy Consumption Prediction Method of CNC Machine Tool Based on Support Vector Machine. Mach. Des. Manuf.
**2014**, 11, 54–56. [Google Scholar] [CrossRef] - He, Y.; Wu, P.; Li, Y.; Wang, Y.; Tao, F.; Wang, Y. A generic energy prediction model of machine tools using deep learning algorithms. Appl. Energy
**2020**, 275, 115402. [Google Scholar] [CrossRef] - Shin, S.-J.; Woo, J.; Rachuri, S.; Meilanitasari, P. Standard Data-Based Predictive Modeling for Power Consumption in Turning Machining. Sustainability
**2018**, 10, 598. [Google Scholar] [CrossRef] [Green Version] - Tuo, J.; Liu, F.; Liu, P. Key performance indicators for assessing inherent energy performance of machine tools in industries. Int. J. Prod. Res.
**2018**, 57, 1811–1824. [Google Scholar] [CrossRef] - Li, B.; Cao, H.; Hon, B.; Liu, L.; Gao, X. Exergy-based Energy Efficiency Evaluation Model for Machine Tools Considering Thermal Stability. Int. J. Precis. Eng. Manuf. Technol.
**2020**, 8, 423–434. [Google Scholar] [CrossRef] - Liu, P.; Liu, Z.; Hu, Y.; Shi, Z.; Pan, Y.; Wang, L.; Wang, G. Integrating a Hybrid Back Propagation Neural Network and Particle Swarm Optimization for Estimating Soil Heavy Metal Contents Using Hyperspectral Data. Sustainability
**2019**, 11, 419. [Google Scholar] [CrossRef] [Green Version] - Dong, C.; Dong, X.; Gehman, J.; Lefsrud, L. Using BP Neural Networks to Prioritize Risk Management Approaches for China’s Unconventional Shale Gas Industry. Sustainability
**2017**, 9, 979. [Google Scholar] [CrossRef] [Green Version] - Li, C.; Xiao, Q.; Tang, Y.; Li, L. A method integrating Taguchi, RSM and MOPSO to CNC machining parameters optimization for energy saving. J. Clean. Prod.
**2016**, 135, 263–275. [Google Scholar] [CrossRef]

**Figure 1.**Correspondence between milling power of CNC milling and program. ① Stop; ② Standby; ③ Spindle start; ④ Quickly locate to the starting point; ⑤ Linear interpolation; ⑥ Quickly locate the starting point; ⑦ Linear interpolation; ⑧ Quickly locate to the tool change point; ⑨ Change tool; ⑩ Quick positioning to the milling point; ⑪ Milling ; ⑫ Quickly locate to the retreat point; ⑬ Quickly locate to the safe point; ⑭ Standby; ⑮ Shut down.

**Figure 5.**Experimental device. (

**A**) Drilling samples of different materials. (

**B**) Milling samples of different materials. (

**C**) is the machining center wiring diagram of the energy consumption measurement. (

**D**) is the wiring of the WT1800 high-precision power analyzer. (

**E**) is the operation interface of the power analyzer.

**Figure 6.**Energy consumption curve of standby and tool change. (

**a**) Standby energy consumption. (

**b**) Tool change energy consumption.

**Figure 8.**Comparison results of IPBPNN and BPNN. (

**a**) Comparison of different algorithms’ training time. (

**b**) The result of the G00 test set. (

**c**) The result of the G01 test set.

**Figure 9.**Prediction and analysis of sample energy consumption.(

**a**) Part design.(

**b**) Tool path generation. (

**c**) CNC machining program. (

**d**) Comparison of prediction results.

Cutting Fluid | Spindle Speed | Start Tool Number | End Tool Number | X-axis Movement Distance | Y-axis Movement Distance | Z-axis Movement Distance | Back Engagement | Working Engagement | Feed Rate | Workpiece Material | |
---|---|---|---|---|---|---|---|---|---|---|---|

T | ● | ● | ● | ● | |||||||

G00 | ● | ● | ● | ||||||||

G01 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ||

G02 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ||

G03 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ||

M03 | ● | ||||||||||

M04 | ● | ||||||||||

M07 | ● |

Parameter | Specifications |
---|---|

Worktable size | 900 mm × 400 mm |

Worktable left and right stroke (X) | 630 mm |

Worktable back and forth stroke(Y) | 400 mm |

Spindle up and down stroke(Z) | 500 mm |

Tool magazine capacity | 12 |

Spindle speed | 50~8000 rmp |

Spindle motor power | 7.5/11 KW |

Spindle output torque | 47 |

Rapid traverse rate | X/Y/Z: 24/24/20 m/min |

Feed rate | X/Y/Z: 1~10,000 mm/min |

**Table 3.**Orthogonal experimental factors and levels of G00 command energy consumption characteristics.

Factors | Levels | Number of Levels | |
---|---|---|---|

1 | Spindle speed | 800, 1200, 1600, 2000, 2400, 2800, 3200 | 7 |

2 | X axis displacement | 20, 40, 60, 80, 100 | 5 |

3 | Y axis displacement | 20, 40, 60, 80, 100 | 5 |

4 | Z axis displacement | 20, 40, 60, 80, 100 | 5 |

**Table 4.**Orthogonal experimental factors and levels of G01 command energy consumption characteristics.

Factors | Levels | Number of Levels | |
---|---|---|---|

1 | Spindle speed (r/min) | 800, 1200, 1600, 2000, 2400, 2800, 3200 | 7 |

2 | Cutting edges | 2, 3, 4 | 3 |

3 | Working engagement (mm) | 4, 6, 8, 10 | 4 |

4 | Back engagement (mm) | 0.2, 0.6, 1.0, 1.4, 1.8 | 5 |

5 | Feed speed (mm/min) | 400, 600, 800, 1000, 1200 | 5 |

6 | Tool usage time (h) | 0, 30, 60, 90, 120 | 5 |

7 | X axis displacement | 20, 40, 60, 80, 100 | 5 |

8 | Y axis displacement | 20, 40, 60, 80, 100 | 5 |

9 | Z axis displacement | 20, 40, 60, 80, 100 | 5 |

Instruction | Network Parameters | Ranges | Instruction | Network Parameters | Ranges |
---|---|---|---|---|---|

G00 | Input layer | 4 | G01 | Input layer | 9 |

Hidden layer | 3–14 | Hidden layer | 3–14 | ||

Output layer | 1 | Output layer | 1 | ||

Activation function | sigmod | Activation function | sigmod |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Cao, J.; Xia, X.; Wang, L.; Zhang, Z.; Liu, X.
A Novel CNC Milling Energy Consumption Prediction Method Based on Program Parsing and Parallel Neural Network. *Sustainability* **2021**, *13*, 13918.
https://doi.org/10.3390/su132413918

**AMA Style**

Cao J, Xia X, Wang L, Zhang Z, Liu X.
A Novel CNC Milling Energy Consumption Prediction Method Based on Program Parsing and Parallel Neural Network. *Sustainability*. 2021; 13(24):13918.
https://doi.org/10.3390/su132413918

**Chicago/Turabian Style**

Cao, Jianhua, Xuhui Xia, Lei Wang, Zelin Zhang, and Xiang Liu.
2021. "A Novel CNC Milling Energy Consumption Prediction Method Based on Program Parsing and Parallel Neural Network" *Sustainability* 13, no. 24: 13918.
https://doi.org/10.3390/su132413918