1 Introduction

The metal-mechanic industry widely uses the phosphate coating process to perform chemical treatment on the surface of its products [1, 2]. Therefore, the generated effluent contains large amounts of phosphates and solids. The inappropriate disposal of these effluents can lead to serious environmental problems, mainly associated to phosphate, because it causes eutrophication. This phenomenon refers to the accelerated growth of algae, causing unsuitable conditions for aquatic life and leading to the death of various aquatic species [3, 4]. In addition, it has been proven that the presence of eutrophication in the bodies of water promotes greenhouse gases [5,6,7]. Therefore, the generated effluents in the metal-mechanical industry must be treated to avoid environmental problems and to promote its reuse in production process contributing to water sustainability.

Several techniques have been employed to remove phosphates from wastewater such as coagulation-flocculation (CF), crystallization, adsorption, or magnetic separation [8, 9]; however, the CF process is the leading technology for removing phosphates from wastewater [10, 11], mainly due to its easy operation, relatively simple design, low cost, and high efficiency [12, 13]. Coagulation consists of adding an agent, commonly trivalent metal ions, or polymerized species to the wastewater to form micro-flocs that are generated by rapid mixing [14,15,16]. After that, flocculation also involves adding a chemical specie, mainly synthetic or organic polymers, so that the primary particles created in the coagulation process, form aggregates that will have a considerable volume and weight that can later be separated from the water through a sedimentation process [17, 18]. The main variables of the coagulation-flocculation process are coagulant/flocculant feed rate, mixing speed, mixing time, pH, type of effluent, and temperature [19]. Traditionally, operational variables of CF process are determined through the well-known jar test [20]. This is an empirical test which depends on the real characteristics of the effluent, so then generating a general mathematical model of the CF process that involves all these variables is a task that seems to be far from being completed [21]. Moreover, operational variables to find the optimal range entail the consumption of time and resources [22].

This last promotes that many industrial plants operate by empirical way and sometimes, environmental regulations are not complied generating environmental pollution. For this reason, it is very important to make an effort for developing or implementing mathematical or statistical models to minimize or even eliminate the empirical operation of wastewater treatment plants. So, one of the main challenges of using the coagulation-flocculation process is to find a mathematical model that can predict how the operational variables (or at least the most important ones) affect the reduction of contaminants. In this context, the response surface methodology (RSM) is an appropriate strategy to model CF process [23, 24]. RSM is a statistical technique that allows representing the influence of a set of variables over the response of interest using a minimum number of experiments [25, 26]. RSM has been proven as a reliable strategy to optimize CF process in several studies, such as effluents from the textile industry to reduce color, turbidity, and chemical oxygen demand (COD) [13, 27]; a tannery industry effluent to reduce COD [28]; a municipal wastewater to reduce turbidity, COD, and biochemical oxygen demand (BOD) [29]; an effluent obtained from a biodiesel production plant to reduce COD, turbidity, and solids [30]; an effluent from the oil industry to reduce COD, turbidity, color, and solids [18]; a surface water to reduce dissolved organic matter (DOM) [23]; and an aqueous solution to reduce hexavalent chromium (Cr(VI)) [31]. Nevertheless, the economic impact is hardly taken into account in the analysis, and real effluents of metal-mechanic industry are hardly studied, because including the economic impact implies a multi-objective optimization problem which involves a more rigorous study.

Therefore, the models generated in these studies could predict optimal solutions to avoid consumption of more resources than necessary and avoiding empirical operation to ensure environmental regulations and promoting water sustainability.

After the actual treatment of the study case, specifications of phosphate concentration are not complied, mainly because it operates by empirical way. Therefore, it is necessary to implement a robust methodology to ensure legal regulations and avoid environmental problems. Thereby, the objective of this research is the statistical modelling and multi-objective optimization in environmental and economic terms of the CF process of a wastewater treatment plant installed in a metal-mechanic industry to treat effluents with high phosphates concentration, focusing on the wastewater quality specifications without compromising operational costs. The methodology developed in this work could be employing for engineering or industrial applications.

