OPTIMAL CONTROLLERS FOR THE OPERATION OF ACTIVATED SLUDGE TREATMENT SYSTEMS

Objective: Application of Optimal Control Theory to the activated sludge process in order to regulate the removal of the carbonaceous part of the organic matter. Theoretical benchmark: Dynamic models of activated sludge processes are capable of enabling the development of innovative control systems. The Optimal Control Theory, aimed at optimizing the performance of dynamic systems, allows the establishment of control systems that enhance efficiency in adapting to changes in operating conditions, ensuring satisfactory process performance. Method: The proposed control systems were established from the application of Optimal Control Theory, considering the use of the dynamic model of the activated sludge process presented by International Association on Water Pollution Research and Control. Computer simulations were used to assess the performance of the control systems proposed. Results and conclusion : The proposed control systems were capable of curbing substantially the oscillations in the concentrations of biomass, of particulate matter produced by the degradation of biomass and those of the inert particulate substrate. The reductions in the oscillations of the slowly biodegradable part of the influent were relatively smaller. The controller was quite effective in leading the wastewater treatment system sooner to the new equilibrium conditions after the imposition of the disturbances in raw effluent. Implications


INTRODUTION
The activated sludge wastewater treatment processes, originally introduced in England in the last century, promote the production of biological flocs (biomass) through the action of microorganisms that grow and agglutinate inside aeration basins.Mechanical aerators or diffusers keep the biomass suspended and in constant contact with the organic compounds that serve as the substrate besides guaranteeing an aerobic environment in the completely mixed reactor.While the activated sludge processes produce high quality effluents and are less demanding in terms of the space required their implantation, they are known to produce excessive amounts of sludge and are energy intensive.There is, thus, a need for efficient design and operation strategies.Automatic control of the wastewater treatment plants emerges as a suitable alternative for the improvements in the performance of activated sludge systems.
This paper presents application of modern Optimal Control Theory techniques to the activated sludge process in order to regulate the removal of the carbonaceous part of the organic matter in an example treatment system.

