Sunteți pe pagina 1din 13

ARTICLE IN PRESS

WAT E R R E S E A R C H

40 (2006) 1095 1107

Available at www.sciencedirect.com

journal homepage: www.elsevier.com/locate/watres

Control of SBR switching by fuzzy pattern recognition


S. Marsili-Libelli
Department of Systems and Computers, University of Florence, Via S. Marta, 3 50139 Florence, Italy

art i cle info

A B S T R A C T

Article history:

The sequencing batch reactor (SBR) is a widely used process for biological removal of

Received 2 August 2005

nutrients (nitrogen and phosphorus) from wastewater. It is based on the metabolism of

Received in revised form

specialised bacteria, which under alternate anaerobic/aerobic conditions uptake phos-

29 December 2005

phorus and perform denitrification. Intermittent operation is normally operated on a fixed

Accepted 11 January 2006

switching schedule with ample margin for possible inaccuracies, with the result that the
process operation is highly inefficient. This paper proposes a switching strategy based on

Keywords:

the indirect observation of process state through simple physico-chemical measurements

Pattern recognition

and the use of an inferential engine to determine the most appropriate switching schedule.

Fuzzy clustering

In this way the duration of each phase is limited to the time strictly necessary for the actual

Artificial intelligence

loading conditions. Experimental results show that the treatment cycle can be significantly

Wavelet transform

shortened, with the results that more wastewater can be treated. The switching strategy is

Wastewater treatment

based on innovative data-processing techniques applied to simple process signals

Soft computing

including pH, oxido-reduction potential (ORP) and dissolved oxygen (DO). They include

Process control

wavelet filtering for signal denoising and fuzzy clustering for features extraction and
decision-making. The formation of a knowledge-base and its adaptation during the
operation are also discussed.
& 2006 Elsevier Ltd. All rights reserved.

1.

Introduction

The sequencing batch reactor (SBR) process is noted for its


operational flexibility, which requires a deep understanding
of its features (Irvine and Ketchum, 1989; Kerrn-Jesperson and
Henze, 1993; Wilderer et al., 2001; Artan et al., 2001; Mace and
Mata-Alvarez, 2002; Artan and Orhon, 2005). The nutrient
removal characteristics of this process is based on the
complex feastfamine behaviour of PAO organisms in dynamic conditions (Smolders et al., 1995; Murnleitner et al.,
1997; Carta et al., 2001; Beun et al., 2002) which in alternating
anoxic/anaerobic and aerobic conditions remove both nitrogen and phosphorus. To exploit these characteristics, the SBR
process is normally operated on a fixed schedule of five
phases: loading, anoxicanaerobic treatment, aerobic treatment, sedimentation, effluent extraction. In normal design,
Tel/fax.: +39 055 4796264.

E-mail address: marsili@dsi.unifi.it.


0043-1354/$ - see front matter & 2006 Elsevier Ltd. All rights reserved.
doi:10.1016/j.watres.2006.01.011

each phase has a prescribed duration regardless of the


process requirements and this may result in a highly
inefficient operation. Moreover, wrong timing may result in
serious process degradation, especially when phosphorus
removal is involved. For this reason, the problem of SBR
control is drawing increasing attention since the pioneering
work of Oles and Wilderer (1991). Since the SBR process is
often used in low-cost applications or with aggressive
effluents, the key control factor is the use of simple and
cheap on-line process measurements to infer the concentration of the chemical variables, which are difficult or expensive
to measure directly (NH4 , NO3 , and PO3
4 ). There has long been
a general consensus on two main issues: that SBR control
aims to adapt the switching sequence to the actual load and
that physico-chemical measurements are used as indirect
process indicators, precisely pH, oxido-reduction potential

ARTICLE IN PRESS
1096

WAT E R R E S E A R C H

40 (2006) 1095 1107

(ORP) and dissolved oxygen (DO). As shown, these aspects are


closely related and after a brief survey of the literature a novel
control strategy will be proposed.

1.1.

Control of the SBR process

Many contributions have been produced which pursue this


goal using simple chemical measurements. Katsogiannis
et al. (1999) proposed an adaptive algorithm for adjusting
the cycle duration for nitrogen removal and Furumai et al.
(1999) have considered the possible deterioration of biological
P-removal in long-term operation. Pavseli et al. (2001) used
chemical on-line measurements (pH and ORP) to control the
phases of a SBR for nitrogen removal without P-uptake. Lee et
al. (2001) examined the importance of providing the conditions for anoxic P-uptake and also found that on-line values
of pH, ORP, and DO were related to the dynamic variations of
chemical process variables concentrations (NH4 , NO3 , and
PO3
4 ). These on-line values were used as real-time control
parameters to adjust the duration of each operational phase
in the SBR, which exhibited better performance in the
removal of phosphorus and nitrogen than the fixed-time
scheme. Kim et al. (2004) proposed an integrated real-time
control scheme based on ORP and pH for controlling the
addition of an external carbon source in treating swine
wastewater. Sin et al. (2004) proposed an optimal operation
strategy by analysing a grid of possible scenarios and
provided a robustness analysis of the solution. Saito et al.
(2004) pointed out the problem of nitrite accumulation.
Buitron et al. (2005) use DO measurements and a simple
kinetic model in a variable timing control scheme and
determine the length of the reaction phase when the
substrate ends, whereas a relation between ORP and hydraulic retention time was observed by Hu et al. (2005).

1.2.

Use of physico-chemical on-line measurements

On-line ORP and pH measurements have been proposed as


