Vous êtes sur la page 1sur 16

ISA Transactions

Volume 45, Number 2, April 2006, pages 159174

Modeling, Identication, and Validation of Models for Predictive Ammonia Control in a Wastewater Treatment PlantA Case Study
Alja Stare,* Nadja Hvala, Darko Vreko
Department of Systems and Control, Joef Stefan Institute, Jamova 39, 1000 Ljubljana, Slovenia

Received 17 March 2004; accepted 14 September 2005

Abstract The aim of this work is to develop the ammonia models that could be used for model predictive control MPC of nitrication process in a wastewater treatment plant. First, a reduced nonlinear model is presented, which is based on expression for nitrication reaction rate in activated sludge model No. 1 and modied for attached biomass processes, while second, a linear black-box model is shown. The data used for model identication were collected during several weeks of experiments on a real plant so that good identication data were obtained. The designed models were validated based on open loop simulations and predictions. Validation results show that the reduced nonlinear model performs better compared to the linear model, however, both models show relatively large errors compared to the real plant data. Hence, a closed loop simulation study was performed to see the differences between the performance of model predictive controller using previously estimated linear and nonlinear models and a standard proportional integral PI controller. From the simulation study results it was seen that in spite of relatively large model errors the MPC algorithms give better results in terms of ammonia removal compared to the PI controller, while MPC with the nonlinear model shows additional improvements over the MPC with the linear model. 2006 ISAThe Instrumentation, Systems, and Automation Society.
Keywords: Kalman lter; Modeling; Models for predictive ammonia control; Nitrogen removal; N4SID subspace identication; Reduced order model; Wastewater treatment

1. Introduction Due to the advent of stricter efuent criteria for wastewater treatment plants WWTP-s , particularly with regard to nutrient removal, the most common issues in current wastewater treatment research are cost-effective solutions that give desired efuent quality at low operational costs. To meet these demands different control concepts can be applied in the control of nutrient removal, e.g.,
*Corresponding author. Tel:
386 1 47 73 798; Fax:

386 1 4257 009. E-mail address: aljaz.stare@ijs.si

from conventional proportional integral differential PID controllers to more advanced modelbased control approaches 1 . Recent research results show that predictive 2,3 and feedforward 4,5 control are more successful in control of nutrient removal than conventional feedback proportional integral PI control. This is especially evident in the case where a WWTP is characterized by a number of reactors in series, what leads to large hydraulic delays, and where the control actions are located far in front of the nutrient measurements. Hence, in the case of high dynamic inuent loads the conventional feedback control actions are carried out too late. The advanced

0019-0578/2006/$ - see front matter 2006 ISAThe Instrumentation, Systems, and Automation Society.

160

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

model-based controllers avoid this problem with the help of a process model. For example, the model predictive controller predicts the process response and chooses the future adjustments of the manipulated variables to minimize the errors between the controlled output variables and their set points. One of the inherent problems of the advanced model-based controllers is that they require information about the process behavior that is obtained through the process model. This means that the quality of the control very much depends on the precision of the process model. In principle, any kind of a model, which allows fast numerical calculations, can be used. For instance, the activated sludge model No. 1 ASM1 model , which was presented by the IWA task group 6 and has gained broad acceptance, describes the removal of carbon and nitrogen compounds from the wastewater and provides a good basis for system design and simulation. However, it is still difcult or even impossible to apply this model in on-line control strategies due to its complexity. The model includes 13 nonlinear differential equations with 19 hardly identiable model parameters 7,8 . Therefore, reduced models that describe only the most important phenomena are used for control purposes. Wastewater processes also express time-varying dynamics because of the living organisms that adapt to the changing conditions. This means that even complicated models are not able to represent the process dynamics for a longer period of time. Therefore, permanent adaptation of the model to the current process behavior is necessary. Another difculty lies in the absence of direct on-line measurements of all biological state variables, which are needed for efcient prediction calculations. The reasons for this are expensive sensor equipment and a lack of sensors for on-line measuring of the process states e.g., biomass, substrate . Therefore, an interesting alternative is in the use of state and/or parameter observer 911 . In this way the mismatch between the process behavior and model predictions can be reduced. In this paper, modeling, identication, and state estimation are used in the design of models for predictive ammonia control in a wastewater treatment plant. Reduced order models representing ammonia dynamics are already shown in the literature 2,4,10 and used in different model-based

