1. Introduction and Research Context
Sand casting is widely employed for large-scale production of critical components in automotive, construction machinery, and other industries. The process is characterized by numerous production steps and a large number of influencing factors, which creates significant challenges for quality control of sand casting parts. Common quality problems such as unqualified mechanical properties and excessive defects often lead to direct scrapping of castings. In practice, the quantitative relationships between process parameters and the final mechanical properties and defects are not clearly established. Consequently, parameter setting and control have traditionally relied on experience and repeated trial-and-error experiments, making accurate and rapid adjustments difficult. Over recent years, the informatization level of the foundry industry has improved substantially, and a considerable amount of first-line production data has been recorded in enterprise information systems.
This research makes use of such production data to construct predictive models for mechanical properties and sand hole defects of typical sand casting parts using back-propagation (BP) neural networks. Furthermore, a hybrid of BP neural networks and genetic algorithms is implemented to solve and optimize casting process parameters. The goal is to provide a quantitative basis for process control and to support the digital transformation of foundry operations.
2. Data Mining from Sand Casting Production
2.1 Production and Inspection Workflow
To identify key influencing factors, I first analyzed the entire production flow of a sand casting foundry. The main steps include core making, molding, sand mixing, melting, pouring, shakeout, heat treatment, finishing, and final inspection. Quality inspections are interleaved between production steps, for example, checking sand properties (permeability, strength, moisture) and performing spectrometric analysis on melt samples. Because of the long route and the many interacting variables, it is important to systematically collect data from every operation.
2.2 Key Factors Affecting Mechanical Properties and Defects
Based on the production process analysis, I identified several groups of key factors that influence the mechanical properties and defects of sand casting parts:
- Molding sand properties: tensile strength, compressive strength, moisture, compactability
- Alloy composition: C, Si, Mn, P, S, Cr, Ni, Mo, Cu, V
- Pouring parameters: actual pouring temperature
- Heat treatment parameters: maximum temperature, holding time, type of heat treatment
- Environmental conditions: ambient temperature and weather condition during molding
These factors interact in a highly nonlinear manner, making conventional linear models insufficient for accurate prediction.
2.3 Data Mining Based on Enterprise Information System
I utilized data from an ERP system used by a sand casting foundry. The system tracks each individual casting by a unique single-piece code, linking all process steps to that code. In this way, I could retrieve multi-process records for every single sand casting part. After cleaning and merging, I obtained 696 complete records for a 304 stainless steel gland casting (coded as “SCP300/400HA-GR.03”). The input vector consisted of 23 variables, including 10 alloy elements, sand properties, pouring temperature, heat treatment parameters, and encoded categorical variables (weather condition and heat treatment type). The outputs were yield strength, tensile strength, elongation after fracture, and the presence of sand holes.