useful process control parameters for biological nutrient
removal in continuous-flow reactors (Hao and Huang, 1996;
Fuerhacker et al., 2000; Kim and Hao, 2001; Chen et al., 2002)
and in SBR. Sperandio and Queinnec (2004) use ORP and DO to
detect wastewater modifications and sludge activity, relating
signal bending points to nitrification and denitrification. Lee
and Oleszkiewicz (2003) have shown that the ORP of the
system is strongly linked to the nitrification rate, whereas
Akin and Ugurlu (2005) use ORP, pH and DO to control a labscale SBR, using absolute values but not their rate of change.
Conversely, it will be shown that the derivative signal
contains important process information which can be used
for control. Moreover, these contributions use physicochemical process signals to control the phase duration in a
direct and deterministic way. Recently more sophisticated
techniques, involving Artificial Intelligence (AI) tools have
been used, particularly neural networks (Zhao et al., 1999;
Cho et al., 2001; Luccarini et al., 2002). Yoo et al. (2004) used
multiway principal component analysis as a monitoring tool
to detect abnormal operation, using physico-chemical variables (DO, pH, ORP).

The aim of this paper is to illustrate the application of AI


tools based on fuzzy clustering of the derivatives of physicochemical signals to detect critical process transitions and
drive the switching accordingly. In this way the duration of
each phase will last exactly as required. Hopkins et al. (2001)
introduced a flexibility index, concluding that the SBR is
constrained by the settling. Any attempt of reducing the
preceding phases and especially aeration, therefore, should
have a positive impact on the settling properties.
After recalling the key points of the SBR operation, the AI
tools will be introduced and finally the application will be
presented and its performance assessed.

1.3.

Indirect process indicators

The alternate operation of SBR hinges on the feast/famine


metabolism of phosphorus accumulating organisms (PAO) to
obtain the biological removal of both phosphorus and
nitrogen (Smolders et al., 1995; van Loosdrecht et al., 1997;
Murnleitner et al., 1997). Denitrification occurs in anoxic
conditions, whereas phosphorus is removed whenever the
organism are driven through a transition from anaerobic to
aerobic conditions.
Normally SBR is switched according to a fixed time-pattern,
allocating 30 min to loading, 120 min to the anaerobic/anoxic
phase, 150 min to the aerobic phase and the last 60 min to the
combined settling and extraction phase, for a total of 6 h,
though some authors consider a 4-h cycle (Bernardes and
Klapwijk, 1996), as shown in Fig. 1, where the physicochemical indicators are also recorded. This rigid scheme may
be very far from optimal because the two central phases
(anaerobic/anoxic and aerobic) are largely load-dependent
and their duration should be tuned to the actual process
requirements, hence the need to adjust switching according
to the state of the process. If all the relevant process
quantities (i.e., ammonium-N, Nitrate-N and Phosphate-P)
were available in real-time, switching could be performed
according to the following simple rules:
(a) The anaerobic/anoxic phase ends when both the nitrate-N
has been denitrified and all the available organic carbon is
used in the process. At this time the aeration should be
switched on.
(b) The aerobic phase ends when all the phosphate-P is taken
up by the PAO or all the ammonium-N is converted into
nitrate-N, whichever takes longer. At this time the
aeration should be switched off.
There is, unfortunately, a formidable obstacle preventing
the implementation of this simple scheme, represented by
the complexity of measuring the above quantities in realtime, which is neither simple nor economical. As already
surveyed, there is abundant literature in the use of physicochemical variables as their substitute, provided a rationale is
available to extract and interpret the information contained
therein. The aim of this paper is to use these indirect
variables to derive pattern indicators to signal the end of
each phase and switch the process accordingly. The existence
of significant process patterns can be demonstrated by

ARTICLE IN PRESS
1097

4 0 (200 6) 109 5 110 7

WAT E R R E S E A R C H

Anoxic-anaerobic

Settling
&
Extraction

Aerobic

mg L-1

Loading

20
10
0

DO (mg L-1)
ORP (mV)
pH

60

150

240

300

360

60

150

240

300

360

60

150

240

300

360

60

150

240

300

360

6
4
2

50
0
-50
-100
-150

8.5
8

End of denitrification

End of P-release

End of P-uptake End of NH4 oxidation

Exact
anaerobic
phase

Exact
aerobic
phase
time (min)
Fig. 1 Typical SBR cycle.

End of
denitrification

End of
P-release

Maximum P release

100

30

12

20

Change in
ORP slope

pH kick

-100

NO3-

10

pH levels off

7.5

50

100

-200
150

time (min)
Exact anaerobic phase
Fig. 2 Process behaviour during the anaerobic/anoxic phase.

N-NO3 (mg L-1)

pH

ORP (mV)

8.5

PO4 (mg L-1)

PO42-

ARTICLE IN PRESS
1098

40 (2006) 1095 1107

WAT E R R E S E A R C H

End of
P-uptake
9

End of
nitrification
DO levels off

30

12

20

DO

pH levels off

NO3-

NH4
8

N (mg L-1)

pH

pH inflexion

DO (mg L-1)

8.5

PO4 (mg L-1)

pH

10

NO2PO42-

7.5
150

200

250
time (min)

300

0
350

Exact aerobic phase


Fig. 3 Process behaviour during the aerobic phase.

inspecting the following Figs. 2 and 3, representing the typical


behaviour during the anaerobic/anoxic and the aerobic
phases, obtained with a 2-l bench-scale pilot plant with
synthetic feed operated at the ENEA, Wastewater Treatment
Division laboratory in Bologna, Italy, and already described in
Luccarini et al. (2002), Marsili-Libelli et al. (2001) and Spagni
et al. (2001).

1.4.

Anaerobic/anoxic patterns

During this phase, including the loading preliminary operation, the pH-influencing processes are denitrification and
P-release, occurring in this order. The end of denitrification is
revealed by a brief pH increase, after which it decreases as a
consequence of phosphorus release. The ORP further decreases as the process gets deeper into anaerobic conditions.
Eventually when all the available nitrate is denitrified and all
phosphorus released, both pH and ORP level off. In Fig. 2 this
phase ends at time 150 min, because of the fixed timing, but
the relevant processes have all ended long before, so there is a
considerable potential for shortening the anaerobic period
without impairing process efficiency. In summary, the
relevant transitions indicating the end of this phase are the
changes in ORP slope and the kick and levelling of pH.

