\documentclass[reqno]{amsart} \usepackage{hyperref} \usepackage{graphicx} \AtBeginDocument{{\noindent\small Eighth Mississippi State - UAB Conference on Differential Equations and Computational Simulations. {\em Electronic Journal of Differential Equations}, Conf. 19 (2010), pp. 161--175.\newline ISSN: 1072-6691. URL: http://ejde.math.txstate.edu or http://ejde.math.unt.edu \newline ftp ejde.math.txstate.edu} \thanks{\copyright 2010 Texas State University - San Marcos.} \vspace{8mm}} \begin{document} \setcounter{page}{161} \title[\hfilneg EJDE-2010/Conf/19/\hfil Optimal control] {Optimal control of a waste water cleaning plant} \author[E. V. Grigorieva, E. N. Khailov\hfil EJDE/Conf/19 \hfilneg] {Ellina V. Grigorieva, Evgenii N. Khailov} % in alphabetical order \address{Ellina V. Grigorieva \newline Department of Mathematics and Computer Science\\ Texas Woman's University \\ Denton, TX 76204, USA} \email{EGrigorieva@mail.twu.edu} \address{Evgenii N. Khailov \newline Department of Computer Mathematics and Cybernetics\\ Moscow State Lomonosov University \\ Moscow, 119991, Russia} \email{Khailov@cs.msu.su} \thanks{Published September 25, 2010.} \subjclass[2000]{49J15, 49N90, 93C10, 93C95} \keywords{Optimal control problem; nonlinear model; \hfill\break\indent waste water cleaning process} \begin{abstract} In this work, a model of a waste water treatment plant is investigated. The model is described by a nonlinear system of two differential equations with one bounded control. An optimal control problem of minimizing concentration of the polluted water at the terminal time $T$ is stated and solved analytically with the use of the Pontryagin Maximum Principle. Dependence of the optimal solution on the initial conditions is established. Computer simulations of a model of an industrial waste water treatment plant show the advantage of using our optimal strategy. Possible applications are discussed. \end{abstract} \maketitle \numberwithin{equation}{section} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \section{Introduction} While water is the most abundant life sustaining substance on the planet, clean, fresh water is in many localities often the most scarce. The supply of fresh water over the land masses is limited by chaotic weather effects. Meanwhile, human populations and the success of our civilizations rely on stable and sustainable supplies of clean, fresh water. As population densities increase, the maintenance of supplies of potable water tend to become dependent on the efficiencies of fresh water recovery methods. The activated sludge process (ASP) is a biochemical process for treating sewage and industrial waste-water that uses air (or oxygen) and microorganisms to biologically oxidize organic pollutants, producing a waste sludge (or floc) containing the oxidized material. The optimal operation of the waste water processes with biological treatment is challenging because of the strong effluent requirements, the complexity of theses processes as an object of control and the need to reduce the operation cost. The USA has strict requirements on the effluent quality of the ASP. Similar strict requirements were adopted during the last decade in Europe and in South Africa \cite{Lit16}. In general, an activated sludge process has an aeration tank where air (or oxygen) is injected and thoroughly mixed into the waste-water and a settling tank (usually referred to as a "clarifier" or "settler"). Flocculation-agglomeration is a process where a solute comes out of solution in the form of floc or flakes. Part of the waste sludge is recycled to the aeration tank where the remaining waste sludge is removed for further treatment and ultimate disposal. A diagram of the process is shown in Figure \ref{fig1}. \begin{figure}[ht] \begin{center} \includegraphics[width=0.8\textwidth]{fig1} %Sludge.eps \end{center} \caption{Diagram of flocculation-agglomeration process}\label{fig1} \end{figure} During the last decades various control strategies for the ASP have been developed. Simple strategies are limited to the maintenance of some desired values of easily determinable process parameters like food-microorganism ratio, sludge recycle flowrate or oxygen concentration in the aeration basin \cite{Lit7}. In more complex models, the behavior of the sludge process also depends on several working conditions e.g. air compressor power to regulate the mean oxygen concentration \cite{Lit15}. Establishing optimal working conditions and control strategies is frequently accomplished with the aid of mathematical models \cite{Lit2,Lit3,Lit8,Lit11,Lit16}. Relevant work in the investigation and comparison of control strategies was done by \cite{Lit4,Lit5,Lit9,Lit10,Lit13,Lit14}. Obviously, the solution depends on the model. What unites all these papers is that either the considered models are so complex that they cannot be solved analytically or that the controls are not bounded and therefore the realism of the model is questionable. The model proposed in \cite{Lit2} is simple enough that it can be investigated analytically. On the other hand, it properly corresponds to the main steps of the ASP and water cleaning control process. In \cite{Lit2} an optimal control problem of the minimization of the waste concentration in the ASP was stated and the Pontryagin Maximum Principle \cite{Lit12} was offered for its solution. However, the complete analysis of the corresponding boundary value problem for the Maximum Principle was not conducted. The author simply offered a numerical solution to the problem at different piecewise constant controls. This work deals with the complete analysis of the model proposed by \cite{Lit2}, but with a different objective function. In Section 2, we discuss the model. In Section 3, we establish the properties of the state variables. In Section 4, we state optimal control problem of minimizing water pollution concentrations at the terminal time $T$ and find optimal solutions. In Section 5, we investigate how optimal solutions depend on the initial conditions. A numerical simulation of the ASP at different parameters of the model is conducted in Section 6. Finally, Section 7 presents our conclusions. \section{The model} Let us consider the model of an activated sludge process. A simplified diagram can be shown in the Figure \ref{fig2}. \begin{figure}[ht] \begin{center} \includegraphics[width=0.8\textwidth]{fig2} % System.eps \caption{Simplified diagram of an activated sludge process}\label{fig2} \end{center} \end{figure} Here $u(t)$ is the inflow rate of the recirculated biomass (gal/min), $b$ is the inflow rate of substrate - polluted water (gal/min), $a_{2}$ the concentration of substrate (lb/gal), $a_{1}$ concentration of bacteria (lb/gal). This process can be described by the following system of differential equations $$\label{num2.1} \begin{gathered} \dot{x}(t) = u(t)a_{1} + \mu_{0}\frac{x(t)s(t)}{k + s(t)} - (b + u(t))x(t), \\ \dot{s}(t) = b a_{2} - \frac{\mu_{0}}{Y} \frac{x(t)s(t)}{k + s(t)} - (b + u(t))s(t), \quad t \in [0,T], \\ x(0) = x_{0} > 0, \; s(0) = s_{0} > 0. \end{gathered}$$ We consider function $u(t)$ as a control function and the set $D(T)$ is the set of all Lebegue measurable functions $u(t)$ such that $0 < u_{1} \le u(t) \le u_{2}$ for almost all $t \in [0,T]$. The recycle sludge rate $u(t)$ is not allowed to take values below a certain lower limit $u_{1}$ in order to prevent the biomass from being swept out of the aeration tank. An upper limit $u_{2}$ for $u(t)$ is given by the limited power of the recycle pump. Here $x(t)$ is the concentration of biomass, $s(t)$ is the concentration of polluted water, $Y$ is the substrate utilization - yield coefficient, $\mu_{0}$ is the maximal specific rate of bacteria growth, $k$ the saturation coefficient. For the model \eqref{num2.1} assume $k \gg s$. This case is realistic since one normally tries to keep the substrate-to-biomass ratio comparatively low. Denoting $\mu = \frac{\mu_{0}}{k}$ the simplified system can be written as $$\label{num2.2} \begin{gathered} \dot{x}(t) = u(t)a_{1} + \mu x(t)s(t) - (b + u(t))x(t), \\ \dot{s}(t) = b a_{2} - \frac{\mu}{Y} x(t)s(t) - (b + u(t))s(t), \; t \in [0,T], \\ x(0) = x_{0} > 0, \; s(0) = s_{0} > 0. \\ \end{gathered}$$ Numerical modeling conducted in \cite{Lit2} shows that the second term in the first equation of \eqref{num2.2} can be ignored. Finally we obtain the following system $$\label{num2.3} \begin{gathered} \dot x(t) = u(t) a_{1} - (b + u(t))x(t), \quad t \in [0,T], \\ \dot s(t) = b a_2 - \frac{\mu}{Y} x(t)s(t) - (b + u(t))s(t), \\ x(0) = x_{0} > 0, \; s(0) = s_{0} > 0. \end{gathered}$$ This model and its investigation will be considered further. \section{Properties of the state variables} We have the following statement, which can be easily proven using direct integration of the system \eqref{num2.3}. \begin{lemma}\label{Lemma1} Let $u(\cdot)\in D(T)$ be some control function. Then there exist corresponding to this control, $u(t)$, solutions $x(t)$, $s(t)$ to system \eqref{num2.3}, which on the closed interval $[0,T]$ satisfy the inequalities: $$x(t) > 0, \quad s(t) > 0.$$ \end{lemma} Analyzing system of equations \eqref{num2.3} with the use of Lemma \ref{Lemma1} we can conclude that if at some moment of time $t \in [0,T]$ we have that $x(t) = a_{1}$, then $$\dot x(t) = - ba_{1} < 0.$$ By analogy if at some moment $t$ we have $s(t) = a_{2}$, then we obtain relationship $$\dot s(t) = - \frac{\mu}{Y}a_{2}x(t) - u(t)a_{2} < 0.$$ The validity of these relationships leads to the following statement. \begin{lemma}\label{Lemma2} Let $u(\cdot) \in D(T)$ be some control function. Suppose that at some moments of time $\tau_{1}, \tau_{2} \in [0,T)$ the following relationships hold $$x(\tau_{1}) \le a_{1}, \quad s(\tau_{2}) \le a_{2},$$ then we have $x(t) < a_{1}$ for any $t \in (\tau_{1},T]$ and $s(t) < a_{2}$ for any $t \in (\tau_{2},T]$. \end{lemma} From results of the Lemma \ref{Lemma2} it follows the statement. \begin{lemma}\label{Lemma3} Let $u(\cdot) \in D(T)$ be some control function. Suppose that at some moments of time $\eta_{1}, \eta_{2} \in (0,T)$ the following relationships hold $$x(\eta_{1}) > a_{1}, \quad s(\eta_{2}) > a_{2},$$ then we have $x(t) > a_{1}$ for any $t \in [0,\eta_{1})$ and $s(t) > a_{2}$ for any $t \in [0,\eta_{2})$. \end{lemma} Moreover, we have the statement. \begin{lemma}\label{Lemma4} Let $u(\cdot) \in D(T)$ be some control function. Suppose that at some moments of time $\theta_{1}, \theta_{2} \in (0,T)$ the following relationships hold $$x(\theta_{1}) \ge a_{1}, \quad s(\theta_{2}) \ge a_{2},$$ then we have inequalities: $$\dot x(\theta_{1}) < 0, \quad \dot s(\theta_{2}) < 0$$ respectively. \end{lemma} The validity of the Lemma \ref{Lemma4} follows from the equations \eqref{num2.3}. \section{Optimal control problem of minimizing pollution at terminal time~$T$} Let $s(t)$ be the pollution concentration at moment $t$. Then an integrated relative increase of the amount of pollution by time $t$ can be written as $$\int_{0}^{t} \frac{\dot s(t)}{s(t)}dt = \ln{\frac{s(t)}{s_0}}, \; t \in [0,T].$$ For system \eqref{num2.3} we will consider an optimal control problem of minimizing of the integrated relative increase of the pollution by time $T$, which is equivalent to $$\label{num4.1} J(u) = s(T) \to \min_{u(\cdot) \in D(T)}.$$ The existence of the optimal control $u_{*}(t)$ and corresponding to it optimal solutions $x_{*}(t)$, $s_{*}(t)$ for the optimal control problem \eqref{num2.3},\eqref{num4.1} follows from \cite{Lit6}. In order to solve problem \eqref{num2.3},\eqref{num4.1} we will apply the Pontryagin Maximum Principle (\cite{Lit12}). For the optimal control $u_{*}(t)$ and corresponding optimal trajectories $x_{*}(t)$, $s_{*}(t)$ there exist nontrivial solutions $\psi_{*}(t)$, $\varphi_{*}(t)$ of the adjoint system $$\label{num4.2} \begin{gathered} \dot{\psi}_{*}(t) = (b + u_{*}(t))\psi_{*}(t) + \frac{\mu}{Y}s_{*}(t)\varphi_{*}(t), \\ \dot{\varphi}_{*}(t) = \left(\frac{\mu}{Y} x_{*}(t) + (b + u_{*}(t))\right)\varphi_{*}(t), \\ \psi_{*}(T) = 0, \quad \varphi_{*}(T) = -1, \end{gathered}$$ for which the control $u_{*}(t)$ is given by $$\label{num4.3} u_{*}(t) = \begin{cases} u_{2} & \text{if } L(t) > 0, \\ \forall u \in [u_{1},u_{2}] & \text{if } L(t) = 0, \\ u_{1} & \text{if } L(t) < 0, \end{cases}$$ where $$L(t) = (a_{1} - x_{*}(t))\psi_{*}(t) - s_{*}(t)\varphi_{*}(t), \; t \in [0,T]$$ is the switching function. As it follows from \eqref{num4.3}, the function $L(t)$ determines the type of the optimal control $u_{*}(t)$. Systems of equations \eqref{num2.3},\eqref{num4.2} and relationships \eqref{num4.3} form the two point boundary value problem for the Maximum Principle. Let us study this problem in depth. Suppose control $u(t)$, trajectories $x(t)$, $s(t)$ and functions $\psi(t)$, $\varphi(t)$ satisfy this boundary value problem. Then such a function $u(t)$ is called extremal control, trajectories $x(t)$, $s(t)$ are extremal trajectories and functions $\psi(t)$, $\varphi(t)$ are called corresponding to them solutions of the adjoint system \eqref{num4.2}. For the functions $\psi(t)$, $\varphi(t)$ the following statement is true. \begin{lemma}\label{Lemma5} Let $u(t)$ be the extremal control, $x(t)$ and $s(t)$ are extremal trajectories and $\psi(t)$, $\varphi(t)$ are the corresponding to them solutions of the adjoint system \eqref{num4.2}. Then the following inequalities hold $$\psi(t) > 0, \quad \varphi(t) < 0$$ for all $t \in [0,T)$. \end{lemma} The proof of this statement is based on integration of the system \eqref{num4.2} with the use of Lemma \ref{Lemma1}. Let $L(t)$ be the switching function corresponding to the extremal control $u(t)$, extremal trajectories $x(t)$, $s(t)$ and solutions $\psi(t)$, $\varphi(t)$ of the adjoint system \eqref{num4.2}. The following statements is true. \begin{lemma}\label{Lemma6} There exists such time $\theta \in [0,T)$ that for the extremal control $u(t)$ the equality $u(t) = u_{2}$ is valid for all $t \in (\theta,T]$. \end{lemma} \begin{proof} For the switching function $L(t)$ from terminal conditions of the system \eqref{num4.2} we have that $$L(T) = (a_{1} - x(T))\psi(T) - s(T)\varphi(T) = s(T).$$ From Lemma \ref{Lemma1} we obtain the inequality $L(T) > 0$. Since $L(t)$ is continuous function, there exists value $\theta \in [0,T)$ such that $L(t) > 0$ for all $t \in (\theta,T]$. Furthermore, from \eqref{num4.3} we have $u(t) = u_{2}$ for $t \in (\theta,T]$. \end{proof} \begin{lemma}\label{Lemma7} If $x_{0} \le a_{1}$, then for the extremal control $u(t)$ the relationship $u(t) = u_{2}$ holds for all $t \in [0,T]$. \end{lemma} \begin{proof} From results of Lemma \ref{Lemma1}, Lemma \ref{Lemma2}, Lemma \ref{Lemma5} for the switching function $L(t)$ the inequality $L(t) > 0$ is true for all $t \in [0,T]$. Therefore, the desired result follows from \eqref{num4.3}. \end{proof} \begin{lemma}\label{Lemma8} The switching function $L(t)$ has at most one zero in the interval $(0,T)$. \end{lemma} \begin{proof} Note that the derivative of the switching function $L(t)$ is $$\label{num4.4} \dot{L}(t) = b a_{1}\psi(t) - b a_{2}\varphi(t) + \frac{\mu}{Y}(a_{1} - x(t))s(t)\varphi(t), \; t \in [0,T].$$ Let $t_{0} \in (0,T)$ such that $L(t_{0}) = 0$. It means that $$a_{1} - x(t_{0}) = \frac{s(t_{0})\varphi(t_{0})}{\psi(t_{0})}.$$ Substituting this expression into the formula \eqref{num4.4} we obtain $$\dot{L}(t_{0}) = b a_{1}\psi(t_{0}) - b a_{2}\varphi(t_{0}) + \frac{\mu}{Y}\frac{s^{2}(t_{0})\varphi^{2}(t_{0})}{\psi(t_{0})}.$$ It follows from the results of Lemma \ref{Lemma1}, Lemma \ref{Lemma5} that $\dot{L}(t_{0}) > 0$. Since $\dot{L}(t)$ is continuous, then switching function $L(t)$ has on the interval $[0,T]$ the form $$L(t) \begin{cases} < 0, & \text{if } 0 \le t < t_{0}, \\ = 0, & \text{if } t = t_{0}, \\ > 0, & \text{if } t_{0} < t \le T. \end{cases}$$ This completes the proof. \end{proof} From Lemma \ref{Lemma6}, Lemma \ref{Lemma7}, Lemma \ref{Lemma8} and relationship \eqref{num4.3} we obtain the following statement. \begin{lemma}\label{Lemma9} If $L(0) \ge 0$, then the extremal control $u(t)$ is constant function of the type $$u(t) = u_{2}, \; t \in [0,T].$$ Alternatively, if $L(0) < 0$, then the extremal control $u(t)$ is a piecewise constant function of the type $$u(t) = \begin{cases} u_{1}, & \text{if } 0 \le t \le \theta, \\ u_{2}, & \text{if } \theta < t \le T, \end{cases}$$ where $\theta \in (0,T)$ is the moment of switching, defined from $L(\theta) = 0$. \end{lemma} From the properties of the switching function $L(t)$ and Lemma \ref{Lemma9} we established that the two point boundary value problem for the Maximum Principle \eqref{num2.3},\eqref{num4.2},\eqref{num4.3} has a unique solution $u(t)$, $x(t)$, $s(t)$, $\psi(t)$, $\varphi(t)$, $t \in [0, T]$, which as it follows from \cite{Lit1} is the optimal solution for problem \eqref{num2.3},\eqref{num4.1}. Optimal control $u_{*}(t)$ has one of the two forms: $$\label{num4.5} u_{*}(t) = u_{2}, \; t \in [0,T],$$ and $$\label{num4.6} u_{*}(t) = \begin{cases} u_{1}, & \text{if } 0 \le t \le \theta_{*}, \\ u_{2}, & \text{if } \theta_{*} < t \le T, \end{cases}$$ where $\theta_{*} \in (0,T)$ is the moment of switching. \section{Dependence of the optimal control on initial conditions} In this section, we will find the initial conditions that correspond to optimal controls of types \eqref{num4.5} and \eqref{num4.6}. Therefore, consider the system \eqref{num2.3} with initial conditions $(x_{0},s_{0})$. Let $u_{*}(t)$, $x_{*}(t)$, $s_{*}(t)$ be optimal solution to the problem \eqref{num2.3},\eqref{num4.1}, and $\psi_{*}(t)$, $\varphi_{*}(t)$ corresponding to them solutions of the adjoint system \eqref{num4.2}. First, we will consider the case that the optimal control $u_{*}(t)$, $t \in [0,T]$ is given by formula \eqref{num4.5}. The inequality $L(0) \ge 0$ can be rewritten as $$(a_{1} - x_{0})\psi_{*}(0) - s_{0}\varphi_{*}(0) \ge 0,$$ or $$\label{num5.1} s_{0} \ge (a_{1} - x_{0})\frac{\psi_{*}(0)}{\varphi_{*}(0)}.$$ Next, we introduce a function $q(t) = \frac{\psi_{*}(t)}{\varphi_{*}(t)}$, which satisfies the system $$\label{num5.2} \begin{gathered} \dot q(t) = -\frac{\mu}{Y}x_{*}(t)q(t) + \frac{\mu}{Y}s_{*}(t), \quad t \in [0,T], \\ q(T) = 0. \end{gathered}$$ The solution of the Cauchy problem \eqref{num5.2} is written as $$\label{num5.3} q(t) = -\frac{\mu}{Y} \int_{t}^{T} e^{\frac{\mu}{Y}\int_{t}^{r} x_{*}(\xi)d\xi}s_{*}(r)dr.$$ Then the inequality \eqref{num5.1} can be rewritten as $$\label{num5.4} s_{0} \ge (a_{1} - x_{0})q(0).$$ From the expression \eqref{num5.3} we obtain the formula $$\label{num5.5} q(0) = -\frac{\mu}{Y} \int_{0}^{T} e^{\frac{\mu}{Y}\int_{0}^{r} x_{*}(\xi)d\xi}s_{*}(r)dr.$$ To show that the value $q(0)$ depends on the initial conditions $(x_{0},s_{0})$, integrate the system \eqref{num2.3} with control $u_{*}(t)$, $t \in [0,T]$ given by \eqref{num4.5}. Integration yields the formulas: \begin{gather} x_{*}(t) = x_{0}e^{-(b + u_{2})t} + \frac{a_{1}u_{2}}{b + u_{2}} \left(1 - e^{-(b + u_{2})t}\right), \quad t \in [0,T], \label{num5.6}\\ \begin{aligned} s_{*}(t) &= s_{0}e^{-(b + u_{2})t} \cdot e^{-\frac{\mu}{Y}\int_{0}^{t} x_{*}(\xi)d\xi} \\ &\quad + a_{2}b \int_{0}^{t} e^{-(b + u_{2})(t - r)} \cdot e^{-\frac{\mu}{Y}\int_{r}^{t} x_{*}(\xi)d\xi}dr. \end{aligned} \label{num5.7} \end{gather} Substituting expressions \eqref{num5.6} and \eqref{num5.7} into \eqref{num5.5}, we obtain $$q(0) = -\sigma s_{0} - g(x_{0}),$$ where the value $$\sigma = \frac{\mu}{(b + u_{2})Y}\left(1 - e^{-(b + u_{2})T}\right)$$ is positive, as well as the function $$\label{num5.8} g(x_{0}) = \frac{\mu a_{2}b}{Y} \int_{0}^{T}\Big( \int_{0}^{r}e^{-(b + u_{2})(r - \eta)} \cdot e^{\frac{\mu}{Y}\int_{0}^{\eta}x_{*}(\xi)d\xi}d\eta\Big)dr$$ is also positive. Function \eqref{num5.8} depends on $x_{0}$ by formula \eqref{num5.6}. Then \eqref{num5.4} can be rewritten as $$\label{num5.9} s_{0}(1 + \sigma(a_{1} - x_{0})) \ge -(a_{1} - x_{0})g(x_{0}).$$ If $a_{1} - x_{0} \ge 0$, then \eqref{num5.9} holds. This means that for any initial conditions $(x_{0},s_{0})$ for which $a_{1} - x_{0} \ge 0$, the optimal control $u_{*}(t)$ has type \eqref{num4.5} in agreement with Lemma \ref{Lemma7}. If $a_{1} - x_{0} < 0$, then from \eqref{num5.9} it follows that $1 + \sigma(a_{1} - x_{0}) > 0$. Then inequality \eqref{num5.9} becomes $$\label{num5.10} s_{0} \ge -\frac{(a_{1} - x_{0})g(x_{0})}{1 + \sigma(a_{1} - x_{0})}.$$ Now, consider a function $$s_{0} = f(x_{0}) = -\frac{(a_{1} - x_{0})g(x_{0})}{1 + \sigma(a_{1} - x_{0})}$$ on the interval $x_{0} \in [a_{1},a_{1} + \frac{1}{\sigma})$. Let us examine the properties of the function $s_{0} = f(x_{0})$. Analyzing formulas \eqref{num5.6},\eqref{num5.8} we obtain relationships: $$f(a_{1}) = 0, \quad \lim_{x_{0} \to a_{1} + \frac{1}{\sigma}} f(x_{0}) = + \infty.$$ Using \eqref{num5.8} we will find derivatives of the function $g(x_{0})$. We have the expressions: \begin{gather*} \dot g(x_{0}) = \big(\frac{\mu}{Y}\big)^{2} a_{2}b \int_{0}^{T}\Big( \int_{0}^{r}e^{-(b + u_{2})(r - \eta)} \cdot e^{\frac{\mu}{Y}\int_{0}^{\eta}x_{*}(\xi)d\xi} \cdot \Big(\int_{0}^{\eta}e^{-(b + u_{2})\xi}d\xi\Big)d\eta \Big)dr, \\ \ddot g(x_{0}) = \big(\frac{\mu}{Y}\big)^{3} a_{2}b \int_{0}^{T}\Big( \int_{0}^{r}e^{-(b + u_{2})(r - \eta)} \cdot e^{\frac{\mu}{Y}\int_{0}^{\eta}x_{*}(\xi)d\xi} \cdot \Big(\int_{0}^{\eta}e^{-(b + u_{2})\xi}d\xi\Big)^{2}d\eta \Big)dr, \end{gather*} from which the inequalities immediately follow: $$\label{num5.11} \dot g(x_{0}) > 0, \quad \ddot g(x_{0}) > 0.$$ The corresponding derivatives of the function $f(x_{0})$ are: \begin{gather*} \dot f(x_{0}) = \frac{g(x_{0})}{(1 + \sigma(a_{1} - x_{0}))^{2}} - \frac{(a_{1} - x_{0})\dot g(x_{0})}{1 + \sigma(a_{1} - x_{0})}, \\ \ddot f(x_{0}) = \frac{2\sigma g(x_{0})}{(1 + \sigma(a_{1} - x_{0}))^{3}} + \frac{2\dot g(x_{0})}{(1 + \sigma(a_{1} - x_{0}))^{2}} - \frac{(a_{1} - x_{0})\ddot g(x_{0})}{1 + \sigma(a_{1} - x_{0})}. \end{gather*} Using \eqref{num5.11} we see that on the interval $x_{0} \in (a_{1},a_{1} + \frac{1}{\sigma})$ the following inequalities are valid: $$\dot f(x_{0}) > 0, \quad \ddot f(x_{0}) > 0.$$ Therefore, function $s_{0} = f(x_{0})$ is increasing and concave up. The graph of this function is shown in Figure \ref{fig3}. It follows from \eqref{num5.10} that for all initial values $(x_{0},s_{0})$ for which $$a_{1} - x_{0} < 0, \quad 1 + \sigma(a_{1} - x_{0}) > 0, \quad s_{0} \ge f(x_{0})$$ the optimal control $u_{*}(t)$ has type \eqref{num4.5}. Now, consider the case that the optimal control $u_{*}(t)$, $t \in [0,T]$ has type \eqref{num4.6}. The inequality $L(0) < 0$ implies the existence of switching $\theta_{*} \in (0,T)$, for which $$\label{num5.12} L(\theta_{*}) = 0.$$ Equality \eqref{num5.12} can be rewritten as $$(a_{1} - x_{*}(\theta_{*}))\psi_{*}(\theta_{*}) - s_{*}(\theta_{*})\varphi_{*}(\theta_{*}) = 0,$$ or $$\label{num5.13} s_{*}(\theta_{*}) = (a_{1} - x_{*}(\theta_{*}))q(\theta_{*}),$$ where the function $q(t)$ is defined by the Cauchy problem \eqref{num5.2}. From \eqref{num5.3} we obtain the formula $$\label{num5.14} q(\theta_{*}) = -\frac{\mu}{Y} \int_{\theta_{*}}^{T} e^{\frac{\mu}{Y}\int_{\theta_{*}}^{r} x_{*}(\xi)d\xi}s_{*}(r)dr.$$ As in the previous case, we find how the value $q(\theta_{*})$ depends on the initial conditions $(x_{0},s_{0})$. For this we will integrate the system \eqref{num2.3} with control $u_{*}(t)$, $t \in [0,T]$ given by \eqref{num4.6}. We have formulas: $$\label{num5.15} x_{*}(t) = \begin{cases} x_{0}e^{-(b + u_{1})t} + \frac{a_{1}u_{1}}{b + u_{1}} \left(1 - e^{-(b + u_{1})t}\right), \quad \text{if } 0 \le t \le \theta_{*}, \\[4pt] \Big(x_{0}e^{-(b + u_{1})\theta_{*}} + \frac{a_{1}u_{1}}{b + u_{1}} \left(1 - e^{-(b + u_{1})\theta_{*}}\right)\Big) e^{-(b + u_{2})(t - \theta_{*})} \\ + \frac{a_{1}u_{2}}{b + u_{2}} \left(1 - e^{-(b + u_{2})(t - \theta_{*})}\right), \quad \text{if } \theta_{*} < t \le T, \end{cases}$$ and $$\label{num5.16} s_{*}(t) = \begin{cases} s_{0}e^{-(b + u_{1})t} e^{-\frac{\mu}{Y}\int_{0}^{t} x_{*}(\xi)d\xi} \\ + a_{2}b \int_{0}^{t} e^{-(b + u_{1})(t - r)} e^{-\frac{\mu}{Y}\int_{r}^{t}x_{*}(\xi)d\xi}dr, \quad \text{if } 0 \le t \le \theta_{*}, \\[4pt] \Big(s_{0}e^{-(b + u_{1})\theta_{*}} e^{-\frac{\mu}{Y}\int_{0}^{\theta_{*}} x_{*}(\xi)d\xi} \\ + a_{2}b \int_{0}^{\theta_{*}} e^{-(b + u_{1})(\theta_{*} - r)} e^{-\frac{\mu}{Y}\int_{r}^{\theta_{*}}x_{*}(\xi)d\xi}dr\Big) \\ \times e^{-(b + u_{2})(t - \theta_{*})} \cdot e^{-\frac{\mu}{Y}\int_{\theta_{*}}^{t} x_{*}(\xi)d\xi} \\ + a_{2}b \int_{\theta_{*}}^{t} e^{-(b + u_{2})(t - r)} e^{-\frac{\mu}{Y}\int_{r}^{t}x_{*}(\xi)d\xi}dr, \quad \text{if } \theta_{*} < t \le T. \end{cases}$$ Substituting expressions \eqref{num5.15} and \eqref{num5.16} into \eqref{num5.14}, we obtain $$q(\theta_{*}) = - \nu_{\theta_{*}} \left(s_{0}\alpha_{\theta_{*}}(x_{0}) + \beta_{\theta_{*}}(x_{0})\right) - h_{\theta_{*}}(x_{0}).$$ Here the value $$\label{num5.17} \nu_{\theta_{*}} = \frac{\mu}{(b + u_{2})Y}\left(1 - e^{-(b + u_{2})(T - \theta_{*})}\right)$$ is positive, and functions: $$\label{num5.18} \begin{gathered} \alpha_{\theta_{*}}(x_{0}) = e^{-(b + u_{1})\theta_{*}} \cdot e^{-\frac{\mu}{Y}\int_{0}^{\theta_{*}} x_{*}(\xi)d\xi}, \\ \beta_{\theta_{*}}(x_{0}) = a_{2}b \int_{0}^{\theta_{*}} e^{-(b + u_{1})(\theta_{*} - r)} \cdot e^{-\frac{\mu}{Y}\int_{r}^{\theta_{*}}x_{*}(\xi)d\xi}dr, \\ h_{\theta_{*}}(x_{0}) = \frac{\mu a_{2}b}{Y} \int_{\theta_{*}}^{T}\Big( \int_{\theta_{*}}^{r}e^{-(b + u_{2})(r - \eta)} \cdot e^{\frac{\mu}{Y}\int_{\theta_{*}}^{\eta}x_{*}(\xi)d\xi}d\eta \Big)dr \end{gathered}$$ are also positive. Functions \eqref{num5.18} depend on $x_{0}$ by formula \eqref{num5.15}. Moreover, it is easy to see that at $\theta_{*} = 0$ the following relationships hold $$\label{num5.19} \nu_{\theta_{*}} = \sigma, \quad \alpha_{\theta_{*}}(x_{0}) = 1, \quad \beta_{\theta_{*}}(x_{0}) = 0, \quad h_{\theta_{*}}(x_{0}) = g(x_{0}).$$ Then equality \eqref{num5.13} can be rewritten as \label{num5.20} \begin{aligned} &\alpha_{\theta_{*}}(x_{0})s_{0} \left(1 + \nu_{\theta_{*}}(a_{1} - x_{*}(\theta_{*}))\right) \\ &= - \beta_{\theta_{*}}(x_{0}) \left(1 + \nu_{\theta_{*}}(a_{1} - x_{*}(\theta_{*}))\right) - (a_{1} - x_{*}(\theta_{*}))h_{\theta_{*}}(x_{0}). \end{aligned} Also from the formula \eqref{num5.13} and Lemma \ref{Lemma1}, Lemma \ref{Lemma5} it follows that $x_{*}(\theta_{*}) > a_{1}$. Then from Lemma \ref{Lemma3} we find that $x_{0} > a_{1}$. It means that if the optimal control $u_{*}(t)$ has type \eqref{num4.6}, then for initial conditions $(x_{0},s_{0})$ the inequality $1 + \sigma(a_{1} - x_{0}) \le 0$ may be satisfied. Let us show that if for initial conditions $(x_{0},s_{0})$ the inequalities: $$\label{num5.21} a_{1} - x_{0} < 0, \quad 1 + \sigma(a_{1} - x_{0}) > 0$$ hold, then the point $(x_{0},s_{0})$ is below the graph of the function $s_{0} = f(x_{0})$ (see Figure \ref{fig3}). First, let us establish the positivity of the left hand side of the equality \eqref{num5.20}. It is sufficient to show the validity of the inequality $$\label{num5.22} 1 + \nu_{\theta_{*}}(a_{1} - x_{*}(\theta_{*})) > 0.$$ Consider the auxiliary function $$\rho(\theta_{*}) = x_{*}(\theta_{*}) - a_{1} - \frac{1}{\nu_{\theta_{*}}}$$ for all $\theta_{*} \in [0,T)$. As a consequence of the first formula of \eqref{num5.19} we have at $\theta_{*} = 0$ the relationship $$\label{num5.23} \rho(0) = x_{0} - a_{1} - \frac{1}{\sigma} < 0.$$ From \eqref{num5.15} and \eqref{num5.17} we find expressions: $$\label{num5.24} \frac{dx_{*}}{d\theta_{*}}(\theta_{*}) = - (b + u_{1})\Big(x_{0} - \frac{a_{1}u_{1}}{b + u_{1}}\Big) e^{-(b + u_{1})\theta_{*}} < 0,$$ and $$\frac{d\nu_{\theta_{*}}}{d\theta_{*}} = - \frac{\mu}{Y}e^{-(b + u_{2})(T - \theta_{*})} < 0.$$ Note that the derivative of the function $\rho(\theta_{*})$ is $$\dot\rho(\theta_{*}) = \frac{dx_{*}}{d\theta_{*}}(\theta_{*}) + \frac{1}{\nu_{\theta_{*}}^{2}}\cdot\frac{d\nu_{\theta_{*}}}{d\theta_{*}}.$$ By \eqref{num5.24} it is seen that the function $\rho(\theta_{*})$ is decreasing for all $\theta_{*} \in (0,T)$. From \eqref{num5.23} the negativity of the function $\rho(\theta_{*})$ for $\theta_{*} \in [0,T)$ follows. This fact implies the validity of the inequality \eqref{num5.22}. Then \eqref{num5.20} can be rewritten as $$s_{0} = F_{\theta_{*}}(x_{0}) = - \frac{(a_{1} - x_{*}(\theta_{*}))h_{\theta_{*}}(x_{0})} {\alpha_{\theta_{*}}(x_{0}) \left(1 + \nu_{\theta_{*}}(a_{1} - x_{*}(\theta_{*}))\right)} - \frac{\beta_{\theta_{*}}(x_{0})}{\alpha_{\theta_{*}}(x_{0})}.$$ Here the right hand side of this equality defines the function $F_{\theta_{*}}(x_{0})$. From \eqref{num5.19} for $\theta_{*} = 0$ it is clear that $$F_{\theta_{*}}(x_{0}) = f(x_{0}).$$ Therefore, the initial conditions $(x_{0},s_{0})$ for which corresponding optimal control $u_{*}(t)$ has type \eqref{num4.6} belong to the graph of the function $s_{0} = F_{\theta_{*}}(x_{0})$. The fact that we need to establish can be restate as follows. Let us show that for the same values $x_{0} \in (a_{1},a_{1} + \frac{1}{\sigma})$ and $\theta_{{*}} \in (0,T)$ the graph of the function $s_{0} = F_{\theta_{*}}(x_{0})$ is below the graph of the function $s_{0} = f(x_{0})$. To prove this fact, we consider the equality \eqref{num5.12}, or alternatively, \eqref{num5.20} as the implicit equation $$\label{num5.25} L(\theta_{*},x_{0},s_{0}(\theta_{*})) = 0.$$ At $\theta_{*} = 0$ the points $(x_{0},s_{0})$ of the graph of the function $s_{0} = f(x_{0})$ satisfy this equation. Now, let us differentiate the equation \eqref{num5.25} by $\theta_{*} \in (0,T)$. We obtain the expression $$\label{num5.26} \frac{\partial L}{\partial t}(\theta_{*},x_{0},s_{0}(\theta_{*})) + \frac{\partial L}{\partial s_{0}}(\theta_{*},x_{0},s_{0}(\theta_{*})) \cdot\frac{ds_{0}}{d\theta_{*}}(\theta_{*}) = 0.$$ From Lemma \ref{Lemma8} and relationships \eqref{num5.20},\eqref{num5.22} it follows that the corresponding partial derivatives of the function $L(\theta_{*},x_{0},s_{0})$ are positive. Then from \eqref{num5.26} it follows that $$\frac{ds_{0}}{d\theta_{*}}(\theta_{*}) < 0, \quad \theta_{*} \in (0,T).$$ Therefore, for the same values $x_{0} \in (a_{1},a_{1} + \frac{1}{\sigma})$ the value $s_{0}$ of the graph of the function $s_{0} = F_{\theta_{*}}(x_{0})$ is less than the value $s_{0}$ of the graph of the function $s_{0} = f(x_{0})$. Hence, when the optimal control $u_{*}(t)$ has the type \eqref{num4.6} and the inequalities \eqref{num5.21} hold, the initial conditions $(x_{0},s_{0})$ satisfy the inequality $$s_{0} < f(x_{0}).$$ Thus, the desired result is established. Finally, let us introduce the sets: \begin{gather*} S = \{ (x_{0},s_{0}) \in \mathbb{R}^{2} : x_{0} > 0, \; s_{0} > 0\},\\ P = \{(x_{0},s_{0}) \in S : x_{0} \le a_{1}\} \cup \{ (x_{0},s_{0}) \in S : a_{1} < x_{0} < a_{1} + \frac{1}{\sigma}, \; s_{0} \ge f(x_{0})\},\\ \begin{aligned} Q &= \{ (x_{0},s_{0}) \in S : a_{1} < x_{0} < a_{1} + \frac{1}{\sigma}, \; s_{0} < f(x_{0}) \} \\ &\quad \cup \{(x_{0},s_{0}) \in S : x_{0} \ge a_{1} + \frac{1}{\sigma}\}. \end{aligned} \end{gather*} It is clear that $S = P \cup Q$. Sets $P$ and $Q$ are shown in Figure \ref{fig3}. \begin{figure}[ht] \begin{center} \includegraphics[width=0.7\textwidth]{fig3} % Picture1.eps \caption{Graph of the function $s_{0} = f(x_{0})$ and sets $P$, $Q$}\label{fig3} \end{center} \end{figure} The preceding arguments show us the following statement. \begin{theorem}\label{Theorem1} The following cases are valid: \begin{itemize} \item[(a)] if the optimal control $u_{*}(t)$, $t \in [0,T]$ has the type \eqref{num4.5}, then corresponding initial conditions $(x_{0},s_{0})$ satisfy the inclusion $(x_{0},s_{0}) \in P$, \item[(b)] if the optimal control $u_{*}(t)$, $t \in [0,T]$ has the type \eqref{num4.6}, then corresponding initial conditions $(x_{0},s_{0})$ satisfy the inclusion $(x_{0},s_{0}) \in Q$. \end{itemize} \end{theorem} The converse of this statement is also true. \begin{theorem}\label{Theorem2} The following cases are valid: \begin{itemize} \item[(a)] if initial conditions $(x_{0},s_{0})$ satisfy the inclusion $(x_{0},s_{0}) \in P$, then corresponding optimal control $u_{*}(t)$, $t \in [0,T]$ has the type \eqref{num4.5}, \item[(b)] if initial conditions $(x_{0},s_{0})$ satisfy the inclusion $(x_{0},s_{0}) \in Q$, then corresponding optimal control $u_{*}(t)$, $t \in [0,T]$ has the type \eqref{num4.6}. \end{itemize} \end{theorem} \begin{proof} We will first prove the case (a). Let the initial conditions $(x_{0},s_{0})$ satisfy the inclusion $(x_{0},s_{0}) \in P$. Then from preceding arguments it follows that the optimal control $u_{*}(t)$, $t \in [0,T]$ has the type \eqref{num4.5} or type \eqref{num4.6}. Type \eqref{num4.6} is impossible since from Theorem \ref{Theorem1} we obtain the contradictory inclusion $(x_{0},s_{0}) \in Q$. Therefore, the optimal control $u_{*}(t)$, $t \in [0,T]$ has type \eqref{num4.5}. Case (b) is proved by analogous arguments. \end{proof} The Theorem \ref{Theorem2} allows us to select the optimal control policy based on initial concentrations $(x_{0},s_{0})$ of biomass and substrate. \section{Computer modeling} Our theoretical results obtained in the previous section allow to select optimal successful strategy of ASP based on the knowledge of the parameters of the model \eqref{num2.3} and initial conditions $(x_{0},s_{0})$. In \cite{Lit2} parameter-estimation and verification of the model measurement values from a waste water plant were obtained for every hour of an operating period of one week. Values of $s(t)$ will be determined by total organic carbon content in the influent and $x(t)$ by the concentration of the suspended solid in the aeration tank. Let us show our results for the following model parameters: $$\begin{array}{ccc} u_{1} = 0.1 \; \text{lb/min}, & u_{2} = 1.0 \; \text{lb/min}, & T = 10 \; \text{hours}, \\ a_{1} = 0.7 \; \text{lb/gal}, & a_{2} = 0.9 \; \text{lb/gal}, & Y = 3.0, \\ x_{0} = 1.5 \; \text{lb/gal}, & s_{0} = 2.0 \; \text{lb/gal}, & \mu = 0.1. \end{array}$$ The following relationships are valid: $$a_{1} - x_{0} = -0.8 < 0, \quad 1 + \sigma(a_{1} -x _{0}) = 0.976 > 0.$$ Then the optimal control $u_{*}(t)$ has the type \eqref{num4.6} with one moment of switching at $\theta_{*} = 2$ hours, which was obtained numerically. So, if we select such optimal policy $u_{1} \to u_{2}$, then the concentration of the polluted water $s(t)$ will be minimized at moment $T$, final operation time (see Figure \ref{fig4}). \begin{figure}[ht] \begin{center} \includegraphics[width=0.6\textwidth]{fig4} %Picture2.eps \caption{Optimal concentration of the polluted water $s_{*}(t)$}\label{fig4} \end{center} \end{figure} \section{Conclusions} Activated sludge process involves complex and subtle relationships among a relatively large number of variables. The model investigated in our paper is not intended to be the best ASP model. However, it is nonlinear and it has a bounded control, which makes it quite interesting from the mathematical point of view. We found the type of optimal control by means of the so-called switching function. This allowed us to reduce a complex two point boundary value problem for the Maximum Principle to one of finite dimensional optimization. Our mathematical investigation of the activated sludge process can be summarized by components: (1) Complete investigation of a model \eqref{num2.3} of the activated sludge process with one bounded control. (2) Development of an optimal control strategy for the recycle flow rate analytically. (3) Investigation of how the selected optimal control strategy depends on the initial conditions. (4) Computer simulation of the controlled activated sludge process for different model parameters. Based on our theory, we find that the optimal analytical solution may decrease waste water plant operation cost. Thus, if $(x_{0},s_{0})$ measured at moment $t = 0$ satisfies inclusion $P$, then the optimal control function $u_{*}(t)$ the rate of the recycle sludge, first must take the lower value, $u_{1}$ until time $\theta_{*}$ and then switch to the upper lever $u_{2}$. Finally, it should be noted that the ideas presented in this study can be applied to other control systems with similar properties. \subsection*{Acknowledgements} The authors thank Dr. Paul Deignan for his helpful suggestions and style recommendations. \begin{thebibliography}{00} \bibitem{Lit1} Bressan A. and Piccoli B.; \emph{Introduction to the Mathematical Theory of Control}, AIMS Series on Applied Mathematics, \textbf{2}, 2007. \bibitem{Lit2} Brune D.; \emph{Optimal control of the complete-mix activated sludge process}, Enviromental Technology, \textbf{6:11}, (1985) 467-476. \bibitem{Lit3} Buitron G., Moreno Y., Betancur M., and Moreno J.; \emph{Application of the event-driven time optimal control strategy for the degradation of inhibitory wastewater in a discontinuous biorector}, Proceedings of the 4th IWA World Water Comgress, Marrakech, 19-24 September, 2004. \bibitem{Lit4} Debussher D., Vanhooren H., and Vanrolleghem P.; \emph{Benchmarking two biomass loading control strategies for activated sludge WWTPs}, Proceedings of the 13 Forum on Applied Biotechnology, University of Gent, \textbf{64/5a}, (1999) 127-132. \bibitem{Lit5} Fikar C. F., Chachat B., and Latifi M.; \emph{Optimal operation of alternating activated sludge processes}, Control Engineering Practice, \textbf{13:7}, (2005) 853-861. \bibitem{Lit6} Fleming W. H. and Rishel R. W.; \emph{Deterministic and Stochastic Optimal Control}, Springer-Verlag, Berlin-Heidelberg-New York, 1975. \bibitem{Lit7} Holmberg A.; \emph{Modelling of the activated sludge process for microprocessor-based state estimation and control}, Water Research, \textbf{16:7}, (1982) 1233-1246. \bibitem{Lit8} Kabouris J. and Georgakakos A.; \emph{Optimal real-time activated sludge regulation}, Proceeding of the Georgia Water Resources Conference, University of Georgia, Athens, Georgia, USA, 19-20 March, 1991. \bibitem{Lit9} Lindberg C.-F.; \emph{Multivariable modeling and control of an activated sludge process}, Water Science and Technology, \textbf{37:12}, (1998) 149-156. \bibitem{Lit10} Lukasse L.; \emph{Multivariable modelling and control of an activated sludge process}, Water Science Technology, \textbf{37:12}, (1998) 149-156. \bibitem{Lit11} Moreno J.; \emph{Optimal time control of bioreactors for the wastewater treatment}, Optimal Control Applications and Methods, \textbf{20:3}, (1999) 145-164. \bibitem{Lit12} Pontryagin L. S., Boltyanskii V. G., Gamkrelidze R. V., and Mishchenko E. F.; \emph{Mathematical Theory of Optimal Processes}, John Wiley \& Sons, New York, 1962. \bibitem{Lit13} Potter T., Koopman B., and Svoronos S.; \emph{Optimisation of a perodic bilogical process for nitrogen removal from wastewater}, Water Research, \textbf{30:1}, (1996) 142-152. \bibitem{Lit14} Qin S., Martinez V., and Foss B.; \emph{An interpolating model predictive control strategy with application to a waste treatment plant}, Computers and Chemical Engineerings, \textbf{21:S1}, (1997) 881-886. \bibitem{Lit15} Rinaldi S., Soncini-Sessa R., Stehfest H., and Tamura A.; \emph{Modeling and Control of River Quality}, McGraw-Hill Inc., London, \textbf{283}, 1979. \bibitem{Lit16} Tzoneva R.; \emph{Methods for real time optimal control of the activated sludge process}, Proceedings of the 15th Mediterranean Conference on Control and Automation, Athens, Greece, 27-29 July, 2007. \end{thebibliography} \end{document}