2 Description of the Wastewater Treatment Plant

The effluent used on this study was collected directly from a wastewater treatment plant of a metal-mechanic industry located in the city of Queretaro, Mexico. Currently, the wastewater treatment plant operates with a homogenization tank, two coagulation tanks, a flocculation tank in continuous stirred mode of operation, an inclined plate settler to separate sludge from wastewater, and a filter press to compress the sludge. The process ends in a tank to store the generated sludge and a tank to store the treated water, as shown in Fig. 1. In the first coagulation stage, calcium hydroxide (CH) is added as the first coagulating agent. Then, in the second coagulation stage, sulfuric acid (SA) is added to adjust the pH, while aluminum salts (AS) are added as a second coagulant agent. Finally, in the flocculation stage, a mixture of soluble anionic polymers (copolymers of acrylamide and urea) are added as a flocculant agent. In general, the whole process takes 4.5 h to complete, maintaining an operational pH between 6 and 7. It is important to mention that the concentration of AS solution is unknown, since a real reagent employed by the study industry is being used and the information is confidential. However, it is a mixture of typical aluminum salts such as Al2(SO4)3, Al(Cl)3, or NaAlO2.

Fig. 1
figure 1

Process diagram of the wastewater treatment plant

3 Materials and Methods

The sample used on this study was collected directly from the homogenization tank stage of the wastewater treatment plant. A volume of 50 L was collected in a high-density polyethylene container, and it was stored in absence of light at room temperature. The characterization of the wastewater was performed by determining the pH with a pH meter Pro + Multi2, HACH® company. Turbidity was determined with a U-10 turbidimeter, HORIBA® company. The phosphate concentration (PC) was determined through the vanadomolybdophosphoric acid method and total solids (TS) were determined with the gravimetric technique, both described in the Standard Methods for the Exam of Water and Wastewater made by American Public Health Association (APHA) [32].

An experimental jar test of four stages was carried out to obtain input parameters. In the first stage, CH was added as the first coagulant at a stirring speed of 60 rpm. In the second stage, SA was added to regulate the pH in a range of 6.5 to 7, and AS were added as a second coagulant varying rotational speeds. In the third stage, the flocculant agent was added at a stirring speed of 40 rpm. Finally, in the last stage, the sedimentation of the generated flocs occurs. All stages represent the real CF process, and reagents employed were the same used in the industrial wastewater treatment plant. It is important to mention that after several trials, the agitation speed of the first coagulation stage as well as the agitation speed of the flocculation stage remain constant. Because, in the case of the agitation speed of the flocculation stage, this must be carried out at a slow speed so as not to affect the formation of flocs, so it cannot move significantly. For the cases when coagulation processes are being carried out, it was observed that only the stage of AS has a significant influence on pollutants removal. Finally, generated sludge volume was measured through Imhoff cones.

4 Description of Response Surface Methodology and Optimization Modelling

The coagulation-flocculation process was modeled considering the four most influential input variables, that are, CH dosage, AS dosage, flocculant dosage, and stirring speed of the second coagulation stage. The response surface methodology was used to correlate the interactions of the input variables with the output variables (phosphate concentration (PC), total solids (TS) and sludge generation (SG)). The composite central design (CCD) was used since it can be used for two or more variables and five levels can be analyzed for each variable [33, 34]. Table 1 shows all levels and variables analyzed. Although BBD could also be adapted to this case study, CCD was preferred because it has more levels for each variable allowing a better prediction of the behavior of the CF process. This design contains three main points:

  1. 1.

    The factorial portion that includes a complete (or a fraction of) \({2}^{k}\) factorial design whose levels are coded as -1, 1.

  2. 2.

    An axial portion consisting of 2 k points arranged so that two points are chosen on the axis of each control variable at a distance of α from the design center (chosen as the point at the origin of the coordinates system) and the value of α is obtained from Eq. (1). In this study, α takes a value of 2.

  3. 3.

    \({c}_{p}\) center points.