concurrent processes, pH may exhibit differing patterns


depending on which ends first. This complex behaviour has
been thoroughly examined by Spagni et al. (2001) who
observed differing pH patterns as a consequence of the
relative duration of two concurrent processes: ammonia
oxidation and P-uptake, in addition to CO2 stripping, responsible for a rapid increase of pH at the beginning of the aerobic
phase. According to this analysis two differing behaviours
may occur, depending on whichever process ends first. If
nitrification ends before P uptake: the end of ammonia
oxidation is marked by a change in the slope of pH, but it is
difficult to detect the so-called ammonia valley, which was
also noted by Kim et al. (2004), Akin and Ugurlu (2005) and Hu
et al. (2005). Conversely, if P-uptake ends before nitrification
the ammonia valley is clearly identifiable, confirming the
effect of P-uptake on pH. In the first part of the aeration
phase, pH increase is due to CO2 stripping and P uptake, when
the latter ends pH starts decreasing due to ammonia
oxidation. The aerobic pH apex can be related to the end
of P uptake.

2.
1.5.

Pattern detection and features extraction

Aerobic patterns

During this phase ammonia is oxidised into nitrate, whereas


phosphorus is utilised by the PAO provided that no organic
carbon is available. The relevant process variables are pH and
DO, with the former showing an inflexion at the end of
phosphorus uptake and the latter levelling off when all the
ammonia has been oxidised, as shown in Fig. 3. However,
since during the aerobic phase nitrification and P-uptake are

From the behaviours shown in Figs. 13 the relevant patterns


in Table 1 are isolated as phase-end indicators. However, the
practical implementation of an inferential engine for the
recognition of these features involves several processing
steps, from preliminary filtering to numerical differentiation
to pattern recognition and feature extraction. The sequence
of operations forming the required inferential engine is
shown in Fig. 4.

ARTICLE IN PRESS
WAT E R R E S E A R C H

4 0 (200 6) 109 5 110 7

Table 1 Process indicators for SBR switching


Phase

Anaerobic
anoxic

Terminated
process

Indicator

Denitrification

pH kicks up and then


falls; ORP negative
slope increases
pH slope levels off
DO slope levels off
pH inflexion point

P- release
Nitrification
P- uptake

Aerobic

Process data

pH

ORP

DO

Wavelet Denoising
and Differentiation
d pHdn

d ORPdn

d DOdn

dt

dt

dt

(pH)

(ORP)

(DO)

Clustering

Inference
Aerobic/Anaerobic
Switching

ON/OFF
Fig. 4 Overall structure of the fuzzy inference engine. The
output of each block is indicated in the right
column. The suffix dn stands for denoised. From
top to bottom, the on-line process signals are
processed by a discrete wavelet transform, then
the informative process features are extracted by
fuzzy clustering. Based on this information, the
inference engine recognizes the current phase
(aerobic or anaerobic), which eventually yields a
hard ON/OFF switching command.

2.1.

Wavelet processing

From Table 1 it appears that all the relevant patterns are


composed of signal derivatives, hence the need to filter the
process data and derive them in a numerically robust way.
Data filtering is normally based on the concept of transform, which is an alternative way of expressing the information contained in the signal to reveal concealed features.
Transformations imply the use of basis functions through
which the signal is expressed and the most popular of these is
the Fourier transform, expanding a signal as an infinite
summation of sinusoids. In this way the frequency content
can be analysed, but the time-information is completely lost
as a consequence of the infinite duration of sinusoids, used as
the basis functions. Wavelets are finite-duration signals
which can be used to replace sinusoids as basis functions.

1099

In this way time and frequency analysis can be combined


through a variable windowing technique and filtering adapts
to the time-varying nature of the signal. Wavelets have been
widely applied in communications, speech and image processing and are currently used to process biomedical signals, but
their use in the environmental area is virtually unknown.
Among the many introductory papers to wavelets, Strang
(1994), Polikar (1999), Silverman and Vassilikos (1999) emerge
for their clarity and the subject is thoroughly treated in the
textbooks by Percival and Walden (2000) and Addison (2002).
The wavelets used in this paper are those of the Matlab
Wavelet toolbox (Misiti et al., 2002).
Given a wavelet function ca; b; t where a and b represent
the scaling and the shifting factors, the continuous wavelet
transform (CWT) is defined as the integral of the signal s(t)
multiplied by the scaled wavelet ca; b; t


Z 1
1
tb
dt:
(1)
stc
Ca; b p
a
a 1
Given the finite time duration of the integration limits in
Eq. (1) can in practice be limited to the actual signal duration.
In CWT a and b vary continuously. If the wavelet is stretched
(ac1) it contains mostly low frequencies and gives a global
view, whereas compressed wavelets (a51) contain mostly
high frequencies and give details of a small portion of the
signal s(t). Thus by varying a the analysis can be concentrated
on global or specific features of the signal. However, computing Eq. (1) for all possible combinations of (a,b) would be
greatly time-consuming with little insight into the signal. If
the scales a and the positions b are chosen as powers of 2
(dyadic decomposition), the signal s(t) can be expanded in
terms of the wavelet ca; b; t as
st

1
1
X
X



cjk 2j=2 c 2j t  k ,

(2)

j1 k1

