You are on page 1of 13

1.

Introduction
Many government's environmental policies of the last decades focus on decarbonizing of
their energy power plants and the reduction of energy consumption. With a primary energy
consumption of more than 30%, industrial manufacturing is one of the main sources of
pollution. As a consequence, attention for energy-efficiency must be paid and is divided in
two scopes: Environmental friendly product design and energy-efficient production.
Linking product geometry features and energy consumption of production is inevitable for
this objective. This can be achieved by linking the NC code which determine the geometry
of the part with the energy consumption of the CNC machine tool. The aim of the paper
which is chosen is, contributing to a highly accurate NC code-based energy consumption
and power curve prediction for CNC machine tool aggregates with variable power demand
(x, y and z axis, spindle and tool change system) at CNC machine tool level. First of all,
this contribution will help to derive low energy machining strategies with respect to
geometry features to create awareness for design engineers. Secondly, this will help to
determine the energy consumption of a part before manufacturing and therefore allowing
to optimize in design phase for energy demand. Also, power demand prediction can help
for peak power balancing to reduce the overall power spikes at factory level as a
contribution to an increased electric grid stability. In addition to this paper, some basic
knowledge about machine learning and the three algorithms which has been used for the
experiment is included.

1.1 Machine Learning


Machine learning is the study of computer algorithm that can improve automatically
through experience and by using data’s. It is a part of artificial intelligence. In machine
learning a model is build based on the sample data, known as training data, for making
predictions or decision without being explicitly programmed to do so. Machine Learning
is having wide varieties of applications, such as in medicine, email filtering, speech
recognition, and computer vision. It is difficult or unfeasible to develop conventional
algorithm to perform the needed task. Subsets of machine learning is closely related to
computational statistics, which is focuses on making prediction using computers. All
machine learning is not statistical learning. Some machine learning uses data and neural
networks in a way that mimics the working of a biological brain. In its application across
business problems, machine learning is also referred to as predictive analytics.

1.1.1 Common Algorithms used in Machine Learning


➢ Linear Regression
➢ Logistic Regression
➢ Decision Tree
➢ Support Vector Machine(SVM)
➢ Naive Bayes
➢ k-Nearest Neighbors (kNN)
➢ K-Means
➢ Random Forest
1
➢ Dimentionality Reduction Algorithm
➢ AdaBoost Algorithms

1.1.2 Decision Tree

Fig.1. Sample of Decision tree


Decision tree is a commonly used algorithm in machine learning. It is a supervised
learning algorithm mostly used for classification problems. A tree comprises of nodes, the main
node which represents the entire population or sample and is divided into two or more
homogeneous sets is known as ‘root node’ or ‘root’. Each node is divided into two or more sub
nodes. When the sub nodes splits into further sub nodes then it is called ‘decision node’. And
the node which have no split or sub nodes are called ‘leaf node’ or ‘leaf’.
Before creating a tree we must have data’s related to the problem. The main problem is assigned
in root node, which is then split into sub nodes using arrows, one arrow represent the true
statement and the other one is false. Then further classification of sub nodes are done according
to a function called ‘Gini Impurity’. This impurity check is done to determine whether the
group is pure or not.
𝑛