Dynamic Model of the Process
The implementation of optimal control techniques invariably involves the use of dynamic models that adequately represent the processes to be controlled.In this study, the behavior of the aeration basins in the activated sludge process was described by the International Association on Water Pollution Research and Control (IAWPRC) model presented in detail and discussed by Henze et al. (1987).The model proposed by IAWPRC provides the quantification of oxidation of the carbonaceous matter, nitrification and denitrification involving eight processes: aerobic growth of heterotrophic biomass, anoxic growth of heterotrophic biomass, aerobic growth of autotrophic biomass, heterotrophic biomass decay, autotrophic biomass decay, ammonification of soluble organic nitrogen, hydrolysis of particulate organic matter and hydrolysis of organic nitrogen.A simplified diagrammatic representation of the IAWPRC model processes is presented in Figure 1.The aeration basin is characterized in this model by six state variables: active heterotrophic biomass concentration (Xb), active slowly biodegradable substrate concentration (Xs), readily biodegradable substrate concentration (Ss), concentration of the products from biomass decay (Xp), particulate inert organic matter concentration (Xi) and effluent flow rate (Qo).As soluble inert substrate is not adsorbed or metabolized by biological flocs, its behavior is not simulated.Further, only three of the six processes mentioned above, namely, aerobic growth of heterotrophic biomass, heterotrophic biomass decay and hydrolysis of particulate organic matter, are included here in the simulation of the aeration basin performance for aerobic substrate decomposition.Thus, the following set of equations describes the behavior of the five process state variables: Following notations are employed in equations ( 1) to ( 5): • V: volume of aeration basin (L 3 ); • Xb: concentration heterotrophic biomass in the reactor (M/L 3 ); • Xbr: concentration of active heterotrophic biomass in the return sludge (M/L 3 ); • Xbi: concentration of active heterotrophic biomass in the raw influent (M/L 3 ); • Ss: concentration of readily biodegradable substrate in the reactor (M/L 3 ); • Ssr: concentration of readily biodegradable substrate in the return sludge (M/L 3 ); • Sii: concentration of readily biodegradable substrate in the raw influent (M/L 3 ); • Xs: concentration of slowly biodegradable substrate in the reactor (M/L 3 ); • Xsr: concentration of slowly biodegradable substrate in the return sludge (M/L 3 ); • Xii: concentration of slowly biodegradable substrate in the raw influent (M/L 3 ); • Si: concentration of soluble inert organic matter in the reactor (M/L 3 ); • Sir: concentration of soluble inert organic matter in the return sludge (M/L 3 ); • Sii: concentration of soluble inert organic matter in the raw influent (M/L 3 ); • Xp: concentration of the products from biomass decay in the reactor (M/L 3 ); • Xpr: concentration of the products from biomass decay in the return sludge (M/L 3 ); • Xpi: concentration of the products from biomass decay in the raw influent (M/L 3 ); • Xi: concentration of inert particulate organic matter in the reactor (M/L 3 ); • Xir: concentration of inert particulate organic matter in the return sludge (M/L 3 ); • Xii: concentration of inert particulate organic matter in the raw influent (M/L 3 ); • YH : coefficient of heterotrophic biomass yield; • fp : fraction of biomass yielding decay products; • H, ks, koh, kno e bH: kinetic parameters for heterotrophic growth and decay; • kH e kx: hydrolysis process coefficients.
The equation describing the variation of effluent discharge is obtained from considerations of mass balance among the aeration basin influent and effluent discharges.Thus: In equation ( 6), Qi represents raw influent flow rate (L 3 /T), Qr, the sludge return flow rate (L 3 /T), Qd, the waste sludge flow rate (L 3 /T) and Qo denotes the aeration basin effluent flow rate (L 3 /T).
The performance of the settling tank was described by simplified version of the model proposed by Vitasovic (1989) in order to evaluate the characteristics of sludge returning to the aeration basin.This model based on the mass balance takes the following form: In equation ( 7), XT is concentration of the solids (M/L 3 ), Di, the dispersion coefficient (L 2 /T), v, the downflow velocity (L/T) and h is vertical coordinate (L).
Following Stenstrom (1975), Vitasovic (1989) suggested that equation.( 7) can be solved by numerical methods under the assumptions given below: • Suspended solids concentration is the same in any horizontal in the settling tank; • No vertical dispersion in the tank; • Mass flux through an infinitesimal volume in the tank can not exceed that through the volume immediately below it; • There is no flux of settleable solids though the tank bottom; • The settling velocity of the solids is function only of the concentration of suspended solids: • There is no significant biologic activity in the tank; • Only the thickening of solids is considered.
Under these assumptions, the settling tank was divided in a finite number of horizontal layers with constant liquid concentration inside them.Thus, equation ( 7) for an intermediate layer j is written as:

6
In equation ( 8), vu is the downward velocity due to fluid movement (L/T), Js the settling flux (M/L 2 T) and h is the height of finite volume j (L).The downward velocity of liquid mass is determined as: In equation ( 09), Qr is recycled sludge flow rate (L 3 /T) and As is the horizontal area of the settling tank (L 2 ).
The settling solids flux is expressed simply as: and the settling velocity written through the empirical relationship of Vesilind as: In equation ( 11), n e  are empirical constants related to the settling properties of the influent sludge.
The mass balance for the surface and bottom layers must satisfy the boundary conditions.The surface boundary condition was specified in terms of the rate of solids inflow to the tank whereas the bottom boundary condition was the rate of removal of settled sludge.Thus the variation of concentration of solids in the surface and the bottom layer respectively is described as: In equations ( 12) and ( 13), Qi is the inflow to the tank (L 3 /T) and XT,i is the suspended solids concentration in the inflow (M/L 3 ).The index n refers to the bottom layer of the settling tank.
It should be observed that the calculation of flux of solids due to sedimentation involves a minimization process that introduces an undesirable discontinuity in Eqs. ( 11), ( 12) and ( 13).In order to deal with this difficulty in the Vitasovic (1989) replaced by a continuous function as follows: ( ) Where The parameter  regulates how closely the discontinuity is represented by the continuous function in equations ( 14) e ( 15).The parameter  was set equal to 10 m 2 min/g.