where the wavelet functions c2j t  k are scaled (by 2j) and
shifted (by k) versions of the original wavelet c(t). The
coefficients cjk contain the information about the signal
behaviour around the scale 2j around time k  2j. The
summation limits in (2) in theory are infinite, but in practice
they can be assumed to be finite, given the limited extension
of the wavelet functions. If the signal is composed of N
samples taken at Ts intervals the DWT consists of successive
decompositions obtained by parallel filtering the signal with a
low-pass filter, yielding the low-frequency component,
named approximation (A1) and the high-frequency component, named Detail (D1). This process can be repeated again
on the approximation A1 to yield A2 and D2 and so on. At each
step, the signal is downsampled by a factor of 2, so the
number of samples is halved at each step, therefore the
process can be iterated log2(N) steps at most, but in practice it
must be stopped long before this limit because as the data
become scarce, the edge effects become important. The signal
decomposition at the k level is fully represented by the
coefficients of the Approximation cAk and of the Detail cDk.
The latter contains most of the noise component which adapt
to the signal behaviour. Therefore, the noise component can
be limited by hard thresholding, i.e., setting to zero the
coefficients with magnitude below the threshold, or by soft
thresholding, where after hard thresholding, the remaining

ARTICLE IN PRESS
1100

WAT E R R E S E A R C H

pH signal

40 (2006) 1095 1107

De-noised
pH signal

Low-Pass

A1

Low-Pass

A2

High-Pass

D1

High-Pass

D2

Thresholding

Fig. 5 Schematic representation of discrete wavelet transform (DWT) for filtering and de-noising. In this application a
second-level decomposition (A2, D2) proved adequate. The same DWTwas applied twice: first to the signals and then
to their numerical derivatives. The graphic insets exemplify the decomposition of a noisy pH signal into
approximations (upper row) and details (bottom row), eventually producing the denoised version.

0.04

nonzero coefficients are compressed towards zero. Finally, the


signal is reconstructed by combining the original Approximation coefficients cAk and the modified details cDk. The
resulting signal is smooth enough to produce a sufficiently
stable numerical derivative, which is then further smoothed
by reapplying the discrete wavelet transform. The decompostition - denoising - reconstruction process is shown in
Fig. 5. In this application it is applied twice: first to the
acquired signals and then to their numerical derivatives,
using a Daubechies (db8) basis wavelet (Misiti et al., 2002) in a
2-level decomposition, to yield the smooth derivatives shown
in Fig. 6.

raw derivative
wavelet derivative

0.03

d (pH)
dt

0.02
0.01
0
-0.01
-0.02
-0.03
-0.04
0

20

40

60

25
20

2.2.

80 100 120 140 160 180 200


Time (min)

raw derivative
wavelet derivative

15

Fuzzy clustering

dikA zk  vi T Ai zk  vi ,
i

(4)

where Ai is the norm-inducing matrix defined in terms of the


fuzzy covariance matrix Fi (Babuska, 1998)

d (ORP)
dt

10

Once the derivative signals have been obtained, they were


classified according to the patterns of Table 1. Though
successful neural networks applications already exist (Zhao
et al., 1999; Cho et al., 2001; Luccarini et al., 2002) and a
heuristic approach was used for a nitrifying SBR (Pavseli et al.,
2001), a fuzzy approach to pattern recognition (Marsili-Libelli
and Muller, 1996; Muller et al., 1997) is considered here as an
alternative, where the Gustafsson-Kessel (GK) fuzzy clustering algorithm was selected for its variable metric (Babuska,
1998). Fuzzy clustering is a classification technique which
assigns each data point to a predetermined number of
clusters in a non-exclusive way. In this sense it is preferable
to deterministic (or hard) clustering for its ability to deal
with borderline cases and in general being more flexible in
handling poorly defined situations like this one. The first step
in clustering is the definition of the distance between the k-th
data point zk and the ith cluster, represented by its centroid vi
(i.e., the most representative point in the cluster) as

5
0
-5
-10
-15
0

20

40

80 100 120 140 160 180


Time (min)

Fig. 6 Comparison of raw and filtered derivatives of pH and


ORP, after the double DWT processing of Fig. 5.

The fuzzy membership mikA(0,1) represents the extent to


which the ith data point is similar to the features embodied in
the kth cluster. The fuzzy exponent mA(1,N) controls the
fuzziness of the partition, acting as the focusing knob of a
telescope so that the larger is m the more blurred is the
partition, leaving more room for uncertain cases. Clustering
the N data zk with respect to c clusters consists of the
minimisation of the fuzzy partition objective function
c X
N
X

Jgk c; m; Ai

where
PN
m m zk  vi zk  vi T
F i k1 ikPN
m
k1 mik

with the constraint


c
X
mik 1 k 2 1; N:

i1 k1

i1

mik m dikA


1=p
Ai ri detF i
 F 1
i

60

ARTICLE IN PRESS
WAT E R R E S E A R C H

15

0.8
Anaerobic phase

0.7

Hn

0.65
0.6

5
0
-5

Minimum of Hn

0.55

Anaerobic phase

10

Hn x 10-3

0.75

0.5

20

40

60
New data

80

100

120

5
C

Hn x 10-3

0.45
0.4

1101

4 0 (200 6) 109 5 110 7

0.8

2
0
-2
-4

Aerobic phase

0.75

Aerobic phase

50

100

150
200
New data

250

300

0.7
Fig. 8 Entropy variation during adaptive operation. The
general downward trend indicates that during the
experiment cluster adaptation produces a better
defined knowledge basis with less uncertainty, i.e.,
lower Hn. Though there is an undecided spell
around the middle of each transition, with
increasing entropy, the final update rate
approaches zero, denoting a stable partition.

Hn

0.65
0.6
Minimum of Hn

0.55
0.5
0.45
0.4
2

5
C

Fig. 7 Normalised partition entropy as a function the


number of clusters, used to determine the best
partition for both phases. In the anaerobic phase
clustering the minimum occurs for c 2, denoting
that a two-cluster structure is appropriate (i.e.,
there is a start cluster and an end cluster),
whereas for the aerobic phase the minimum for
c 3 implies that there is a middle cluster along
the transition path.