control approaches, but were up to now tested only in simulations and compared to simulated full order models. The aim of this paper is to determine, using real plant data, whether the designed models can represent the real plant ammonia dynamics and what their quality in simulations and predictions is. The data used in identication were collected from experiments on a moving bed biolm reactor MBBR pilot plant in the DomaleKamnik wastewater treatment plant. Two models are designed in the paper, a nonlinear and a linear one. The reduced nonlinear model is similar to previously proposed reduced models in the literature, but adjusted for the biolm processes by introducing a new oxygen switching function for nitrication, while the linear black-box model was identied with the well known N4SID numerical algorithm for subspace state space system identication algorithm. As the models will be used for predictive ammonia control the model predictions were also calculated and validated. For the nonlinear model predictions, estimation of unmeasured state variables and adjustable model parameter was performed by an extended Kalman lter EKF . Besides this a simulation study of the control algorithms was performed using previously estimated models. The paper is organised as follows. In the next section, the MBBR pilot plant is presented followed by a reduced nonlinear and a linear model presentation. After that simulation results of both models are compared and validated. Then the state and parameter observation results by means of an EKF are shown followed by nonlinear and linear prediction validation. The next section contains a simulation study of the control algorithms and nally, some conclusions are drawn. 2. MBBR pilot plant A scheme of the Domale-Kamnik MBBR pilot plant is shown in Fig. 1. The pilot plant is built for nitrogen removal and consists of an anoxic reactor, two aerobic reactors, a mixed reactor, and a settler. The main process that takes part in ammonia NH4 N removal is nitrication 1,12 . This process runs in aerobic reactors and is strongly dependent on the dissolved oxygen DO concentrations. Hence, for the ammonia control, DO is used as a manipulated variable, while NH4 N concentration in the last aerobic reactor is treated as a controlled variable. Other measured process

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

161

Fig. 1. MBBR pilot plant in Domale-Kamnik wastewater treatment plant.

variables that also have inuence on the nitrication process and act as measurable disturbances are inuent ow rate, inuent ammonia, and temperature Fig. 2 . The biomass in the plant is attached to plastic carriers, which ow freely in the anoxic and both aerobic reactors. For attached biomass processes high DO concentrations are needed to drive the diffusion of oxygen into the biolm. While a conventional activated sludge system is normally designed for 12 mg/ l of DO, DO concentration for attached biomass systems should be higher than 34 mg/ l. 3. Process models 3.1. Nonlinear reduced order model In modeling ammonia dynamics it was assumed that nitrication is the only conversion process in the pilot plant. Therefore, the ammonia mass balance in the ith aerobic reactor can be written as

= rNH

SNHi KNH + SNHi 1+e

1
k1SOi+k2

T20

, 2

where SOi represents DO concentration in the reactor, rNH is nitrication reaction rate parameter, is temperature coefcient, T represents liquid temperature, KNH is ammonia half-saturation coefcient for autotrophic biomass, while k1 and k2 are sigmoid switching function parameters. The expression for nitrication reaction rate was taken from the ASM1 model 6 and modied by introducing temperature dependency. Also, the commonly used Monod type DO switching function for nitrication

Sf =

S Oi K OA + S Oi

dSNHi dt

where KOA presents oxygen half-saturation coefcient for autotrophic biomass, was changed to sigmoid switching function

= DiSNHi + DiSNHin +

i,

1 Sf = 1+e

where SNHi represents ammonia concentration in the reactor, SNHin is the inuent ammonia concentration, Di is the dilution rate dened as Di = in / Vi, in represents the input owrate and is equal to output owrate, while Vi is the reactor volume. i is the nitrication reaction rate dened as

k1SOi+k2 .

The DO switching function is used in suspended biomass models to limit nitrication at low oxygen concentrations. In the MBBR process, nitrication starts at higher DO concentrations because of the diffusion processes. To model this, sigmoid switching function was introduced 13 . Within

Fig. 2. Observed process variables.

162

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

Fig. 3. The sigmoid switching function for different values of k1 and k2 up and Monod type switching function for different values of KOA down .

this function parameters k1 and k2 can be optimized so that the nitrication process shifts to higher DO concentrations, while the sensitivity of nitrication rate to DO variations remains high Fig. 3 . The complete reduced nonlinear model describing ammonia mass balances for each reactor can be written in the following state space form:

H= 0 F = Din = 0

1 0
3

0 , 0 0 T,
7

SNHin
2

0 T,

x = Dx + F + , y = Hx, 5

0 0 Dr D1 0 0 D2 D2 , D= 0 0 D3 D3 0 0 D4 D4 Din =
in

where x represents the state vector, i.e., ammonia concentration in each reactor, y is the model output SNH3 , D is a dilution rate matrix, F is the feed rate vector, is the nitrication reaction rate vector, and H is the output vector. They are as follows:

V1

D1 =

tot

V1

D2 =

tot

V2
r

