Introduction

Waste water treatment plants are large-capacity and nonlinear systems. Waste water is the result of substances been dissolved or suspended in water. Many control strategies have been proposed in the literature for the control of waste water treatment plants. Fuzzy logic is a powerful methodology with many applications. Angeline Rajathi and P. Subha Hency Jose [2] discussed soft computing techniques like backpropagation network and fuzzy logic. They are used to provide optimum current, optimum reaction time and color removal efficiency based on pH and conductivity measurements. Adama Traoré et al., [3] have provided the fuzzy control strategy that is based on simple online data (influent and recycle flows) and daily analytical values of the sludge volume index (SVI). It has reduced sludge height variations and thus increased the settling process efficiency. The developed controller has been applied to the Cassà de la Selva activated sludge Waste Water Treatment Plant (WWTP) in Spain. Carlos Alberto Coelho Belchiora et al., [4] presented adaptive fuzzy controller (AFC) design methodology of data-driven controller; it uses the Lyapunov synthesis approach with a parameter projection algorithm for DO control in WWTP. Catalin Simion et al., [5] provided the decision support system based on fuzzy control for a waste water treatment plant. Esra Yel and Sukran Yalpirb [6] discussed the prediction of primary treatment effluent parameters by fuzzy inference system (FIS) approach. Fernando et al., [7] presented the fuzzy modeling on wheat productivity under different doses of sludge and Sewage Effluent.

G.Vijayaraghavan and M.Jayalakshmi [8] presented a quick review on applications of fuzzy logic in waste water treatment. Kaleeswari, et al., [9] discussed the influencing factors on water treatment plant performance analysis using fuzzy logic technique. R. Maachou, et al. [10], presented the control of recycle sludge in activated sludge process using adaptive neuro-fuzzy logic controller (ANFIS). Md. Pauzi Abdullah [11] discussed the development of new water quality model using fuzzy logic system for Malaysia. O.C. Pires et al., [12] presented the fuzzy-logic-based expert system for diagnosis and control of an integrated waste water treatment. P. Ramdewor, et al., [13] and Soneechur presented the simulation of the nitrification process in waste water treatment using fuzzy logic. S.N. Saranya, et al., [14] provides the prediction of paper mill waste water treatment process parameters in sequencing batch reactor using fuzzy logic technique. Tawanda Mushiri et al. [15], discussed careful selection of memberships and setting the right rules of fuzzy logic control; it is possible to bring any waste water pH to neutrality in an acceptable time, regardless if the waste is strong base nature or strong acidic or not.

In the above literature review, we find that the benchmark simulation model has not been considered for the design of fuzzy logic controller. In fuzzy logic method, the controller design is based on fuzzy rules, which are based on the human reasoning.

Figure 1 describes the implementation of fuzzy logic controller, similar to the conventional PID controller.

Fig. 1
figure 1

Block diagram of fuzzy logic control of a process

Objectives of the present work are as follows:

* Study of the multivariable dynamic model of waste water treatment plant with the help of benchmark simulation model 1 (BSM1),

* Design of a fuzzy logic controller using Mamdani rules and.

* Performance evaluation of fuzzy logic controller for waste water treatment plant using MATLAB and Simulink Toolbox.

Mathematical Model of a Waste Water Treatment Plant

The benchmark simulation model is relatively with a simple layout as shown in Fig. 2. The first part of BSM1 is also a biological or biochemical activated sludge reactors system, which is comprised of five-compartments or reactors; two of them are anoxic tanks and the following three are aerobic tanks. The second part of BSM1 is a secondary settler. Reactors 1 and 2 are unaerated but fully mixed, Reactors 3, 4 and 5 are aerated.

Fig. 2
figure 2

Schematic diagram of a waste water treatment plant with five reactors and a settler

For the open-loop case, the oxygen transfer coefficients (KLa), i.e., air flow rate, are fixed. For Reactors 3 and 4, the coefficients KLa3 and KLa4 are set to be a constant at 240 d−1 (10 h−1), respectively, which means the air flow rate of the blower is constant. For reactor 5, the coefficient, KLa5 is selected as manipulated variable for maintaining the DO concentration at a level of 2g/m3

The BSM1 model has been selected to describe the biological phenomena taking place in the biological reactor and a double-exponential settling velocity function has been selected to describe the secondary settler which is modeled as a 10-layer non-reactive unit, i.e., no biological reaction. In the activated sludge waste water treatment system, the concentration of DO in the aeration tank is the most important variable in the process. Actually, the DO concentration has a direct impact on the effluent quality with respect to total nitrogen (Ntot), nitrate nitrogen (SNO) and ammonia (SNH). Therefore, the study of DO control has its important practical significance and prospect for application.