Optimal Control
The design of an optimal controller aims at establishing an automatic control system with desired operational performance.The dynamic model of the activated sludge system is first written in the state space form as: In equations ( 16) and ( 17), x represents the state vector (n x 1), u the control vector (r x 1), w the disturbance vector (m x1), y the output vector, A the state matrix (n x n), B the control input matrix (n x r), C the output matrix (m x n) and D the disturbance input matrix (r x m).In this study, the active heterotrophic biomass concentration (Xb), concentrations of various forms of organic matter (Xs, Ss, Xp and Xi) and the inflow discharge (Qo) are taken as the state variables of the activated sludge process.The recycled sludge flow rate (Qr) and the waste sludge flow rate (Qd) are the control inputs and the raw influent flow rate (Qi) is the disturbance input.
For the linear optimal control considered here, the control vector can be written as: The design of an optimal control system involves determination of the feedback gain matrix K for the control vector such that a given performance measure is optimized.The quadratic performance measure commonly employed in the design of optimal control systems is given as: Matrices Q e R are used to weight respectively the deviations of the state variables from the equilibrium or other desired state (x T (t)x(t) ) and the control effort exerted by the system (u T (t)u(t) ).These weight matrices were defined in this study the Bryson's Inverse Square Method (Bryson & Ho, 1969).Kwakernaak & Sivan (1972) demonstrate that the matrix K for the linear invariant systems is given by: Matrix P in eq.20, known as Riccati Matrix is the solution of the Reduced Riccati Matrix Equation:

Wastewater Treatment System
The wastewater treatment system in Figure 3 (Van Haandel & Marais, 1999) is used as an example for the application of the optimal controller in Figure 2.This activated sludge process is composed of a completely mixed aeration basin followed by a secondary settling tank.Table 1 presents the parameters and their values required for modeling the activated sludge process.

9
The data on the characteristics of inflow organic material in terms of its concentration and distribution among biodegradable and non-biodegradable, soluble and particulate fractions are presented in Table 2 as in Van Haandel & Marais (1999).From the same reference, the following physical characteristics of the aeration basin and the settling tank as well as the various expected flow rates in the system during equilibrium condition are given in Table 3.

Definition and Evaluation of the Control System Performance
Although the influent flow rate fluctuates during the daily operation of real wastewater treatment systems and does not follow a definite pattern of variation, it has a periodic nature.Thus we have chosen influent flow variations in the forms of step and sinusoidal functions to conduct example computational simulations for the evaluation of performance of the proposed optimal control system.These simple disturbance patterns are typically used to test the action of such controllers.According to Ogata (1982), the systems tested against such signals perform satisfactorily when submitted to real inputs.The step and sinusoidal functions are expressed mathematically as: Step function: ( ) The constants A e  regulate the intensity of influent variation in these functions.The computational simulations, whose results are presented in the next section, assumed a value of 10% of the equilibrium influent flow rate for A.
All simulations used to assess the performance of established control system were conducted using MATLAB  software.The Riccati matrix (P, equation ( 21)) and feedback gain

RESULTS AND DISCUSSION
The state of an aeration basin is characterized in the dynamic model by six state variables namely, active heterotrophic biomass concentration (Xb), active slowly biodegradable substrate concentration (Xs), readily biodegradable substrate concentration (Ss), concentration of the particulate products arising from biomass decay (Xp), particulate inert organic matter concentration (Xi) and effluent flow rate (Qo).The performance of the settling tank, which is important in the evaluation of the characteristics of sludge that returns to the aeration basin, is also expressed in terms of the same biomass and substrate as those related to the aeration basin (Xb, Ss, Xs, Xp e Xi).However, as the settling tank is divided in 10 layers with the 5 lowest being simulated, there are 31 state variables used to model the activated sludge system.The return and waste sludge flow rates Qr and Qd are considered to be the control variables.The influent flow rate Qi is taken as the external disturbance acting on the activated sludge system.
The state space equation ( 16) describing the performance of the activated sludge system modeled here is expressed through the coefficient matrices A, B and Dw, respectively the state matrix, the input matrix and the disturbance matrix, as follows:

