13
Computers and Chemical Engineering 35 (2011) 638–650 Contents lists available at ScienceDirect Computers and Chemical Engineering journal homepage: www.elsevier.com/locate/compchemeng Aeration control of a wastewater treatment plant using hybrid NMPC S. Cristea , C. de Prada, D. Sarabia, G. Gutiérrez Department of Systems Engineering and Automatic Control, Faculty of Sciences, University of Valladolid, c/Real de Burgos s/n, 47011 Valladolid, Spain article info Article history: Received 16 November 2009 Received in revised form 25 May 2010 Accepted 16 July 2010 Available online 3 August 2010 Keywords: Hybrid nonlinear Model Predictive Control Wastewater treatment plants Real-time optimization abstract In the operation of wastewater treatment plants a key variable is dissolved oxygen (DO) content in the bioreactors. As oxygen is consumed by the microorganisms, more oxygen has to be added to the water in order to comply with the required minimum dissolved oxygen concentration. This is done using a set of aerators working on/off that represents most of the plant energy consumption. In this paper a hybrid nonlinear predictive control algorithm is proposed, based on economic and control aims. Specifically, the controller minimizes the energy use while satisfying the time-varying oxygen demand of the plant and considering several operation constraints. A parameterization of the binary control signals in terms of occurrence time of events allows the optimization problem to be re-formulated as an nonlinear programming (NLP) problem at every sampling time. Realistic simulation results considering real perturbations data sets for the inlet variables are presented. © 2010 Elsevier Ltd. All rights reserved. 1. Introduction Biological wastewater treatment is essential to keep the eco- logical balance of the environment and now it is frequently used in industries and urban areas. Most biological oxidation processes for treating wastewater have in common the use of oxygen (or air) and microbial action. In particular, aerobically activated sludge pro- cesses are, nowadays, the most extensively used system to clean wastewater. The basis of the process lies in maintaining a mixture of several microorganisms transforming the biodegradable pollu- tants (substrate) into new biomass. As in this operation oxygen is consumed by the microorganisms, it becomes necessary to add more oxygen to the water in order to comply with the required minimum dissolved oxygen concentration, which is supplied by a set of aerators. As shown in Fig. 1, where a scheme of this kind of plants is pre- sented, after a pre-treatment, the inflow is first processed in the bioreactor where, by the action of microorganisms, the substrate content is reduced. Next, the water flows to a settler, where the biomass sludge is recovered. The clean water remains at the top of the settler and is carried out of the plant, and a fraction of the sludge is returned to the input of the bioreactor in order to maintain an appropriate level of biomass, allowing the reduction of the organic matter. The rest of the sludge is purged. Like in other biotechnological processes, the real-time control of these plants constitutes a quite complex problem due to the lack of reliable and cheap on-line instrumentation and the changing Corresponding author. E-mail address: [email protected] (S. Cristea). nature of the microbiological processes that take place in the biore- actor (Beck, 1986). In addition, it presents some specific problems like the great variability of the input (both in quantity and quality) and the complex interactions between the different microorganism populations present in the system. Nevertheless, effective operation can be achieved by regulation of substrate and other product levels and the maintenance of DO in the process above minimum acceptable conditions. The system is multivariable in nature, however, taking into account the fact that the time scale in which the oxygen operates is in minutes while the substrate and other components evolve in the range of hours, it is possible to decompose the control problem in two different layers, isolating the DO control from the other ones that can be considered as disturbances. The DO concentration is controlled with aerators, turbines moved by electrical motors that represent the main energy and maintenance costs, accounting for 50–90% of the total energy demand of a treatment plant. For this reason, a natural target is to operate the plant so that a minimal energy is consumed while respecting a minimal DO concentration according to the oxygen demand of the microorganisms. In addition, regulation of DO may improve the plant performance, avoiding incidences which can cause filamentous sludge bulking, or poor sludge settling condi- tions (WPCF, 1988). In many conventional wastewater systems, aerators operate according to a sequence of pre-programmed on/off changes in such a way that constantly provide enough dissolved oxygen to meet the oxygen demands during peak loading periods. At other times, oxygen is wasted, resulting in lower efficiency. With the use of dis- solved oxygen control, the amount of aeration is adjusted to the bioreactor load, therefore, aeration is not wasted and energy costs 0098-1354/$ – see front matter © 2010 Elsevier Ltd. All rights reserved. doi:10.1016/j.compchemeng.2010.07.021

1-s2.0-S0098135410002693-main.pdf

Embed Size (px)

Citation preview

Page 1: 1-s2.0-S0098135410002693-main.pdf

A

SD

a

ARRAA

KHWR

1

lifacwotimms

sbcbtiam

oo

0d

Computers and Chemical Engineering 35 (2011) 638–650

Contents lists available at ScienceDirect

Computers and Chemical Engineering

journa l homepage: www.e lsev ier .com/ locate /compchemeng

eration control of a wastewater treatment plant using hybrid NMPC

. Cristea ∗, C. de Prada, D. Sarabia, G. Gutiérrezepartment of Systems Engineering and Automatic Control, Faculty of Sciences, University of Valladolid, c/Real de Burgos s/n, 47011 Valladolid, Spain

r t i c l e i n f o

rticle history:eceived 16 November 2009eceived in revised form 25 May 2010ccepted 16 July 2010

a b s t r a c t

In the operation of wastewater treatment plants a key variable is dissolved oxygen (DO) content inthe bioreactors. As oxygen is consumed by the microorganisms, more oxygen has to be added to thewater in order to comply with the required minimum dissolved oxygen concentration. This is done

vailable online 3 August 2010

eywords:ybrid nonlinear Model Predictive Controlastewater treatment plants

eal-time optimization

using a set of aerators working on/off that represents most of the plant energy consumption. In thispaper a hybrid nonlinear predictive control algorithm is proposed, based on economic and control aims.Specifically, the controller minimizes the energy use while satisfying the time-varying oxygen demandof the plant and considering several operation constraints. A parameterization of the binary controlsignals in terms of occurrence time of events allows the optimization problem to be re-formulated as annonlinear programming (NLP) problem at every sampling time. Realistic simulation results considering

