Keywords

1 Introduction

The pH neutralization process, or the control of pH, is a crucial task in wide industrial applications, such as chemical, biotechnological engineering, wastewater and water treatment plants (WTP). The pH, as a definition, is the logarithmic value of hydrogen ion activity in an aqueous solution or a measure of the acidity or alkalinity of a solution [1]. In terms of numerical values, a solution with a pH equal to 7 is neutral and for an alkalinity solution, this value is greater than 7. In an acidic solution, the pH value is less than 7.

The control of a pH neutralization is one of the major problem in water treatment plants, particularly due to its highly nonlinear characteristics [2]. In the last years, many researchers have studied pH control strategies and methods to resolve or minimize this strong nonlinearity [2].

In some cases, an extended Kalman filter (EKF) and an unscented Kalman filter (UKF) were used to estimate some values in a nonlinear pH process [3, 4]. In [5], double-control scheme for pH process was employed to obtain a good load rejection performance, particularly simultaneous change occurs in set point and in disturbance inputs. This solution was proposed to overcome some drawbacks usually found in conventional PID (proportional-integral-derivative) systems, such as the robustness of the control.

In [6], a Wiener-Laguerre model was used to evaluate the pH neutralization process as a nonlinear model predictive control framework, based on the sequential quadratic programming algorithm. This solution was designed considering an operation of the pH process in distinct set points. A Wiener model identification and predictive control also was applied of a pH neutralization process in [7], but in this case in an effluent solution control.

A multi-model nonlinear predictive control scheme was applied in [8] to describe and handle the nonlinearities of a pH industry process. This approach included a parallel integral action in the controller to compensate unmeasured states.

In a WTP, for example, natural dissolved organic matter (DOM) is present and this kind of product may cause relevant problems for process control [9]. In this situation, a coagulation step should be applied to maximize the removal of DOM in water, but accordingly to [9], some coagulants are able to modify the final pH, especially after enhanced coagulation. In [10], a reset/hybrid control application was applied an in-line pH process, in order to test the performance of a reset controller for a non-linear system with disturbances.

In some cases, a pH process requires an online monitoring and control system due to its highly nonlinear aspects [11, 12]. Other researches took into account the use of artificial intelligence techniques to improve pH control, in particular for predictive purposes and adaptive and/or optimization strategy [13,14,15,16,17,18,19,20,21].

As aforementioned, the pH control is a major issue in some industrial processes due to its nonlinear behavior, thus, in this context, the aim of this work consists in the modelling and simulating a pH closed-loop control of a real WTP, in order to better manage the process and reduce some costs related to the use of raw materials in a water treatment plant, for some operational scenarios, as well as identify the better parameters for this type of process.

2 Methodology

The present work has been applied for simulation purposes and some process variables were chosen by mathematical modelling. These variables were identified con-sidering their impact for pH control in a real drinking water treatment plant, located at São Paulo city, Brazil. The rated flow of this WTP is 33 m\(^{3}\)/s. In this context, this research has been performed in six steps, as follows:

Fig. 1.
figure 1

A process screen in the SCADA system for pH monitoring and lime dosage

Table 1. Some historical data selected from SCADA software
  1. 1.

    Identify the process variables according to the desired pH behavior. Thus, considering the knowledge of the operators, some parameters were identified as relevant for pH control, such as, chlorine dosage and fluorine dosage at the end of the process treatment, raw water flow, treated water turbidity and the lime dosage;

  2. 2.

    Select a range of historical data stored in a Supervisory Control and Data Acquisition (SCADA system). This system is running at the local water plant and Fig. 1 shows a screen of the SCADA used for operating the WTP and lime dosage to control the pH of the drinking water. On this screen is possible to adjust the reference value for automatic controller or the lime pump frequency, as well as other parameters such as the lime flow, lime dosage and dosage pumps.

  3. 3.

    Identify a sample data wherein the pH process was being controlled in automatic mode. Table 1 shows a brief sample of the experimental data used for modelling and simulation.

  4. 4.

    Load these data in the MATLAB® software and execute some specific commands to determine the behavior (transfer function) of each input and respective output variable. In this case, the output variable is the measured pH. The following commands were used:

    • Command “iddata”: create a data object to encapsulate the input/output data and their properties (Eq. 1).

      $$\begin{aligned} DAT = iddata(Y,U,Ts) \end{aligned}$$
      (1)

      Where: Y = output, U = input and Ts = sampling interval

    • Command “tfest”: This MATLAB® function estimates a continuous-time transfer function, sys, using time- or frequency-domain data, DAT obtained from “iddata” command, and contains np poles, as follows Eq. 2:

      $$\begin{aligned} sys = tfest(DAT,np) \end{aligned}$$
      (2)
  5. 5.

    Modelling each input/output variable and/or equipment in the MATLAB Simulink environment, in order to proceed to the operational scenarios simulation. Figure 2 shows an aerial view of the WTP used for modelling and experimental validation. Figure 3 shows a final model of each variable, i.e., chlorine dosage, treated turbidity and flow, as well as the equipment behavior, such as lime and fluorine pumps, after modelling step. Figure 3 also highlights a transfer function obtained for one disturb-ance, i.e., for chlorine dosage, using Eqs. 1 and 2. This function is a relation between the chlorine dosage and its influence in the pH value. Equations 1 and 2 also were used for determining the other disturbances, such as fluorine dosage, flow and turbidity influence.

  6. 6.

    The performance of the final model is measured by the mean absolute error (MAE), as shown in Eq. 3:

    $$\begin{aligned} MAE = \frac{1}{N}\sum _{i=1}^{N} t_i - y_i \end{aligned}$$
    (3)

    Where, \(\mathrm{t}_\mathrm{i}\) is desired value; \(\mathrm{y}_\mathrm{i}\) is value obtained from the mathematical model and N is number of existing samples. The next section shows the results and discussion about the simulation of three operational scenarios using the model depicted in Fig. 3.