The latter constraint must be introduced for consistency, i.e.,


for each data point zk the sum of the memberships to all the
clusters must equal one, meaning that each data point must
be thoroughly classified by the c clusters. The earliest fuzzy
clustering algorithm, named Fuzzy C-means (FCM) was
introduced by Bezdek (1981) using the Euclidean norm as
the distance in Eq. (4), but had several shortcomings, such as
producing spherical clusters which might not be appropriate
for the data. The GK algorithm, instead produces clusters
which conform to the data, thanks to the norm-inducing
matrices Ai defined by Eq. (5). Solving the optimisation
problem Eq. (6) yields the required partition matrix and the
centroids (Bezdek, 1981; Babuska, 1998)
PN
m
1
k1 mik zk
i 2 1; c.
7
mik
!2=m1 and vi PN
m
dik
k1 mik
P
A
c
j1

i
djk
Ai

The number of clusters c has to be selected a priori and a way


of estimating their best number for each phase was by

minimising the normalised information entropy Hn (Bezdek,


1981) defined as a function of the membership functions mik
Hn

1
c
1
N

Xc XN
i1

k1

mik logmik ;

c41.

(8)

The rationale behind this choice is that the more order there
is in the partition the lower would Hn be. Applying the GK
clustering method to the anaerobic and aerobic data, the
partitions of Fig. 7 were obtained, indicating that cAN 2 and
cAER 3 were the best partitions. By inspecting the upper part
of Fig. 7, it might be argued that perhaps c 1 (i.e. no clusters)
would be the best solution, but this is not the case because
Eq. (8) holds for c41, so the graph could not be extrapolated
for c 1. From a practical viewpoint it is well known that the
process variables do have significantly different values at the
beginning at the end of the anaerobic phase, hence there
must be at least two clusters. Further, the clustering
algorithm should adapt to process changes due to influent
variability and biomass changes, and yet retain its discriminating power. So, after an initial training phase, cluster
adaptation was introduced using the same entropy criterion
Eq. (8) as described in Marsili-Libelli (1998). Each new data was
classified according to the existing centroids, yielding the new
2=m1
Pc 
and the pre-existing
membership mnew 1= j1 dnew =dj
partition matrix Uold [mik] is augmented with this new
membership, i.e., Unew [mik|mnew] only if the relative entropy
variation
DHn

Hn Unew  Hn Uold
oE,
Hn Uold

(9)

ARTICLE IN PRESS
1102

WAT E R R E S E A R C H

40 (2006) 1095 1107

Training Data

15

0.8

New Data
+++++

10

Data end

0.9

0.8

0
dt

d ORPdn

Centroid Update

0.9

-5

0.9

0.8

-10
0.8

-15
Data begin
-20
-20

-10
d pHdn
dt

-15

-5

x 10-3

New Data

0.04

+++++

0.

0.8

Training Data

0.045

Fig. 9 Adaptive data clustering during the anaerobic/anoxic phase, showing considerable adaptation of the first cluster, near
the beginning of the phase, whereas the other cluster remains substantially unchanged. Two separate runs are
shown, one for training and the other to test the adaptation cabilitity of the algorithm.

Centroid Update

0.

0.035

dt

d DOdn

0.025
0.02

0.

0.8
0.9

0.03

0.8

0.015

0.9

0.01
0.005

0.8

8
0.

Data begin

-0.005 Data end


-0.05

0.05

0.1
0.15
d pHdn
dt

0.2

0.25

0.3

Fig. 10 Adaptive data clustering duirng the aerobic phase, showing a comparatively higher daptation of the middle cluster,
whereas the terminal clusters are almost unaffected. Two separate runs are shown, one for training and the other to
test the adaptation cabilitity of the algorithm. The meandering of the data around the middle (third) cluster is
evident, justifying the Hn miminum for c 3 shown in Fig. 7.

is negative or below a small positive threshold e. In this case


the new centroid positions are recomputed by the second of
Eqs. (7) and the clusters can adjust their shape to the
changing operational environment without disrupting the
existing knowledge base. Fig. 8 shows the entropy variations
during the adaptive clustering of two trial experiments,

shown in Figs. 9 and 10 indicating a general tendency towards


entropy decrease during training. These last two figures show
that during a normal cycle, the rates of change of the process
variables do indeed span the clustered space consistently
with the GK partition, i.e., the trajectory starts from a startof-phase cluster and ends into a end-of-phase cluster,

ARTICLE IN PRESS
WAT E R R E S E A R C H

1103

4 0 (200 6) 109 5 110 7

hence the no-cluster option c 1 is in fact ruled out. In the


aerobic phase, a third cluster is necessary to discriminate the
possible transitions of Table 1. Two separate experiments are

shown in order to demonstrate the adaptation of clusters


centres, which are adjusted according to Eq. (9) in order to
accommodate the peculiarities of each cycle.

2.3.

Fig. 11 Inference engine including timing. The decision


results produced by the inferential engine are
AND-ed with hard time constraints to avoid
excessive phase duration.

Inferential engine

According to the cluster structure determined in the previous


section, the inference engine has two rules for the former and
three rules for the latter situation. The antecedents are ANDed with a time-duration check, to prevent both premature
termination or excessive duration of the phase. The lower
time-limit was specified through a set of fuzzy memberships
assuming that the aerobic phase should last long enough to
insure consistent ammonia oxidation, whereas the minimum
anoxic/anaerobic duration is related to loading and denitrification. The excessive duration was avoided through a hard
time-limit equal to the conventional phase duration (i.e.,
120 min for the anoxic/anaerobic phase and 150 min for the
aerobic phase). The definition of the fuzzy rules is a
consequence of the indicators listed in Table 1, assuming
that the consequent y 0 means that the process is in the
anaerobic phase and y 1 indicates that this phase should be
terminated and the process switched to the aerobic phase.