Table 1 Coded and uncoded levels of the independent variables of CF process

The distance α is given by the following:

$$\alpha ={\left({N}_{k}\right)}^\frac{1}{4}.$$
(1)

The number of experiments (N) to perform in CCD for k variables is calculated with Eq. (2):

$$N={2}^{k}+2k+{c}_{p},$$
(2)

where \({N}_{k}\) denotes the number of points in the factorial portion [33, 34]. According to Eq. 2, 36 experiments must be carried out with 4 central points for 4 variables, following the CCD matrix shown in Appendix 1 (Table A.1). STATGRAPHICS® Centurion XVI.I software was used for the design and analysis of the experiments presented in Table A.1. The experimental data were fitted to a second-order model, as shown in Eq. (3), using the least square multiple regression methodology:

$$Y={\beta }_{0}+\textstyle\sum_{i=1}^{k}{\beta }_{i}{x}_{i}+{\sum }_{i< j}^{k}\textstyle\sum {{\beta }_{ij}x}_{i}{x}_{j}+\textstyle\sum_{i=1}^{k}{\beta }_{ii}{x}_{i}^{2}+\epsilon ,$$
(3)

where \(Y\) is the model response of interest, \({x}_{i}\) and \({x}_{j}\) are the independent variables, \({\beta }_{0}\) is the constant coefficient, \({\beta }_{i}\) is the linear coefficient, \({\beta }_{ii}\) is the quadratic coefficient, and \({\beta }_{ij}\) is the interaction coefficient. The models were validated in terms of the coefficient of determination (R2), adjusted coefficient of determination (R2-adj.), and the predicted coefficient of determination (R2-pred.) The value of R2 between 0.9 and 1 reveals a best fit of data between experimental and predicted values [29]. Besides, the probability value (P value) at 95% confidence interval was used to evaluate the significance of model terms [19].

Once the response surface models have been obtained, a multi-objective optimization problem is formulated, aiming to minimize operating costs (OC) and environmental impact (EI), measured in terms of the phosphate concentration (PC) and the sludge generation (SG), as shown in Eq. (4):

$$\begin{array}{c}{\text{min}}\left(OC, PC,SG\right)=f \;\left({C}_{PC},{C}_{TS}, {D}_{CH}, {D}_{AS}, {D}_{F}, {E}_{C},{D}_{SS},{G}_{S}\right)\\\text{subject to}-2\le { X}_{1},{X}_{2},{X}_{3},{X}_{4}\le 2,\end{array}$$
(4)

where \({C}_{PC}\) is the phosphate concentration, \({C}_{TS}\) is the total solids concentration, \({D}_{CH}\) is the dose of CH, \({D}_{AS}\) is the dose of aluminum salts, \({D}_{F}\) is the dose of flocculant, \({E}_{C}\) is the energy consumed, \({D}_{SS}\) the stirring speed, and \({G}_{S}\) the generation of sludge.

The optimization problem has been coded in GAMS® 34.2.0 to perform the multi-objective optimization. This tool is the most used to solve multi-objective optimization problems [35, 36]. The Pareto front was constructed through the ε-constraints method. This technique is based on selecting one of the objective functions to be optimized, while the others are converted into constraints by establishing an upper limit (ε1,….εl) for each of the objective functions [36]. The construction of the Pareto front was performed, with around 100 points, and the Hammersley sampling technique was employed. In this work, the cost function is selected as the main objective. Thus, the optimization problem is reformulated as follows:

$$\begin{array}{c}{\text{min}}\left(OC\right)=f \left( {D}_{HC}, {D}_{AS}, {D}_{F}, {E}_{C},{D}_{SS},{G}_{S}\right)\\-2\le { X}_{1},{X}_{2},{X}_{3},{X}_{4}\le 2,\\PC\le {\varepsilon }_{1},\\SG\le {\varepsilon }_{2}.\end{array}$$
(5)

In general, the best solution was obtained by normalizing each objective function (OC, PC and SG) with Eq. (6):