The waste water treatment plant is designed for an average influent dry-weather flow rate of 18,446 m3.d−1 and an average biodegradable COD in the influent of 300 g.m−3. Its hydraulic retention time based on average dry weather flow rate and total tank volume, i.e., biological reactor + settler of 12,000 m3, is 14.4 h. The biological reactor volume and the settler volume are both equal to 6,000 m3. The wastage flow rate equals 385 m3.d−1. This corresponds to a biomass sludge age of about 9 days based on the total amount of biomass present in the system. The waste water treatment plant is described by 13 variables as given in Table 1.

Table 1 List of variables

List of Processes

Generally, eight basic processes are used to describe the biological behavior of the system.

j = 1, Aerobic Growth of Heterotrophs

$$\rho_{1} = \mu_{H } \left( {\frac{{S_{S} }}{{K_{S} + S_{S} }}} \right)\left( {\frac{{S_{0} }}{{K_{O,H} + S_{0} }}} \right)X_{B,H}$$
(1)

j = 2, Anoxic Growth of Heterotrophs

$$\rho_{2} = \mu_{H } \left( {\frac{{S_{S} }}{{K_{S} + S_{S} }}} \right)\left( {\frac{{K_{0,H} }}{{K_{O,H} + S_{0} }}} \right)\left( {\frac{{S_{NO} }}{{K_{NO} + S_{NO} }}} \right)\eta_{g} X_{B,H}$$
(2)

j = 3, Aerobic growth of Autotrophs

$$\rho_{3} = \mu_{A } \left( {\frac{{S_{NH} }}{{K_{NH} + S_{NH} }}} \right)\left( {\frac{{S_{0} }}{{K_{O,A} + S_{0} }}} \right)X_{B,A}$$
(3)

j = 4, Decay of Heterotrophs

$${\uprho }_{4} = {\text{ b}}_{{\text{H}}} {\text{X}}_{{{\text{B}},{\text{H}}}}$$
(4)

j = 5, Decay of Autotrophs

$${\uprho }_{5} = {\text{ b}}_{{\text{A}}} {\text{X}}_{{{\text{B}},{\text{A}}}}$$
(5)

j = 6, Ammonification of soluble organic nitrogen

$${\uprho }_{6} = {\text{ k}}_{{\text{a}}} {\text{S}}_{{{\text{ND}}}} {\text{X}}_{{{\text{B}},{\text{H}}}}$$
(6)

j = 7 Hydrolysis of entrapped organics

$${\uprho }_{7} = {\text{ k}}_{{\text{h }}} \frac{{\frac{{X_{S} }}{{X_{B,H} }}}}{{K_{X} + \left( {\frac{{X_{S} }}{{X_{B,H} }}} \right)}}\left[ {\left( {\frac{{{\text{S}}_{{\text{O}}} }}{{{\text{K}}_{{{\text{O}},{\text{H}}}} + {\text{S}}_{{\text{O}}} }}} \right) + {\upeta }_{h} \left( {\frac{{{\text{K}}_{{{\text{O}},{\text{H}}}} }}{{{\text{K}}_{{{\text{O}},{\text{H}}}} + {\text{S}}_{{\text{O}}} }}} \right)\left( {\frac{{{\text{S}}_{{{\text{N}}0}} }}{{{\text{K}}_{{{\text{NO}}}} + {\text{S}}_{{{\text{N}}0}} }}} \right)} \right]{\text{X}}_{{{\text{B}},{\text{H}}}}$$
(7)

j = 8, Hydrolysis of entrapped organic nitrogen

$${\uprho }_{8} = {\text{ k}}_{{\text{h }}} \frac{{\frac{{{\text{X}}_{{\text{S}}} }}{{{\text{X}}_{{{\text{B}},{\text{H}}}} }}}}{{{\text{K}}_{{\text{X}}} + \left( {\frac{{{\text{X}}_{{\text{S}}} }}{{{\text{X}}_{{{\text{B}},{\text{H}}}} }}} \right)}}\left[ {\left( {\frac{{{\text{S}}_{{\text{O}}} }}{{{\text{K}}_{{{\text{O}},{\text{H}}}} + {\text{S}}_{{\text{O}}} }}} \right) + {\upeta }_{{\text{h}}} \left( {\frac{{{\text{K}}_{{{\text{O}},{\text{H}}}} }}{{{\text{K}}_{{{\text{O}},{\text{H}}}} + {\text{S}}_{{\text{O}}} }}} \right)\left( {\frac{{{\text{S}}_{{{\text{N}}0}} }}{{{\text{K}}_{{{\text{NO}}}} + {\text{S}}_{{{\text{N}}0}} }}} \right)} \right]{\text{X}}_{{{\text{B}},{\text{H}}}} \left( {\frac{{{\text{X}}_{{{\text{ND}}}} }}{{{\text{X}}_{{\text{S}}} }}} \right)$$
(8)