D3 =
where tot =
r

tot

x = SNH1

SNH2

SNH3

SNH4 T ,
6

V3
r

D4 =

tot

V4

Dr =

V1

and

in +

tot represent recycled and total volumetric ow rate, respectively.

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

163

3.2. Linear black-box model Black-box identication is an approach that requires little prior process knowledge. For this purpose a simple N4SID algorithm 14 , whose numerical implementation is available in MATLAB Identication Toolbox, was used. Matlab function N4 SID estimates the following state-space model in the innovation form:

Y f = Xf ,

13

where X f presents the predicted Kalman lter states, which are up to now unknown. By performing the singular value decomposition SVD of 11 , deleting small singular values, and comparing to 13 gives
Y f = USVT = U1S1/2, 1 U 1S 1V T = X f , 1 Xf =

14 15

xk+1 = Axk + Buk + Kek , Yf, y k = Cxk + Duk + ek , 9


where denotes the Moore-Penrose pseudoinverse. The number of dominant singular values that are included in S1 can-thus deliver the order of the system. Moreover, once the matrix of states is given 15 , the state space model matrices can be found by solving a simple set of overdetermined equations in a least square sense

where uk, xk, and y k are the process inputs, states and outputs, respectively, while A is a system matrix, B is an input matrix, C is an output matrix, D is a direct feedthrough matrix, K is the Kalman gain, and ek is an innovation sequence see Ref. 15 . In our case u = SO2 SO3 SNHin T in T and y = SNH3. The idea behind the subspace methods is on rst estimating the state vector xk from input-output data, and then nding the state space matrices 9 by applying the least square method. First, the measured data are arranged to form block Hankel matrices Y f , Y p, U f , and U p 16 , where the subscripts f and p denote future and past, respectively. The Hankel matrices can be arranged to form a linear regression equation

A B Xk+1 = C D Yk

Xk + Uk

k,

16

Y f = RUp

RY p

RU f

Up Yp , Uf

10

which can be solved in a least square sense. By excluding the linear contribution of the U f , the matrix of predicted outputs can be written as:

with k as residual matrix. In addition, the Kalman gain K can then, if desired, be computed from A, C, and the covariance matrix of k. The advantages of subspace algorithms are that they are robust and suitable for high-order multivariable systems, for which it is not trivial to nd a useful parametrization among all possible parametrizations. These algorithms do not involve nonlinear optimization techniques, i.e., they are fast and accurate since no problems with local minima exist. The main drawback of these algorithms is that in the obtained model the physical insight of the process is lost, which is a common characteristic for all black-box models.

Y f = RUp

RY p

Up . Yp

11

4. Estimation of model parameters The data used in model development were collected through the pilot plant experiments in the periods from 6.2.-26.2.2003 and 9.4.-2.5.2003. In both cases the DO concentration in aerobic reactor was controlled by manipulating the airow, which is a common practice in the wastewater treatment plants. In the rst period 6.2.-26.2. the plant was operated in the normal regime, i.e., the DO set point was set to a high value in order to achieve satisfactory nitrication. In the latter period the

It can also be shown 16 that the input-stateoutput relations can be expressed as

Y f = X f + RU f U f + E f ,

12

where is the extended observability matrix, X f is a matrix of state sequences stored as row vectors, and E f is a noise term. By excluding U f as in 11 , the matrix of predicted outputs can be dened

164

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

Fig. 4. Measured process data used for model estimation.

oxygen concentrations in the rst and second aerobic reactor were purposely varied so that the process was sufciently excited. DO variations were made by introducing random step changes of different magnitudes. DO concentrations were changed a few times per day so that the inuence of DO concentration on NH4 N concentration could be observed because of the long process time constant a few hours . In both periods other process inputs that represent uncontrollable disturbances were also measured. The second set of data was used for model estimation while the rst one was used for model validation. Measured process variables for estimation data are shown in Fig. 4.

4.1. Parameter estimation for reduced nonlinear model Reduced nonlinear model parameters k1, k2, KNH, and rNH were optimized based on process data, while the value of temperature coefcient was taken from the literature 12 and was equal to 1.1. Because the model 5 is nonlinear in the parameters many local optima exist which leads to a problem of nding a global minimum. Despite extensive efforts, no perfect minimization algorithm for nonlinear objective functions exists and nding a global minimum for nonlinear problems cannot be guaranteed 8 .

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

165

Table 1 Model parameter values. Parameter Optimization range Parameter values rNH 0 , 1000 522.1 KNH 0,5 0.51 k1 0,2 0.57 k2 0 , 10 3.08 / 1.1

