Abstract
The selection of parameters affects the surface roughness in the additive manufacturing process. This study aims to determine the optimal combination of input parameters for predicting and minimising the surface roughness of samples produced by Fused Deposition Modelling on a 3D printer using a cascade-forward neural network (CFNN) and genetic algorithm. Box–Behnken Design with four independent printing parameters at three levels is used, and 25 parts are fabricated with a 3D printer. Roughness tests are performed on the fabricated parts. Models generated by the hybrid algorithm achieve the best results for predicting and optimising surface roughness in 3D-printed parts. The surface roughness prediction accuracy of the trained CFNN with optimised parameters is more accurate compared to previous random test results.
Keywords
Introduction
Additive manufacturing (AM) is one of the latest manufacturing revolutions and future-proof technology that provides 3D manufacturing by adding layers to the previous layer of the material [1]. AM has many advantages, such as fast fabrication, material, and time-saving compared to traditional subtractive fabrication [2]. As a result of the developments in printer technology, 3D fabrication, which was previously used only by designers, is now preferred to produce final products in many industrial applications. This technology fabricates parts for critical industrial areas such as automotive, robotics, space, aviation, and energy sectors [3–6].
The features of AM, such as printing complex structures, rapid fabrication, and improving mechanical properties, have led to the development of 3D manufacturing [7]. The various processes can be classified depending on: (a) the raw material; and (b) the physical joint between the material. There are various available technologies, such as Fused Deposition Modelling (FDM), Stereolithography (SLA), and Selective Laser Sintering/Melting (SLS/SLM) [8–11]. The most widely used among these technologies is the FDM. The main properties of FDM are its wide choice of materials, low equipment cost, high equipment strength, and not time-consuming. In addition, thin-walled structures have disadvantages such as difficulty obtaining and poor surface quality [12,13].
The performance, quality, and surface roughness of the samples depends on the printing parameters of the 3D printer during fabrication with FDM. It is necessary to work on the fabrication process parameters with FDM to obtain the desired surface quality [14]. Examining the effect of 3D printing parameters on the response properties of FDM samples helps us adjust the level of process parameters that improve the quality of manufactured parts [15–17]. Although there are many parameters, the four printing parameters that most affect the surface roughness were selected in the current study.
Process optimisation studies are carried out in 3D printing [18,19]. These studies cover extrusion temperature, sample orientation, and base thickness. Moreover, controllable input parameters such as printing speed, table temperature, wall thickness, layer height, and fill rate also affect the quality of the final products. Surface roughness is the most critical factor affecting product quality in mass fabrication. The formation mechanism of this roughness is complex and depends on the manufacturing process. Surface roughness measurements performed in many industrial applications are essential to the quality control process [20–22].
Considering the common usage areas of AM, the need for the final product to have a good surface quality is increasing. Thus, research on predicting and optimising the AM process and its applications in new fields have increased significantly. ML algorithms should be used to realise this process. Many studies have investigated the effects of FDM-based 3D printers on fabrication parameters and surface roughness output. For instance, Li et al. [23] used six different ML methods to estimate the surface roughness of 3D-printed PLA samples. Devicharana et al. [24] FDM examined the printing quality of the parts by controlling the input parameters. It is foreseen that the obtained results will significantly contribute to improving the quality problem. Altan et al. [25] investigated the surface roughness and tensile strength of PLA samples fabricated with AM.
The current studies show that the surface roughness of the final product fabricated with AM depends on the printing parameters. However, in examining surface roughness, it was observed that there is a very limited publication on the estimation and optimisation of the fabrication process depending on the level and factors of the printing parameters. Optimisation is an adequate method to improve part performance in surface roughness. In the present study, the surface roughness of the AM parts, which needs to be adequately studied in the literature, is handled in terms of estimation and optimisation using ML.
In this study, the surface roughness of the samples fabricated from PETG was investigated by real-time experimental studies. The parameters affecting the fabrication process were examined with the Box–Behnken Designs (BBD), a response surface design (RSD) method, and the effect of the experimental parameters on the test result was examined, and a minimum number of experimental designs were created. Samples designed with BBD were fabricated with an FDM-based 3D printer. A data set of 25 samples was obtained by determining the four factors and three levels most affecting roughness. A cascade forward neural network (CFNN) is trained with these data. The number of hidden layers, training method, and activation function parameters used in the training of CFNN were optimised using genetic algorithms (GA).
Materials and methods
Experiment apparatus
The final product's surface roughness in AM is essential regarding the parts’ appearance and cost and time savings. The biggest problem with the FDM compared to other AM techniques is that the surface roughness of the final products is high. The main reason for this is the layer-by-layer processing process.
FDM-based printers are devices that produce products by injecting filament material through a nozzle that is held at a specific temperature. It is possible to fabricate products with different geometries using this method, which fabricates products from thermoplastic materials. The thermoplastic material, which is wound on a specific spool and has a specific thickness, is moved by feeders and passed through a nozzle at a specific temperature and has a temperature control unit on it (Figure 1(a)).
FDM-based AM process. (a) FDM printing process. (b) Samples of printed parts.
Factors and levels used in BBD, Experimental Design Model Statistics and Anova analysis.
The surface roughness of the parts was measured using the Mitutoyo® Surftest SJ-210 model with a sampling length of 2.5 mm and a measuring speed of 0.75 mm/s. The surface roughness of all the parts was measured twice to minimise measurement errors that may occur.
Design of experiment
In this study, the effects of the input parameters of the AM process are investigated. The experimental design uses the BBD as shown in Figure 2. A Multilayer Perceptron (MLP) is trained using the data set generated from the measurements obtained from the experimental studies. The MLP training parameters are optimised using GA. The results of comparing the outputs of the optimal model and the experimental findings are discussed.
Experimental and optimisation process.
After conducting 3D printing experiments, to understand the performance and the effect of parameters on the surface quality, experiments use four factors that affect surface roughness in 3D printing. The factors considered include nozzle temperature (Nt), layer thickness (Lt), printing speed (Ps), and wall thickness (Wt), which are tested at three levels and designed using the BBD. The domain and coded levels for the variables of the AM process are presented in Table 1.
BBD with four independent variables is performed at three levels (− 1, 0, and 1) (Table 1). Values of 100, 200, and 300 µm were chosen for layer thickness. The first one is the minimum recommended by the predefined options of the Zaxe software. The second and third one is a higher value, which was selected expecting an increase in surface roughness as it was identified in the literature. A value of 40, 80, and 120 mm/s was selected for printing speed. The first one is a speed lower than that recommended by the manufacturer. The second one is the average printing speed value. The third one is a value of 80 mm/s, the maximum recommended. Values of 0.5, 1, and 1.5 mm were selected for wall thickness, considering that wall thickness should be higher than two times the size of the nozzle extruder (0.4 mm). For nozzle temperature, a maximum value lower than the one recommended by the PETG manufacturer (260°C) was selected, i.e. 240°C and 230°C and, as a minimum value, 220°C was selected that lies slightly below the minimum recommended (230°C).
Box–Behnken design
Reducing the number of experiments needed for studies that analyse and model the parameters that affect fabrication is an important issue. The number of experiments should be minimised by considering factors such as the material used and the time and labour required for fabrication. BBD method, a Response Surface Methodology (RSM) approach, generates experimental design matrices and suggests a specific number of experimental designs based on the influence of the parameters on the experiment on the experimental results. In this study, a test design was conducted using the BBD with surface roughness as the response variable and layer thickness, printing speed, wall thickness, and nozzle temperature as the input parameters. Equation (1) shows the linear relationship between the output parameter roughness and the determined parameters, as suggested by the BBD [26].
is an estimated surface roughness,
are the input parameters, and
are coefficients of the estimated response function for roughness.
Cascade forward neural network
The relationship between the input parameters and roughness can be modelled linearly by training a CFNN structure with the data obtained from the experiments determined by the experimental design method. The network shown in Figure 3 is a two-layer network, and the results obtained after training are provided. The CFNN allows solving deep and complex problems by connecting the inputs and outputs. The CFNN consists of multiple layers of interconnected nodes, where the output of one layer serves as the input to the next layer.
Architecture of optimisation process with GA.
The output layer is directly connected to the input and hidden layers. The CFNN can explain the nonlinear relationships between the input and output without eliminating the linear relationships. Instead, it captures the linear and nonlinear relationships, providing a complete picture of the underlying data [27].
is the output of the network,
are the activation functions of the network layers, and
are the inputs, and
are the weights. The expected output (
) can be used with the following quadratic performance model to update these weights.
Here, J is the loss function,
is the output of the network, and d is the expected output. The weights can be updated as follows by taking the partial derivative of this model with respect to w.
is the momentum constant and is used to prevent the optimisation from getting stuck in local minima. In addition to the method known as gradient descent, many algorithms can be used to train the predicted network, such as quasi-Newton backward propagation (BFG), resilient backpropagation (RPROP), conjugate gradient backpropagation with Powell-Beale (CGB), with Fletcher-Reeves (CGF), with Polak–Ribiere, and Levenberg-Marquardt backpropagation, One Step Secant, etc. The activation function, which also affects the training, can also affect the training and test success of the network, such as tangent hyperbolic, logarithmic sigmoid activation functions [28].
Optimisation process with genetic algorithm
Genetic Algorithms (GA) are intuitive optimisation techniques based on evolutionary computation. Each candidate solution determined in the solution space is called an individual in GA. Based on the successful results obtained from testing individuals with the cost function, the next-generation solution suggestions are fabricated through mating and mutation from the previous generation. The optimal result will be found because of the selection pressure of successful examples throughout the generations. Each coded sequence suggested by GA for the solution is called a chromosome or an individual (Figure 3).
Each chromosome has as many genes as the number of variables in the solution space. The fitness value
of a population
with high
is selected with selection algorithms, increasing the probability of seeing their genes in the next generation
. New individual chromosomes are created according to the crossover rules determined because of the selection
. This process enables the transfer of genes that contribute positively to success in each generation and reduces the frequency of others in the population. In addition to crossover, mutation is applied on randomly determined genes at a certain rate to preserve gene diversity in each generation transition (
). The next generation is created with newly created chromosomes and selected ones from previous chromosomes. Equation (5) gives the optimisation process functions.
is best solution,
is previous generation,
is new generation, and
are the function of fitness, function of selection, and function of mutation, respectively.
Results and discussion
BBD design results
After determining the roughness value of each sample, the input and output data matrix was completed. The designed experiments and surface roughness of each sample are listed in Table 1. The effect of each linear model parameter on the estimation result can be examined through the standard error and ρ values.
The Lt (
) value is seen as the parameter that has the greatest positive effect on the roughness variable (Table 1). In contrast, Ps (
) has a negative effect. The linear model equation obtained using the calculated coefficients is given in Equation (6). This function shows the relationship between roughness and the parameters of layer thickness, printing speed, wall thickness, and nozzle temperature.
The effect of the other binary variables can be seen in Figures 4(a) and 4(f). The effect of Print Speed on roughness is nonlinear as seen in figures. The experiments made with the parameters obtained by the BBD can be seen in Table 2. These data were used for CFNN training. The number of experiments was limited to 25 with the BBD experimental design method.
BBD Estimated function of surface roughness as the function of print speed, nozzle temperature, layer thickness and wall thickness. Experimental data: results for surface roughness using FDM process parameters.
The best surface quality was measured as 16.0260 µm in experiment number 17. The layer thickness, printing speed, wall thickness, and nozzle temperature are 100 µm, 120 mm/s, 0.5 mm, and 210°C, respectively. The layer thickness is the most critical parameter affecting the surface roughness of the parts fabricated by AM. 2x reduction of this parameter reduces the roughness by approximately 60%. Increasing this parameter by 2x reduces the roughness by approximately 20%. The parameters that affect the surface roughness the least are wall thickness and nozzle temperature. Increasing these parameters negatively affects the roughness. Low wall thickness and nozzle temperature should be selected for high surface quality.
Cascade forward neural network results
To solve the problem, the proposed CFNN model needs to determine the number of neurones in the first hidden layer (FHLS), the number of neurones in the second hidden layer (SHLS), the training method (TM), and the activation function (AF). A number of combinations can be created for training parameters within certain ranges. When FHSL is 1-50, SHLS is 1-50, TM is 1–8 (SCG, BFG, RPROP, CGB, CGF, CGP, GDX, LM), and AF is 1–2 (tan-sig, log-sig), approximately
training repetitions are required for 500 repetitions for each data set. When some of these experiments were conducted, for example, for FHLS and SHLS in turn, 10 and 1 and for SCG training method with tan-sig activation function, the performance (mse) ranged from 0.0025 to 0.2738 when the training was repeated 500 times. The standard deviation of this performance range is 0.0242. Individual training was carried out with different parameters, and the minimum mse was calculated as 0.0017 at the end of all training. The other parameters that were kept constant for this experiment are as follows: maximum epoch is 1000, maximum validation checks is 6, scaling factor used to adjust the size of the weight change
is
and amount of weight decay regularisation applied to the weight updates
is
.
Hybrid CFNN and GA results
The training function created was optimised using the GA optimisation method to find the best solution using the determined parameters. Details of the optimisation process performed with a GA are shown in Figure 5. The first row of subplots shows each generation's best and average fitness values for 50 generations, demonstrating the current best individual optimum solution. The fitness values for each individual for the current iteration and the new individuals derived from each individual for the next generation can be seen respectively in the second row. The optimisation process was carried out using a GA with 50 individuals and 50 iterations for the network training performance in Figure 5. The GA evaluated each individual's fitness function over multiple generations and identified the best performing individual. The fitness value is the test MSE value obtained for each CFNN training. The resulting parameter vector for this best individual was [2,1,4,1], which produced the highest level of performance for the neural network among all the individuals tested in the optimisation process. These correspond to the number of neurones in the first hidden layer as 2, the number of neurones in the second hidden layer as 1, the training method as ‘CGB’, and the activation function as ‘tansig’. When the recommended parameters were repeated in the experiment described in Table 2, the standard deviation was found to be 0.0135, the maximum mse was 0.1493, and the minimum mse was 0.0012 for 500 repetitions of the experiment. The previous test results of the training conducted with randomly selected training parameters were calculated to have an average standard deviation of 0.0232, an average maximum mse of 0.2440, and an average minimum mse of 0.0021. The model suggested by GA is much better than the previous experiments.
GA training process graphs.
The results of the training and testing performed with the model recommended by GA are shown in Figure 6. The success rate between the predicted and test data is 97.63%. The predicted values of the proposed model with a 40 different test roughness data set that was never used in training and the BBD process are compared (Figure 6(a)) as normalised. The regression graph of these values is shown in Figure 6(b). According to this, the prediction coincides with the test data at a rate of 0.9763. This R-value is the correlation coefficient between the test and output data. It can also be seen that some roughness values unexpectedly yield negative outputs in Figure 6(a), indicating the absolute errors of the model. The optimisation performed using GA was completed in 250 s. All optimisation and CFNN training were performed in MATLAB.
GA training process and results. (a) Test Results comparison. (b) Test Result and Real Values.
Conclusion
The present study investigates the surface roughness achieved in AM processes through an experimental investigation. A range of manufacturing parameters was varied and the results were analysed through graphical and statistical analysis. The parameters affecting the fabrication process were examined using the BBD, and a minimal number of experimental designs were created. A dataset of 25 samples was obtained by identifying the four factors and three levels that had the most impact on roughness. The results showed that layer thickness directly affected surface roughness, with an increase in roughness as layer thickness increased, which is consistent with previous studies. The direct effect of layer thickness on surface roughness is that thinner layers make the layers less visible. Increasing the wall thickness and nozzle temperature increased the surface roughness.
The primary goal of this study is to determine the optimal combination of input parameters to predict and minimise the surface roughness of samples fabricated by a 3D printer using a CFNN optimised by GA. Therefore, after training with a multilayer perceptron neural network with a determination coefficient, the experiments matrix was combined to determine the optimum composition of the input parameters with the GA. On the other hand, the validation has been done for optimal parameters of the BBD.
Based on the validating results, it was found that the hybrid CFNN and GA, and BBD have a high ability to optimise and predict the roughness of parts printed with the 3D printer. The hybrid algorithm with a mean absolute percentage error (MAPE) of 3.37% and the BBD with a MAPE of 9.62% can predict and optimise printed samples. This way, the optimisation results show that BBD and hybrid algorithms can predict the optimal parameters with an error of less than 10%. Consequently, both optimisation methods have decreased surface roughness, despite the ability of the hybrid algorithm in this area being greater.
Footnotes
Disclosure statement
No potential conflict of interest was reported by the authors.
Data availability statement
All data underlying the results are available as part of the article and no additional source data are required.
Ethical approval
The author declares that this study does not require ethical approval.