Observed Conversion Rates

The observed conversion rates (ri) that result from combination of the above basic processes are given below.

$${\text{r}}_{{\text{i}}} = \mathop \sum \limits_{{\text{j}}} {\text{v}}_{{{\text{ij}}}} {\uprho }_{{\text{j}}}$$
(9)

SI (i = 1)

$${\text{r}}_{{1}} = \, 0$$
(10)

SS (i = 2)

$${\text{r}}_{2} = - \frac{1}{{{\text{Y}}_{{\text{H}}} }}{\uprho }_{1} - \frac{1}{{{\text{Y}}_{{\text{H}}} }}{\uprho }_{2} + {\uprho }_{7}$$
(11)

SI (i = 3)

$${\text{r}}_{{3}} = \, 0$$
(12)

XS (i = 4)

$${\text{r}}_{4} = \left( {1 - {\text{f}}_{{\text{P}}} } \right){\uprho }_{4} + \left( {1 - {\text{f}}_{{\text{P}}} } \right){\uprho }_{5} - {\uprho }_{7}$$
(13)

XB,H (i = 5)

$${\text{r}}_{5} = {\uprho }_{1} + {\uprho }_{2} - {\uprho }_{4}$$
(14)

XB,H (i = 6)

$${\text{r}}_{6} = {\uprho }_{3} - {\uprho }_{5}$$
(15)

XP (i = 7)

$${\text{r}}_{7} = {\text{f}}_{{\text{P}}} {\uprho }_{4} + {\text{f}}_{{\text{P}}} {\text{Q}}_{5}$$
(16)

SO (i = 8)

$${\text{r}}_{8} = - \frac{{1 - {\text{Y}}_{{\text{H}}} }}{{{\text{Y}}_{{\text{H}}} }}{\uprho }_{1} - \frac{{4.57 - {\text{Y}}_{{\text{A}}} }}{{{\text{Y}}_{{\text{A}}} }}{\uprho }_{3}$$
(17)

SNO (i = 9)

$${\text{r}}_{9} = - \frac{{1 - {\text{Y}}_{{\text{H}}} }}{{2.86{\text{Y}}_{{\text{H}}} }}{\uprho }_{2} + \frac{1}{{{\text{Y}}_{{\text{A}}} }}{\uprho }_{3}$$
(18)

SNH (i = 10)

$${\text{r}}_{10} = i_{XB} \rho_{1} - i_{XB} \rho_{2} - \left( {i_{XB} + \frac{1}{{Y_{A} }}} \right){\uprho }_{3} + {\uprho }_{6}$$
(19)

SND (i = 11)

$${\text{r}}_{11} = - {\uprho }_{6} + {\uprho }_{8}$$
(20)

XND (i = 12)

$${\text{r}}_{12} = \left( {{\text{i}}_{{{\text{XB}}}} - {\text{f}}_{{\text{p}}} {\text{i}}_{{{\text{Xp}}}} } \right){\uprho }_{4} + \left( {i_{XB} - {\text{f}}_{{\text{p}}} {\text{i}}_{{{\text{Xp}}}} } \right){\uprho }_{5} - {\uprho }_{{\text{g}}}$$
(21)

SALK (i = 13)

$${\text{r}}_{13} = \frac{{ - {\text{i}}_{{{\text{XB}}}} }}{14}{\uprho }_{1} + \left( {\frac{{1 - {\text{Y}}_{{\text{H}}} }}{{14.286{\text{Y}}_{{\text{H}}} }} - \frac{{{\text{i}}_{{{\text{XB}}}} }}{14}} \right){\uprho }_{2} - \left( {\frac{{{\text{i}}_{{{\text{XB}}}} }}{14} + \frac{1}{{7{\text{Y}}_{{\text{A}}} }}} \right){\uprho }_{3} + \frac{1}{14}{\uprho }_{6}$$
(22)

Tables 2 and 3 provide stoichiometric parameters and kinetic parameters of the process.

Table 2 Stoichiometric parameters
Table 3 Kinetic parameters

General Mass Balance Equations for Benchmark Simulation Model

Number of reactors: 5