Time saved
9

0
ORP

7.5

-100

PO4 (mg L-1)

dpH/dt

-200

0.02
0.01
0
-0.01
-0.02

d (ORP)

d (pH)

dt

dt

30
20
10
0
6

N (mg L-1)

0
-1
-2
-3
-4

d (ORP)/dt

pH

100

ORP (mV)

200
pH

8.5

NH4+

4
NO2-

NO3-

0
Air switch

1
On

0.5
Off
0

20

40

60
80
Time (min)

100

120

140

Fig. 12 Fuzzy inference and switching function for the anaerobic/anoxic phase, showing to which extent the phase could be
shortened without impairing the process effectiveness.

ARTICLE IN PRESS
1104

40 (2006) 1095 1107

WAT E R R E S E A R C H

Time saved
10

9
8

PO4 (mg L-1)

dpH/dt

DO

DO

0.2
0.1
0
-0.1
-0.2
30

0.04
0.03
0.02
0.01
0

d (pH)
d (DO)

dt

dt

d (DO)/dt

pH

pH

20
10
0

N (mg L-1)

8
6

NO3-

NH4+

NO2-

Air switch

0
1
On
0

Off
100

50

150

Time (min)
Fig. 13 Fuzzy inference and switching function for the aerobic phase. In this case the switching command is reversed with
respect to the inferential output (bottom graph).

The recognition of this phase requires three clusters with




consequents y 0 0:7 1:0 . The complete fuzzy inference
engine is then described by the following equations:

2.3.1.

Anoxic/Anaerobic phase

R2OX : IF

t  T2OX THEN y2OX 0:7



d pH dDO
 C3OX AND
;
R3OX : IF
dt
dt
t  T2OX THEN y3OX 1

The following two rules are defined



d pH dORP
 C1AN AND
;
R1AN : IF
dt
dt
t  T THEN y1AN 0,



d pH dORP
 C2AN AND
;
R2AN : IF
dt
dt

P3
yOX

P2

2.3.2.

i
i
i1 yAN mAN
.
P
2
i
m
i1 AN

Aerobic phase

This phase requires three rules in the following form



d pH dDO
 C1OX AND
;
R1OX : IF
dt
dt
t  T1OX THEN y1OX 0

i
i
i1 yOX mOX
.
P
2
i
i1 mOX

(13)

10

from which the defuzzified anaerobic output is obtained as


yAN

12

from which the defuzzified aerobic output is obtained as

1
AN

t  T2AN THEN y2AN 1,



d pH dDO
 C2OX AND
;
dt
dt

(11)

The output is represented


by the
two mutually exclusive
h
i
defuzzified values y yAN yOX . To be operational, it must
be further hardened to produce a crisp on/off switching
command, which is obtained from either yAN or yOX, whichever is active, via thresholding with an a-cut 0.95, i.e.,
whichever variable is greater than 0.95 is assumed to be
true and drives the controller. The complete fuzzy inference
mechanism is shown in Fig. 11. Figs. 12 and 13 show the result
of the fuzzy engine operation for either phase. Switching
occurs well ahead of the usual fixed timing, indicating that a
considerable time saving is possible.

ARTICLE IN PRESS
WAT E R R E S E A R C H

1105

4 0 (200 6) 109 5 110 7

pH

8.5
8
7.5

12

18

24

12

18

24

ORP (mV)

100
50
0
-50
-100
S

EL

An

Ae

EL

An

EL

Ae

An

An

Ae

12
time (h)

Ae

An = Anoxic
Ae = Aeration
L = Loading
E = Extraction
S = Stirring
24

18

Fig. 14 A day-long operation showing the reduced cycle length. Each cycle is completed in less than the standard 6-h period.

8.8

150

8.6

100

8.4

pH

0
8
-50
7.8

ORP (mV)

50

8.2

-100

7.6
ORP
pH

7.4

-150
-200

7.2
day 1

day 2
Cycle legend

day 3
An

day 4
Ae

day 5

S&E

Fig. 15 A 5-day experiment shows that consistent operation can be achieved even in the presence of varying process
conditions, shown here by the changing pH values. It can be seen that each cycle, after the first, is completed in less
than the 6-h reference time.

2.4.

Process implementation

The inferential mechanism just described was first implemented in the Matlab (The Mathworks Inc., Natick, USA)
platform where extensive simulations were run (MarsiliLibelli et al., 2001) and then tested on a 2-l pilot plant at the
ENEA laboratories in Bologna, where the fuzzy algorithm was
implemented in real-time using the LabviewTM 5.1 (National
Instruments, Austin, USA) software platform. The results of

this switching strategy are shown in Figs. 14 and 15, where


the process variables are recorded on differing time-scales.
On the short time-scale it can be seen in Figs. 14 that there is
a considerable time saving with respect to the fixed-time
arrangement, because the duration of each cycle is less than
the prescribed 6 h. On a longer time-scale, a 5-day experiment
is shown in Fig. 15, demonstrating that consistent operation
can be achieved even in the presence of varying process
conditions, shown by the changing pH values. It can also be

ARTICLE IN PRESS
1106

WAT E R R E S E A R C H

40 (2006) 1095 1107

seen that each cycle, after the first, is completed in less than
the 6 h reference time. It can be concluded that the proposed
detection strategy to determine the end of each phase as a
result of the inference process provides a tight switching
control. Thus for each cycle two advantages are achieved: the
timing is adapted to the current process conditions and each
phase does not last more than needed. In this way a shorter
cycle is obtained, with a considerable time saving, which
implies that in a given time more cycles can be performed
and therefore more wastewater can be treated.

3.

Conclusion

This paper has presented an inferential engine to control the