In our case the model parameters were determined by combining Monte Carlo simulation and gradient optimization. In Monte Carlo simulation the model simulations were repeated a number of times 10 000 with different random selected parameters in a range shown in Table 1. For each set of parameter values the quality of the model was evaluated by calculating the mean relative squared error MRSE criterion
N

put with known parameter values. Only in the case where no noise was added to the process output the true parameter values could be obtained by optimization. The reason for obtaining multiple parameter values with similar performance is that DO concentrations were excited in a range from 4 to 7 mg/ l, which means that the reaction rate curve 2 can be quite similar within this range for different parameter values, while outside this region it can differ. Solution to this would be to excite the DO concentrations in a wider range. The parameter values nally chosen are shown in Table 1. 4.2. Parameter estimation for linear black-box model Before the black-box identication algorithm was employed, the measured data were pretreated so that it had zero mean and variance 1. This is a common practice in model identication procedures since the magnitudes of different process variables can be quite arbitrary. This means that the identication algorithm must correct these levels by adjusting model parameters, which is quite unnecessary 15 . The linear model matrices A, B, C, D, and K 9 were determined by minimizing the error between the process measurements and simulated model outputs. From observing the dominant singular values 14 a second order model was selected, which also gave satisfactory results compared to higher order models. The following matrices were obtained:

y mi y i MRSE =
i=1 N

100 % , y2 i

17

i=1

where N is the number of data samples, while y i and y mi represent process measurements and model outputs, respectively. MRSE values can vary between 0 and . MRSE equal to 0 indicates perfect agreement between process measurements and model outputs, while larger values show poorer agreement. Parameter values that gave the best MRSE results were then used as initial values for optimization algorithm available in MATLAB Optimization Toolbox. For optimization the gradient method lsqcurvet function was used, which solves nonlinear curve-tting data-tting problems in the least-squares sense and can give only local solutions. From the random search approach it was found that only 0.2% of 10 000 selected parameters have the MRSE criterion smaller than 50%, which means that optimal parameters lie in a very small subspace compared to the total space selected in Table 1. With gradient optimization it was possible to lower the MRSE to around 45%, but it was found that similar minimal MRSE values are obtained at different parameter values, which means that the parameters cannot be determined uniquely. Similar results were obtained also in a simulation experiment where process output measurements were replaced by simulated model out-

A=

0.991 0.0513 , 0.0860 0.871

B = 105

5.53 38.5 53.8 114 62.6 , 238 51.2 276 144 230 C = 42.2 D= 0 0 0.901 , 0 0 0 , 18

K = 0.0282

0.189 T ,

which result in a stable, observable, and controllable model.

166

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

Fig. 5. Upper plot: The output of the reduced nonlinear model and the linear black-box model compared with real plant measurements for the estimation data. Lower plot: DO concentrations in the rst and second aerobic reactor.

5. Model validation based on open loop simulations The identied models were compared and validated against real plant data. Fig. 5 shows a comparison between simulated model output and measurements for estimation data. It can be seen that a relatively good agreement is achieved both for the linear and nonlinear model. However, a linear model is limited by its linear structure, which means that it has a smaller validity range compared to the nonlinear model and can also take negative output values Fig. 5 . This, on the other hand, does not present too much problem when the linear model is used within MPC as the feedback mechanism of MPC can correct model errors, while also arbitrary constraints can be used to represent possible actuator slew rates, actuator ranges, and constraints on the controlled variables. Fig. 6 shows the model comparison for validation data where slightly better performance of the nonlinear model can be seen compared to the linear model. It can be seen also that both models show poor accuracy at the initial stage day 07 , where the DO concentrations in the second aero-

bic reactor were high compared to the rest of data. The reason for that was the offset of DO sensor measurements. The quality of the models was also determined by calculating the MRSE criterion. The MRSE values are presented in Table 2 and show that the accuracy of both models is similar for the estimation data, while the MRSE criterion for validation data is a little lower for the nonlinear model. However, both models have relatively large MRSE errors compared to the real plant data, although important process phenomena that are desired for efcient control are incorporated in both models. 6. On-line state and parameter estimation As the models will be used in predictive ammonia control, it is important to determine how the predicted values of the controlled variable NH4 N are calculated. Namely, it turns out that the way the predictions are calculated has a great effect on the performance of the closed loop system running under predictive control 17 . Hence, the predictions in our case were calculated and validated from the best estimate of the current

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

167

Fig. 6. Upper plot: The output of the reduced nonlinear and the linear black-box model compared with real plant measurements for the validation data. Lower plot: DO concentrations in the rst and second aerobic reactor.