The statistical ranges of the main variables are summarized in Table 1.
| Parameter | Unit | Min | Max | Mean | Std. |
|---|---|---|---|---|---|
| Sand tensile strength | MPa | 0.189 | 0.863 | 0.387 | 0.168 |
| Sand compressive strength | MPa | 0.491 | 3.183 | 1.916 | 0.480 |
| Ambient temperature at molding | °C | 1 | 32.5 | 13.711 | 7.987 |
| C content | wt% | 0.050 | 0.071 | 0.057 | 0.007 |
| Si content | wt% | 0.370 | 0.885 | 0.545 | 0.155 |
| Mn content | wt% | 0.920 | 1.444 | 1.143 | 0.162 |
| P content | wt% | 0.025 | 0.040 | 0.033 | 0.005 |
| S content | wt% | 0.001 | 0.015 | 0.006 | 0.005 |
| Cr content | wt% | 17.572 | 18.486 | 18.203 | 0.133 |
| Ni content | wt% | 8.010 | 9.474 | 8.151 | 0.220 |
| Pouring temperature | °C | 1564 | 1650 | 1610.26 | 14.861 |
| Heat treatment max temperature | °C | 630 | 1150 | 1092.65 | 60.338 |
| Holding time | h | 0.5 | 1.0 | 0.803 | 0.244 |
3. Linear Regression Baseline
Before applying neural networks, I constructed multiple linear regression models for the three mechanical properties. The general linear equation is:
$$Y = a_1X_1 + a_2X_2 + \cdots + a_nX_n + \beta \tag{1}$$
For yield strength and elongation, I applied Box-Cox transformations to improve normality:
$$\frac{Y^{\lambda} – 1}{\lambda g^{\lambda-1}} = a_1X_1 + a_2X_2 + \cdots + a_nX_n + \beta \tag{2} $$
The regression performance is summarized in Table 2.
| Response | R² | Adjusted R² | Predicted R² |
|---|---|---|---|
| Yield strength | 0.943 | 0.942 | 0.939 |
| Tensile strength | 0.900 | 0.897 | 0.889 |
| Elongation after fracture | 0.804 | 0.799 | 0.787 |
The low accuracy for elongation indicated that linear regression failed to capture the nonlinear relationships between process parameters and the properties of sand casting parts. This motivated the use of BP neural networks.
4. BP Neural Network Models for Mechanical Properties and Sand Holes
4.1 Data Preprocessing
All continuous variables were normalized to the range [-1, 1] using the min-max method:
$$x_N = \frac{2x – x_{max} – x_{min}}{x_{max} – x_{min}} \tag{3}$$
Categorical variables (weather condition and heat treatment type) were encoded using one-hot encoding. Because there were four heat treatment types and three weather types, the total number of input features became 23. The outputs were yield strength, tensile strength, elongation, and sand hole presence (for classification).
4.2 Network Structure Determination
I used the MATLAB neural network toolbox to train the networks with the Levenberg-Marquardt algorithm. The target error was set to \(10^{-7}\), and the maximum number of epochs was 30,000. For each configuration, I ran 20 trials and averaged the results. Using a single hidden layer, I varied the number of hidden neurons from 6 to 50. The mean squared error (\(MSE\)), coefficient of determination (\(R^2\)), and average error rate (\(AER\)) were used as evaluation metrics.
$$MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i – \hat{y}_i)^2 \tag{4}$$
$$R^2 = \frac{\sum_{i=1}^{n} (\hat{y}_i – \bar{y})^2}{\sum_{i=1}^{n} (y_i – \bar{y})^2} \tag{5}$$
$$AER = \frac{1}{n} \sum_{i=1}^{n} \frac{|y_i – \hat{y}_i|}{y_i} \tag{6}$$
After comprehensive testing, I determined that a single hidden layer with 37 neurons gave the best result for yield and tensile strength, while 45 neurons were optimal for elongation, and 35 neurons for sand hole classification. The activation functions were tansig for hidden layers and purelin for the output layer in regression tasks; for sand hole classification, ReLU in the hidden layer and sigmoid in the output layer were used.
| Model | Structure | MSE | R² | AER |
|---|---|---|---|---|
| Yield strength | 23-37-1 | 2.313 | 0.997 | 0.0005 |
| Tensile strength | 23-37-1 | 0.960 | 0.998 | 0.0003 |
| Elongation | 23-45-1 | 0.197 | 0.994 | 0.0007 |
For the sand hole classification problem, the confusion matrix is given in Table 4.
| Actual | Predicted | |
|---|---|---|
| No defect | Defect | |
| No defect | 594 | 35 |
| Defect | 9 | 58 |
The overall accuracy was 93.68%, with 94.44% accuracy for the no-defect class and 86.57% for the defect class.
5. Sensitivity Analysis and Influence Rules
5.1 Single-Factor Analysis
Using the trained prediction model, I performed a controlled-variable analysis by varying one input parameter across its range while keeping all others at their mean values. A few important results are:
- Ni content has the strongest positive effect on yield strength: increasing from 8.01% to 9.474% raises yield strength by 45.0 MPa.
- Si and Mn effectively increase tensile strength, with Mn causing a 38.4 MPa increase over its range.
- C content strongly reduces elongation, causing a decrease of 21.1 percentage points over its range.
- Ambient temperature at molding has a significant but non-monotonic effect on tensile strength (range of 49.7 MPa).
5.2 Garson Sensitivity Analysis
I applied the improved Garson algorithm to quantify the relative contribution of each input feature to tensile strength. The relative importance \(R_k(i)\) is computed as:
$$R_k(i)^* = \frac{ \sum_{j=1}^{n} \left( |W_{ij}V_{jk}| / \sum_{i=1}^{n} |W_{ij}| \right) }{ \sum_{i=1}^{n} \sum_{j=1}^{n} \left( |W_{ij}V_{jk}| / \sum_{i=1}^{n} |W_{ij}| \right) } \tag{7} $$
where \(W_{ij}\) is the weight between input node \(i\) and hidden node \(j\), and \(V_{jk}\) is the weight between hidden node \(j\) and output node \(k\). The analysis showed that the most influential factors for tensile strength of sand casting parts were Cu content, holding time, sand tensile strength, and P content, each contributing a relative importance of more than 4.5%. This confirms that all production steps have a non-negligible influence.
6. Process Parameter Optimization under Different Data Availability Scenarios
6.1 Relationship between Data Volume and Model Accuracy
To investigate the impact of data volume on prediction accuracy, I used another casting, “叶轮法兰” (impeller flange, material ZG270-500), for which 1126 records were available. I randomly split off 20% (226 samples) as an independent test set, and then varied the size of the training set from 100 to 900. The resulting \(R^2\) values are shown in Table 5.
| Training samples | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
|---|---|---|---|---|---|---|---|---|---|
| R² | 0.0995 | 0.170 | 0.233 | 0.524 | 0.659 | 0.619 | 0.835 | 0.876 | 0.927 |
It is obvious that with fewer than 400 samples, the model is almost useless. When the training set reached 700 samples, the \(R^2\) exceeded 0.9. This demonstrates that neural-network-based predictions for sand casting parts require a large amount of historical production data.
6.2 Hybrid BP Neural Network and Genetic Algorithm
For the case where data is sufficient, I combined the BP neural network model (acting as a fitness function) with a genetic algorithm (GA) to search for the optimal process parameters. The GA flowchart includes initialization, selection, crossover, and mutation. Each individual in the population represents a set of process parameters. The fitness function is designed based on the distance between the target mechanical properties and the predicted values, while penalizing predicted sand hole defects:
$$gap = \begin{cases} w_1|T_{\sigma_s} – \sigma_s| + w_2|T_{R_m} – R_m| + w_3|T_A – A|, & \text{if no predicted sand hole} \\ C_{1max}, & \text{if sand hole predicted} \end{cases} \tag{8}$$
$$fitness = C_{2max} – gap \tag{9}$$
Here, \(T_{\sigma_s}\), \(T_{R_m}\), \(T_A\) are the user-specified target values for yield strength, tensile strength, and elongation, respectively. The weights \(w_1\), \(w_2\), \(w_3\) allow the user to prioritize different properties. \(C_{1max}\) and \(C_{2max}\) are constants chosen to be sufficiently large.
I implemented the GA in MATLAB with the settings in Table 6.
| Parameter | Value |
|---|---|
| Population size | 100 |
| Crossover probability | 0.8 |
| Mutation probability | 0.001 |
| Maximum generations | 500 |
| Selection method | Roulette wheel |
| Crossover type | Single-point |
| Mutation type | Bit-flip |
In a simulation experiment, the user specified targets of 315 MPa yield strength, 530 MPa tensile strength, and 52% elongation. The GA converged after 121 generations and found a parameter combination whose predicted values were within 0.22 MPa of the targets, with no predicted sand hole defect. The detailed results are shown in Table 7.
| Property | Target | Predicted | Difference |
|---|---|---|---|
| Yield strength (MPa) | 315.00 | 314.80 | 0.20 |
| Tensile strength (MPa) | 530.00 | 530.22 | 0.22 |
| Elongation (%) | 52.00 | 52.09 | 0.09 |
In a second test aimed at reducing Ni content, I added the Ni content into the fitness function, thus penalizing high Ni usage. The optimization produced a parameter set that achieved almost the same mechanical properties while decreasing Ni usage by 12.7% compared to the historical recipe. The comparison is shown in Table 8.
| Parameter | Historical | Optimized |
|---|---|---|
| Ni content (wt%) | 9.232 | 8.055 |
| Cr content (wt%) | 17.572 | 18.333 |
| Predicted yield strength (MPa) | 255.00 (actual) | 255.18 |
| Predicted tensile strength (MPa) | 550.00 (actual) | 549.86 |
| Predicted elongation (%) | 71.00 (actual) | 71.08 |
| Sand hole defect | No | No |
6.3 Interactive Simplex Search for Low-Data Scenarios
When historical data are insufficient for training neural networks, I turned to the Nelder-Mead simplex method (NMSM). This is a direct search method that does not require any model. It iteratively updates a simplex of \(n+1\) vertices using reflection, expansion, contraction, and shrinkage. The algorithmic steps are:
- Initialization: generate \(n+1\) vertices randomly within the feasible domain.
- Evaluate the objective function (e.g., the measured 24h tensile strength of a sand specimen) at each vertex.
- Reflect the worst vertex:
- Expand if the reflected point is better:
- Contract if necessary:
- Shrink the whole simplex towards the best point:
$$x^{(r)} = \bar{x} + \alpha(\bar{x} – x^{(h)}) \tag{10}$$
$$x^{(e)} = \bar{x} + \gamma(x^{(r)} – \bar{x}) \tag{11}$$
$$x^{(c)} = \bar{x} + \beta(x^{(h)} – \bar{x}) \tag{12}$$
$$x^{(i)} \leftarrow \delta x^{(i)} + (1-\delta)\bar{x}, \quad i \neq l \tag{13}$$
The coefficients were set as \(\alpha=1\), \(\gamma=2\), \(\beta=\delta=0.5\).
I applied this method to optimize the proportions of a new inorganic sand binder system. Four parameters were considered: binder addition (%), hardener addition (%), heating temperature (°C), and heating time (s). The objective was to maximize the 24h tensile strength of the sand specimen. The simplex method requires one experiment per vertex; in this case, with four variables, five initial experiments are needed. Table 9 shows the optimization progress.
| Exp# | Binder (%) | Hardener (%) | Temp (°C) | Time (s) | 24h Strength (MPa) | Operation |
|---|---|---|---|---|---|---|
| 1 | 1.5 | 30 | 140 | 120 | 0.741 | Initial |
| 2 | 1.5 | 40 | 160 | 140 | 1.409 | Initial |
| 3 | 1.5 | 50 | 180 | 160 | 2.292 | Initial |
| 4 | 2.0 | 30 | 160 | 160 | 1.207 | Initial |
| 5 | 2.5 | 40 | 140 | 160 | 1.005 | Initial |
| 6 | 2.25 | 50 | 180 | 190 | 3.009 | Reflection |
| 7 | 2.625 | 60 | 200 | 225 | 3.005 | Expansion |
| 8 | 1.125 | 45 | 200 | 165 | 1.648 | Reflection |
| 9 | 1.188 | 62.5 | 200 | 167.5 | 2.490 | Reflection |
| 10 | 1.531 | 63.75 | 220 | 201.25 | 3.255 | Reflection |
After only 10 experiments, the 24h tensile strength of the sand specimen increased from an initial 0.741 MPa to 3.255 MPa, demonstrating that the simplex method can quickly find a satisfactory parameter combination with very limited experimental effort.
To make this method usable by engineers who do not know the details of the simplex algorithm, I designed and implemented an interactive simplex search system. The system automatically recommends the next experimental point based on the type of point (reflection, expansion, contraction, or shrinkage). The user only needs to input the result of the recommended experiment, and the system updates the simplex and recommends the next point. This approach completely hides the algorithmic complexity from the user.
7. Development and Application of the Optimization System
7.1 System Architecture
I developed a web-based system for sand casting process parameter optimization. The architecture consists of three layers: presentation layer (HTML/JSP), business logic layer (Spring/SpringMVC), and data access layer (MyBatis with MySQL). Using UML use-case and class diagrams, the system supports three main types of experiments:
- Mechanical property and defect prediction experiments
- Process parameter optimization experiments using hybrid BP-GA
- Interactive simplex search optimization experiments
7.2 System Functions and Testing
On the prediction page, the user selects a casting type and inputs the chemical composition and process parameters. The system then uses the corresponding BP model to predict the yield strength, tensile strength, elongation, and whether the casting will have sand holes. I conducted a validation test using the latest 18 production records. The maximum prediction errors for yield strength, tensile strength, and elongation were 2.09%, 1.94%, and 5.14%, respectively, while the average errors were 0.75%, 0.89%, and 1.76%. These results confirm that the system can provide reliable quality predictions for sand casting parts.
The optimization page allows the user to input design targets and weights, and then a set of optimized process parameters is returned. The system also provides the ability to lock certain parameters that must be kept at fixed values, thereby increasing the practical usability of the optimization.
The interactive simplex page guides the user step-by-step during experiments. For example, in the inorganic sand optimization experiment, the system recommended experimental point #6 with binder 2.25%, hardener 50%, temperature 180°C, and time 190s. After the user entered the measured strength, the system recommended the next point. This functionality significantly eases the burden of manual calculation and enables rapid process development for new sand casting parts.
8. Conclusion and Outlook
In this work, I have demonstrated that production data mining combined with neural network modeling can accurately predict the mechanical properties and sand hole defects of sand casting parts. The key conclusions are:
- A systematic data mining approach based on the single-piece code allows the integration of multi-process production parameters into a unified dataset.
- BP neural networks achieve excellent prediction performance: \(R^2\) values of 0.997, 0.998, and 0.994 for yield strength, tensile strength, and elongation, respectively, and a 93.68% overall accuracy for sand hole defect classification.
- Garson sensitivity analysis provides a quantitative ranking of the influencing factors, showing that all process steps contribute to the final quality.
- When sufficient historical data are available, the hybrid BP-GA method can solve process parameters that meet user-specified performance targets, and it can also help reduce expensive alloy content while maintaining similar properties.
- When data are scarce, the interactive simplex search method provides a fast experimental optimization route, as demonstrated by the successful optimization of inorganic sand proportioning with only 10 experiments.
- The developed web-based system integrates all these functions and is ready for use in a real foundry environment.
Future work will focus on extending the models to casting families rather than individual products, automating the retraining process when new data are added, and incorporating more environmental and real-time sensor data to further improve the prediction accuracy and robustness.
