1 Introduction

Since the dawn of rapid manufacturing, additive manufacturing (AM) has become one of the remarkable and popular ways of fabrication in the manufacturing world. AM is a method in which engineers can create models by adding successive layers of feedstock material adhered together (Ref 1). Fused deposition modeling (FDM) is a solid-based rapid prototyping technology by which a sample is created by successive deposition of polymeric layers from a print head (Ref 2). The schematic of 3D printing by fused deposition modeling is shown in Fig. 1 (Ref 3). FDM offers several advantages such as low machine costs, mold dimension accuracy, and time savings (Ref 3). Owing to its advantages, FDM is widely used in manufacturing areas to contribute to improvements in the design and commercialization of products (Ref 4). The required low temperature, the ability to be solidified fast, and the inverse correlation between temperature and viscosity make the amorphous polymers good candidates in FDM (Ref 5).

Fig. 1
figure 1

Schematic of 3D printing by the fused deposition modeling (Ref 3)

A large number of FDM processes were investigated by artificial intelligence techniques, design of experiment (DOE), or evolutionary algorithm to study the effect of FDM parameters on the build quality (Ref 6). Some of these parameters, such as material density, fill density, and extrusion temperature, were investigated to see how they affected the mechanical properties of different materials, including acrylonitrile butadiene styrene (ABS), polyethylene terephthalate glycol (PETG), and multi-materials (Ref 7). Understanding the correlation between process parameters and the component properties is an effective approach to optimize the process (Ref 8). Response surface method (RSM) is a widely used tool to correlate the process parameters with the component properties (Ref 9). The regression model obtained by this method provides this opportunity to optimize the process. Artificial neural network (ANN) (Ref 10) and genetic algorithm-artificial neural network (GA-ANN) were also utilized to optimize the procedure (Ref 6). Results indicated that there is a fundamental relation between the tensile strength, extrusion temperature, and infill density (Ref 8). The processing parameters including extrusion or nozzle temperature, infill density, and infill pattern are believed to affect strongly feature qualities, mechanical properties, and build time of the ultimate part (Ref 5). The important role of layer thickness, infill percentage, and extruder temperature was reported by Moradi et al. (Ref 11, 12). The objective of the optimization can vary from case to case. For example, obtaining a high maximum failure, shortening the build time and part weight was the main objective of the investigation performed by Moradi et al. (Ref 13). It was reported that the layer thickness and infill percentage were the most influential parameters in determining the failure load, build time, and part weight (Ref 14). Moradi et al. investigated the effect of layer thickness, infill percentage, and extruder temperature on the maximum failure load, thickness, and build time of bronze polylactic acid (Br-PLA) composites using the DOE process (Ref 15). Results indicated that layer thickness is the core element in obtaining the maximum failure load. Augmentation of the layer thickness and the infill percentage caused a significant improvement in the mechanical properties (maximum failure) (Ref 16). Grden et al. examined the fracture behavior of printed specimens produced by a new filament deposition method (Ref 2). The new filament contributed to a 30% improvement in toughness and caused enlargement of the deformation zone. Sajan et al. (Ref 17) considered bed and nozzle temperature, print pace, infill percentage, thickness, and the number of loops as input parameters to improve circularity and surface roughness of a grinder blade made of acrylonitrile butadiene styrene (ABS). In another study, the Taguchi method was used to achieve the optimal process parameters, and this improved the surface quality in the XY and XZ planes (Ref 18). In addition to the aforementioned parameters, void and raster orientation affect the quality of the build (Ref 19).

Demands on special mechanical properties of the build necessitate the regulation of the FDM parameters (Ref 20, 21). It is also important to know the effect of process parameters on the build quality. ANN is a strong tool to model the processes (Ref 22, 23). The RSM is regarded as a modeling process used by experimental research to evaluate the efficiency and the effect of the parameters. In the present study, both ANN and RSM were used to model and investigate the effects of contour numbers, infill percentage, and layer thickness on strength and modulus. Regulating controlled variables to produce tough ABS + specimens, reducing part weight, and minimizing build time of the printing parts were the main objectives (Ref 24). The details of such measurements are provided in reference (Ref 25). Tensile tests were used to determine the maximum failure load and elastic modulus. The output data were used along with the input parameters to establish a model by using an artificial neural network (Ref 26). Validation of the obtained model was confirmed by using some untrained data, named test series (Ref 27).