timing of a SBR, a process largely used in biological nutrient
removal. Normally, this process, which requires a periodic
switching between anaerobic and aerobic conditions, is
operated on a fixed time-schedule for the lack of process
information. The proposed strategy controls timing as the
result of an inference process whereby indirect process
indicators, represented by pH, ORP and DO, give information
about the state of the process through a fuzzy clustering
algorithm to decide whether each phase is about to end. This
information, extracted form the noisy process signals
through wavelet processing, constitutes the antecedent of a
fuzzy inferential engine whose output is the switching
decision variable. The training and test data were obtained
from a pilot plant, on which the switching algorithm was then
tested, showing that a significant time saving could be
achieved with respect to conventional fixed timing. These
results have been achieved thanks to the use of innovative
numerical techniques, such as wavelet denoisingremoving
the noise from the data and providing reliable numerical
derivativesand fuzzy clusteringallowing a soft extraction of the information contained in the rate of change of the
datato produce an inferential engine capable of detecting
the critical process transitions.
Though satisfactory results were obtained in terms of
phase-length control, several aspects remain to be investigated: the hard time-limit may be inadequate in case of
overloading and some additional fuzzy rules could be
introduced to adapt it to the changing operation. Further,
though no settling problems occurred, the experiment length
was insufficient to rule out possible sludge consequences and
there is still the possibility that long-term operation may
affect the settling characteristics. Further, a good initial
cluster training is essential, as is the inclusion of problematic
data. Both aspects are crucial in endowing the controller with
the widest possible knowledge, so that it can recognise
weird situations and put up a defensive strategy.

Acknowledgements
The cooperation of Dr. Giuseppe Bortone, Dr. Luca Luccarini
and Dr. Alessandro Spagni is gratefully acknowledged in
granting access to the pilot plant located at the ENEA
Wastewater Treatment Division facilities in Bologna (Italy)

and related data. The author also wishes to thank the


anonymous reviewer for his valuable suggestions.
R E F E R E N C E S

Addison, P.S., 2002. The Illustrated Wavelet Transform Handbook.


Institute of Physics Publishers, Bristol, UK, p. 353.
Akin, B.S., Ugurlu, A., 2005. Monitoring and control of biological
nutrient removal in a sequencing batch reactor. Proc.
Biochem. 40, 28732878.
Artan, N., Orhon, D., 2005. Mechanisms and design of sequencing
batch reactors for nutrient removal. IWA Scientific and Technical
Report no. 19. IWA Publishers, London.
zgur, N., 2001.
Artan, N., Wilderer, P., Orhon, D., Morgenroth, E., O
The mechanism and design of sequencing batch reactor
systems for nutrient removalthe state of the art. Water Sci.
Technol. 43, 5360.
Babuska, R., 1998. Fuzzy Modeling for Control. Kluwer, Amsterdam, p. 260.
Bezdek,
J.C.,
1981.
Pattern
Recognition
with
Fuzzy
Objective Function Algorithms. Plenum Press, New York,
p. 256.
Bernardes, R.S., Klapwijk, A., 1996. Biological nutrient removal in
a sequencing batch reactor treating domestic wastewater.
Water Sci. Technol. 33, 2938.
Beun, J.J., Dircks, K., van Loosdrecht, M.C.M., Heijnen, J.J., 2002.
Poly b-hydroxybutyrate metabolism in dynamically fed mixed
microbial cultures. Water Res. 36, 11671180.
Buitron, G., Schoeb, M.E., Moreno-Andradea, I., Moreno, J.A., 2005.
Evaluation of two control strategies for a sequencing batch
reactor degrading high concentration peaks of 4-chlorophenol.
Water Res. 39, 10151024.
Carta, F., Beun, J.J., van Loosdrecht, M.C.M., Heijnen, J.J., 2001.
Simultaneous storage and degradation of PHB and glycogen in
activated sludge cultures. Water Res. 35, 26932701.
Chen, K.C., Chen, C.Y., Peng, J.W., Houng, J.Y., 2002. Real-time
control of an immobilized-cell reactor for wastewater treatment using ORP. Water Res. 36, 230238.
Cho, B.C., Liaw, S.L., Chang, C.N., Yu, R.F., Yang, S.J., Chiou, B.R.,
2001. Development of a real-time control strategy with
artificial neural network for automatic control of a continuous-flow sequencing batch reactor. Water Sci. Technol. 44,
95104.
Fuerhacker, M., Bauer, H., Ellinger, R., Sree, U., Schmid, H.,
Zibuschka, F., Puxbaum, H., 2000. Approach for a novel
control strategy for simultaneous nitrificationdenitrification
in activated sludge reactors. Water Res. 34, 24992506.
Furumai, H., Kazmi, A.A., Fujita, M., Furuya, Y., Sasaki, K., 1999.
Modelling long term nutrient removal in a sequencing batch
reactor. Water Res. 33, 27082714.
Hao, O.J., Huang, J., 1996. Alternating aerobicanoxic process for
nitrogen removal, process evaluation. Water Environ. Res. 68,
8393.
Hopkins, L.N., Lant, P.A., Newell, R.B., 2001. Using the flexibility
index to compare batch continuous activated sludge processes. Water Sci. and Technol. 43, 3543.
Hu, Z., Ferraina, R.A., Ericson, J.F., MacKay, A.A., Smets, B.F., 2005.
Biomass characteristics in three sequencing batch reactors
treating a wastewater containing synthetic organic chemicals.
Water Res. 39, 710720.
Irvine, R.L., Ketchum Jr., L.H., 1989. Sequencing batch reactors for
biological wastewater treatment. CRC Crit. Rev. Environ.
Control 18, 255294.
Katsogiannis, A.N., Kornaros, M.E., Lyberatos, G.K., 1999. Adaptive
optimization of a nitrifying sequencing batch reactor. Water
Res. 33, 35693576.

ARTICLE IN PRESS
WAT E R R E S E A R C H