Non-aerated reactors: 2

Aerated Reactors:

1. Reactors 3 and 4 are with a fixed oxygen transfer coefficient (KLa3 = KLa4 = 10 h−1 = 240d−1).

2. Reactor 5: the dissolved oxygen concentration (DO) is controlled at a level of 2 g.m−3 by manipulation of the KLa5.

For each Reactor:

  1. 1.

    Flow rate: Qk

  2. 2.

    Concentration: Zk

  3. 3.

    Volume:

  4. 4.

    Non-aerated Reactors: V1 = V2 = 1,000m3

  5. 5.

    Aerated reactors: V3 = V4 = V5 = 1,333 m3

Reaction rate: rk.For k = 1 (Reactor 1)

$$\frac{{{\text{dZ}}_{1} }}{{{\text{dt}}}} = \frac{1}{{{\text{V}}_{1} }}\left( {{\text{Q}}_{{\text{a}}} {\text{Z}}_{{\text{a}}} + {\text{Q}}_{{\text{r}}} {\text{Z}}_{{\text{r}}} + {\text{Q}}_{0} {\text{Z}}_{0} + {\text{r}}_{1} {\text{V}}_{1} - {\text{Q}}_{1} {\text{Z}}_{1} } \right)$$
(23)
$${\text{Q}}_{1} = {\text{Q}}_{{\text{a}}} + {\text{Q}}_{{\text{r}}} + {\text{Q}}_{0}$$

For k = 2 to 5 (Reactors 2 to 5)

$$\frac{{{\text{dZ}}_{{\text{k}}} }}{{{\text{dt}}}} = \frac{1}{{{\text{V}}_{{\text{k}}} }}\left( {{\text{Q}}_{{{\text{k}} - 1}} {\text{Z}}_{{{\text{k}} - 1}} + {\text{r}}_{{\text{k}}} {\text{V}}_{{\text{k}}} - {\text{Q}}_{{\text{k}}} {\text{Z}}_{{\text{k}}} } \right)$$
(24)
$$\frac{{{\text{dS}}_{{{\text{o}},{\text{k}}}} }}{{{\text{dt}}}} = \frac{1}{{{\text{V}}_{{\text{k}}} }}\left( {{\text{Q}}_{{{\text{k}} - 1}} {\text{S}}_{{{\text{o}},{\text{k}} - 1}} + {\text{r}}_{{\text{k}}} {\text{V}}_{{\text{k}}} + ({\text{K}}_{{\text{L}}} {\text{a}})_{{\text{k}}} {\text{V}}_{{\text{k}}} \left( {{\text{S}}_{0}^{*} {\text{S}}_{{0,{\text{k}}}} } \right){\text{Q}}_{{\text{k}}} {\text{S}}_{{{\text{o}},{\text{k}}}} } \right)$$
(25)

where the saturation concentration for oxygen is.

S0* = 8 g.m−3.

Miscellaneous equations are.

Za = Z5; Zf = Z5;Zw = Zr;

Qf = Q5−Qa = Qe + Qr + Qw = Qe + Qu.

Design of a Fuzzy Logic Controller

Fuzzification

The fuzzy logic control block diagram ( Fuzzy toolbox of MATLAB) is shown in Fig. 3. As a first step of design, fuzzification is carried out with two inputs as error and error rate in DO concentration. The first input variable, Error consists of five fuzzy sets as shown in Fig. 4 and they are named as VHIGH, HIGH, NORMAL, LOW, and VLOW. These fuzzy sets are in triangular shape.

Fig. 3
figure 3

Block diagram of a fuzzy logic controller

Fig. 4
figure 4

Fuzzy sets of input variable, Error

Error rate for DO concentration consists of 3 fuzzy sets named as LOW, ZERO and HIGH as shown in Fig. 5. The seven fuzzy sets for manipulated variable, KLa5, are given in Fig. 6 and named as HDECREASE, DECREASE, LDECREASE, NO CHANGE, LINCREASE, INCREASE and HINCREASE.

Fig. 5
figure 5

Fuzzy sets of error rate

Fig. 6
figure 6

Fuzzy sets of KLa5 (i.e., air flow rate), the manipulated variable

Total seven rules are developed based on the knowledge of the process. They are written as.

  1. 1.

    If (Error is VHIGH), then (KLa5 is

    HDECREASE).

  2. 2.

    If (Error is VLOW), then (KLa5 is

    HINCREASE).

  3. 3.

    If (Error is HIGH), then (KLa5 is

    DECREASE).

  4. 4.

    If (Error is LOW), then (KLa5 is

    INCREASE).

  5. 5.

    If (Error is NORMAL) and (Error_rate is LOW), then (KLa5 is LDECREASE).

  6. 6.

    If (Error is NORMAL) and (Error_rate is HIGH), then (KLa5 is LINCREASE).

  7. 7.

    If (Error is NORMAL) and (Error_rate is ZERO), then (KLa5 is NO CHANGE).