2 Methodology and Experimental Work

ABS is a three-monomer amorphous polymer made up of acrylonitrile, butadiene, styrene, and an opaque and oil-based thermoplastic. What contributed ABS to be a popular material is its versatility. ABS' products can be used in a variety of domestic, industrial, and specialist settings all over the world. Chemical and thermal stability is provided by the acrylonitrile in ABS, while hardness and strength are added by the butadiene. The styrene gives the finished polymer a nice, glossy finish. ABS has a low melting point, allowing it to be used in injection molding and 3D printing with ease. It also has high tensile strength and is chemically and physically resistant, allowing the finished plastic to withstand heavy use and harsh environmental conditions. ABS has been instrumental in the growth and development of 3D printing. ABS parts are inexpensive and simple to mold into the desired shape and effect. ABS can be heated and cooled multiple times which makes it an environmental material. It is considered to have a very high impact, tensile strength, and aesthetic qualities. It is also a cost-effective material and easy to use for fabricating complex shapes without extra effort.

ABS 3D printing specimens were obtained by fused deposition modeling (FDM). The performance of the 3D printer is easy to be tracked and can be adjusted accurately. Therefore, simplify 3D was used to adjust the specimens’ parameters. Based on international standard ISO 527-2, the tensile sample was designed by Solidwork software and imported to Simplify 3D.

Table 1 shows the considered independent variables. 17 samples were printed in diverse settings mentioned in Table 2 and drawn on a design of experiment to scrutinize the effects of input parameters distinctively. Material properties are mentioned in Table 3. Table 4 shows the assigned parameters which are identical for all experiments. Moreover, Fig. 2 represents the geometrical dimensions and internal patterns of samples. The filament was carried by two rollers, and thereafter, a heating element melted the material by designating three input parameters. Then, the pressure by the rollers was applied to drive the material and deposit the first layer. By moving the platform down, the nozzle printed the next layers.

Table 1 Levels of independent variables
Table 2 Design matrix and experiment results
Table 3 Material properties
Table 4 FDM build parameters
Fig. 2
figure 2

Geometrical dimensions and internal features of 3D printing of acrylonitrile butadiene styrene (ABS). (a) Dimensions of the tensile test sample according to ASTM-D638 type-IV and (b) 3D-printed samples

Tensile test results were used to determine the maximum failure load and elongation at break. Tensile tests were performed in accordance with ASTM D638 in a universal testing machine. The brittle fracture of a sample is presented in Fig. 3. Based on the results, the samples’ behavior could be categorized as a brittle or tough fracture. The brittle samples fracture at the elastic limit, while the tough specimens experienced a low degree of plastic deformation before fracture.

Fig. 3
figure 3

(a) Tensile test. (b) Brittle fracture of a tensile specimen

2.1 Methodology of Data Analysis

ANN is a robust tool for analyzing the data that can relate the input parameters to output responses. ANN has a structure like neurons that these neurons are correlated with each other by a transfer function. Variables, treated as neurons in a 1st layer, are connected through a transfer function to several neurons that are set in a hidden layer. The hidden layer is also connected to the output with a transfer function. Figure 4 depicts the ANN structure. In the present research, the input parameters (first layer) are the experiment parameters, i.e., contour numbers, thickness, and infill percentage. The outputs are UTS and modulus.

Fig. 4
figure 4

ANN structure

To train the model by ANN, some data were randomly selected as training data series (85% of data) among which some were considered for validation of the training process to avoid overfitting. Finally, the rest data which were not included in the training stage were selected as test data sets to assess the accuracy of the model. The model’s ability to predict new experimental conditions is evaluated using these results. In this analysis, 70% of the data were chosen as a training series, 15% as a validation series, and 15% as a test series. Up to two hidden layers and different numbers of neurons (5-15) and different types of transfer functions (logsig-tansif-linear) were chosen to train the model. After a sufficient number of runs, the optimal ANN was discovered, ensuring that the error achieved in the prediction of the test data series was minimum. Matlab software was used to carry out the whole process.