state xk and future inputs that were assumed known. State estimates can be easily calculated for the linear model, which has been already estimated in the innovation form 9 , while the state estimates for the nonlinear model were calculated by using an EKF. In addition, an EKF was also used for on-line estimation of the rNH parameter in order to see if recursive parameter adaptation improves prediction accuracy, especially in the period when DO sensor offset problems occurred.
6.1. Extended Kalman lter The EKF is widely used estimation algorithm and has been successfully used in a number of chemical and other engineering applications. The EKF addresses the general problem of trying to
Table 2 MRSE values for nonlinear and linear model. Nonlinear model % Estimation data Validation data 44.3 49.4 Linear model % 42.6 56.0

estimate the process state vector x that is governed by the nonlinear stochastic difference equation 18,19

xk+1 = f xk,uk + wk ,
with an observation measurement z that is

19

zk = h xk +

k,

20

where xk is a process state vector, uk the input vector, zk is measurement vector, f and h are known nonlinear functions, while wk and k are random variables with covariance matrices Q = E w k w k T and R = E v k v k T that represent the process and measurement noise, respectively. The complete recursive EKF equations are

K k = P H T H k P H T + R k k k k

21 22 23 24

k k xk = x + Kk zk h x , P k = I K kH k P , k xk+1 = f xk,uk ,

168

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174
Pk+1 = Ak PkAk + Q.

25

xk+1 = xk + TS Dxk + F + zk = Hxk +


k,

+ wk , 28

The Kalman lter equations have the form of an observer, with a special choice of observer gain K , which gives an optimal minimum error variance estimate of the state x 18 . In Eqs. 21 k 25 x and xk are the a priori and a posteriori or updated estimates, P and Pk are the a priori and k k a posteriori estimate error covariances, h x is a measurement prediction, Kk is the Kalman gain while the matrices Ak and Hk are the Jacobian matrices of partial derivatives of f and h with respect to x, that is

where xk is a process state vector, zk is measurement vector, wk and k represent the process, and measurement noise with covariance matrices Q and R, respectively. Matrices D, F, , and H are the same as presented in 5 , while the Jacobian matrices Ak and Hk are calculated Eqs. 26 and 27 as follows:

Ak = I + TS D + W ,
29

A i,j =

f x

i j

xk,uk ,

26

W = diag 0

SNH2 Hk = H,

SNH3

0 30

H i,j =

hi x
j

xk .

27

The matrices Ak and Hk in Eqs. 21 , 23 , and 25 are subscripted to point out that they are different at each time step, while Q and R are assumed as constants and are determined according to the process noise magnitude Q and measurement noise magnitude R . In practice one can often assign a meaningful value for R, which is based on the sensor accuracy. The determination of the process noise covariance Q is generally more difcult as we typically do not have the ability to directly observe the process noise. Often acceptable lter performance can be obtained by tuning the lter parameters Q and R 19 . This was also the case in our work in the following section. Since the EKF algorithm is computed recursively divergence problems can arise. Common sources of difculty can occur due to roundoff errors, modeling errors or observability problems 18 . 6.2. Application of the EKF to nitrication process 6.2.1. State estimation In order to use an EKF discrete-time algorithm, the reduced nonlinear model was rewritten in a discrete-time form using a rst order Euler approximation. The reduced nonlinear model 5 can be written as the following discrete-time stochastic state model presented in 19 and 20 :

where I denotes the unity matrix 4-by-4 . Before starting the EKF algorithm the initial a priori error covariance matrix, initial a priori estimate and the covariance matrices for measurement and process noise have to be determined. They were the following:

0 x = 12

2 T,

P = 10I, 0 31

R = 0.05,

Q = 10I.

The initial a priori estimate was set close to the true initial state of the process, but even if the initial a priori estimate is not known, the lter quickly converges to the same state estimates. In this case just the value of the initial a priori error covariance matrix should be set to a larger value e.g., 106 since the prior knowledge about the initial estimate is not known. The tuning parameters Q and R were chosen so that R was very small relative to Q. This means that the NH4 N measurements were supposed to be very accurate as indeed are , and hence, the estimation of xk by the lter is fast. 6.2.2. State and rNH parameter estimation In this section, along with the process state vector, a reaction rate parameter too is estimated recursively. Allowing rNH to vary with time implies the possibility for the model to adapt to important system dynamics. Therefore, the system 28 was augmented with the rNH parameter as an additional state, which was postulated that varies like a random walk. Hence, the augmented system is

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

169

Fig. 7. MRSE values for different prediction horizons for estimation up and validation down data.

xk+1 rNH,k+1

= +

xk rNH,k

+ TS

D 0 0 0 + wk ,

xk rNH,k

Hk = H

0 ,