$${z}_{i,normalized}=\frac{{Z}_{i}-{Z}_{i}^{lo}}{{Z}_{i}^{up}-{Z}_{i}^{lo}},$$
(6)

where \({z}_{i}\) is the i-th objective function, while the superscripts lo and up refer to the lower and upper bounds of the objective \({z}_{i}\), respectively. To find the solution with the best compromise between the objective functions, the Euclidean distance theorem was applied, as shown in Eq. (7):

$$Distance=\sqrt{\textstyle\sum_{i=1}^{k}{z}_{i}^{2}}.$$
(7)

This solution will be the one with the smallest distance between all points.

5 Results and discussion

The wastewater was characterized, and pH, turbidity, PC and TS were found to be 6.7 ± 0.01, 25 ± 0.75 NTU, 96.09 ± 0.86 mg L−1 and 690 ± 14 mg L−1, respectively. It is important to emphasize that wastewater samples do not present suspended solids, and TS are associated only with the amount of dissolved solids including phosphates and traces of other metals such as Fe.

The relationship between the four independent variables (CH dosage, AS dosage, flocculant dosage, and stirring speed) and their responses (PC, TS, and SG) was analyzed through the CCD matrix. The results obtained from the three responses were fitted to a second-order mathematical model given by the following equations:

$$\begin{aligned}{Y}_{PC}=&\;+20.3017-2.367085{X}_{1}-9.2971{X}_{2}\\&-1.445415{X}_{3} -0.939585{X}_{4}+0.274375{X}_{1}{X}_{2}\\&+0.040625{X}_{1}{X}_{3}+0.370625{X}_{1}{X}_{4}-0.108125{X}_{2}{X}_{3}\\&+0.591875{X}_{2}{X}_{4}+0.663125{X}_{3}{X}_{4}+0.444271{X}_{1}^{2}\\&+2.3902{X}_{2}^{2}-0.52573{X}_{3}^{2}-0.56698{X}_{4}^{2},\end{aligned}$$
$$\begin{aligned}{Y}_{TS}=&\;+1866.67+329.5835{X}_{1}+32.91665{X}_{2}\\&-33.75{X}_{3}-89.5835{X}_{4}+43.125{X}_{1}{X}_{2}\\&-18.125{X}_{1}{X}_{3}-45.625{X}_{1}{X}_{4}-13.125{X}_{2}{X}_{3}\\&-45.625{X}_{2}{X}_{4}-31.875{X}_{3}{X}_{4}-23.22915{X}_{1}^{2}\\&-14.27085{X}_{2}^{2}+31.97915{X}_{3}^{2}+20.72915{X}_{4}^{2},\end{aligned}$$
$$\begin{aligned}{Y}_{SG}=&+31.0069+1.708335{X}_{1}+9.875{X}_{2}\\&+0.958335{X}_{3}+0.375{X}_{4}+0.0625{X}_{1}{X}_{2}\\&+0.0625{X}_{1}{X}_{3}-0.0625{X}_{1}{X}_{4}-0.3125{X}_{2}{X}_{3}\\&-0.625{X}_{2}{X}_{4}-0.0625{X}_{3}{X}_{4}-0.2395835{X}_{1}^{2}\\&-1.239585{X}_{2}^{2}+0.1354165{X}_{3}^{2}-0.3854165{X}_{4}^{2}.\end{aligned}$$

The results of the experiments as well as the results of the predictions of the generated mathematical models are shown in Appendix 1 (Table A.1). According to the experimental results of Table A.1, it is possible to reduce the PC by a maximum of 90.00% and a minimum of 51.10%, while for the concentration of TS, it increased from a minimum of 188.40% to a maximum of 381.15%. The increase in the concentration of TS is because not all of the CH and AS interact in the process, so it remains in the water as dissolved solids. Finally, for the generation of sludge, there is a minimum generation of 16 mL L−1 and a maximum generation of 94 mL L−1. It should be noted that turbidity was not considered in this study, since in all performed experiments, it exceeded 99% removal (not shown in this work) and wastewater composition does not have significant suspended solids concentration.