To figure out how important each variable is in determining the outputs, main effects plots were drawn based on the data generated by the neural network model. If the number of data increases, the precision of the main effect plots improves. Furthermore, to obtain the interaction plots, enough combinations of data are needed. When there are three variables and four levels, the required number of data combinations is 43 = 64. To put it another way, a factorial design is needed, which takes time to complete all the tests. With only a limited number of experiments, ANN can produce all of the required data. Since an accurate ANN model can predict the performance for any combination of variables without having to run experiments on certain variables, it’s a great way to save time. To make sure that the ANN model is accurate, it is necessary to perform a rational design of experiments. The design of experiments in regular regression methods such as the RSM is extremely reliable because they cover the required range of all variables through a minimum of experiments. The simple quadratic functions are potent to make a regression over the range of variables with acceptable accuracy. ANN is capable of doing this regression with much higher accuracy. In this study, a central composite design method was used to design the experiments. The essential data were created by the obtained model after obtaining an accurate ANN model.

Following, the produced data were used to create main effects and interaction plots. The input variables and their coded and uncoded levels are presented in Table 5.

Table 5 Input variables and their coded and uncoded levels

RSM is a structured and arranged method to identify relationships between factors affecting a process and the output of the process. Design-Expert V8 software was exploited for statistical analysis of experimental data via RSM (Ref 28,29,30). Finally, main effects plots were generated by the obtained ANN and RSM models to assess the trends of influence of each variable on the characteristics of the obtained ABS +.

3 Results and Discussion

The results of the experimental work are provided in Table. 2. For each output, a separate ANN model was considered, as this makes the model more accurate. The chosen ANN models have an accuracy of more than 90% in the prediction of the untrained data. The accuracy is obtained from the relative error (e) which is obtained from:

$$ e = \frac{1}{n}\mathop \sum \limits_{1}^{n} \frac{{\left| {G_{{{\text{target}}}} - G_{{{\text{output}}}} } \right|}}{{G_{{{\text{target}}}} }} \times 100 $$
(1)

where \({G}_{\mathrm{target}}\) and \(G_{{{\text{output}}}}\) are the expected output values and the values obtained by modeling, respectively. “n” is the number of data. The “root mean square error” (RMSE) is another criterion used to assess the model accuracy and is obtained from:

$$ {\text{RMSE}} = \sqrt {\frac{1}{n}\mathop \sum \limits_{ }^{ } \left( {G_{{{\text{target}}}} - G_{{{\text{output}}}} } \right)^{2} } $$
(2)

The correlation coefficient (R) is a measure of the linearity of target and output values and is obtained from:

$$ \left( R \right) = \frac{{n\mathop \sum \nolimits_{ }^{ } \left( {G_{{{\text{target}}}} G_{{{\text{output}}}} } \right) - \mathop \sum \nolimits_{ }^{ } \left( {G_{{{\text{target}}}} } \right)\;\mathop \sum \nolimits_{ }^{ } \left( {G_{{{\text{output}}}} } \right)}}{{\sqrt {\left[ {n\mathop \sum \nolimits_{ }^{ } G_{{{\text{target}}}}^{2} - \left( {\mathop \sum \nolimits_{ }^{ } G_{{{\text{output}}}} } \right)^{2} } \right]\left[ {n\mathop \sum \nolimits_{ }^{ } G_{{{\text{target}}}}^{2} - \left( {\mathop \sum \nolimits_{ }^{ } G_{{{\text{target}}}} G_{{{\text{output}}}} } \right)^{2} } \right]} }} $$
(3)

It is most desirable that R be close to 1.

The optimum ANN models obtained for each output and the corresponding error, for both preparation and testing, the root mean square error and correlation coefficient, and test data series are provided in Table 6.

Table 6 Optimum ANN models were obtained for each output and the corresponding error, root mean square error, and correlation coefficient for both training and test data series

3.1 UTS Modeling

The results of the ANN model plotted as the target values versus output values are presented in Fig. 5(a) and (b) for training and test data series, respectively.