34

F + 0 0 0 xk

zk = H

rNH,k

k,

32

while the Jacobian matrices Ak and Hk are dened as

Ak = I + TS

D 0 + 0 0

W 0

rNH 0

, 33

where I denotes the unity matrix 5-by-5 . In this case the same matrices were used as in previous section, while additionally the initial a priori estimate and the covariance matrix for process noise have to be augmented. In order to achieve proper rNH value adaptation to slow process variations Q was set to diag 10, 10, 10, 10, 7 . Initial a priori estimate was set close to true estimate and was equal to 12, 5 , 3 , 2 , 550 T for estimation data and 12, 5 , 3 , 2 , 350 T for validation data in order to avoid errors due to the wrong initial estimate.

170

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

Fig. 8. Prediction results for 5h prediction horizons for nonlinear model with constant rNH and recursively estimated rNH compared with real plant measurements.

7. Model validation based on predictions The quality of model predictions was assessed for the linear model, the nonlinear model with constant rNH and the nonlinear model with recursively estimated rNH parameter. In every prediction calculation, the values of model inputs were assumed as known and were changing over the entire prediction horizon. In this way predictions for different prediction horizons were calculated and compared to the real plant data by calculating the MRSE criterion for estimation and validation data set. From Fig. 7 it can be seen that the quality of model predictions for the estimation data is similar for different models, except for the shortterm predictions where the linear model predictions are slightly better. It can be also seen that the model long-term prediction quality approaches the quality of the open-loop simulation. On the other hand, the model predictions for validation data

show that the nonlinear model with recursively estimated rNH parameter performs better compared to other models. This is also seen in Fig. 8 where the 5h predictions for both nonlinear models are shown. The gure is plotted in such a way that 5h prediction calculated at time t is plotted on the same x-axis location as the t + 5h measured value. Better performance of the nonlinear model with rNH estimation can be seen especially in the period from day 07, where the DO offset errors occurred. In this period the estimated parameter rNH has a lower value Fig. 9 , which reduces the error between the model predictions and measurements. 8. Simulation study of the control algorithms Model applicability was tested also by simulating the model predictive control loop for the linear and nonlinear model estimated in Section 4. The

Fig. 9. Estimated reaction rate parameter rNH for validation data.

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

171

Fig. 10. Control scheme of the ammonia predictive control.

performance of standard PI controller is also shown, although it is not meant as a direct comparison with MPC as the MPC has also a feedforward action. In the study NH4 N in the last aerobic reactor was chosen as a controlled variable, while the DO concentrations in both aerobic reactors were set equal to obtain only one manipulated variable. In the case of MPC inuent NH4 N, temperature and inuent ow rate are used as measurable disturbances see Fig. 2 . In simulations the real plant data for inuent NH4 N and liquid temperature Fig. 4 was used, while inuent owrate was constant and set to 42 m3 / h. The control objective was to hold NH4 N in the last aerobic reactor at a desired value of 2 mg/ l in spite of intense changes of inuent NH4 N. The DO concentration in aerobic reactors was limited between umin = 0 mg/ l and umax = 9 mg/ l in order to model a limited airow into the aerobic reactors, while the maximum DO change u in one sampling time 5 min was set to 0.2 mg/ l, which is approximately the same value as was observed from the real pilot plant. The output NH4 N level is usually controlled by a cascade controller 1 , where the outer NH4 N control loop determines the DO set point, while the inner loop controls the DO concentration by manipulating the airow. The response of the inner DO control loop is much faster and can be reasonably well modeled as a rst order model. Hence, the MBBR process model contained also the dynamics of the DO control loop approximated as a rst order model with the time constant of 10 min and the gain 1. To simulate the MBBR process behavior the nonlinear model of the same structure as presented in Section 3.1 was used, only the parameter values were changing randomly and were generated by low pass ltering white noise so that the frequency

contents of the signals was between 0 and 1.4 day1. The parameter mean values were equal to estimated values Table 1 , while the amplitude of variations was between 15% and 35% depending on the parameter sensitivity. Beside this also measurement noise was modeled by adding white noise with standard deviation 0.1 to the output measurements. In this way a similar mismatch between the simulated process and the models was achieved as in the case of real plant data in Section 5. The MRSE criterion between the simulated process model and the nonlinear model used in the controller was 37%, while MRSE for the linear model was 45%. 8.1. Model predictive ammonia controller The control scheme of the predictive ammonia controller is shown in Fig. 10. The controller calculates the present and future control moves uk , uk+1 , . . . , uk+Hu1 to minimize a quadratic objective function of the form 17
Hp Hu

J=
i=1

y k+i k rk+i