Results of ANOVA are shown in Appendix 2 (Table A.2). A P value (or Prob. > F) is the probability that the result will equal or exceed the value that was observed if the model produces accurate results. If the model Prob. > F, and no term exceeds the level of significance (e.g., c = 0.05), the model can be considered acceptable within a confidence interval of (1 − c) [19]. Examining the relevance of the obtained parameters (P value < 0.05) in Table A.2, it is observed that \({X}_{1}\), \({X}_{2}\), \({X}_{3}\), \({X}_{4},\) and \({X}_{2}{X}_{2}\) are the most significant elements for PC, being aluminum salts dose the most influential variable, while for TS, \({X}_{1}\), \({X}_{2}\), \({X}_{3}\), \({X}_{4}\), \({X}_{1}{X}_{2}, {X}_{1}{X}_{4},{X}_{2}{X}_{4,}\) and \({X}_{3}{X}_{3}\), all variables are considerably influential. Finally, for SG, \({X}_{1}\), \({X}_{2}\), \({X}_{3}\), \({X}_{4}, {X}_{1}{X}_{1}\), and \({X}_{2}{X}_{2}\) are the most significant elements, being calcium hydroxide dose and aluminum salt dose, the most influential variables. The three-response regression results of ANOVA confirm that all generated models are significant, with high F values ​​(779.41, 634.39, and 472.12 for PC, TS, and SG, respectively) and low P values (< 0.05 for all models). Therefore, the developed models were statistically significant within ± 5% [24, 29]. In order to evaluate the quality of the efficiency of the generated models, the coefficient of determination (R2) was used, finding values very close to 1 (0.976 for FC, 0.970 for TS and 0.997 for SG). On the other hand, the obtained adjusted determination coefficients (R2-adj) were also quite good (0.956 for FC, 0.946 for TS and 0.994 for SG). Thereby, a good correlation between the generated predictive model and the experimental values is ensured.

Figure 2 shows how much of the independent variables affect the different responses. It is observed in Fig. 2a that the dose of aluminum salts presents a significant effect over other variables, this is due to the fact that AS is the coagulant with the most interaction with contaminants, because with AS, a 98% removal of phosphates can be achieved [8]; in addition, CH is used only as a coagulant aid [37, 38]. In the case of total solids, it is observed in Fig. 2b that the main interaction variable is calcium hydroxide, because it promotes an increase or decrease of this variable due to the fact that not of the whole reactant interacts with the contaminants and it remains in the solution in the form of ions. Finally for the generation of sludge, the dose of aluminum salts predominates, since large amounts of sludge could be generated when AS is used as a coagulant [39].

Fig. 2
figure 2

Main effects plots for a phosphates, b total solids and c sludge generation vs calcium hydroxide (CH), aluminum salts (AS), flocculant dose (F), and stirring speed (SS)

Response surface graphs were made with the variables with highest interaction, and they are shown in Fig. 3. In Fig. 3a, It is observed that the minimum removal of phosphates considering only the effects of CH and AS is 39.64%, and the maximum removal is 86.48%, while by varying CH and AS, a minimum removal of 50.47% and a maximum removal of 93.76% are achieved. In Fig. 3b, it is observed that the minimum and maximum values for the concentration of total solids considering only the effects of CH and stirring speed present a decrease of 27.54% and an increase of 304.34%, respectively. Meanwhile, by varying only the CH and the flocculant, a maximum value of 347.82% and a minimum value of 123.18% were obtained. Figure 3c shows that analyzing only the effects of CH and AS, the minimum and maximum amount of sludge are 5 and 100 mL L−1, respectively. On the other hand, by varying only the AS and the flocculant, a minimum and a maximum of 20 and 110 mL L−1 are achieved. It is confirmed that phosphate removal, sludge generation and total solids removal present a complex interaction, and its behavior is difficult to predict by empirical operation.

Fig. 3.
figure 3

3D response surface plots showing the effects of the most influence input variables: a PC vs AS vs CH and F, b TS vs CH vs SS and F, and c SG vs AS vs CH and F