11
The system of equations ( 16) defined through these matrices is stable as observed in Figure 4 in which all the eigenvalues are found to be in the left complex semi-plane.12 The feedback gain matrix K of the control system defined by equations ( 20) and ( 21) is found to be: As described above, the effectiveness of the proposed controller is tested in response to the influent flow rate variations in the form of step and periodic functions.The fluctuations in the state variables for the aeration basin and the settling tank bottom layer for step function disturbance in the influent flow are shown in Figures 5 and 6 respectively for the situation where there is no control and where the designed control is introduced.A step increase in the influent flow rate causes a progressive increase in the quantity of solids at the settling tank bottom and in the recycled sludge.Further, there is an increase in the return sludge flow rate and consequently the new equilibrium concentrations of biomass, and of other components of substrate, are also higher than those existing before the disturbance.With the introduction of the controller into the activated sludge system (Figure 6), the fluctuations in the state variables and the time required for the establishment of a new equilibrium are reduced.There is appreciable reduction in the deviations, from the equilibrium state, in the concentrations of active heterotrophic biomass (Xb) and consequently in the concentrations of slowly biodegradable substrate (Xs) and products from biomass decay (Xp).The reductions in Xs are, however, less significant for two reasons.Firstly, Xs in the influent is much higher in the previous equilibrium condition in the aeration basin whereas opposite is true for biomass and other components of the substrate.Secondly, larger part of the decomposed biomass (about 80% as indicated in Table 1) is converted into slowly biodegradable substrate.
The action of the controller in terms of the control variables, namely, return and waste sludge flow rates Qr and Qd is shown in Figure 7.It can be observed that the increase in the influent flow rate is dealt with through an increase in Qr and Qd, the latter requiring smaller changes.It is observed from the system response that periodic influent variations do not introduce excessive changes in the concentration of sludge recycled to the aeration basin.Also, the oscillations in the variables at the bottom layer of the settling tank are a small fraction of equilibrium concentrations in the recycled sludge.The controller acts to reduce these oscillations diminishing still further the influence of the dynamics of the settling tank on the state variable concentrations in the aeration basin.
The behavior of the control variables of the process, presented in Figure 10, shows that the controlled system reacts to the rise in the influent flow rate by increasing the flow rates of the sludge return to the aeration basin and the sludge waste and inversely when the influent flow rates diminish.The variations in the sludge return flow rate are, however, large.

CONCLUSIONS
This application of Optimal Control Theory to the activated sludge process evaluated viability of automatic control of wastewater treatment in response to changes in the influent flow rate.The linear invariant models for the aeration basin and the settling tank, that comprised the activated sludge process, were found to be stable and adequate in the definition of the control system.
The proposed control systems were capable of curbing substantially the oscillations in the concentrations of biomass, of particulate matter produced by the degradation of biomass and those of the inert particulate substrate.The reductions in the oscillations of the slowly biodegradable part of the influent were relatively smaller.Such varied responses of the state variables to the action of the control system are considered to be due to the differences in the compositions of the raw influent, the recycled sludge and the aeration basin contents besides the intricate relations between them.
The readily biodegradable part of the influent, being quickly taken up by the microorganisms, behaved differently in all the simulations.It presented low concentrations with or without the action of the controller independently of the mode of disturbance in the influent flow rate.The controller was quite effective in leading the wastewater treatment system sooner to the new equilibrium conditions after the imposition of the disturbances.The action of the controller to attenuate the effect of the disturbances was to raise the sludge recycle and waste flow rates in response to the rise in influent flow rate and vice-versa.In the case of a fall in the flow rates, the oscillations in the state variables were less significant.
These results were obtained by the application of Optimal Control Theory on the assumption of small disturbances in the influent flow rates that permit linearization of mathematical models of the dynamics of aeration basin and settling tank.Also, this study was limited to the removal of carbonaceous fraction of organic matter.For future work, it is recommended to develop control systems that have as an additional objective the removal of nutrients.

Figure 1 -
Figure 1 -Block diagram of the exchanges in IAWPRC model (Henze et al. (1987)) .Source: Prepared by the authors themselves.

Figure 2
Figure 2 presents in diagrammatic form the controller proposed for the operation an activated sludge system.

Figure 2 -
Figure 2 -Block Diagram of the optimal control system Source: Prepared by the authors themselves.

Figure 4 -
Figure 4 -Eigenvalues of the modeled activated sludge.Source: Prepared by the authors themselves.

Figure 5 -Figure 6 -
Figure 5 -State variable fluctuations in the aeration basin (left) and in the settling tank bottom layer (right) in response to a step-function flow rate disturbance with no controls.Source: Prepared by the authors themselves.Time (days)

Figure 7 -
Figure 7 -Changes in recycle and waste sludge flow rates determined by the controller to deal with a step-function variation in the influent flow rate.Source: Prepared by the authors themselves.

Figure 8 -Figure 9 -
Figure 8 -Changes in the state variables for the aeration basin (left) e the settling tank bottom layer (right) in response to a periodic influent flow rate disturbance with no controls.Source: Prepared by the authors themselves.Time (days)

Figure 10 -
Figure 10 -Variations in the control variables of the activated sludge process in response to the sinusoidal change in the influent flow rate Source: Prepared by the authors themselves.