𝐺𝑖𝑛𝑖 𝑖𝑚𝑝𝑢𝑟𝑖𝑡𝑦 = ∑ 𝑃(𝑖) ∗ (1 − 𝑃(𝑖)


𝑖=1

If group is pure then value of Gini impurity is equal to zero, if value is 0.5 then the group is
half mixed.
Another basic calculation related to decision tree is ‘Information Gain’. This information gain
decide which node is to be split further. Once calculate the information gain of each splitted
decision rule, we now can select the decision rule, which has largest information gain to split
the current node.
𝐼𝑛𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝐺𝑎𝑖𝑛 = 𝑖𝑚𝑝𝑢𝑟𝑖𝑡𝑦 − 𝑤𝑒𝑖𝑔ℎ𝑡𝑒𝑑 𝑎𝑣𝑒𝑟𝑎𝑔𝑒 𝑖𝑚𝑝𝑢𝑟𝑖𝑡𝑦 𝑜𝑓 𝑐ℎ𝑖𝑙𝑑 𝑔𝑟𝑜𝑢𝑝
We stop splitting if there are no decision rules left or group impurity is zero.

2
Advantage
➢ Easy to understand.
➢ Useful in Data exploration.
➢ Less data cleaning required.
➢ Data type is not a constraint.
➢ Non Parametric Method.

Disadvantage
➢ Chance for overfitting is more when tree is deep.

1.1.3 Random Forest

Fig.2. Sample of random forest algorithm.


Random forest is simply a collection of decision trees. Each tree makes its own predictions and
those prediction are then aggregated into a final prediction either by votes for classification
problem or as an average for regression problem. Random forest is a good way to prevent
overfitting without sacrificing bias. The depth of the tree will be one or two.

Advantage
➢ They work well on large dataset.
➢ Can model non-linear pattern.
➢ Can handle problems where there are more than two class.

3
1.1.4 AdaBoost

Fig.3. Sample of AdaBoost algorithm

AdaBoost is also like decision tree and random forest. Combining AdaBoost with decision tree
is the most common way to use AdaBoost. Unlike from decision tree, AdaBoost is having only
one node and two leaves called stump. AdaBoost is weak learner, that is why they are so
commonly combined. Each stump is made by taking the previous stump’s mistake into account.
Not that much accurate than random forest and decision tree, but easy to classify.

2. Approach of Study
The aim of this paper is to contribute a highly accurate NC code-based energy consumption
and power curve prediction for CNC machine tool aggregate with variable power demand. This
will help to derive low energy machining strategies with respect to geometry feature to create
awareness for design engineers. And also, this will help to determine the energy consumption
of a part before manufacturing and therefore allow to optimize in design phase for energy
demand. This approach uses only the data which is directly accessible from CNC machine tool
and neither simulation data nor rule-based energy models are included, which is the origin of
this paper. Furthermore, no special reference part for energy consumption model
parameterization is needed. High-frequency data with sampling interval of 2ms is gathered via
an innovative SIEMENS Edge Device. Our approach is to investigate three different machine
learning models, namely ’DecisionTree’, ’RandomForest’ and boosted ’RandomForest’, for
high precision energy prediction of CNC machining strategies.
In this study the parameters are limited to one CNC machine tool, one material and dry
machining. After those preliminary restrictions the approach of study is depicted in Fig.4.

4
Fig.4. Approach of study [1]
1. First, a training part is machined and high frequency measurements and the NC
instructions are acquired.
2. Based on this data, a Machine Learning model is trained.
3. After that, a validation part is machined.
4. The NC instructions from the validation part are passed to the already trained model.
5. The model then predicts the energy consumption.
6. The actual measurements obtained while machining the part are compared to the
predicted values.
3. Methodology and Challenges
In this section we discuss each step individually and elaborate hoe the study is carried out and
the challenges occurring.
The data from the machining process is the foundation for developing a prediction model. Two
different parts, shown in Fig. 5, are machined for the study. The raw material used is an
aluminium alloy (AlCuMgPb) with the size 125.3mm x 19.34mm x 14.52mm. The machining
parts are machined on a SPINNER U5630 5-axis simultaneous CNC machine tool with a
SINUMERIK 840D SL v4.8 numerical control unit (NCU). The tools that is being used in the
machining process are given in Table 1. In which four tools are used in both manufacturing
processes, but other seven are used in either of the two. Hence, the validation data set contains
tools which are not in the training set.

Fig.5. Part used for study [1]

5
Table 1. Tool used to machine part [1]

The power measurements are performed with a SIEMENS edge device. This high frequency
software sensor is installed onto the NCU, which provides high resolution data with a sampling
interval ∆𝑡 of 2ms. The NC code is extracted after the machining and is compared with the
output of a CAM software, contains additional internal machine instructions and possible
changes of the machine operator, ensuring the usage of the accurate NC code responsible for
the measurements.

Merge measurements and NC code


The NC code, containing all the NC instructions to machine the given part, and the power
demand measurements are matched via a time stamp. Depending on the execution length of
each individual NC instruction i, m consecutive measurement results j has to be assigned to the
NC instruction. By merging those two data sets, every power demand measurement 𝑃𝑖𝑗 is
multiplied by the sampling interval of the measurement device ∆𝑡 to obtain the current energy
consumption. The total energy consumption 𝐸𝑡𝑜𝑡𝑎𝑙 is then:
𝑛 𝑚

𝐸𝑡𝑜𝑡𝑎𝑙 = ∑ ∑ 𝑃𝑖𝑗 ∆𝑡 … … … … (1)


𝑖=1 𝑗=1

Syntax interpretation
NC code is to be processed to make the hidden information accessible for further usage, e.g.
the category of operation (rapid positioning, material removal, miscellaneous function, etc.) or
the go-to positions, in the text of the unprocessed NC instructions, shown in Fig. 6. Domain
knowledge is necessary for this data transformation task to improve the data quality set
containing information, that can be used later by a ML algorithm.

6
Fig.6. Syntax interpretation of NC code [1]
Negligible code lines
Machine instruction that don’t contain information regarding the energy consumption
(e.g.”STOPRE”, “GETSELT”, etc.), do not lead to a significant energy consumption higher
than the idle power consumption. So, this can be identified and can summarized into a
negligible category. One NC instruction may contain more than one element responsible for
different simultaneous CNC machine tool operations. However, the energy consumption
measurement for the NC instruction is conducted as a whole and retrospective separation and
allocation to the respective CNC machine tool aggregates is not possible.
Feature extraction and feature engineering
The input parameters, i.e., features are generated from the data set according to their relevance
for machining process based on the analytical and technological considerations. The needed
information can be directly used from the data set in given form (e.g. the spindle speed). In the
feature engineering process, the domain knowledge or additional information’s like the
diameters of the tools is added and the mathematical transformations like, path between two
positions, are implemented in the information is transferred to the data set for the Machine
Learning model. The model is trained and validated with the help of 37 input features, of which
is discussed hereafter.
Length of tool path
One main parameter of the cutting power consumption is the material removal rate 𝑄 = 𝑣𝑐 . 𝐴.
When multiplied with the specific cutting force 𝑘𝑐 will obtain the power demand 𝑃𝑐 = 𝑘𝑐 𝑄.
Given those prerequisites, one can calculate the energy consumption of a milling process. If
the run time of NC instruction ∆𝑡𝑖 is not directly utilizable out of the data, so it has to be
substituted by federate 𝑣𝑐 and tool path length 𝑙𝑝 , by simplifying we obtain:
𝑙𝑝
𝐸𝑐 = 𝑘𝑐 . 𝑄. = 𝑘𝑐 . 𝐴. 𝑙𝑝 … … … (2)
𝑣𝑐

where, 𝑘𝑐 is a material constant that can be neglected in this regression study as only one
material (aluminium alloy) is used. Also, assumed that the cross-section A is also constant in
the given operation. In Eq. (2), it shows that the cutting lengths for every feed axis ⃗𝑙𝑖 is an
important feature in a data set, which can be calculated by the difference of the current position
of the tool ⃗⃗⃗
𝑥𝑖 and the position ⃗⃗⃗⃗⃗⃗⃗
𝑥𝑖+1 after execution of the NC instruction i:

7
⃗𝑙𝑖 = ∆𝑥
⃗⃗⃗𝑖 = 𝑥
⃗⃗⃗𝑖 − ⃗⃗⃗⃗⃗⃗⃗
𝑥𝑖+1 … … … … . (3)

The cutting lengths ⃗𝑙𝑖 is calculated for every feed axis separately and not by the amount of the
vector ⃗⃗⃗
𝑥𝑖 − ⃗⃗⃗⃗⃗⃗⃗
𝑥𝑖+1 . The power consumption is measured and predicted results for every axis
separately, also a separate cutting length for every axis is needed.
Feed rate determination
An external database of feedrate has been set for determining the feed. Based on the tool and
operation mode for each NC instructions, correct feed rate can be assigned (see Fig. 7).

Fig.7. Determination of feed rate [1]


Material engaging and effective machining
When tool engages into the part, material removal rate Q is not constant. During engaging the
material removal rate increases with the length of the tool path 𝑙𝑟𝑢𝑛 , from the beginning until
attaining a constant material removal rate at a specific length 𝑙𝑡ℎ𝑟𝑒𝑠ℎ𝑜𝑙𝑑 .
𝑄 = 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒, 𝑖𝑓 𝑙𝑟𝑢𝑛 < 𝑙𝑡ℎ𝑟𝑒𝑠ℎ𝑜𝑙𝑑. … … … … . (4)
= 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Those NC instructions that meet the condition 𝑙𝑟𝑢𝑛 < 𝑙𝑡ℎ𝑟𝑒𝑠ℎ𝑜𝑙𝑑 is recognised as a group of
instruction that take place at the beginning of every removal process in Machine Learning
model. The value of 𝑙𝑡ℎ𝑟𝑒𝑠ℎ𝑜𝑙𝑑 is retained by minimizing the error of the predictions for NC
instructions of the engaging process.
Tool diameter
The removed area A correlates to the tool diameter 𝑑𝑡𝑜𝑜𝑙 as bigger tools will be used to remove
more material at a time. As the removed area A correlates to the material removal rate Q and
in consequence to the energy consumption.
𝐸𝑐 = 𝑘𝑐 . 𝑓(𝑑𝑡𝑜𝑜𝑙 ). 𝑙𝑝 … … … … . . (5)

If material and tool path length 𝑙𝑝 are constant, the energy consumption for bigger tool is higher
than the energy consumption of a known tool.
Model training and prediction
Three different models have been trained using, ’RandomForest’, ’DecisionTree’ and
’DecisionTree’ including the ’AdaBoost’ method. Later it does not support multioutput
predictions, for every output a separate model was trained. The models have been trained with
all of the training data, gathered during machining of the training part, while the data obtained

8
during machining of the validation part was used to evaluate the predictions of the three
algorithms.

4. Results and Discussion


The statistical measures, specifying the quality of the predictions, are given in Table 2 for all
five considered CNC machine tool aggregates (x, y and z axis, spindle and tool change
system) and for the three trained algorithms. The comparison between the algorithms for one
of those aggregates (y axis) is depicted in Fig. 8. Although there are exceptions for specific
measures and aggregates, the most accurate predictions can be achieved with ‘RandomForest’
algorithm.
Table 2. Validation of three investigated machine learning algorithms with test data set [1]

Fig.8. Comparison of the prediction for the y-axis of part B [1]


Fig.9 represents the plot of the predictions of the energy consumption of the y axis
aggregate is compared to the measurements. The energy demand curve of the machining
process gets predicted accurately. The peaks in the plot is having difference in their value,
which is correctly predicted by the trained model.

Fig.9. Comparison of the prediction for the y-axis for the whole machining cycle [1]
9
Tool change system
For the tool change system, the ’DecisionTree’ algorithm achieves the lowest total
deviation compared to the ’RandomForest’. This is caused by performing the tool change
operation for several times during machining. In contrast to the other aggregates, a
regression problem is to be solved, in this case an algorithm has to be distinguish between
the NC instructions, where a tool change operation takes place, and those, where not. This
decision problem is better to be performed by the ’DecisionTree’ than by a model, that was
build using the ’Random Forest’ method. In ’Random Forest’, the data set is split into
smaller sub data sets and these are used to train sub models, which leads to an averaging
effect or a smoothing of the regression function.
Spindle
The errors for the predictions of the energy consumption of the spindle shown in Fig. 10,
are higher than for the remaining aggregates. This is caused by three main issues:
➢ The acceleration and the deceleration of the spindle are responsible for exceptional
high-power peaks. This leads to a high range of current energy consumption
between those rare peaks and effective CNC machine tool operation. The algorithm
averaging those, leads to a high error.
➢ Those power peaks occur rather rarely compared to effective machining. This leads
to an underfitting of the models of this power peaks. This problem of unbalanced
data influences also other domains with power peaks, like rapid movement of the
axis.
➢ Acceleration and the deceleration are not only energy intense processes but also
time consuming. The NCU moves ahead after initiating the spindle deceleration
while the spindle is still decelerating and acts like a generator, thereby influencing
the energy consumption of the following NC instructions.

Fig.10. Comparison of the prediction quality for the spindle aggregate for the whole
machining cycle [1]
Peak consumption
The deviation of the predictions for the peaks in Fig. 9 are posed on several reasons concerning
especially the energy consumption of CNC machine tools and the milling process:
➢ There are NC instructions, which are directly followed by an identical copy of
themselves, e.g. ’G0 G40 G60 G90 Z= $TC_CARR40[_TC1]-_TOOLL[2]*_FAK1’ or
’G90 D0 SPOS=0 POS [X]=_X FA[X]=RED_RAPID_SPEED POS[Y]=_Y
10
FA[Y]=RED_RAPID_SPEED POS[Z]=_Z FA[Z]’, whereas only one of those
instructions leads to an significant energy consumption of the machining operation.
This is a challenge in data acquisition, which leads to high prediction errors: Having
two identical inputs generating highly different energy consumption, the model has to
average the output and produce high errors.
➢ Despite being similar, NC instructions can differ in energy consumption. For example,
the energy needed for the tool change system is dependent on the position in the tool
magazine. This information is not available in the data set and therefore it cannot be
considered.

11
5. Conclusion
From the study various measures (total deviation, mean deviation, Root Mean Square
Error) of energy prediction for a real geometry including auxiliary operations are measured.
For some operations (Tool change system), Decision tree achieves the lowest total
deviation compared to other two (Random forest and AdaBoost). But most accurate
prediction is achieved with ‘Random Forest’ algorithm.
Future Scope of this study are,
➢ In this study only one material is used, as a future scope, it has to be investigated
whether is it possible to calculate accurate prediction for common model trained based
on data containing different material.
➢ Should investigate the possibility to integrate multiple CNC machine.
➢ Similar study can be conduct by using artificial neural networks (ANN), and should
examine whether more accurate prediction is possible or not.
➢ When connected this model with CAD- Systems it would give the engineers design
feedback about energy-efficient design of the part.

12
References
1. Wuwer, M., Brillinger, M., 2021, Energy consumption for a CNC machining process.
CIRP Journal of Manufacturing Science and Technology, 35:715-723.
2. Trabesinger, S., Butzerin,A., Schall,D.,Pichler,R.,2020,Analysisofhigh frequency data
of a machine tool via edge computing. Proc Manuf, 45:343–348.
3. Schmid, J., Schmid, A., Pichler, R., Haas, F., 2020, Validation of machining operations
by a virtual numerical controller Kernel based simulation.1478– 1483.
4. He, Y., Wu, P., Li, Y., Wang, Y., Tao, F., Wang, Y., 2020, A generic energy prediction model
of machine tools using deep learning algorithms. Appl Energy, 275:115402.

13

You might also like