Fig. 2.
figure 2

The water treatment plant used for modelling and simulation

Fig. 3.
figure 3

The process modelling in the MATLAB/Simulink® software

3 Results and Discussion

This session shows the results and discussion about the simulation of three opera-tional scenarios using the final mathematical model depicted in Fig. 3. In each case, the initial conditions were used to start the simulation and proceed with experimental validation.

  • First scenario (initial conditions): in this case the initial parameters were defined as follows: chlorine dosage = 1.74 mg/l, fluorine dosage = 0.645 mg/l, raw water flow = 13.83 m\( ^{3} \)/s and treated turbidity = 0.422 NTU. Figure 4(a) and (b) show the lime pumps dosage, and the pH obtained in the experimental and simulated data (Fig. 4).

  • Second scenario (initial conditions): in this case the initial conditions were defined as follows: chlorine dosage = 1.86 mg/L, fluorine dosage = 0.654 mg/L, raw water flow = 17.24 m\(^3\)/s and turbidity = 0.33 NTU. Figures 5(a) and (b) show the lime pumps dosage and the pH obtained in the experimental and simulated data.

  • Third scenario (initial conditions): in this case the initial conditions were defined as follows: chlorine dosage = 1.76 mg/L, fluorine dosage = 0.691 mg/L, raw water flow = 27.03 m\( ^{3} \)/s and turbidity = 0.272 NTU. Figures 6(a) and (b) show the lime pumps dosage and the pH obtained in the experimental and simulated data.

Fig. 4.
figure 4

(a) Frequency of lime pumps 1 and 2 and (b) pH measured for experimental and simulated data

Fig. 5.
figure 5

(a) Frequency of lime pumps 1 and 2 and (b) pH measured for experimental and simulated data

Fig. 6.
figure 6

(a) Frequency of lime pumps 1 and 2 and (b) pH measured for experimental and simulated data

The results show a good approximation between the simulated and experimental data, even though some operational points should be better evaluated in each case. On the other hand, it should be noted that the results achieved in the scenario 3 are better than those obtained in other cases, as this last scenario have considered a data sampled time equal to 10 s from the knowledge base (SCADA system), while in the first and second cases were employed data sample time equal to 2.5 min. Table 2 shows the MAE values for each scenario.

Table 2. Values of MAEs scenarios

The frequency of each lime pump is a relevant parameter capable of estimating the lime consumption in the WTP, since this parameter is useful to determine lime flow. Today, the pH control at the water plant used for experimental validation requires more than 15 tons of lime per day, when the raw water flow is near 33 m\( ^{3} \)/s.

4 Conclusions

This work presented a model of a pH control for process management in a drinking water treatment plant. A data set obtained from a SCADA software was used to define the behavior of each input and disturbances of the process, using the MATLAB/Simulink® software. The results of the three operational scenarios show a good approximation between simulated and experimental data, thus, the present model can be used in other operational conditions, in order to estimate the lime pump frequency and the pH in the treated water, as well as improve the raw water quality and reduce the lime consumption. The current mathematical model can be a useful tool for a decision-making process and production management; particularly for estimating the daily chemical refills in the WTP, which is not an easy task. It should be mentioned that lime consumption could represent 15% of total operational costs in a WTP [22]. Moreover, the lime consumption could be better evaluated due to initial parameters of the WTP. Further investigations should be considered, using an artificial intelligence approach, to estimate the minimum dosage of the lime pumps, maintaining the quality of the treated water. That could lead to cost reduction in the water treatment process.