Fig. 5
figure 5

Results of ANN model plotted as the target values vs. output values of UTS for (a) training data series and (b) test data series

The main effects plot for UTS is shown in Fig. 6. Among the three variables, the contours number has the most effect on the UTS, and with increasing the contour number, the UTS increases. The same trend is observed for the two other variables but with a lower effect. The main effect plots obtained from RSM modeling are presented in Fig. 7. The same trend as ANN can be observed here.

Fig. 6
figure 6

Main effects plots for UTS obtained from ANN modeling

Fig. 7
figure 7

Main effects plots for UTS obtained from RSM modeling

3D plots of UTS versus the contour numbers and thickness are presented in Fig. 8. The plots correspond to 3 levels of infill percentage. The highest UTS is obtained at maximum contour numbers, maximum thickness, and maximum infill percentage.

Fig. 8
figure 8

3D plots of UTS vs. the contour numbers and thickness at three levels of infill percentage obtained by ANN

3D plots obtained by RSM modeling are provided in Fig. 9. Likewise ANN modeling, the contour number has the main effect on UTS, and by increasing the contour number, the UTS is improved. The infill percentage does not affect the UTS. By increasing the layer thickness, the part thickness is divided into a fewer number of sections, and therefore the specimen printed by a thicker layer consists of less interlayer adhesion than a specimen with a thinner layer. Therefore, increasing layer thickness directly results in less interlayer adhesion. Also, the thicker layer causes a lower heat transfer rate which results in improving interlayer adhesion. That is why the printing of specimens with a thicker layer ends up with tougher properties. Increasing the contours similar to increasing the infill density increases the failure force.

Fig. 9
figure 9

3D plots of UTS vs. the contour numbers, thickness, and infill percentage obtained by RSM

Based on both RSM and ANN models, the trend of the effect of contours number is dependent on the infill percentage. The analysis of variances by RSM modeling is provided in Table 7. In the analysis of variance, the alpha value in F value is considered to be 0.05, which indicates that if the probability of P in the analysis of variance is less than 0.05, the relevant parameter with a probability of more than 95% is effective. Also, the values of R indicate the good accuracy of modeling by RSM.

Table 7 The analysis of variances (ANOVA) for UTS obtained by RSM modeling

The regression equation obtained from the RSM model for coded values is obtained as follows:

$$ \begin{gathered} {\text{UTS }}\left( {\text{N}} \right) = 32.281 + 4.089\;{\text{Contours}}\;{\text{number}} \hfill \\ \quad \quad \quad \quad \quad \; + 1.100\;{\text{Layer}}\;{\text{thickness}} + 0.459\;{\text{Infill}}\;{\text{percentage}} \hfill \\ \quad \quad \quad \quad \quad \; - 0.773\;{\text{Contours}}\;{\text{number }} \times {\text{ Infill}}\;{\text{percentage}} \hfill \\ \end{gathered} $$

The interaction between contours number and the infill percentage is obvious from this equation.

3.2 Modulus

The results of the ANN model plotted as the target values versus output values are presented in Fig. 10(a) and (b) for training and test data series, respectively.

Fig. 10
figure 10

Results of the ANN model plotted as the target values vs. output values of modulus for (a) training data series and (b) test data series

Figure 11 shows the main effects plot according to ANN modeling. The contour numbers and infill percentage have similar trends, and the modulus is increased as they increase. The effect of the thickness is negligible.

Fig. 11
figure 11

Main effects plot for modulus obtained by ANN

Figure 12 shows the main effects plot obtained by RSM modeling. The trend of contours number and layer thickness is similar for both RSM and ANN modeling. A slight difference in the case of infill percentage is observed for the two models. While the ANN model predicts that the modulus increases with infill percentage, the RSM model predicts a decreasing trend at the high values of infill percentage.

Fig. 12
figure 12

Main effects plot for modulus obtained by RSM

The 3D plots obtained by ANN modeling are presented in Fig. 13. A strong interaction exists between contour numbers and infill percentages at their highest values. When the infill percentage is high, the increase in contour numbers results in a steep increase in modulus. In other words, the highest modulus is obtained when the infill percentage and contour numbers are at their highest level.

