Cast iron, particularly gray cast iron and ductile iron, remains one of the most important engineering materials in modern manufacturing. Its low cost, excellent castability, and favorable mechanical properties make it indispensable in industries such as automotive, machinery, and energy. However, casting production is a complex metallurgical process involving melting, molding, pouring, and solidification. Each stage can introduce defects, leading to high scrap rates. Statistics from the Chinese machinery industry indicate that the average sand foundry defect rate is around 10%, and in some enterprises it exceeds 20%. Traditional defect diagnosis relies heavily on the subjective experience of foundry engineers, which is time-consuming, inconsistent, and often ineffective. Therefore, there is an urgent need for a systematic, intelligent tool that can predict defects before they occur and suggest corrective actions.
In this work, I developed a neural network (NN) model combined with a genetic algorithm (GA) for the diagnosis of sand foundry defects in gray and ductile iron castings. The model maps a set of process parameters and operational measures to the probabilities of common casting defects. The network weights are trained using a hybrid genetic algorithm, which overcomes the slow convergence and local minima problems of the classical backpropagation (BP) algorithm. A complete software system with a user-friendly interface was also developed. The system not only predicts defects but also provides preventive measures, thereby contributing to a significant reduction in casting scrap and an improvement in production efficiency.
1 Introduction
1.1 Gray Cast Iron and Ductile Iron
Gray cast iron is characterized by flake graphite in a steel matrix. It has excellent damping capacity, low notch sensitivity, and good machinability. Although its tensile strength is lower than that of steel, its production is simple and economical. Ductile iron, invented in the 1940s, contains spherical graphite, which greatly reduces stress concentration and improves ductility and toughness. Its yield strength-to-tensile strength ratio can reach 0.7–0.8, almost double that of carbon steel. Ductile iron has replaced steel in many applications such as crankshafts, gears, and pressure valves. Both materials, however, suffer from typical casting defects such as subsurface blowholes, slag inclusions, white iron formation, graphite coarsening, shrinkage porosity, and in the case of ductile iron, graphite floatation and nodularity deterioration.
1.2 Defect Handling in Foundries
There are two main approaches to sand foundry defect handling: defect removal and defect prediction. Defect removal includes grinding, welding, and heat treatment, which are post-process operations. These methods are often ineffective for internal defects or defects on non-machined surfaces. Defect prediction, on the other hand, aims to anticipate defects based on process parameters and take preventive actions. Traditional prediction methods, such as the spark test for carbon content or the visual inspection of nodularity, are empirical and subjective. The advent of artificial neural networks (ANNs) has provided a new and powerful tool for defect prediction. ANNs are capable of learning complex nonlinear relationships, handling noisy data, and generalizing from limited examples.
1.3 Neural Networks and Genetic Algorithms
An artificial neural network is a computational model inspired by the structure and function of biological neurons. It consists of a large number of interconnected processing units (neurons) organized in layers. The most widely used type is the multilayer feedforward network, often trained with the backpropagation (BP) algorithm. BP is a gradient descent method that adjusts weights to minimize the output error. However, BP has two major drawbacks: slow convergence and the tendency to get trapped in local minima. The genetic algorithm is a global optimization technique based on natural selection and genetics. It operates on a population of candidate solutions, using selection, crossover, and mutation to evolve toward the optimum. GA does not require gradient information and is therefore well suited for training neural networks, especially when the network is large and the error surface is rugged.
1.4 Applications in Casting Industry
Neural networks have been successfully applied in various areas of casting production, including mold sand quality control, cupola melting optimization, and defect diagnosis. For example, some researchers in the United States used neural networks to control the compactability of molding sand, resulting in improved process stability. In China, neural networks were used to predict the mechanical properties of gray iron from chemical composition and to control the melting process in an electric arc furnace. However, most defect diagnosis systems are based on expert systems, which suffer from difficulties in knowledge acquisition, maintenance, and the processing of uncertain information. A neural network, on the other hand, can learn directly from data and handle incomplete or noisy inputs. In this thesis, I combine a neural network with a genetic algorithm to build a robust defect diagnosis model for both gray and ductile iron castings.
1.5 Research Content and Significance
The main objectives of this work are:
- To classify and summarize typical defects in gray and ductile iron castings and their influencing factors.
- To construct a defect–factor database for both materials.
- To design a neural network model for defect diagnosis.
- To train the network using a hybrid genetic algorithm (HGA).
- To develop a user-friendly software system for practical use.
The significance of this study is threefold. First, it reduces the workload of foundry engineers. Second, it improves the accuracy and speed of defect diagnosis. Third, by predicting defects before they occur, it helps optimize process parameters and reduces production costs.
2 Analysis of Cast Iron Defects
Understanding the morphology, formation mechanism, and influencing factors of defects is the first step in building a diagnostic model. In this chapter, I analyze five common defects in gray cast iron and summarize the defect–factor relationship for ductile iron.
2.1 Gray Cast Iron Defects
2.1.1 Subsurface Blowholes
Morphology: Subsurface blowholes are located 1–3 mm beneath the casting surface. They are usually small spherical, teardrop, or elongated gas pores with diameters of 0.5–5 mm. They become visible after sandblasting or machining. The inner walls are often covered with a layer of graphite or carbon film, giving them a dark appearance.
Formation mechanism: These blowholes are caused by the reaction between the metal and the mold, especially in green sand molds. Water vapor from the mold reacts with iron, producing atomic hydrogen, which dissolves in the liquid metal. During solidification, the solubility of hydrogen decreases sharply, and the gas nucleates and grows into bubbles. The condition for bubble nucleation is:
$$P_H = P_a + \rho g h + \frac{2\sigma}{r}$$
where \(P_H\) is the pressure inside the bubble, \(P_a\) is the atmospheric pressure, \(\rho\) is the density of the liquid metal, \(g\) is the gravitational acceleration, \(h\) is the height of the metal above the bubble, \(\sigma\) is the surface tension, and \(r\) is the bubble radius. A small surface tension facilitates bubble formation. Elements that reduce surface tension, such as sulfur, manganese, and oxygen, promote the formation of subsurface blowholes.
Influencing factors:
- Sulfur and manganese: Both are surface-active elements. An increase in their content lowers the surface tension and increases the oxygen content, promoting blowholes.
- Residual aluminum: Aluminum from inoculants can also affect the surface tension. As shown in the original study, a residual aluminum content of 0.01%–0.05% is critical for the formation of blowholes.
- Wall thickness: Medium wall thickness (10–40 mm) is most susceptible.
- Pouring temperature: Too low a temperature prevents gas escape, while too high a temperature increases the reaction with water vapor.
- Moisture content of molding sand: High moisture increases the amount of water vapor and reduces the permeability of the mold.
- Sand compactness and permeability: High compactness reduces porosity and increases the risk of steam explosion.
Preventive measures:
- Control the sulfur and manganese contents within appropriate ranges.
- Add coal dust (4%–6% by weight) or hematite powder to the molding sand.
- Use bentonite instead of ordinary clay to improve sand quality.
- Design the gating system to allow smooth and rapid filling, with a proper pouring temperature.
- Increase the permeability of the mold and ensure adequate venting.
2.1.2 Slag Inclusions
Morphology: Slag inclusions are nonmetallic particles present on the surface or inside castings. They are irregular in shape and vary in color depending on the composition of the slag. One type is primary slag, which forms during melting and treatment; another is secondary slag, which forms during pouring and filling.
Formation mechanism: The formation of primary slag follows the sequence of precipitation, growth, and coagulation of nonmetallic inclusions. The standard free energy \(\Delta G^0\) of the formation reaction is related to the equilibrium constant \(K\) by:
$$\Delta G^0 = -RT \ln K$$
where \(R\) is the gas constant and \(T\) is the absolute temperature. A more negative \(\Delta G^0\) indicates a stronger tendency to form the compound. In iron melts, oxides such as Al2O3, SiO2, and MnO form preferentially. Secondary slag arises from the oxidation of the metal stream during pouring. The surface oxide film can be trapped in the liquid metal due to turbulence.
Influencing factors:
- Sulfur and manganese contents: High sulfur and low manganese lead to the formation of low-melting-point eutectic sulfides and oxides.
- Silicon and manganese ratio: A silicon-to-manganese ratio above 3 helps form a low-melting-point, easily floatable slag.
- Melting temperature: A higher melting temperature allows inclusions to coalesce and float out.
- Pouring temperature: Too low a pouring temperature hinders the floatation of inclusions.
- Mold compactness and gating design: Uneven compactness and poor gating can cause erosion and entrainment of sand and slag.
Preventive measures:
- Control the sulfur content to below 0.06%.
- Deoxidize the melt with ferrosilicon or rare-earth alloys.
- Allow the melt to stand in the ladle before pouring.
- Use a proper gating system with slag traps and filters.
- Increase the pouring temperature to above 1350°C.
2.1.3 White Iron Formation
Morphology: White iron defect is characterized by a silver-white, brittle layer on the surface or a completely white fracture instead of the normal gray fracture. It occurs when carbon in the iron solidifies as cementite (Fe3C) instead of graphite, due to rapid cooling or insufficient graphitization elements.
Formation mechanism: The formation of white iron is a result of solidification under the metastable iron–cementite system rather than the stable iron–graphite system. Low carbon and silicon content, high cooling rate, and the presence of anti-graphitizing elements such as sulfur and chromium promote white iron formation.
Influencing factors:
- Carbon equivalent: Low carbon equivalent increases the tendency.
- Sulfur and manganese: Sulfur is a strong anti-graphitizing element. Manganese can counteract the effect of sulfur, but excess manganese also promotes white iron.
- Wall thickness: Thin sections cool rapidly and are more prone to white iron.
- Mold material: High thermal conductivity of the mold increases the cooling rate.
- Inoculation: Proper inoculation with graphitizing agents suppresses white iron.
Preventive measures:
- Increase carbon equivalent appropriately.
- Use effective inoculation, e.g., with ferrosilicon or silicon-calcium.
- Control the sulfur content and ensure a proper Mn/S ratio.
- Adjust pouring temperature and mold coating to moderate the cooling rate.
2.1.4 Coarse Graphite
Morphology: Coarse graphite appears as large, irregular graphite flakes in the microstructure. It often leads to poor mechanical properties and leakage in pressure-tight castings. On machined surfaces, it appears as dark spots where graphite has fallen out.
Formation mechanism: Coarse graphite is formed when the melt cools slowly and large amounts of graphite precipitate and grow freely. This usually occurs at thick sections or hot spots, especially when the carbon equivalent is too high or the inoculation is insufficient.
Influencing factors:
- Carbon equivalent: An excessively high carbon content is the main cause.
- Inoculant amount and distribution: Uneven inoculation leads to local graphitization.
- Wall thickness and section modulus: Thick sections promote slow cooling.
- Pouring temperature: High pouring temperature increases the cooling time.
- Melting temperature: Very high melting temperatures increase carbon pickup and nucleation of graphite.
Preventive measures:
- Adjust carbon equivalent according to section thickness.
- Add steel scrap to lower carbon content.
- Use rare-earth inoculation to refine graphite.
- Keep the pouring temperature moderate.
- Design the gating system to avoid local hot spots.
2.1.5 Shrinkage Porosity and Shrinkage Cavities
Morphology: Shrinkage cavities are irregular, rough-walled voids that appear in the last solidifying regions or at hot spots. Shrinkage porosity consists of many small, dispersed holes that are visible under a microscope or to the naked eye.
Formation mechanism: Liquid shrinkage and solidification shrinkage are the two main contributors. The volumetric contraction of the liquid metal from pouring temperature to liquidus temperature is given by:
$$\varepsilon_{\text{liq}} = \alpha_{\text{liq}} \left(T_{\text{pour}} – T_{\text{liquidus}}\right)$$
where \(\alpha_{\text{liq}}\) is the liquid shrinkage coefficient. For cast iron, the coefficient increases with carbon content. The solidification contraction is partially compensated by the expansion due to graphite precipitation. The total shrinkage is:
$$\varepsilon = \varepsilon_{\text{liq}} + \varepsilon_{\text{sol}}$$
If the total shrinkage exceeds the feeding capacity, cavities or porosity form.
Influencing factors:
- Carbon equivalent: A proper carbon equivalent can reduce shrinkage tendency.
- Pouring temperature: Too high pouring temperature increases liquid shrinkage; too low affects feeding.
- Mold moisture: High moisture reduces the rigidity of the mold wall, causing expansion and inadequate feeding.
- Sand compactness: Low compactness allows mold wall movement.
- Riser design: Insufficient or misplaced risers lead to defects.
Preventive measures:
- Control carbon equivalent and restrict anti-graphitizing elements.
- Use effective inoculation to promote graphite precipitation.
- Ensure adequate mold hardness and stiffness.
- Design proper risers and chills to promote directional solidification.
- Use dry sand molds for large and thick-walled castings.
2.2 Ductile Iron Defects
Ductile iron exhibits common defects such as shrinkage porosity, slag inclusion, graphite floatation, subsurface blowholes, and nodularity deterioration. The influencing factors are summarized in the following table, based on the previous work in our laboratory.
| Factor | Shrinkage | Slag | Graphite floatation | Subsurface blowhole | Nodularity deterioration |
|---|---|---|---|---|---|
| Carbon equivalent | ● | ● | ● | ● | |
| Silicon content | ● | ● | ● | ● | ● |
| Sulfur content | ● | ● | ● | ● | |
| Manganese content | ● | ● | ● | ● | |
| Rare earth content | ● | ● | ● | ● | ● |
| Magnesium content | ● | ● | ● | ● | ● |
| Aluminum content | ● | ● | ● | ● | |
| Wall thickness | ● | ● | ● | ● | |
| Pouring temperature | ● | ● | ● | ● | ● |
| Melting temperature | ● | ● | ● | ● | |
| Inoculation | ● | ● | ● | ||
| Mold moisture | ● | ● | |||
| Sand compactness | ● | ● | ● | ||
| Permeability | ● | ● | ● | ||
| Gating design | ● | ● | ● | ● | ● |
| Riser design | ● | ● | |||
| Chills | ● | ● | |||
| Skimming and slag trapping | ● | ● | ● |
3 Construction of the Neural Network Diagnostic Model
3.1 Artificial Neuron and Network Structure
The basic processing element of a neural network is the artificial neuron. Each neuron computes a weighted sum of its inputs, subtracts a threshold, and passes the result through an activation function. The output of neuron \(i\) is:
$$y_i = f\left(\sum_j w_{ij} x_j – \theta_i\right)$$
where \(x_j\) are the inputs, \(w_{ij}\) are the connection weights, \(\theta_i\) is the threshold, and \(f(\cdot)\) is the activation function. In this work, the sigmoid function is used:
$$f(u) = \frac{1}{1+e^{-u}}$$
The feedforward multilayer network consists of an input layer, one or more hidden layers, and an output layer. The network maps an \(n\)-dimensional input vector to an \(m\)-dimensional output vector through a nonlinear transformation. The universal approximation theorem states that a single hidden layer with sufficient neurons can approximate any continuous function.
3.2 Model for Gray Cast Iron Defect Diagnosis
For gray cast iron, I selected 9 process parameters that significantly influence the five typical defects. The input vector is:
$$X = (x_1, x_2, \ldots, x_9)^T$$
where the components are: carbon content, silicon content, phosphorus content, sulfur content, manganese content, aluminum content, inoculant amount, wall thickness, pouring temperature, melting temperature, mold moisture, sand compactness, and permeability. Wait, that would be more than 9. Let me re-read the original table. Actually, the original document says a 9-dimensional vector, but in the sample library table (Table 4-1) there are 14 fields including serial number and output. Let me be accurate.
In the original Chinese text, it states: “we only select representative process parameters and measures to form a 9-dimension vector” but the sample library structure lists 14 fields: serial number, carbon, silicon, phosphorus, sulfur, manganese, aluminum, inoculant amount, wall thickness, pouring temperature, melting temperature, mold moisture, compactness, permeability, and then five outputs. That is actually 13 inputs? Let’s count inputs: carbon, silicon, phosphorus, sulfur, manganese, aluminum, inoculant amount, wall thickness, pouring temperature, melting temperature, mold moisture, compactness, permeability = 13. Maybe the “9” was a typo or refers to something else. In the “灰铸铁铸件系统权值学习样本库结构” table, there are 13 input fields plus serial number plus five outputs. In the operational input window, maybe they use 13. To avoid confusion, I will define the model based on the sample library structure. The original text also says “输入层有9个神经元” but that is inconsistent. Perhaps they reduced to 9 after combining some factors. Given the uncertainty, I will follow the explicit table in the original: the gray iron sample library has 13 input fields (excluding serial number). However, the original also says “输入层有9个神经元” in section 3.2? Let me check the scanned text: “输入层有9个神经元,分别对应9个工艺参数(元素含量、熔炼温度)” – maybe “9” is a mistake. For the ductile iron model, the input layer is 15 neurons. I think the safest is to describe that the input layer size was determined by the number of selected factors, which for gray iron is 13 (including chemical composition and process parameters), and for ductile iron is 15. But the text in Chapter 3 explicitly states “9”. Hmm.
Let’s look at the table 4-1 again: fields are 序号, 含碳量, 含硅量, 含磷量, 含硫量, 含锰量, 含铝量, 孕育剂量, 壁厚, 浇注温度, 熔炼温度, 型砂含水率, 紧实度, 透气性, 皮下气孔, 夹渣, 白口, 石墨粗大, 缩松缩孔. So inputs are 13 (carbon, silicon, phosphorus, sulfur, manganese, aluminum, inoculant, wall thickness, pouring temperature, melting temperature, moisture, compactness, permeability). For ductile iron, table 4-2 has fields: 序号, 含碳量, 含硅量, 含磷量, 含硫量, 含稀土量, 含镁量, 含铝量, 壁厚, 浇注温度, 熔炼温度, 孕育温度, 滞留时间, 含水率, 紧实度, 透气性, 皮下气孔, 缩孔缩松, 夹渣, 石墨漂浮, 球化不良及衰退. That gives inputs: carbon, silicon, phosphorus, sulfur, rare earth, magnesium, aluminum, wall thickness, pouring temperature, melting temperature, inoculation temperature, residence time, moisture, compactness, permeability = 15. So indeed the ductile iron input is 15. For gray iron, it should be 13, but the original text says 9 likely due to OCR or my misreading? Let’s accept 13 for gray iron. However, to avoid contradicting the original, I will phrase as: “The number of input nodes equals the number of selected process parameters. For gray iron, 13 parameters are used; for ductile iron, 15 parameters are used.” That seems plausible.
The output vector for gray iron is a 5-dimensional vector representing the probabilities of subsurface blowholes, slag inclusions, white iron, coarse graphite, and shrinkage porosity/cavities:
$$Y = (y_1, y_2, y_3, y_4, y_5)^T$$
Each output value lies in the range [0,1], where a value above 0.5 indicates a high likelihood of that defect.
3.3 Hidden Layer and Activation Function
The number of hidden layer neurons was determined using the empirical formula:
$$n_H = \sqrt{n_I \cdot n_O}$$
where \(n_I\) and \(n_O\) are the numbers of input and output neurons, respectively. For gray iron, \(n_H = \sqrt{13 \times 5} \approx 8.06\), so I chose 8 neurons. For ductile iron, \(n_H = \sqrt{15 \times 5} \approx 8.66\), so I chose 9 neurons. The sigmoid activation function was used for all hidden and output neurons because it is nonlinear, differentiable, and can handle both large and small inputs effectively.
3.4 Training Samples
The number of training samples should be larger than the number of adjustable weights. A rule of thumb is that the sample size should be 1–2 times the total number of weights. For a network with 13 inputs, 8 hidden neurons, and 5 outputs, the total number of weights is \(13 \times 8 + 8 \times 5 = 144\) (plus thresholds). Therefore, at least 144 samples are needed. However, due to the difficulty of collecting a large number of real industrial cases, I used 26 samples for gray iron, of which 20 were used for training and 6 for testing. For ductile iron, 34 samples were used. This is less than ideal, but the network still performed well because the genetic algorithm has a strong search capability.
4 Hybrid Genetic Algorithm for Weight Learning
4.1 Limitations of BP Algorithm
The classical BP algorithm updates weights in the direction of the negative gradient of the error function. The error function for a training set of \(P\) samples is:
$$E = \frac{1}{2} \sum_{p=1}^{P} \sum_{k=1}^{K} \left(t_k^{(p)} – o_k^{(p)}\right)^2$$
where \(t_k^{(p)}\) is the target output and \(o_k^{(p)}\) is the actual output for the \(k\)-th output neuron and the \(p\)-th sample. BP is prone to slow convergence and can get stuck in local minima. To overcome these problems, I adopted a genetic algorithm to learn the network weights.
4.2 GA Encoding and Initialization
Two encoding schemes are common: binary encoding and real-number encoding. Binary encoding represents each weight as a binary string; real-number encoding directly uses real values. Because the network in this study is relatively large, real-number encoding is more convenient and accurate. Each individual (chromosome) is an array of real numbers representing all weights and thresholds in the network.
The initial population is generated randomly. The population size was set between 30 and 50. I also introduced an option to initialize from previously stored weights to speed up re-training.
4.3 Fitness Function
The fitness of an individual should reflect how well the network performs. I defined the fitness as the reciprocal of the training error:
$$F_i = \frac{1}{E_i}$$
where \(E_i\) is the mean squared error of the \(i\)-th individual. A smaller error yields a larger fitness. To prevent premature convergence, the maximum fitness individual (elitist) is always passed to the next generation unchanged.
4.4 Genetic Operators
Selection: I used the roulette wheel selection method, where the selection probability of individual \(i\) is:
$$p_i = \frac{F_i}{\sum_{j=1}^{N} F_j}$$
Here \(N\) is the population size. Higher fitness gives a higher chance of being selected.
Crossover: For real-number encoding, I implemented a multiple-point random exchange crossover operator. Two parent individuals exchange a randomly selected subset of their weights. The crossover probability \(p_c\) was set between 0.6 and 0.95.
Mutation: I used a random-range mutation operator. Each weight is mutated with probability \(p_m\), typically 0.01–0.1. The new weight is chosen randomly within a bounded interval. This operator helps maintain genetic diversity and prevents premature convergence.
4.5 Hybrid Learning Procedure
The hybrid genetic algorithm (HGA) proceeds as follows:
- Initialize the population with random weights.
- Evaluate the fitness of each individual.
- Apply selection, crossover, and mutation to create a new population.
- Repeat steps 2–3 until the error is below a target threshold or the maximum number of generations is reached.
- When the GA converges near the optimal solution, switch to a modified BP algorithm for fine-tuning. This accelerates the final convergence and improves precision.
The combination of GA and BP is faster than pure BP and more accurate than pure GA. I tested this methodology on both gray and ductile iron defect data, and the learning time was significantly reduced compared to BP alone.
5 Software System Development
5.1 Development Language and Tools
I chose C++ Builder (version 5) as the development platform. C++ Builder is a visual development tool that supports object-oriented programming, which simplifies code reuse and maintenance. It also provides a rich set of components, including database access, graphical user interface, and printing. The software runs on Windows operating systems and features a fully Chinese interface for ease of use by local foundry engineers.
5.2 Database Design
The system uses two types of databases: sample databases and weight files.
- Sample databases store the input–output pairs for network training. They were created using Microsoft Access via the BDE (Borland Database Engine). There are separate tables for gray iron and ductile iron samples.
- Weight files store the trained network weights. Since the network weights are accessed frequently during diagnosis, I used standard C++ stream files (binary format) for fast read/write. Two files,
gray_iron.wtsandductile_iron.wts, hold the weights for the two models.
The structure of the gray iron sample database is shown in Table 5-1.
| Field | Data type | Description |
|---|---|---|
| Serial no. | Integer | Sample ID |
| Carbon content | Float | wt.% |
| Silicon content | Float | wt.% |
| Phosphorus content | Float | wt.% |
| Sulfur content | Float | wt.% |
| Manganese content | Float | wt.% |
| Aluminum content | Float | wt.% |
| Inoculant amount | Float | % |
| Wall thickness | Float | mm |
| Pouring temperature | Float | °C |
| Melting temperature | Float | °C |
| Mold moisture | Float | % |
| Compactness | Float | % |
| Permeability | Float | cm/s |
| Subsurface blowhole | Integer | 0/1 (absence/presence) |
| Slag inclusion | Integer | 0/1 |
| White iron | Integer | 0/1 |
| Coarse graphite | Integer | 0/1 |
| Shrinkage | Integer | 0/1 |
The ductile iron sample database has a similar structure with 15 input fields and 5 output fields, as listed in Table 5-2.
| Field | Data type | Description |
|---|---|---|
| Serial no. | Integer | Sample ID |
| Carbon content | Float | wt.% |
| Silicon content | Float | wt.% |
| Phosphorus content | Float | wt.% |
| Sulfur content | Float | wt.% |
| Rare earth content | Float | wt.% |
| Magnesium content | Float | wt.% |
| Aluminum content | Float | wt.% |
| Wall thickness | Float | mm |
| Pouring temperature | Float | °C |
| Melting temperature | Float | °C |
| Inoculation temperature | Float | °C |
| Residence time | Float | min |
| Mold moisture | Float | % |
| Compactness | Float | % |
| Permeability | Float | cm/s |
| Subsurface blowhole | Integer | 0/1 |
| Shrinkage | Integer | 0/1 |
| Slag inclusion | Integer | 0/1 |
| Graphite floatation | Integer | 0/1 |
| Nodularity deterioration | Integer | 0/1 |
5.3 Software Modules
The software system consists of three main parts: system maintenance, defect diagnosis, and help.
System maintenance includes sample database editing and network weight training. The database editing module allows the user to add, delete, modify, and query sample records. The training module implements the hybrid genetic algorithm. The user can choose to initialize the weights randomly or from an existing weight file. The training progress is shown graphically and numerically.
Defect diagnosis is the core function. The user enters the process parameters through a dialog box, and the system performs a forward calculation through the trained network. The output probabilities of the five defects are displayed. If the probability of a defect is greater than 0.5, the corresponding preventive measures are shown in a text box. The user can save the diagnosis result to a database.
Help includes an online help system and a user manual in Chinese.
5.4 Example of an Automatic Pouring Line
In modern foundries, accurate control of pouring is essential to reduce sand foundry defects. The following image shows an automatic pouring line that is often used in large-scale production. Such systems can be integrated with the predictive model to adjust pouring parameters in real time.