ts for

real perturbations data se

. Introduction

Biological wastewater treatment is essential to keep the eco-ogical balance of the environment and now it is frequently usedn industries and urban areas. Most biological oxidation processesor treating wastewater have in common the use of oxygen (or air)nd microbial action. In particular, aerobically activated sludge pro-esses are, nowadays, the most extensively used system to cleanastewater. The basis of the process lies in maintaining a mixture

f several microorganisms transforming the biodegradable pollu-ants (substrate) into new biomass. As in this operation oxygens consumed by the microorganisms, it becomes necessary to add

ore oxygen to the water in order to comply with the requiredinimum dissolved oxygen concentration, which is supplied by a

et of aerators.As shown in Fig. 1, where a scheme of this kind of plants is pre-

ented, after a pre-treatment, the inflow is first processed in theioreactor where, by the action of microorganisms, the substrateontent is reduced. Next, the water flows to a settler, where theiomass sludge is recovered. The clean water remains at the top ofhe settler and is carried out of the plant, and a fraction of the sludges returned to the input of the bioreactor in order to maintain anppropriate level of biomass, allowing the reduction of the organic

atter. The rest of the sludge is purged.Like in other biotechnological processes, the real-time control

f these plants constitutes a quite complex problem due to the lackf reliable and cheap on-line instrumentation and the changing

∗ Corresponding author.E-mail address: [email protected] (S. Cristea).

098-1354/$ – see front matter © 2010 Elsevier Ltd. All rights reserved.oi:10.1016/j.compchemeng.2010.07.021

the inlet variables are presented.© 2010 Elsevier Ltd. All rights reserved.

nature of the microbiological processes that take place in the biore-actor (Beck, 1986). In addition, it presents some specific problemslike the great variability of the input (both in quantity and quality)and the complex interactions between the different microorganismpopulations present in the system.

Nevertheless, effective operation can be achieved by regulationof substrate and other product levels and the maintenance of DO inthe process above minimum acceptable conditions. The system ismultivariable in nature, however, taking into account the fact thatthe time scale in which the oxygen operates is in minutes while thesubstrate and other components evolve in the range of hours, it ispossible to decompose the control problem in two different layers,isolating the DO control from the other ones that can be consideredas disturbances.

The DO concentration is controlled with aerators, turbinesmoved by electrical motors that represent the main energy andmaintenance costs, accounting for 50–90% of the total energydemand of a treatment plant. For this reason, a natural target isto operate the plant so that a minimal energy is consumed whilerespecting a minimal DO concentration according to the oxygendemand of the microorganisms. In addition, regulation of DO mayimprove the plant performance, avoiding incidences which cancause filamentous sludge bulking, or poor sludge settling condi-tions (WPCF, 1988).

In many conventional wastewater systems, aerators operateaccording to a sequence of pre-programmed on/off changes in such

a way that constantly provide enough dissolved oxygen to meetthe oxygen demands during peak loading periods. At other times,oxygen is wasted, resulting in lower efficiency. With the use of dis-solved oxygen control, the amount of aeration is adjusted to thebioreactor load, therefore, aeration is not wasted and energy costs
Page 2: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 639

ludge

cpaam

i(sCcCdvpo

dmof2gaHi

at1dtost

vob

Fig. 1. Activated s

an be kept to a minimum. Nevertheless, this is not a conventionalroblem, the difficulties coming from two sides: the fact that it ishybrid process, combining a continuous system with on/off aer-

tors, and the need to include explicitly an economic target – theotors energy consumption.In this paper both aspects have been considered. On one hand,

nstead of using the traditional approach of a two layered systeman upper RTO in charge of the economics of the process that fixeset points for a lower control layer) (Busch, Oldenburg, Santos,ruse, & Marquardt, 2007), an integrated approach has been usedombining both in a single controller (Engell, 2007; Sarabia, Prada,ristea, & Mazaeda, 2008a). On the other hand, the hybrid pre-ictive control problem has been addressed proposing a controlariable parameterization of the decision variables that allows theroblem to be solved in real-time as a NLP one. Conditions of usef this strategy have also been analysed.

In the literature, several dynamical models of the process andistinct control strategies can be found. For instance, dynamic opti-ization has been analysed in order to determine the optimal

ff-line aeration policy which minimizes the energy consumptionor small wastewater treatment plant (Chachuat, Roche, & Latifi,001). Model based predictive control strategies have been sug-ested in order to maintain the dissolved oxygen concentrationt a certain imposed set point (Caraman, Sbarciog, & Barbu, 2007;olenda, Domokos, Rédey, & Fazakas, 2008), but this requires vary-

ng the aeration rate continuously.In practice, the great majority of operating plants do not have

ny provision for varying the air flow rate continuously, the aera-ion equipment being operated on an on–off basis (Marsili-Libelli,989). It is the sequence of motor on–off switches which must beetermined in order to control the dissolved oxygen level. Fur-hermore, several constraints must be satisfied in order to avoidperational problems. They refer to a maximum time in the “off”tate, in order to avoid the microorganisms to settle and a minimumime in both states, so that excessive switching is avoided.

One process like this, that involves continuous as well as on/offariables and certain logic of operation, can be described in termsf a hybrid model where continuous variables are representedy real variables and the logic and on/off variables is formulated

Fig. 2. Schematic diagram of the continu

plant schematic.

with binary variables using a set of inequalities. See, for instance(Floudas, 1995) or the Mixed Logical Dynamical (MLD) framework(Bemporad & Morari, 1999). This formulation leads, in the contextof Model Predictive Control (MPC), to a mixed-integer optimiza-tion problem that must be solved every sampling time, as in Prada,Sarabia, and Cristea (2005). This kind of formulation in the discretetime domain using linear models generates a high dimensionality ofthe problem, resulting from considering the variables over the pre-diction horizon, except in a limited number of cases. But, in practice,it is not possible to solve the associated MILP or MIQP optimiza-tion problem on-line. Additionally, linear models may not providean adequate representation of the nonlinear dynamics that takesplace in wastewater treatment processes which convert the opti-mization problem in a MINLP one, not suitable for real-time control.In the same way, only in small dimension problems it is feasible tosolve the problem off-line and apply the solution as a look-up tableusing multi-parametric programming (Bemporad, Morari, Dua, &Pistikopoulos, 2002).