Fig. 13
figure 13

3D plots of modulus vs. the contour numbers and thickness at three levels of infill percentage obtained by ANN

The 3D plots obtained by RSM are presented in Fig. 14. Both RSM modeling and ANN modeling infer that by increasing the infill percentage the elastic modulus is increased. Also, the ANN model states that the effects of infill percentage and contour numbers are correlated, and the effect of contour number is higher at a higher infill percentage. This correlation is not obvious in 3D plots obtained by the RSM model. Also, both models show that the thickness has the lowest effect on modulus.

Fig. 14
figure 14

3D plots of modulus vs. the contour numbers, thickness, and infill percentage obtained by RSM

The analysis of variances by RSM modeling is provided in Table 8. In the analysis of variance, the alpha value in F value is considered to be 0.05, which indicates that if the probability of P in the analysis of variance is less than 0.05, the relevant parameter with a probability of more than 95% is effective. Also, the values of R indicate the good accuracy of modeling by RSM.

Table 8 The analysis of variances (ANOVA) for modulus obtained by RSM modeling

The regression equation obtained from the RSM model for coded values is obtained as follows:

$$ \begin{gathered} {\text{Elastic}}\;{\text{Modulus}}\left( {{\text{MPa}}} \right) = 1173.7 + 121.2\;{\text{Contours}}\;{\text{number}} \hfill \\ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \; + 32.2\;{\text{Layer}}\;{\text{thickness}} + 83.7\;{\text{Infill}}\;{\text{percentage}} \hfill \\ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \; - 30.6\;{\text{Layer}}\;{\text{thickness }} \times {\text{ Layer}}\;{\text{thickness}} \hfill \\ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \; - 30.5\;{\text{Infill}}\;{\text{percentage }} \times {\text{ Infill}}\;{\text{percentage}} \hfill \\ \end{gathered} $$

The coefficients in the regression equation for coded values are indicative of the importance of each variable. In this case, according to the above equation, the contour number has the most influence on the elastic modulus.

To have a comparison between ANN and RSM, the values of R obtained for prediction are presented in Table 9. According to this table, the accuracy of prediction obtained by the ANN model is higher than the one obtained by RSM, especially for the prediction of modulus. This is attributed to the fact that in RSM a simple regression is used while in ANN a complex relationship is established during training between the inputs and outputs. This is achieved by the selection of the right weight function and choosing the optimum coefficients during the training.

Table 9 R values for both UTS and modulus were obtained in ANN and RSM

According to Table 9, the ANN resulted in more precise modeling of both UTS and modulus than the modeling by RSM, though the difference is negligible. The drawback of ANN modeling is that a huge number of data are needed to accurately model the process.

4 Conclusions

Improving mechanical properties to minimize component weight and build time as much as possible was the research’s final goal to investigate fused deposition modeling of ABS. By ANN and RSM, the effects of layer thickness (LT), infill percentage (IP), and contour numbers (C) on UTS and elastic modulus were investigated, and the following results were obtained:

  1. 1.

    The results indicated that as the contour numbers increase, the mechanical properties (maximum failure load) improve.

  2. 2.

    The contours number plays the most effective role in the specimens’ improvement compared with layer thickness and infill percentage.

  3. 3.

    The mechanical properties of the structure depend slightly on the layer thickness, which indicates that a part can be fabricated fast by increasing the layer thickness without any influence on the build properties. The elastic modulus was mainly dependent on the infill percentage.

  4. 4.

    The results of both RSM and ANN stated that the mechanical properties of the build can be controlled by changing the process variables individually, as the interaction between the variables is negligible. A slight interaction between infill percentage and contour numbers was observed in the case of UTS which according to both models can be neglected at lower values.

  5. 5.

    The R value obtained in ANN modeling was higher than the one obtained in RSM modeling, indicating a more reliable prediction by ANN, though the difference was not considerable.

  6. 6.

    Both ANN and RSM can be used to model the mechanical properties of ABS produced by additive manufacturing. These models are effective tools in understanding the effect of each variable on the properties of the final part.