2 Q

+
i=1

uk+i1 2 , R

35

where y k+i k is the predicted process output, rk+i presents the future reference values, H p is the prediction horizon, Hu is the control horizon, while Q and R are weighting matrices. Q penalizes the error between the predicted process output and the reference trajectory, while R penalizes the changes in the control signals. In general, greater R always has the effect of making the control actions less aggressive. The predictive control problem presented above can be solved analytically if the linear model within MPC is used and no constrains on the inputs and/or outputs are assumed, while in the case of nonlinear model an iterative optimization algo-

172

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

Fig. 11. NH4 N concentrations upper plot and DO concentrations lower plot in the last aerobic reactor when using PI control, MPC with linear and nonlinear model.

rithm must be employed. Since in our case constrains on the control signal were imposed, in both cases a MATLAB gradient nonlinear optimization algorithm fmincon function was used. The control horizon Hu was set to 3, H p was equal 10, Q was equal to 0.1, while R was set to 5 for the linear model and 1 for the nonlinear model. In the case of linear model the R value has to be increased in order to make control moves less aggressive, and hence, avoid oscillations. In every prediction calculation, the measured input disturbances used by the controller were set equal to the current measured values and were constant over the entire prediction horizon. The model states were estimated as shown in Section 6, while feedback in both cases was incorporated by assuming a constant output disturbance model where unmeasured output disturbance was estimated as a difference between the measured process output y k and predicted process output y k k1. In this way an integral action is incorporated in the predictive control law. Therefore, steady-state errors are eliminated if there is an unknown constant additive disturbance acting at either the input or the output of the plant 17 .

uk = uk1 + K p ek ek1 + K p
with

TS e Ti k1 36

TS u ulim , Ti k1

umin if uk1 ulim = uk1 if umin umax if uk1

umin uk1 umax

umax ,

37

where umin and umax are minimal and maximal DO set-point values. The rst three terms on the righthand side of 36 represent a standard PI algorithm, while the last term represents the antiwindup protection, which is used when a manipulated variable is limited. The coefcients K p and Ti are proportional gain and integral time constant, while TS represents a sampling time. The values of K p and Ti were obtained from the Ziegler-Nichols rules and then after ne tuning they were set to 0.5 and 1.1 h, respectively. 8.3. Comparison of aeration control algorithms Comparison of the described controllers is shown in Fig. 11 and evaluated in Table 3. Fig. 11 shows only a segment from day 1317 so that the differences between controller performances are better seen. In all control cases Fig. 11 shows that

8.2. PI ammonia controller For PI controller a recursive discrete PI algorithm with antiwindup protection was used

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

173

Table 3 Performance criteria for control algorithms. Control PI control MPC with linear model MPC with nonlinear model Mean NH4 N mg/l 2.24 2.22 2.15 Variance of NH4 N 1.80 0.88 0.71

NH4 N peaks occur, which are the consequence of both intense inuent NH4 N loads and the limitations of DO concentrations. From Fig. 11 it can be seen that the highest variations of NH4 N are achieved in the case of PI controller, smaller variations in the case of MPC with the linear model and the smallest in the case of MPC using the nonlinear model. The main reason for poorer PI control performance is that control actions are carried out later compared to MPC actions, which is also seen from the bottom diagram in Fig. 11. It can be also noticed that in the case of PI controller and MPC using linear model the output NH4 N drops well below the desired set point during the periods of low inuent loads, while the performance of MPC using nonlinear model is much better. Namely, the nonlinearity of the process gets larger as NH4 N is closer to 0, which means that the linear model harder copes with it, and hence, the control performance deteriorates. Moreover, in the periods when output NH4 N is below the set point the DO concentration is higher than needed for a desired level of nitrication, which means that also important energy savings up to 20% can be gained with tighter NH4 N control. The same conclusions with respect to control performances can be drawn also from Table 3 where the mean value and the variance of output NH4 N are, calculated, with the best performance achieved in the case of MPC with the nonlinear model.
9. Conclusions The paper presents the development of models that could be used for model predictive ammonia control in a wastewater treatment plant, their validation on real plant data, and testing within MPC controller in a simulation environment. Validation of models in open loop simulations using real plant data has shown that the reduced nonlinear model performs better than the black-