A Pareto front was generated for the development of a multi-objective optimization. As a first step, the limits of the objective functions were established through their individual optimization, as shown in Table 2. Once the limits of each objective function were obtained, 100 points of the Pareto front were obtained and represented graphically in Fig. 4. Analyzing the results shown in Fig. 4, the operating costs are strongly related to the PC, since when the operating cost is higher, the PC increases and vice versa, and as the same for total solids. On the other hand, having low values ​​of PC, the concentration of total solids increases. The Euclidean distance theorem was used to obtain the point with the best compromise between objective functions, then an optimal point was found with PC at 23,839 mg L−1, TS at 1611,416 mg L−1, and OC at 7.91 USD/day. The convergence time was 0.594 s for the point found performing a total of 13 iterations. For this optimal point, operational variables CH, AS, flocculant, and stirring speed were obtained at 400 mg L−1, 0.723 mL L−1, 3.32 × 10–3 mg L−1, and 100 rpm, respectively. A phosphate removal efficiency of 75.20% was achieved.

Table 2 Limits of objective functions
Fig. 4
figure 4

Pareto front for variables of interest: operating cost (OC), total solids concentration (TS), and phosphate concentration (PC)

Operational variables currently used in the wastewater treatment plant and optimal values obtained in this work are shown in Table 3. According to these values, an operational cost of 7.80 USD per day of operation is obtained with concentrations of 36.07 mg L−1 of phosphates and 890 mg L−1of total solids. The obtained phosphate concentration after the current process of the wastewater treatment plant is above the limit allowed by the internal regulations of the industrial park (< 30 mg L−1), so its current process conditions are not adequate to comply with the required regulation. According to the results obtained by modelling, it was found that the current process is cheaper than the optimal one found (with a difference of 1.01% per day) and an increase in the concentration of total solids (of 233.53%). Nevertheless, the cost increment is not significant, and the phosphates concentration decreases to comply with the regulation, which is the most important objective for this particular metal-mechanic industry. It is important to remark that the increment of total solids is not environmental harmful according with the local environmental regulations of this particular industrial park, because its mainly composition are non-toxic dissolve salts and non-toxic metal traces, such as Fe. Besides, the concentration of aluminum ions (Al3+) reported in the residual water after the treatment is 0.03 ± 0.004 mg/L, which is a very low value for aluminum concentration. Individual studies must be performed for other study cases, and the methodology presented in this work could be taken as a first keystone.

Table 3 Comparison between values of the current operating conditions and values obtained in this work for the wastewater treatment plant

Table 4 shows other studies of different coagulation processes to remove phosphates, where it is shown that there are processes with more removal efficiency and others with less removal efficiency. However, these do not consider the economic impact, which makes the main difference of this work with the others [11, 40,41,42].

Table 4 Comparative table of other coagulation processes for the removal of phosphates

6 Conclusions

In this work, statistical modeling and optimization methodology of a CF process of a metal-mechanic industry have been presented. The generated mathematical model of the CF process was performed with RSM employing a CCD, and the input data was obtained from an experimental jar test method using a real sample from the metal-mechanic industry. Then, a Pareto front was generated using the ε-constraint method to perform a multi-objective optimization. The results of this investigation reveal optimal operating conditions with 400 mg L−1 of CH, 0.723 mL L−1 of AS, 3.32 × 10–3 mg L−1 of flocculant, and 100 rpm agitation speed. The analyzed objectives found their best compromise in 23.839 mg L−1 of PC, 1611.416 mg L−1 of TS, and 7.91 USD/day of operating cost. The results obtained indicate that the CF process is effective to reduce PC and is suitable to treat effluents from the metal-mechanic industry. On the other hand, it was found that the wastewater treatment plant of the study case needs to change its operating conditions to comply with the regulations required by the industrial park where it is located, with a low increment of 1.01% of the cost of operation and an increment of 181% of total solids concentration. The proposed methodology could be applied in effluents with high phosphates content for engineering or industrial applications.