Proceedings of the 7th World Congress on Mechanical, Chemical, and Material Engineering (MCM'21)
Prague, Czech Republic Virtual Conference – August, 2021
Paper No. ICMIE 107
DOI: 10.11159/icmie21.107

Using Machine Learning to Establish the Relationship between Die Casting
Parameters and the Casting Quality
Pr. S. Henry Juang1, Yi-Ning Huang2, David A. Kafando3
1,2National Taiwan Ocean University, Department of Mechanical and Mechatronic Engineering
No 2 Peining Rd., Zhongzheng Dist., Keelung City, Taiwan (ROC)
1shjuang@mail.ntou.edu.tw; 2love9721227@gmail.com
3
davidanselmek@gmail.com

Abstract - The die casting process is highly automated and computerized. Nowadays, the machines are able to display dozens of data
each cycle of the process with few setting parameters. The daily data remain unexploited in the industry. In this experiment, there are six
setting parameters for the machine, such as cylinder pressure, high speed, high-speed switching point, intensification pressure starting
position, injection delay, and biscuit thickness. The purpose of this research is to use machine learning to build two models, model 1
establishes the relationship between die casting machine setting parameters and the machine response (displayed) parameters via
polynomial regression and the R square is used to evaluate the model, and model 2 is built using support vector machine algorithm,
predicts the quality of die castings based on machine response parameters. The two models are then combined, and it allows the foundry
men to adjust the machine parameters to improve the quality of die-casting parts. The experimental results of model 1 show that R squared
greater or equal to 0.5 means that the setting parameters and the reaction parameters have a certain correlation. After cross-validation ofmodel 2, the model is stable and the accuracy rate can reach 74%, with a small amount of data under the circumstances, it has reached
the applicable standard. This research results are based on two data sets provided by diecasters A and B to establish and verify the models.
`
Keywords: machine learning, polynomial regression, support vector classification, casting quality, parameter adjustment.

1. Introduction
In response to Industry 4.0, Taiwan government promotes “5+2” innovative industry, among which smart machinery, itaims to promote the introduction of smart technology in the machinery industry, establish a smart machinery ecosystem,
provide innovative products and services, and promote the transformation and upgrading of Taiwan’s industry [1].
The foundry industry is the basis of the machinery industry. The high-pressure casting is a highly automated method
suitable for mass production in the foundry industry, which is quite suitable for the development of intelligent die-casting
technology. The intelligent die-casting technology system is sequenced into perception, thinking and action, as shown in
Figure 1. Among them, the sensing layer using sensors to measure the casting pressure in the mold cavity, the surface
temperature of the mold cavity, and the temperature of molten alloy, etc., are collected to the database through the Internetof Things (IoT). In the thinking layer, the data collected by the sensing layer mark the data and divide the data into training
group and testing group, using machine learning to build models. The action layer applies the prediction model establishedby the thinking layer to die casting production, and adjust the parameters according to the model results to achieve the goal,high efficiency, stable quality and low energy consumption requirements [2, 3].

ICMIE 107-1

Fig. 1: Smart Die Casting Technology System

The die casting industry never stop innovating and integrating new technologies into the process and production lines.
Yarlagadda and Chiang [4] established an artificial neural networks (ANN) based model that allow to obtain the processparameters for the high pressure die casting process using three different training algorithms, such as the error
backpropagation algorithm, the momentum and adaptive learning algorithm. Their investigation showed that the casting
conditions, e.g., melt temperature, die temperature, injection pressure and injection time, dominate the quality of the casting.
Anijdan et al. [5] in order to optimize the process parameters associated with the minimum porosity rate in Al-Si castingalloys, developed a combined genetic algorithm-artificial neural network (GA-ANN) method. Tsoukalas [6] developed linear
regression and genetic algorithm (GA) as an effective method to find the optimal process parameters associated with theminimum percentage of porosity of AlSi9Cu3 aluminum alloy castings. Part of the die-casting industry relies on the diecasting master’s experience and traditional trial-and-error methods to adjust process parameters to improve the quality ofcastings. Because there is no systematic basis for adjusting the parameters, it consumes a lot of production costs and time. In
addition, new die-casting personnel take time to obtain knowledge and experience. The purpose of this research is to use
machine learning to establish a prediction model of the casting quality based on machine process parameters.

2. Methodology
This research aims to use the programming languagePython 3 to construct a set of die-casting AI models with machinelearning to predict the impact of the variation of die-casting process parameter on the quality of die-casting parts, and tomonitor die-casting production information to improve die-casting yield. The actual research methodology chart shown in
Figure 2.

Fig. 2: Research flow chart.

ICMIE 107-2

2.1 Select Feature Parameters
The die-casting industry has always pursued new technologies to meet customers' high-quality requirements for the
products. In addition, process parameters are also the main factors affecting the quality of die-casting parts. There are about
dozens of displayed parameters of the die-casting machine, of which only some parameter directly affect the quality of diecasting parts. Therefore, the correlation analysis and literature reviews were used to select characteristic parameters to
perform machine learning with more influential parameters.
2.1.1 Correlation Analysis
The correlation analysis is a method to study the direction and closeness of the interdependence between two or more
random variables. The Pearson correlation coefficient mainly used to express the linear correlation strength between
continuous variables [7]. The Pearson correlation coefficient was calculated using the Eq. (1). Table 1 shows the correlation
between the density of castings and process parameters. After the correlation coefficient is taken as an absolute value, thegreater the coefficient, the stronger the relationship with the density of the casting; A positive correlation coefficientindicating that the large the process parameter, the higher the casting density; on the contrary, the smaller the processparameter, the higher the casting density.

r==∑(𝑥𝑖 −𝑥̅ )(𝑦𝑖 −𝑦̅)√∑(𝑥𝑖 −𝑥̅ )(𝑦𝑖 −𝑦̅)(1)where r is the correlation coefficient; xi and yi are the values of the x-variable and y-variable in a sample, respectively; x̅ andy̅ denote the mean of the values of the x-variable and y-variable, respectively.
Table 1: Correlation between casting density and process parameters.
DensityHigh speed
0.030
Hydraulic pressure
0.452
Casting pressure
0.452
Biscuit thickness
0.494
Clamping force
0.188
Low speed time
0.173
High speed time
-0.183
Intensification pressure time
0.029
Pouring time
-0.404
Low speed stroke
0.198
High speed stroke-0.366
Cycle stroke-0.4942.1.2 Literature Selection
According to Pascal's principle, the casting pressure can be obtained from the cylinder pressure, cross-sectional area of
injection cylinder and plunger tip, as shown in Eq. (2). When the casting pressure is increased, the quality of the casting canbe improved; however, if the casting pressure is too high, it may cause problems such as poor casting size: too low may cause
the casting to appear porous and other casting defects [8].

𝐶𝑎𝑠𝑡𝑖𝑛𝑔 𝑝𝑟𝑒𝑠𝑠𝑢𝑟𝑒 =𝐶𝑦𝑙𝑖𝑛𝑑𝑒𝑟 𝑝𝑟𝑒𝑠𝑠𝑢𝑟𝑒∗𝑐𝑦𝑙𝑖𝑛𝑑𝑒𝑟 𝑝𝑖𝑠𝑡𝑜𝑛 𝑎𝑟𝑒𝑎
𝑃𝑙𝑢𝑛𝑔𝑒𝑟 𝑡𝑖𝑝 𝑎𝑟𝑒𝑎

(2)

During the die-casting process, the plunger speed can be divided into two stages, low and high speed. The melt is pushed
at a low speed to fill the shot sleeve, and then forced at a high speed to inject it into the mold cavity. Controlling the lowspeed speed can reduce the air entrapment in the sleeve. The gate speed affects the surface of the casting quality and also themold life, the ideal gate speed can be obtained by controlling the high-speed. The melt reaches the gate at a position switchingfrom low to high-speed. According to different products, the high-speed switching position can be adjusted to obtain a better
casting quality.

ICMIE 107-3

The intensification stage in the die casting process is the key affecting the mechanical properties of the casting. Whenthe intensification starting time is too early, it affects the high speed and cause burrs in the die casting; if it is too late, theintensification effect may not be achieved. The biscuit thickness of the casting affects the pressure transmission in theintensification stage. Usually the biscuit thickness is maintained at 10 ~ 30 mm. When the porosity rate requirements arestrict, it would thicken about 2 ~ 5mm.
Based on the results of the correlation analysis, the process parameters that affect the quality of the castings are selected.
The parameters with a correlation coefficient of 0.3 or more are selected as the characteristic parameters, such as the cylinderpressure, casting pressure. According to the above-mentioned Eq. (2), the casting pressure is calculated from the cylinderpressure, so the final characteristic parameters are the cylinder pressure, the biscuit thickness, the pouring time, the highspeed stroke and the overall stroke.
2.2 Data Pre-Processing
The key factors of the learning results of machine learning algorithms are the quality of the data and the amount of useful
information contained. In order to improve the prediction results of the model, the data needs to be pre-processed. Common
pre-processing method includes missing value processing by removing or replanting blanks or placeholders in the data table,
category classification processing by encoding category labels as integer values, data feature scaling-mainly divided into two
methods, regularization and standardization [9]. Normalization is to scale the feature data to [0, 1] or [1, -1] without changing
the original distribution.
In the present study the quality of castings is judged by density, and it is divided into categories such as good, acceptable,
pending and defective rates according to the diecaster’s needs. There are four categories, as shown in Table 2.
Table 2: Classification of casting quality.
Category
Density(g/cm3)
1-Defective
ρ < 2.6810
2- Pending
2.6810 < ρ < 2.6868
3-Acceptable
2.6868 < ρ < 2.6977
4-Goodρ > 2.6977

2.3 AI Model Establishment
The first model uses polynomial regression analysis to analyse the machine settings and machine response parameters
to find the correlation between the two, the correlation is determined by the regression coefficient. The machine setting
parameters in this study are only six parameters such as cylinder pressure, high speed, high-speed switching point,
intensification pressure starting position, injection delay, and biscuit thickness. The second model uses the Support Vector
Machine/ Support Vector Classification (SVM/SVC), to study the relationship between the machine displayed parameters
and the porosity (quality) is established [10]. However, due to insufficient data provided by the diecaster, the establishmentof model 1 is not yet completed. Only model 2 can be used to predict the casting quality with machine response parameters,
and then model 1 can be used to understand the setting parameters that affect the response parameters for adjustment.
The polynomial regression analysis is used for modelling, which gives a better fit, as shown in Eq. (3) [11].

𝑦𝑖 ＝ 𝛽0 + 𝛽1 𝑥𝑖 + 𝛽2 𝑥𝑖2 + ⋯ + 𝛽𝑝 𝑥𝑖 + 𝛽𝑞 𝑥𝑖2 + 𝜀𝑖 (𝑖 = 1,2, ⋯ , 𝑛)(3)where yi represent the machine displayed parameters, β0 to βq are the regression coefficients and the independent variable xi
represent the setting parameters.
Support vector machine is a supervised learning model for analyzing data in classification and regression and related
learning algorithms, such as Support Vector Classification and Support Vector Regression. The goal is to find an optimal
hyperplane to separate the data of different categories, as shown in Figure 3 [12].

ICMIE 107-4

Fig. 3: Support Vector Machine [12].

3. Results and Discussion
In this study, machine learning was used to establish a casting quality prediction model, and two models were establishedseparately and then integrated.
3.1 Training Results of Model 1
Model 1 is evaluated using the R-squared value. The larger the number, the better the fit of the regression model. The
cylinder pressure, high-speed speed, high-speed switching point, pressurization start position, injection delay, and biscuit
thickness are the inputs parameters; yi are the machine response parameters such as cylinder pressure, biscuit thickness,pouring time, high-speed stroke, and overall stroke. The determination coefficients of the final machine setting parameters
and reaction parameters are shown in Table 3, and the polynomial regression equation is shown in Table 4.
Table 3: The fit of displayed parameters used in model 1 after normalization processing.
Characteristic Parameters
R-square
Cylinder pressure
0.999
Biscuit thickness
0.905
Pouring time
0.57
High speed stroke
0.686
Overall stroke
0.752
Table 4: The characteristic regression coefficient after normalization in polynomial regression analysis of model 1.
𝑦1
𝑦2
𝑦3
𝑦4
𝑦5
0.795
0.498
-0.088
0.994
0.559
𝑥1
0.207
-0.6410.133-0.747-0.255
𝑥12
0.010
0.017
0.0047
0.141
0.131
𝑥2
2
0.010
0.017
0.0047
0.141
0.131
𝑥2
-0.143-0.3290.091-0.731-0.159
𝑥3
0.148
0.433
-0.059
0.359
0.347
𝑥32
0.010
0.059
0.014
0.124
0.087
𝑥4
0.010
0.059
0.014
0.124
0.087
𝑥42
-0.0013
0.044
0.071
0.129
0.101
𝑥5
-0.0013
0.044
0.079
0.129
0.101
𝑥52
0.157
0.881
-0.0580.562-0.031𝑥6-0.185-0.1070.091-0.714-0.564𝑥62

Table 3 shows the R square value of the machine setting parameters and displayed parameters after normalization. They
are all greater than 0.5, indicating that these displayed parameters have a certain relationship with the setting parameters.
Table 4 shows the equation of polynomial regression analysis. According to Table 4, it can be seen that the machine setting
parameters affect the reaction parameters. The larger the coefficient, the greater the influence. Among them, the cylinder

ICMIE 107-5

pressure of the setting parameter has a greater influence on the cylinder pressure, the thickness of the biscuit thickness, thehigh-speed stroke, and the overall stroke of the response parameters.
3.2 Training Results of Model 2This study uses SVC algorithm to establish model 2, taking machine response parameters as input and casting quality
as output. The data provided by diecaster A has two die casting data, which are mixed for training. However, because thetrained model is too simple or too complex, there are problems with low bias or high variance. In order to obtain a morereliable model, this study uses k-fold cross-validation [13]. The final cross-validation model accuracy rate was 74%.
3.3 Influence of Parameter Adjustment on Casting Quality
Combining model 1 and model 2 can not only predict the product quality of the die-casting process, but also find themain settable parameters that affect the quality of the finished product, and provide the setting parameter adjustment direction
to reduce the traditional trial and error method that consumes a lot of production costs and time, and improve product yield.
According to the results of model 1, it allows to select the parameters that have R square equal or greater to 0.9, and observethat it is applied to model 2. It can be seen that increasing the cylinder pressure and the biscuit thickness of the response
parameters can increase the yield. According to the model 1, adjusting the cylinder pressure affects the cylinder pressure of
the displayed parameter; changing the biscuit thickness can adjust the biscuit thickness, the pressure of the cylinder and thehigh-speed switching point in sequence. Taking the prediction result of cylinder pressure as an example, as shown in Table
5, some of the classification results are bad, and it is speculated that the error is caused by imperfect data. According toModel 1, if the cylinder pressure of the reaction parameter is to be modified, the cylinder pressure, the biscuit thickness andthe high-speed switching point of the set parameters can be adjusted in order to improve the quality of the casting.

Hydraulicpressure (MPa)
180
183
190
200
210
220
230
240
250
260
270

Table 5: Predictive classification results of adjusting cylinder pressure
BiscuitPouringHigh speed
Overall cycle
Qualitythickness (mm)time(s)stroke(mm)stroke (mm)classification
18
11
94
345
1
18
11
94
345
1
18
11
94
345
3
18
11
94
345
3
18
11
94
345
1
18
11
94
345
1
18
11
94
345
3
18
11
94
345
4
18
11
94
345
3
18
11
94
345
1
18
11
94
345
3

3.4 Application to Different Data Sets
There are more than 7000 die-casting data sets provided by diecaster B. The die-casting data of this diecaster only
provides machine displayed parameters and casting quality classification results. Therefore, following the same method of
establishing model 2 in this study, the same prediction model is established. The correlation analysis is used to select thecharacteristic parameters, and the correlation between the displayed parameters and the product quality results is shown in
Table 6. The selection of the characteristic parameters takes into account the Pearson correlation coefficient greater than 0.3(> 0.3). It is known that the casting pressure is calculated from the cylinder pressure, so the final characteristic parameters
are the cylinder pressure, low-speed speed, high-speed speed, and hydraulic oil temperature as input. The casting quality
result is divided into two types good and bad. Taking 80% of the data set provided by diecaster B as the training group and
20% as the test group, the accuracy rates are 99.58% and 99.8%, respectively.

ICMIE 107-6

Table 6: Correlation between selected parameters and good product results.
Good productCasting pressure-0.898High speed-0.684
Low speed-0.717
Intensification pressure starting time
-0.050
Cycle time
0.094
Biscuit thickness
0.178
Low speed stroke
0.003
Oil temperature-0.504
2nd phase speed-0.167
3rd phase speed-0.174
1st phase speed-0.033
Spray 1 time
2.59E-16
Spray 2 time
2.59E-16
Blow 2 time
2.59E-16
Cylinder pressure-0.898

4. Conclusion
The following conclusions were obtained from the study results:
1. According to the results of the polynomial regression analysis of the model, the machine setting parameters and displayedparameters such as cylinder pressure, biscuit thickness, feeding time, high-speed stroke, and overall stroke have a highR squared value, respectively 0.999, 0.905, 0.57, 0.686 and 0.752. All are above 0.5, indicating that those machine setting
parameters and the display parameters have a certain correlation.
2. After the cross-validation of model 2, the model has reached stability and the accuracy rate is 74%. Using the data set of
diecaster B which has a large amount of data and the quality of castings is only classified into two categories, the samemodel reaches 99% accuracy.
3. This study hopes to combine model 1 and model 2, and finally set the parameters of the machine as input and casting
quality as output to establish a complete model for predicting die casting quality. However, due to insufficient data, only
model 2 can be used to find out the impact the response parameters of casting quality are adjusted according to the
influence of the model 1 machine setting parameters on the response parameters. In addition, because the amount of datais too small, this study is only a preliminary machine learning model, and it is still unable to achieve self-learning.
4. According to the application of the process parameters in model 2, increasing the cylinder pressure and the thickness ofbiscuit of the response parameters can increase the yield. To change the cylinder pressure, it must first adjust the cylinderpressure of the set parameter; changing the thickness of biscuit can adjust in order the thickness of biscuit, cylinderpressure and high-speed switching point. Reducing the overall stroke of the response parameters can increase the yield.
Adjust the overall stroke to sequentially adjust the cylinder pressure, high-speed speed, high-speed switching point,
injection delay, and tip thickness of the set parameters.

Acknowledgements
This study is the project sponsored by the Ministry of Science and Technology (MOST) in Taiwan, with project
numbered MOST-180-2221-E-019-MY3. Without the support of MOST, it would not fulfil to carry out this project smoothly.
It is also grateful to the diecasters A and B for the die casting machine data and casting quality. Also thanks to Pr. Dong-Lin
Li, Department of Electrical Engineering at NTOU, for his guidance and advice on machine learning.

References[1] https://www.ey.gov.tw/Page/5A8A0CB5B41DA11E/18ef26a4-5d05-4fb3-963e-6b228e713576。2019.
[2] H. Lee, K. Ryu, and Y. Cho, “A framework of a smart injection molding system based on real-time data”, Procedia
Manufacturing 11:1004-1011, 2017, DOI:10.1016/j.promfg.2017.07.206[3] Y. Zhao, F. Qian, Y. Gao, “Data driven die casting smart factory solution”, ICSEE/IMIOT, CCIS, vol. 923, pp13-21.
Springer, Singapore, 2018.

ICMIE 107-7

[4] K. Prasad and D.V. Yarlagadda, “Prediction of die casting process parameters by using an artificial neural networkmodel for zinc alloys”, International Journal of Production Research, 38, 119–139, 2010.
[5] S. H. M. Anijdan, A. Bahrami, H. R. M. Hosseini, and A. Shafyei, “Using genetic algorithm and artificial neuralnetwork analyses to design an Al-Si casting alloy of minimum porosity”, Mater. Des. 27(7), 605-609, 2006.
[6] V. D. Tsoukalas, “Optimization of porosity formation in AlSi9Cu3 pressure die castings using genetic algorithm
analysis”, Mater. Des., 29(10), 2027-2033, 2008.
[7] M. Franzese and A. Iuliano, “Correlation analysis, encyclopedia of bioinformatics and computational biology”, Vol.1,
pp.706-721. 2019.
[8] S. H. Juang, Fabrication Technology of Intelligent Die Casting Molds (2nd ed.), Wunanbooks, Taiwan, 2013.
[9] W. McKinney, Translated by Zhang Jingwen, Python data analysis (2nd ed.), GOTOP Information Inc., Taiwan, 2018.
[10] M. Fan and C. Li, “Python machine learning and practice”, Tsinghua University Press, China, 2016.
[11] Python programming and data analysis, Princeton International Publishing Co., Ltd., Taiwan, 2019.
[12] T. Huang, “Machine Learning-support vector machine (SVM) detailed derivation”, 2018, [online]. https://chih-shenghuang821.medium.com/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92%E6%94%AF%E6%92%90%E5%90%91%E9%87%8F%E6%A9%9F-support-vector-machine-svm%E8%A9%B3%E7%B4%B0%E6%8E%A8%E5%B0%8E-c320098a3d2e[13] S. Raschka and L. I. Liu, Compiled by J. H. Wu, Python machine learning, DrMaster Press Co., Ltd, Taiwan, 2016.

ICMIE 107-8