Defuzzification

The most efficient centroid method is used for defuzzification.

Results and Discussion

The Simulink block diagram (combined form) for the performance evaluation of fuzzy logic control, PID control and open loop is given in Fig. 7. The PID controller parameters are Kc = 25, KI = 1250 and Kd = 0.025[1]. The scaling factor for fuzzy logic controller is obtained as: 1.5 for error, 0.001 for error rate and 3000 for the controller output, KLa5. They are obtained by trial and error method.

Fig. 7
figure 7

The Simulink block diagram for a fuzzy logic control, PID control and open-loop systems

The performance of fuzzy logic controller and PID controller have been evaluated for different a) set point changes in DO concentration, b) disturbances in feed concentrations (soluble substrate concentration, Ss) and c) for the step disturbances in KLa3 and KLa4 of Reactors 3 and Reactor 4, respectively.

The responses of fuzzy logic and PID controllers and open loop (i.e., manual control) have been studied at initial steady-state condition of 2.0 g/m3 of DO and are shown in Fig. 8. It shows all the three responses converging to 2.0 g/m3 of DO and remaining at the steady state with some unsteady-state behavior. The control actions in KLa5 of fuzzy logic controller and PID controller are given in Fig. 9,

Fig. 8
figure 8

The closed-loop response of fuzzy logic controller, conventional PID controller and open loop for the at initial steady state at 2.0 g/m3 of DO with constant, KLa5 = 131.64 m3/day

Fig. 9
figure 9

The control actions in KLa5 for the responses shown in Fig. 8

The regulatory response of both fuzzy logic and conventional PID controllers and open-loop response for the step disturbance from 69.5 to 76.5 g/m3 (+ 10%) in soluble substrate concentration, Ss, in feed is shown in Fig. 10. The fuzzy controller provides faster rejection of disturbance and maintains the set point of 2.0 (with small offset) than PID controller. Open-loop method leads to divergence to 2.15 g/m3 of DO.

Fig. 10
figure 10

Regulatory responses of fuzzy logic controller, PIDcontrollerandmanual control for the step change in disturbance in soluble substrate concentration, Ss, in the feed

The closed responses of fuzzy logic controller and PID responses for two set point changes of 2.5 and 1.5 are shown in Fig. 11. As from the Fig. 11, it is observed that for PID controller deviation is very high compared to fuzzy logic controller. The fuzzy logic controller shows faster response than PID controller. The manipulated variable, KLa5, for both fuzzy logic and PID, is given Fig. 12 and obtained as smooth for implementation.

Fig. 11
figure 11

The response of fuzzy logic controller, PID controller and open loop for two step changes set points from (i) 2.0 to 2.5 and (ii) 2.5 to 1.5 the from initial steady-state value of 2.0 g/m3 of DO

Fig. 12
figure 12

The control actions in KLa5 for responses shown in Fig. 11

Figures 13 and 14 show the regulatory responses of fuzzy logic controller, PID control and open-loop response for the step disturbance in KLa3 and KLa4 from 240 to 192 (− 20%) in Rector 3 and Reactor 4, respectively. Without control actions in Reactor 3 and Reactor 4 i.e., fixed values of KLa3 and KLa4, as expected divergence in DO in case of change in KLa3 is more than that of change in KLa4 as the KLa3 effecting is all three reactors.,; Reactor 3, Reactor 4 and Reactor 5 and KLa4 effecting only two reactors; Reactor 4 and Reactor 5. Fuzzy controller response is faster than that of PID controller.

Fig. 13
figure 13

Regulatory responses of fuzzy logic controller, PID controller and manual control for the step change in disturbance in KLa3 of reactor 3

Fig. 14
figure 14

Regulatory responses of fuzzy logic controller, PID controller and manual control for the step change in disturbance in KLa4 of Reactor 4

Conclusions

The knowledge-based fuzzy logic controller is designed for DO control in the Reactor 5 of waste water treatment Plant. It is found that fuzzy logic controller performance is better than PID controller for various set point changes and disturbances in feed concentration and in KLa3 and KLa4 of Reactors 3 and 4, respectively. Hence, fuzzy logic controller is superior for the control of waste water treatment plant in place of existing PID controllers.