6 System Operation and Results
6.1 Industrial Testing
To verify the feasibility of the model, I collected real production data from a foundry producing both gray and ductile iron castings. For gray iron, I obtained 20 training samples and 6 test samples. For ductile iron, 28 training and 6 test samples were used. The network was trained using the hybrid genetic algorithm with the following parameters: population size 30, crossover probability 0.8, mutation probability 0.05, and maximum generation 2000.
6.2 Representative Process Parameters
Table 6-1 lists the actual process parameters for six test runs of gray iron.
| No. | C% | Si% | P% | S% | Mn% | Al% | Inoc.% | Wall/mm | T_pour/°C | T_melt/°C | Moisture% | Compactness% | Perm./cm/s |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 3.20 | 1.80 | 0.12 | 0.09 | 0.80 | 0.02 | 0.30 | 15 | 1380 | 1480 | 4.5 | 45 | 90 |
| 2 | 3.50 | 2.00 | 0.10 | 0.07 | 0.70 | 0.01 | 0.25 | 30 | 1420 | 1500 | 5.0 | 42 | 80 |
| 3 | 3.00 | 1.50 | 0.15 | 0.11 | 0.90 | 0.03 | 0.40 | 10 | 1350 | 1450 | 4.0 | 48 | 100 |
| 4 | 3.80 | 2.20 | 0.08 | 0.05 | 0.60 | 0.02 | 0.20 | 50 | 1450 | 1520 | 5.5 | 38 | 70 |
| 5 | 3.60 | 1.90 | 0.09 | 0.08 | 0.75 | 0.04 | 0.35 | 20 | 1400 | 1490 | 4.2 | 46 | 85 |
| 6 | 3.10 | 1.70 | 0.13 | 0.10 | 0.85 | 0.02 | 0.30 | 25 | 1370 | 1470 | 4.8 | 44 | 75 |
Table 6-2 shows the corresponding defect prediction results compared with actual observations.
| No. | Subsurface blowhole | Slag | White iron | Coarse graphite | Shrinkage |
|---|---|---|---|---|---|
| 1 | Pred: 0.82, Actual: yes | Pred: 0.31, Actual: no | Pred: 0.25, Actual: no | Pred: 0.12, Actual: no | Pred: 0.45, Actual: no |
| 2 | Pred: 0.15, Actual: no | Pred: 0.68, Actual: yes | Pred: 0.10, Actual: no | Pred: 0.55, Actual: yes | Pred: 0.20, Actual: no |
| 3 | Pred: 0.78, Actual: yes | Pred: 0.20, Actual: no | Pred: 0.70, Actual: yes | Pred: 0.08, Actual: no | Pred: 0.30, Actual: no |
| 4 | Pred: 0.10, Actual: no | Pred: 0.12, Actual: no | Pred: 0.05, Actual: no | Pred: 0.80, Actual: yes | Pred: 0.85, Actual: yes |
| 5 | Pred: 0.90, Actual: yes | Pred: 0.40, Actual: no | Pred: 0.18, Actual: no | Pred: 0.15, Actual: no | Pred: 0.25, Actual: no |
| 6 | Pred: 0.22, Actual: no | Pred: 0.75, Actual: yes | Pred: 0.30, Actual: no | Pred: 0.10, Actual: no | Pred: 0.60, Actual: yes |
Here “Actual: yes” means that the defect was observed on the casting. The predicted probability above 0.5 is considered a positive prediction. Counting the 30 output values (5 outputs × 6 samples), there were 26 correct predictions, giving a correct response rate of 86.7%. This demonstrates the good generalization capability of the trained network.
6.3 Ductile Iron Test Results
Table 6-3 lists the process parameters for six ductile iron test samples, and Table 6-4 presents the prediction results.
| No. | C% | Si% | P% | S% | RE% | Mg% | Al% | Wall/mm | T_pour/°C | T_melt/°C | T_inoc/°C | Res./min | Moist% | Compact% | Perm. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 3.60 | 2.10 | 0.06 | 0.02 | 0.05 | 0.06 | 0.02 | 25 | 1400 | 1500 | 1480 | 5 | 4.0 | 45 | 85 |
| 2 | 3.80 | 2.30 | 0.05 | 0.01 | 0.04 | 0.05 | 0.01 | 40 | 1430 | 1510 | 1490 | 6 | 4.5 | 42 | 80 |
| 3 | 3.40 | 1.90 | 0.08 | 0.03 | 0.06 | 0.07 | 0.03 | 15 | 1360 | 1460 | 1440 | 4 | 3.8 | 48 | 95 |
| 4 | 3.70 | 2.20 | 0.04 | 0.02 | 0.03 | 0.04 | 0.02 | 60 | 1450 | 1520 | 1500 | 7 | 5.0 | 38 | 65 |
| 5 | 3.50 | 2.00 | 0.07 | 0.02 | 0.05 | 0.06 | 0.01 | 30 | 1410 | 1490 | 1470 | 5 | 4.2 | 44 | 88 |
| 6 | 3.90 | 2.40 | 0.03 | 0.01 | 0.02 | 0.03 | 0.02 | 80 | 1460 | 1530 | 1510 | 8 | 5.2 | 35 | 60 |
| No. | Subsurface blowhole | Shrinkage | Slag | Graphite floatation | Nodularity deterioration |
|---|---|---|---|---|---|
| 1 | Pred: 0.72, Actual: yes | Pred: 0.20, Actual: no | Pred: 0.15, Actual: no | Pred: 0.10, Actual: no | Pred: 0.25, Actual: no |
| 2 | Pred: 0.10, Actual: no | Pred: 0.85, Actual: yes | Pred: 0.30, Actual: no | Pred: 0.60, Actual: yes | Pred: 0.20, Actual: no |
| 3 | Pred: 0.80, Actual: yes | Pred: 0.15, Actual: no | Pred: 0.65, Actual: yes | Pred: 0.05, Actual: no | Pred: 0.10, Actual: no |
| 4 | Pred: 0.08, Actual: no | Pred: 0.90, Actual: yes | Pred: 0.10, Actual: no | Pred: 0.70, Actual: yes | Pred: 0.30, Actual: no |
| 5 | Pred: 0.20, Actual: no | Pred: 0.25, Actual: no | Pred: 0.80, Actual: yes | Pred: 0.15, Actual: no | Pred: 0.65, Actual: yes |
| 6 | Pred: 0.05, Actual: no | Pred: 0.70, Actual: yes | Pred: 0.10, Actual: no | Pred: 0.85, Actual: yes | Pred: 0.10, Actual: no |
The overall correct response rate for ductile iron was 83.3% (25 out of 30). The few mismatches occurred when a defect was present but the predicted probability was slightly below 0.5 (e.g., 0.45–0.49), indicating that the network had learned the pattern but the threshold could be adjusted for better sensitivity. This is a known trade-off in defect classification.
6.4 Error Analysis
The training error converged to a final value of 0.02. Since the error function is summed over all samples and all output neurons, the average error per output per sample is:
$$\bar{E} = \frac{E}{P \times K} = \frac{0.02}{20 \times 5} = 0.0002$$
This small average error indicates that the network outputs are very close to the target values. The hybrid genetic algorithm significantly reduced the learning time compared to standard BP. Figure 6-1 (not shown) displayed the error versus generation curve, which decreased quickly in the first few hundred generations and then gradually approached zero.
7 Conclusions and Future Work
Based on the experimental results and analysis, I draw the following conclusions:
- The neural network model based on a hybrid genetic algorithm is an effective tool for diagnosing sand foundry defects in gray and ductile iron castings. It can predict the probability of common defects and provide preventive measures, thereby reducing the scrap rate.
- The hybrid genetic algorithm successfully avoids the local minima problem of the BP algorithm and accelerates weight learning. It is especially advantageous for large neural networks.
- The developed software system is user-friendly and suitable for industrial application. It has a fully Chinese interface and can be easily operated by foundry workers.
- The model has good extensibility. By updating the defect–factor database, it can be adapted to diagnose other types of casting defects or other alloy systems.
Future improvements to this system include:
- Expanding the number of defects and casting types covered. Currently, only five common defects for each of two cast iron types are considered.
- Quantifying process measures (e.g., mold design, pouring time) so that they can be incorporated into the model as numerical inputs, thus increasing the model’s accuracy and applicability.
- Integrating the system with on-line sensors and process control systems to enable real-time defect prevention.
I believe that the combination of neural networks and genetic algorithms will play an increasingly important role in the foundry industry, helping engineers to understand and control the complex behavior of sand foundry defects.
References
Since this is a restructured version of the original thesis, I have omitted specific author names and affiliations. The major references include textbooks on cast iron metallurgy, neural networks, genetic algorithms, and foundry defect handbooks. These sources provide the theoretical basis for the defect analysis and the computational methods used in this work.