In this paper, the proposed hybrid predictive control algorithmis applied to the activated sludge process of a wastewater treat-ment plant in Manresa, a town of 100,000 inhabitants, located nearBarcelona (Spain). The work is focused on the dissolved oxygen con-trol and the objective is to satisfy quality constraints related to theDO concentration while minimizing energy demands. In this plantthe DO is regulated by a series of aerators with fixed speed motorsas can be seen in Fig. 2.

This problem has been set out in Moreno, de Prada, Lafuente,Poch, and Montague (1992) not in the MILP or MINLP context. Theadopted solution was to decompose the optimization problem intotwo sub-problems: a continuous one in which an array of optimalvalues of the aeration factor (function of the number of aeratorsswitched on) is obtained; and a second one, in which, during thecontrol horizon, feasible combinations of motor switches are eval-uated, giving values of this factor as near as possible to the optimalvalues.

This paper presents an alternative approach of the hybrid con-troller where the on/off actions are formulated in terms of timeinstants of occurrence of events, instead of as binary values on eachsampling time. This approach has been tested by the authors in

ous flow activated sludge process.

Page 3: 1-s2.0-S0098135410002693-main.pdf

6 emical Engineering 35 (2011) 638–650

oaacoG

ltasrm

tfluTg

spicpcc

2

aicmbsitu