box linear model. Similar conclusions were obtained also from the model prediction study, except in the case of short-term predictions where the linear model performs better. It was also seen that prediction improvements could be gained when the time-varying reaction rate parameter is estimated recursively. In this way, slower process dynamics can be captured, which increases robustness against the model errors and sensors drift. Evaluation of models with the MRSE criterion has shown that both models have relatively large MRSE errors compared to the real plant data. When using the models in the closed loop the feedback mechanism of MPC can correct deviations that result from the deciencies in the process model, which in our case led to a satisfactory NH4 N MPC results. It was seen that MPC with the nonlinear model performs better than the MPC with the linear model, especially during the periods of low inuent loads because of the process nonlinearity, which the linear model cannot take into account. On the other hand, during the periods of high inuent loads the differences are not as obvious since the constraint on the manipulated variable was present. Hence, it can be concluded that although the nonlinear model development is more time consuming and consequently more costly, it enables tighter NH4 N control and leads to more protable operation. In our future work the obtained models will be tested and validated together with the predictive control algorithms on the real MBBR pilot plant to determine whether these improvements are worth the extra effort also on the real pilot plant. Acknowledgments The authors wish to thank the staff of WWTP Domale-Kamnik for their cooperation and permission to use the data from the WWTP. The nancial support of the European Commission SMAC project, Contract No. EVK1-CT-200000056 and Slovenian Ministry of Education, Science and Sport P2-0001 is also gratefully acknowledged. References
1 Olsson, G. and Newell, B., Wastewater Treatment Systems, Modelling, Diagnosis and Control. IWA Publishing, London, 1999. 2 Hoen, K., Schuhen, M., and Khne, M., Control of nitrogen removal in wastewater treatment plants with

174

ALJA STARE, NADJA HVALA, DARKO VRECKO / ISA Transactions 45, (2006) 159174

6 7 8 9 10

predenitrication, depending on the actual purication capacity. Water Sci. Technol. 33 1 , 223236 1996 . Vreko, D., Hvala, N., and Gerki, S., Multivariable predictive control of an activated sludge process with nitrogen removal. 9th International Symposium of the Computer Applications in Biotechnology, Nancy, France, 2004. Ingildsen, P., Jeppsson, U., and Olsson, G., Dissolved oxygen controller based on on-line measurements of ammonia combining feed-forward and feedback. Water Sci. Technol. 45 45 , 453460 2002 . Carlsson, B. and Rehnstrm, A., Control of an activated sludge process with nitrogen removalA benchmark study. Water Sci. Technol. 45 45 , 135142 2001 . Henze, M., Gujer, W., Mino, T., and van Loosdrecht, M., Activated Sludge Models ASM1, ASM2, ASM2d and ASM3. IWA Publishing, London, England, 2000. Weijers, S., Modelling, identication and control of activated sludge plants for nitrogen removal. Ph.D. Thesis, Technische Universiteit, Eindhoven, 2000. Dochain, D. and Vanrolleghem, P. A., Dynamical Modelling and Estimation in Wastewater Treatment Processes. IWA Publishing, London, 2001. Lukasse, L., Control and identication in activated sludge processes. Ph.D. Thesis, Wageningen University, 1999. Alex, J., Tschepetzki, R., and Jumar, U., Predictive control of nitrogen removal in WWTP using parsimonious models. 15the IFAC World Congress on Automatic Control, Barcelona, 2002.

11 Sotomayor, O. A. Z., Park, S. W., and Garcia, C., Software sensors for on-line estimation of the microbial activity in activated sludge systems. ISA Trans. 41, 127143 2002 . 12 Henze, M., Harremos, P., la Cour Jansen, J., and Arvin, E., Wastewater TreatmentBiological and Chemical Processes. Springer Verlag, Berlin Heidelberg, Germany, 1997. 13 Stare, A., Hvala, N., Vreko, D., Burica, O., Straar, M., and Levstek, M., Design of models for predictive ammonia control. 2nd International IWA Conference on Automation in Water Quality Monitoring AutMoNet 2004. Vienna, Austria, 2004, pp. 245252. 14 Van Overschee, P. and De Moor, B., N4SID: Subspace algorithms for the identication of combined deterministic-stochastic systems. Automatica 30, 7593 1994 . 15 Ljung, L., System Identication: Theory for the User. 2nd ed. Prentice Hall, Englewood Cliffs, NJ, 1999. 16 Van Overschee, P. and De Moor, B., Subspace Identication for Linear Systems: Theory, Implementation, Applications. Kluwer Academic, Dordrecht, 1996. 17 Maciejowski, J. M., Predictive Control with Constraints. Prentice Hall, Harlow, 2002. 18 Brown, R. G. and Hwang, P. Y. C., Introduction to Random Signals and Applied Kalman Filtering. 3rd ed. Wiley, New York, 1997. 19 Welch, G. and Bishop, G., An introduction to the kalman lter. http://www.cs.unc.edu/~welch/kalman/ kalmanIntro.html, 2003.

Vous aimerez peut-être aussi