4 0 (200 6) 109 5 110 7

Kerrn-Jesperson, J.P., Henze, M., 1993. Biological phosphorus


removal from wastewater by aerobic-anoxic sequencing
batch reactors. Water Res. 27, 617624.
Kim, H., Hao, O.J., 2001. pH and oxidationreduction potential
control strategy for optimization of nitrogen removal in an
alternating aerobicanoxic system. Water Environ. Res. 73,
95102.
Kim, J.H., Chen, M., Kishida, N., Sudo, R., 2004. Integrated realtime control strategy for nitrogen removal in swine wastewater treatment using sequencing batch reactors. Water Res.
38, 33403348.
Lee, D.S., Jeon, C.O., Park, J.M., 2001. Biological nitrogen removal
with enhanced phosphate uptake in a sequencing batch
reactor using single sludge system. Water. Res. 35, 39683976.
Lee, Y., Oleszkiewicz, J.A., 2003. Effects of predation and ORP
conditions on the performance of nitrifiers in activated sludge
systems. Water Res. 37, 42024210.
van Loosdrecht, M.C.M., Hooijmans, C.M., Brdjanovic, D., Heijnen,
J.J., 1997. Biological phosphate removal processes. Appl.
Microbiol. Biotechnol. 48, 289296.
Luccarini, L., Porra`, E., Spagni, A., Ratini, P., Grilli, S., Longhi, S.,
Bortone, G., 2002. Soft sensors for control of nitrogen and
phosphorus removal from wastewaters by neural networks.
Water Sci. Technol. 45 (45), 101107.
Mace, S., Mata-Alvarez, J., 2002. Utilization of SBR technology for
wastewater treatment: an overview. Ind. Eng. Chem. 41,
55395553.
Marsili-Libelli, S., 1998. Adaptive fuzzy monitoring and fault
detection. Int. J. COMADEM 1 (3), 3138.
Marsili-Libelli, S., Muller, A., 1996. Adaptive fuzzy pattern
recognition in the anaerobic digestion process. Pattern Recognition Lett. 17, 651659.
Marsili-Libelli, S., Ratini, P., Spagni, A., Bortone, G., 2001.
Implementation, study and calibration of a modified ASM2d
for the simulation of SBR processes. Water Sci. Technol. 43 (3),
6976.
Misiti, M., Misiti, Y., Oppenheim, G., Poggi, J.M., 2002. Wavelet
Toolbox users Guide, version 2. The MathWorks, Inc., Natick,
p. 934.
Muller, A., Marsili-Libelli, S., Aivasidis, A., Lloyd, T., Kroner, S.,
Wandrey, C., 1997. Fuzzy control of disturbances in a wastewater treatment system. Water. Res. 31, 31573167.
Murnleitner, E., Kuba, T., van Loosdrecht, M.C.M., Heijnen, J.J.,
1997. An integrated metabolic model for the aerobic and
denitrifying biological phosphorus removal. Biotechnol.
Bioeng. 54, 434450.

1107

Oles, J., Wilderer, P.A., 1991. Computer aided design of sequencing


batch reactors based on the IAWPRC activated sludge model.
Water Sci. Technol. 23, 10871095.
Pavseli, N., Hvala, N., Koijan, J., Ros, M., Subelj, M., Music, G.,
Strmcnik, S., 2001. Experimental design of an optimal phase
duration control strategy used in batch biological wastewater
treatment. ISA Trans. 40, 4156.
Percival, D.B., Walden, A.T., 2000. Wavelet Methods for Time
Series Analysis. Cambridge University Press, Cambridge,
p. 594.
Polikar, R., 1999. The story of wavelets, In: Mastorakis, N. (Ed.),
Physics and Modern Topics in Mechanical and Electrical Engineering.
World Scientific and Eng. Society Press, pp. 192197. (an online version is available at http://users.rowan.edu/polikar/
WAVELETS/WTtutorial.html)
Saito, T., Brdjanovic, D., van Loosdrecht, M.C.M., 2004. Effect of
nitrite on phosphate uptake by phosphate accumulating
organisms. Water Res. 38, 37603768.
Silverman, B.W., Vassilicos, J.C., 1999. Preface to Wavelets: the key
to intermittent information? Philos. Trans. R. Soc. London 357,
23932395.
Sin, G., Insel., G., Lee, D.S., Vanrolleghem, P.A., 2004. Optimal
but robust N and P removal in SBRs: a model-based systematic
study of operation scenarios. Water Sci. Technol. 50,
97105.
Smolders, G.J.F., van Loosdrecht, M.C.M., Heijnen, J.J., 1995. A
metabolic model for the biological phosphorus removal
process. Water Sci. Technol. 31 (2), 7993.
Spagni, A., Buday, J., Ratini, P., Bortone, G., 2001. Experimental
considerations on monitoring ORP, pH, conductivity and
dissolved oxygen in nitrogen and phosphorus biological
removal processes. Water Sci. Technol. 43 (11), 197204.
Sperandio, M., Queinnec, I., 2004. Online estimation of wastewater nitrifiable nitrogen, nitrification dynamics and denitrification rates, using ORP and DO dynamics. Water Sci. Technol.
49, 3138.
Strang, G., 1994. Wavelets. Am. Sci. 82, 250255.
Wilderer, P., Irvine, R.L., Goronszy, M.C., 2001. Sequencing batch
reactors Technology. IWA Scientific and Technical Report no. 10.
IWA Publishers, London.
Yoo, C.K., Lee, D.S., Vanrolleghem, P.A., 2004. Application of
multiway ICA for on-line process monitoring of a sequencing
batch reactor. Water Res. 38, 17151732.
Zhao, H., Hao, O.J., McAvoy, T.J., 1999. Approaches to modelling
nutrient dynamics: ASM2, simplified model and neural nets.
Water Sci. Technol. 39, 227234.