whtsoK(c

aDl1T

dsat

O

Table 1Model variables and parameters.

Symbol Description Unit

x Biomass concentration in thebioreactor output

mg/L

s Nutrient substrateconcentration into the reactor

mg/L

q Input water flow m3/hV Reactor working volume m3

�x Maximum specific growth rate 1/hKs Saturation constant mg/LKdx , Kds = 0.2 × Kdx Specific death rate 1/hKcx , Kcs = 0.2 × Kcx Endogenous decay rate 1/hc DO at the reactor outlet mg O2/Lcs Saturation DO level at the

working temperaturemg/L

Fa Aeration factor (function of thenumber of aerators switchedon

OUR Oxygen uptake rate mgO2/(Lh)Kla Mass transfer coefficient

between air and water1/h

Kx Model constant L/mgK0 Model constant 1/hqi , qr Water input and sludge

recycled flowm3/h

xir , sir , cir Biomass, substrate and DOconcentration in bioreactorinput

mg/L

xi , si , ci Biomass, substrate and DOconcentration in the input flow

mg/L

xr , sr , cr Biomass, substrate and DO mg/L

40 S. Cristea et al. / Computers and Ch

ther applications (Prada, Cristea, Mazaeda, & Colmenares, 2007),nd has the advantage that all decision variables are of real type,nd its number is reduced significantly, which means that the asso-iated optimization problem is a nonlinear programming (NLP)ne and the problem can be solved more efficiently (Caballero androssmann, 2007).

The proposed controller is formulated in the framework of non-inear MPC, but uses a nonlinear continuous time model, insteado a discrete one, to compute the output predictions. The controlctions are calculated by means of a dynamic optimization problemolved on-line every sample time. Specifically, the proposed algo-ithm determines the sequence of motor on/off switches needed toaintain the DO level above a critical value (2 mg/L in this plant).The algorithm have been tested in a realistic validated simula-

ion (Robuste, 1990) but applying experimental data of the inputow collected from the plant for 7 days, in order to make the sim-lation work under the real disturbances present on the process.he results obtained show that the proposed controller may be aood alternative to the current control strategy.

The paper is organized as follows: after the introduction, theecond section describes the nonlinear model obtained from firstrinciples that will be used in the MPC controller. The third section

ntroduces the control problem, while the fourth one describes theontrol objectives and the hybrid MPC. Simulation results of theroposed control approach are given in Section 5 showing the pro-ess response to realistic disturbances. The paper ends with someonclusions and bibliographic references.

. Nonlinear continuous time model

The activated sludge process is performed in a 10,800 m3 biore-ctor operated as continuous stirred reactors. Dissolved oxygens measured at the outlet of the system. Details about the pro-ess modelling of this plant can be found in Moreno (1991). Aodel describing the DO time evolution is given by a dynamic mass

alance where the oxygen accumulation equates the oxygen rateupplied by the aerators, which depends on the number of themn operation and on the closeness to the oxygen saturation level,he oxygen consumed by the microorganisms, given by the oxygenptake rate, and a transport term:

dc

dt= KlaFa(cs − c) − OUR − q(c − cir)/V

cir = (ciqi + crqr)/q(1)

here c is the DO concentration (mg/L) at the reactor assumedomogeneous, cs represents the DO saturation level at the workingemperature, Fa is the aeration factor (dimensionless), OUR repre-ents the oxygen uptake rate (mg(Lh)−1), cir is the DO concentrationf the inflow to the reactor, q denotes the input water flow (m3/h),la is a dilution constant (h−1) and V the reactor working volumem3). The DO concentrations in the input flow and the sludge recy-led flow are considered constant: ci = 2 mg/L and cr = 0.

The aeration factor Fa, is normalized varying between 0 and 1s a function of the number of aerators in operation. Flows andO are continuously measured and recorded. The DO saturation

evel is computed from the measured temperature (Marsili-Libelli,989) and in our case the constant value cs = 10.92 mg/L is given.he model parameter Kla has the value 0.4 h−1.

The oxygen uptake rate (OUR) plays an important role in theynamic of the DO as it represents the rate at which oxygen is con-

umed by the microorganisms, with one term proportional to thectivity of the microorganisms and another one to its concentra-ion:

UR = Kx�1xs + K0x (2)

concentration in the sludgerecycled flow

Here x is the biomass concentration in the bioreactor (mg/L),s corresponds to the substrate concentration (mg/L) and theother parameters can be taken as constants with valuesK0 = 0.2 × 10−3 h−1, Kx = 0.01 L/mg, �s = 4.079 × 10−4 h−1.

The dynamics of the biomass x and substrate s in the bioreactorcan be described by:

dx

dt= �x

s

Ks + sx − Kdx

x2

s− Kcxx + q

V(xir − x)

ds

dt= − 1

˛�x

s

Ks + sx + Kds

x2

s+ Kcsx + q

V(sir − s)

xir = xiqi + xrqr

q

sir = siqi + srqr

qq = qi + qr

(3)

where the model coefficients have the following values:�x = 0.1085 h−1, ˛ = 0.5948, Kdx = 5 × 10−5 h−1, Kds = 10−5 h−1,Kcx = 1.33 × 10−4 h−1, Kcs = 0.27 × 10−4 h−1. This model includesthe usual terms of population growing, declining and transport(Table 1 summarizes the model variables and parameters). Theworking volume V of the reactor is a fraction of the total volume,V = 0.55 × 10,800 m3 = 5996 m3.

The bioreactor has three aerators: the first one has a motor of90-HP, meanwhile the other two have a smaller power of 75-HP.Considering three binary variables yi to represent the on/off stateof every aerator and their relative powers, the contribution of eachmotor to the global aeration factor values is given by:

Fa = 9y1 + 7.5

y2 + 7.5y3 (4)

24 24 24

If the ith aerator electric motor is working, then yi = 1, otherwiseyi = 0.

Page 4: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 641

Fig. 3. Inlet substrate concentration data.

3

itsdm

ccasott

tTd

4

ltoo

Fig. 5. Water input flow data.

main operational target of the controller has been included as abracket function penalising the violation of the minimum DO con-centration desired in the bioreactor cmin = 2 mg/L. In this way, thecontroller cost index corresponds to the function J computed over

Fig. 4. Inlet biomass concentration data.

. The control problem

As mentioned in Section 1, the control challenge of this processs to develop an on-line efficient and optimal control strategy forhe scheduling of the turbine operation that minimizes power con-umption and keeps always the DO level over 2 mg/L in spite ofisturbances. In addition, there are some technical constraints thatust be fulfilled:

A mechanical constraint to prevent turbines from an exces-sive wear and power consumption: all motors have to keep theselected position (switched on or switched off) at least for 1 h.A biological constraint to avoid too long non-stirred periodswhich could cause sedimentation of biomass in the aeration tankand induce phenomena not described by the model: no motorcan be switched off for more than 2 h.

The main disturbances acting on the plant are related to thehanging inflow, namely, the total wastewater flow and its con-entration in biomass and substrate. In order to make a realisticpproach to the daily operation of the plant, real perturbation dataets (inlet variables) have been used, corresponding to the situationf the plant along 166 h. The fluctuations of the substrate concen-ration (si), biomass concentration (xi), and water input flow (qi) inhe inlet flow are shown in Figs. 3–5.

As it can be seen, the inflow experiences a daily periodicity, withhe weekend corresponding to the forth and fifth days in the graphs.he recycled sludge flow qr and biomass concentration xr follow aifferent pattern (Figs. 6 and 7).

. The hybrid MPC

A natural approach for many real-time decision-making prob-ems is Model Predictive Control. In MPC an internal model ofhe process is used to predict its future behaviour as a functionf the present and future control actions, which are selected inrder to minimize some performance index or cost function J.

Fig. 6. Recycled sludge flow data.

The optimal control signals corresponding to the current timeare applied to the process and the whole procedure is repeatedevery sampling period. These concepts require certain adaptationin order to deal with hybrid systems and, in particular with thewastewater treatment problem. In the following, a description ofthe components of the proposed hybrid MPC is presented: thecost function, the internal model and the architecture of the con-troller.

4.1. Cost function

The performance index to be minimized according to the con-trol objectives described in Section 3 integrates a direct economicaim, the energy consumption over a time period, into the cost func-tion of the controller. In this way the economic target is combinedwith an intended operating zone represented by a set point to fol-low. The controller will change the manipulated variables in orderto operate continuously in the best economic conditions withinthe constraints imposed by the process operation. In addition, the

Fig. 7. Recycled sludge biomass concentration data.

Page 5: 1-s2.0-S0098135410002693-main.pdf

6 emical Engineering 35 (2011) 638–650

t

wnsfc

P

w

gm

4

api4

ipisfmlppg

4

vcirbtftit

epmo

f2da

According to what was mentioned above, the duration of theintervals Tj

on,i(t) and Tj

off,i(t) must satisfy a set of constraints (8) cor-

responding to the maximum and minimum times an aerator can bein the ‘on’ or ‘off’ state and to the feasibility of the parameterization,

42 S. Cristea et al. / Computers and Ch

he prediction horizon Tp:

J = �Jeco + ˇJop + Jpenalty

Jeco =∫ Tp

0

3∑i=1

Pi(t)

Jop =∫ Tp

0

((c − csp)2)dt

Jpenalty = ˛[max(0, (cmin − c(t)))]2

(6)

here c(t) is integrated using (1) and ˛ is a appropriate bigumber (ex. alpha between 100 and 10000). In this way, path con-traints on DO have been included in the second term of the costunction (Jpenalty), penalizing the values of c below the minimummin = 2 mg/L.

The power consumption of each motor is given by:

i ={

Ci if yi = 10 if yi = 0

(7)

here C1 = 90 HP = 67.11 KW/h and C2 = C3 = 75 HP = 55.93 KW/h.This cost function has to be minimized with respect to the (inte-

er) decision variables subject to the constraints imposed by theodel and other operating limits.

.2. Internal model

The hybrid MPC has been formulated in continuous time usings internal model, Eqs. (1), (4) and (5) of the first principles modelresented in Section 2. Two different cases were considered accord-

ng to the availability of the OUR, as will be discussed in Section.4.

In the model of Section 2, all manipulated variables yi(t) arentegers, corresponding to the on/off state of each motor over therediction horizon. A usual control vector parameterization (CVP)

s to assign future values (0 or1 in this case) to a variable in everyampling time. In such case the optimization of a certain costunction J in terms of these variables implies solving a MINLP opti-

ization problem, difficult to perform in real-time because of thearge number of integer variables (three times the number of sam-ling intervals in the prediction horizon). In order to avoid thisroblem, a new parameterization is presented in the next para-raph.

.3. Integer variables parameterization

The idea is to take advantage of the specific pattern that a binaryariable must follow, a sequence of 0/1 pulses, combined with aontinuous time formulation of the MPC problem, to convert thenteger decision variables associated to each sampling period intoeal decision ones that correspond to the time instants when theinary actuator changes its state. This is coherent with a sequen-ial approach for solving the associated MPC optimization problemormulated in continuous time, as the pattern of time evolution ofhe integer variables can be embedded into the simulation of thenternal model so that the only decision variables remaining arehe time instants when they change its state.

Besides reducing the number of decision variables, this param-terization allows to solve the optimization problem as a nonlinearrogramming, NLP, one in terms only on real variables, instead ofixed-integer nonlinear programming, decreasing the complexity

f the optimization procedure and saving computation time.

As can be seen in Fig. 8, the proposed parameterization can be

ormulated in terms of new real variables Tjon,i

(t) and Tjoff,i

(t) (i = 1,, 3; j∈N) for each integer manipulated variable yi, denoting theuration of the time the integer variable yi remains in the values 1nd 0, respectively in pulse number j. The pattern followed by the yi

Fig. 8. Definition of the pulse in the parameterization of integer decision variable.

variables can be seen as a series of pulses (Sarabia, Capraro, Larsen,& de Prada, 2008b) due to the fact that the system cannot stabilizein none of the two possible values of the manipulated variablesfulfilling the operation requirements. In this case, for a specifiednumber Np,i of pulses, the number of the decision variables for eachcontrol variable yi is 2 * Np,i.

The implementation of the concept of control horizon in classi-cal MPC is made counting as decision variables only the intervalscorresponding to a certain number of pulses Nci and, from the Nci-thpulse to the final of the prediction horizon repeating the last pulseassuming that a stable periodic pattern has been achieved. Noticethat, with this formulation, the prediction horizon length is vari-able, depending on the number of pulses of the slower changinginteger manipulated variable yi. This means that, in order to com-pute a certain cost function J, the internal model will be integrateduntil the slowest train of pulses completes Np pulses. So, each inte-ger manipulated variable can perform a different number of pulsesin the same period of time Tp. In this case, the index J (Eq. (6)) has tobe formulated in a different way in terms of energy costs per unittime dividing it by Tp. This method has been used previously by theauthors (Sarabia et al., 2008b).

In this paper, a different use of the pulses has been considered. Ifone wishes to maintain a constant prediction horizon, the param-eter Nci can indicate not the number of pulses to be optimized,but the number of changes of the manipulated variable over a fixprediction horizon Tp (Fig. 9), that is, Nc represents the number of

decision variables Tjon,i

(t) and Tjoff,i

(t) in the optimization problem.Notice that the minimum value for Nc is 1 and in this case there isonly one decision variable T1

on, or T1off,i

(t).

Fig. 9. Proposed parameterization of integer decision variables.

Page 6: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 643

a

l

T

nhta

4

emflNeo

tmsmao

4

petvdco

real est

Fig. 10. Constraints on T1on,i

and T1off,i

.

s can be seen from Fig. 9:

Tminon,i

≤ Tjon,i

Tminoff,i

≤ Tjoff,i

≤ Tmaxoff,i

∀i = 1, 2, 3∑j

T jon,i

+ Tjoff,i

< Tp

(8)

The following physical values for minimum and maximumength of decision aeration/non-aeration sequences were chosen:

minon,i = Tmin

off,i = 1h, Tmaxoff,i = 2h (9)

Notice that the implementation of some of these constraintseeds to keep past values of the time evolution, as the times Tj

iave to be measured from the time instant when the last changeook place, which forces the first change to redefine its constraintsccording to Fig. 10.

.4. OUR estimation

In order to evaluate the cost function (6), and according toquation (1), the prediction of c depends on future values of theanipulated variable Fa, future values of the measured input water

ow q (q = qi + qr) and future values of the oxygen uptake rate OUR.evertheless, the OUR future values are not known and must bestimated in order to compute predictions of the main processutput, the DO concentration c.

In this paper two cases are considered in order to estimatehe future values of OUR. The first one assumes the possibility of

easuring the oxygen uptake rate every sampling time while theecond one only takes into account the dissolved oxygen measure-ents, being OUR an unmeasured variable. It is worth to performcomparison of both cases in face to a cost-benefit analysis for thexygen controller.

.4.1. Case 1: OUR is a measured variableConsidering that the value of OUR is available on-line, using

resent and past known values of the oxygen uptake rate OUR, anxtrapolation method is applied in order to obtain a future pat-

ern. Taking into account Eq. (2) as a good representation of realalues of OUR (Moreno, Poch, & Robusté, 1991), the OUR variationepends on the biomass concentration x and the substrate con-entration s. Nevertheless, the numerical values of the first termf (2) can be neglected if compared with the second one, so OUR

Fig. 11. Receding horizon estimation.

depends mainly on x. The evolution of the inlet biomass concen-tration xi profile (Fig. 4) suggests that a polynomial extrapolationis adequate to approximate the future behaviour of OUR. So, theproblem of fitting a curve to data is solved minimizing the sum ofsquares of errors between the known past values of OUR, OURpast(k)and a cubic polynomial function OURfut est(t):

mina0,a1,a2

N∑k=1

(OURpast(k) − OURfut est(k))2 (10)

where

OURfut est(t) = a2t2 + a1t + a0 (11)

The dimension of the data set is N and the values OURfut est(k)are calculated using (11) in the instants t = (k − 1) * ts, ts being thesampling period.

4.4.2. Case 2: OUR is a non-measured variableIn this case, present and past values of the measured variable c

are used to obtain estimates of past values for OUR by means of aReceding Horizon Estimator. The RHE approach has been adoptedbecause it works well with a very general class of problems. Theestimation is formulated as an optimization problem on a finitehorizon using past data.

The basic idea is summarized in Fig. 11 where past (N − 1) sam-pling times are displayed.

Over this past time interval, the control signals effectivelyapplied to the process Fa(t) and the process output c(t) are bothknown. The problem is to estimate the N past values of OUR byminimizing the difference between the output cest given by the evo-lution of the model from its initial conditions at (t − (N − 1) * ts) andthe measured values creal over the interval [t − (N − 1) * ts, t].

As new measurements become available, the old measurementsare discarded from the estimation window and the finite horizonestimation problem is solved to determine the OUR new past esti-mated values. The criterion to minimize is:

Jest =N∑

k=1

(crealk− cestk

)2 (12)

where c are the real process outputs (recorded values) and c

k k

is the model output (13) when the known past controls Fak and flowq are applied. The estimation of c is calculated from:

dcest

dt= KlaFa(cs − cest) − OURest − q(cest − cir)

V(13)

Page 7: 1-s2.0-S0098135410002693-main.pdf

644 S. Cristea et al. / Computers and Chemica

p

iaNNOO

os

4

u∑2fpbocnetfswf

Fig. 12. Proposed shape of estimated past OUR.

Because of the type of the continuous evolution of OUR, theroposed parameterization for its estimation (Fig. 12) is:

OURest(t) = OURi + ˛�, � ∈ [t − (N − 1)ts, t]with ˛ = ˛N−k when t−(N−k)ts ≤ � ≤ t−(N−(k+1)ts); 1 ≤ k ≤ N−1

(14)

The minimization of (12) is solved as a NLP problem consider-ng as decision variables the initial value of OUR in (t − (N − 1) * ts)nd the slopes ˛1, . . ., ˛N−1. The solution is used to calculate the

estimated values OURest(k) in the instants (k − 1) * ts (k = 1, . . .,) using (14) and then, in order to obtain a future shape of OUR,URfut est(t), the curve fitting problem (10) and (11) is solved withURest replacing OURpast.

Due to the reduced size of this problem, the computation timef the moving horizon estimation is not significant compared to theampling period.

.5. NMPC

The hybrid NMPC must then minimize the cost function (6)nder the model dynamics (1), (4) and (5) with respect to the

3i=1Nci decision variables Tj

on,i(t) and Tk

off,i(t) (k, j < Nci and i = 1,

, 3), taking into account the constraints (8) and (9). Notice that,ormulated in this way, it is a continuous dynamic optimizationroblem that can be solved every sampling period ts. A possi-le approach for solving this problem is given in the schematicf Fig. 13. This corresponds to a sequential approach where theost function J is computed by integration of the dynamical inter-al model. The simulation package integrates the internal modelquations over the prediction horizon Tp taking as initial condi-

ions the current process state and evaluating the formulated costunction J at the end of the integration. The internal model wasimulated using the EcosimPro simulation language (EA Int, 1999),hich allows combining DAE equations with events, while per-

orming a correct integration in spite of the model discontinuities.

Fig. 13. Nonlinear controller – continu

l Engineering 35 (2011) 638–650

In this way, from the point of view of the optimizer, the problemis a static NLP. An SQP algorithm (in our case the one implementedin a commercial library NAG for C) was used in conjunction withthe simulation to implement the controller. The C++ code of thehybrid MPC, generated automatically by the simulation environ-ment, can be embedded in a processor for on-line control or in aprocess simulation to perform off-line tests.

Notice that, as the hybrid MPC calculates the exact time instantsTj

on,i(t) and Tk

off,i(t) of changes for each on/off manipulated variable,

in order to implement this decisions, a converter, for instance a PLC,is required between the controller and the actuators to transformthese times in discrete manipulated signals yi, activated when theevents take place. This feature allows decoupling the application ofthe on/off signals from the sampling time.

Some additional comments about the inherent discontinuitiesappeared in the proposed continuous reformulation are given inAppendix A.

5. Simulation results

5.1. Hybrid MPC

To illustrate the behaviour and performance of the hybrid MPC,several experiments have been made with the wastewater treat-ment plant simulated in the simulation environment EcosimPro.The experiments correspond to a week of operation (exactly 166 h)using real data for the perturbations (Figs. 3–7). The controller cal-culates the sequence of motor switches, using a sampling time (ts)of 15 min, in order to keep always the DO level above 2 mg/L, whichis required to allow the substrate oxidation reactions proceedingnormally, in spite of flow and load variations.

Considering the case 1 (OUR measured) and using a predictionhorizon Tp = 2.5 h, the DO evolution is presented in Fig. 14, whilethe optimal motor switches computed by the HMPC controller areshown in Fig. 15. As can be seen the DO is always above the mini-mum level, being quite sensitive to the on/off state of the turbines.Notice that these must switch from time to time due to the oper-ating constraints (8) and (9).

Throughout the simulation period of the study (166 h) themotors were “on”-time 79.05, 84.62 and 85.7 h, respectively and

“off”-time 86.95, 81.38 and 80.3 h.

As we mentioned before, an estimation of OUR future values isincluded in the controller with the dimension of the past data setN = 5. The economic cost index calculated using (6) over the 166 hsimulation time was Jeco = 148.31 × 102 kW.

ous implementation framework.

Page 8: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 645

Fig. 14. Dissolved oxygen using Nc = (2,2,2) and Tp = 2.5 h (case 1).

sing N

1p

as

Fig. 15. Manipulated variables u

The simulation was performed in a 1.83 GHz computer with

GB of RAM and the time required to solve the predictive controlroblem every sampling time is represented in Fig. 16.

The same simulation was repeated but considering case 2 (OURs an unmeasured variable). The OUR estimation, updated everyampling time, is given in Fig. 17 besides the real OUR evolution.

Fig. 16. Computation time (s); max t

c = (2,2,2) and Tp = 2.5 h (case 1).

It can be seen a good fit between measured and computed

OUR values, so the evolution of the dissolved oxygen underclosed loop with this estimation is very similar to the case 1.The mean computation time was 3.6 s with a maximum time of66 s. The computational cost is acceptable for this real-time pro-cess.

ime = 64.84 s, mean time = 2.7 s.

Page 9: 1-s2.0-S0098135410002693-main.pdf

646 S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650

F f the rt

5

ac

trttt

ig. 17. Real (black line) and estimate (red line) OUR (case 2). (For interpretation ohe article.)

.2. PI controller

In order to compare these results with the ones obtained withPI traditional control, some experiments were made in the same

onditions.Under PI control the controller output is the global aeration fac-

or F ∈ [0,1] but the motors are switched on and off following the

a

ule depicted in Fig. 18 and considering the constraints (9). The con-inuous value of u = Fa calculated by the PI controller is converted tohe on/off manipulated variables as follows: if u < 0.25 then all theurbines are switched off (if it is possible, that is if the aerator i was

Fig. 18. Conversion from continuous control to discrete control.

eferences to color in this figure legend, the reader is referred to the web version of

in the ‘on state’ and Tion ≥ 1 h or Ti

off≤ 2 h); if 0.25 ≤ u < 0.5 then only

one of the motors has to work, if 0.5 ≤ u < 0.75 then two turbineshave to be activated and finally, if u ≥ 0.75 then all the aerators areturned on, always taking into account the constraints (9).

When the DO is under the PI control (with proportional gain K = 1and integral time constant Ti = 0.7 h), the tracking performance isshown in Figs. 19 and 20.

The control loop tries to keep the DO concentration at adesired value sp. The set point sp = 3.1 mg/L was set in order toguarantee no violation of the low limit (cmin = 2). The controlledvariable presents a good behaviour but the power consumption(Jeco = 187.52 × 102 kW) is higher, a 26.43% more than in the pre-vious hybrid MPC case, with a total “on”-time = 114, 94.75 and103.75 h, respectively. This may justify the use of the HMPC con-troller.

5.3. Adaptation strategy

Notice that in the controller, in order to reduce the problemsassociated with modelling errors an additional term E has beenincorporated into the equation of the internal model of DO (Eq. (1))

Page 10: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 647

Fig. 19. Dissolved oxygen using a PI controller.

ariab

t

papb

Fig. 20. Manipulated v

hat is used to make the predictions:

dccorr

dt= KlaFa(cs − ccorr) − OUR − q(ccorr − cir)

V+ E (15)

This term is estimated every sampling time using past and

resent information from the process, using a well-known strategy:s the past control is known, the model is integrated from samplingeriod (t − 1) up to t and then E is obtained from the difference eetween the measured output creal(t) and the one predicted by the

Fig. 21. Adaptation strategy.

les using PI controller.

model at time t − 1 (Fig. 21).

e = creal(t) − c(t/t − 1)

E ={

e

tsif t ≤ ts

e if t > ts

(16)

In this way, modelling or disturbances can be compensatedin the future predictions and integral action is added to thecontroller.

The model of DO used in the controller optimization (Eq. (1))depends on the dilution constant Kla. In order to test the strategyagainst the modelling errors, this parameter was changed in therange [0.3, 0.6] during the simulation of the process (Fig. 22), whilethe model maintained the initial value Kla = 0.4. The results are

Fig. 22. Kla parameter changes.

Page 11: 1-s2.0-S0098135410002693-main.pdf

648 S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650

Fig. 23. Dissolved oxygen using adapted strategy.

Fig. 24. Dissolved oxygen without adaptation strategy.

ol with

sstao

w(

Fig. 25. PI contr

hown in Fig. 23 considering the case of an unmeasured OUR. Theuggested method can efficiently deal with the operating condi-ions changes (the economic cost is Jeco = 155.42 × 102 kW). With no

daptation strategy the control results are no satisfactory becausef the bound exceeding (Fig. 24).

The same experiment was considered using the PI controlith good results (Fig. 25) but a higher power consumption

Jeco = 191.97 × 102 kW).

changes in Kla .

6. Conclusions

The nonlinear predictive control approach followed in this paper

presents promising results when applied to a realistic simulation ofa wastewater plant located in Manresa, a town near Barcelona. Theproposed methodology seems to be an efficient way to control theDO levels in activated sludge process. It allows maintaining alwaysthe DO level over the required value of 2 mg/L with the objective to
Page 12: 1-s2.0-S0098135410002693-main.pdf

S. Cristea et al. / Computers and Chemical Engineering 35 (2011) 638–650 649

uity a

rnopah

pcadc

A

pa

A

Sdiog

wptFc

wp

ct

I(

Fig. 26. (a) State and model evolution before and after a discontin

educe the energy used in aeration process and managing the tech-ical constraints present in the plant. In addition the decouplingf the manipulated variables from the sampling time leads to theossibility of using larger samplings times, but the control signalsre always applied corresponding to exact instant calculated by theybrid controller.

The approach presented is able to reformulate many hybridroblems that involve continuous dynamics, on/off variables andertain logic of operation in terms of continuous ones, combiningn adequate parametrization and embedding the operation in aynamic simulation. The associated dynamic optimization probleman be solved with NLP methods.

cknowledgements

The authors are thankful for the financial support received fromrojects DPI2006-13593 and DPI2009-12805 of the Spanish CICYTs well as project GR.085/2008 of Junta CyL.

ppendix A.

The main concern using the continuous approach (proposed inection 4.5) is related to the fact that the inherent discontinuitiesoes not disappear from the simulated internal model. One can ask

f they allow a safe computation of gradients required by the SQPptimization algorithm. In order to answer the question, notice thativen the dynamic variable structure optimization problem:

minp

J(p) =∫ T

0

L(x, u(p))dt

Fk(x, x, u(p)) = 0

(17)

here the control variable u has been parameterized in terms of thearameters p, and the model Fk presents a discontinuity at a givenime instant t*, so that from this time when the model changes tok+1, the gradient of the cost function with respect to a certain pian be computed by means of:

dJ

dpi=

∫ T

0

(∂L

∂xsi + ∂L

∂u

∂u

∂pi

)dt (18)

ith si representing the sensibility of the state x with respect to thearameter pi, si = ∂ x/∂ p.

The sensibilities at stage k can be computed by solving the so-alled extended system, obtained from differentiation with respecto p of the model equations:

∂Fk

∂xk

dski

dt= ∂Fk

∂xksk

i + ∂Fk

∂uk

∂uk

∂piFk(x, x, u(p)) = 0

(19)

f at a certain time instant t* the model changes from k to k+1

Fig. 26), the extended system will change to:

∂Fk+1

∂xk+1

dsk+1i

dt= ∂Fk+1

∂xk+1sk+1

i+ ∂Fk+1

∂uk+1

∂uk+1

∂piFk+1(x, x, u(p)) = 0

(20)

t time t*; (b) sensibility before and after a discontinuity at time t*.

The initial value of the state at t* will be given by xk+1(t*), which,assuming continuity of the state, will be equal to the state reachedby the model k:

xk+1(t∗) = xk(t∗) (21)

and differentiating this equality with respect to the parameter pi itis possible to obtain initial conditions for sk+1

i:

sk+1i

(t∗) = ski (t∗) − [xk+1(t∗) − xk(t∗)]

∂t∗

∂pi(22)

In our problem the parameters pi correspond to the time instantst* (Fig. 9), so that:

∂t∗

∂pi= 1 sk+1

i(tk) = sk

i (tk) − [xk+1(tk) − xk(tk)] (23)

As a result, the sensibilities will present discontinuities as inFig. 26b, but, as given by (18), the computation of the gradientscan be performed adequately provided that, with respect to everydecision variable, the number and order of discontinuities do notchange as it happens in our problem because of the particular selec-tion of decision variables. A full cover of the topic can be seen in(Galán, William, & Barton, 1999).

References

Beck, M. B. (1986). Identification, estimation and control of biological wastewatertreatment processes. Proceedings of the IEE Part D, 254–264.

Bemporad, A., & Morari, M. (1999). Control of systems integrating logic, dynamicand constraints. Automatica, 35, 407–427.

Bemporad, A., Morari, M., Dua, V., & Pistikopoulos, E. N. (2002). The explicit linearquadratic regulator for constrained systems. Automatica, 38(1), 3–20.

Busch, J., Oldenburg, J., Santos, M., Cruse, A., & Marquardt, W. (2007). Dynamicpredictive scheduling of operational strategies for continuous processes usingmixed-logic dynamic optimization. Computers and Chemical Engineering, 31,574–587.

Caballero, J. A., & Grossmann, I. E. (2007). Una revisión del estado del arte en opti-mización. Revista Iberoamericana de Automática e Informática Industrial, 4(1),5–23.

Caraman, S., Sbarciog, M., & Barbu, M. (2007). Predictive control of a wastewa-ter treatment process. International Journal of Computers, Communications andControl, 2(2), 132–142.

Chachuat, B., Roche, N., & Latifi, M. A. (2001). Dynamic optimisation of small sizewastewater treatment plants including nitrification and denitrification pro-cesses. Computers and Chemical Engineering, 25, 585–593.

EA Int (1999) EcosimPro User Manual. Available <http://www.ecosimpro.com>.Engell, S. (2007). Feedback control for optimal process operation. Journal of Process

Control, 17(3), 203–219.Floudas, C. A. (1995). Nonlinear and mixed-integer optimization: Fundamentals and

applications. Oxford University Press.Galán, S., William, F., & Barton, P. I. (1999). Parametric sensitivity functions for hybrid

discrete/continuous systems. Applied Numerical Mathematics, 31(1), 17–47.Holenda, B., Domokos, E., Rédey, A., & Fazakas, J. (2008). Dissolved oxygen of the

activated sludge wastewater treatment process using model predictive control.Computers and Chemical Engineering, 32, 1270–1278.

Marsili-Libelli, S. (1989). Modelling, identification and control of activated sludgeprocess. Advances in Biochemical Engineering/Biotechnology, 38, 89–148.

Moreno, R. 1991. Control predictivo no lineal en depuración aerobia. MSc Thesis. Uni-versitat Autónoma de Barcelona.

Moreno, R., de Prada, C., Lafuente, J., Poch, M., & Montague, G. (1992). Non-linear pre-dictive control of dissolved oxygen in the activated sludge process. In Proceedingsof the ICCAFT 5/IFAC-BIO 2 Conference Keystone, CO, USA,

Prada, C., Moreno, R., Poch, M., & Robusté, J. (1991). Recursive estimation of OUR inactivated sludge process. In ECC 91 European Control Conference, Vol. 2 Grenoble,France.

Page 13: 1-s2.0-S0098135410002693-main.pdf

6 emica

P

R

S

50 S. Cristea et al. / Computers and Ch

rada, C., Sarabia, D., & Cristea, S. (2005). Modelling and control of fourtanks Mixed Logic Dynamical (MLD) system. Dynamics of Continuous, Dis-crete and Impulsive Systems B: Applications and Algorithms, 12(2), 243–

264.

obuste, J. (1990). Modelització i identificació del proces de fangs activats. PhD Thesis.Universitat Autónoma de Barcelona.

arabia, D., Capraro, F., Larsen, L. F. S., & de Prada, C. (2008). Hybrid NMPCof supermarket display cases. Control Engineering Practice, 17(4), 428–441.

l Engineering 35 (2011) 638–650

Sarabia, D., Prada, C., Cristea, S., & Mazaeda, R. (2008). Plant-wide control of a hybridprocess. International Journal of Adaptive Control and Signal Processing, 22(2),124–141.

Sarabia, D., Prada, C., Cristea, S., Mazaeda, R., & Colmenares, W. (2007). Hybrid NMPCcontrol of a sugar house. In R. Findeisen, F. Allgöwer, & L. Biegler (Eds.), Assess-ment and future directions of nonlinear model predictive control, series: Lecturenotes in control and information sciences (pp. 495–502). Berlin: Springer.

WPCF (1988). Aeration, Manual of practice FD-13. Water Pollution Control Federation(Ed.).