Академический Документы
Профессиональный Документы
Культура Документы
Computer-based measurement of
wastewater BOD
George Hassapis
Aristotelian University, Faculty of Engineering, Department of Electrical Engineering, Division
of Electronics & Computer Engineering, 540 06 Thessaloniki, Greece
Abstract. This paper describes the development of a computer-based instrument for the fast
measurement of the biological oxygen demand (BOD) of wastewater. The conventional meas-
urement method is based on laboratory analysis results that are available after a delay of five
days. The BOD is assessed by the instrument described here by monitoring the change in the
dilution ratio of fresh water to wastewater that has to be made in order to keep at a constant
value the oxygen consumed in a special whirl bed reactor in which microorganisms are grown.
Depending on the reactor volume, the algorithm for the computer control of the dilution ratio
and the architecture of the computer selected, a measurement time in the range of 2 to 10
minutes can be achieved. The results of practical experience gained from building and testing
such a measuring instrument are presented and discussed.
I. Introduction
Reliable and accurate measurements of the influent and effluent substrate con-
centrations of biological oxygen demand (BOD) are required for the practical
implementation of automatic control strategies for wastewater treatment plants.
However, devices that can perform this type of measurement within the response
time limits imposed by automatic control requirements are not generally available.
A laboratory apparatus that has been reported [1] is able to measure the substrate
concentration of BOD in sewage in approximately four hours, whereas the only
commercially available unit [2] claims to have a measurement delay of three
minutes. The detailed design of these devices is not generally published and only
the basic principles on which their design is based is explained in the literature.
They use a bed-type reactor in which the inner surface of a number of small plastic
Elsevier
Industrial Metrology 2 (1991) 71-84
rings serves as the growing area for microorganisms. An electronic controller tries
to hold at a constant value the difference of the dissolved oxygen concentrations
between the influent and the effluent streams of the reactor by adjusting the dilution
ratio of the wastewater to the freshwater in the influent stream. F r o m the moni-
tored variations of this dilution ratio and the influent temperature the B O D of the
wastewater can be inferred. It seems that the problem of designing a fast B O D
measuring device is a problem of control.
The aim of this work was to find and provide in the open literature a computer
control strategy that could be used to build custom-made B O D measuring devices
with measurement times comparable to those claimed in commercial products.
According to this strategy a change in the wastewater B O D is viewed as a distur-
bance to the dilution ratio. A linear quadratic control algorithm with on-line
process identification and parameter estimation of the control algorithm is applied
to regulate the dissolved oxygen difference. Its operation in practice was tested by
building and operating an experimenal B O D measuring device.
2. Controller design
It has been proved [3] that the dynamic behavior of any reactor in which
microorganisms are grown, is described by the following differential equation:
TM -d2y(t)
- + 1 + TM + TMksCBAdy(t)
koCBACw(t) dt 2 kOCBACw(t)T
M dt
1 + TMksCBA 1
+ (1)
, .
mass balance equation, Cw(Ois the BOD concentration in mg/1 in the wastewater,
and n(t) is the dilution ratio defined as the ratio of the freshwater flow rate to the
wastewater flow rate.
In a closed-feedback loop a controller of this system will drive the difference y(t)
to a desired value Yd by manipulating the dilution ratio n(t) to offset the influence
of the disturbance cw(t). Therefore, the dilution ratio is a measure of the degree of
wastewater pollution. A mathematical relationship that can express Cw(t) as a
function of n(t) can be derived from eqn. (1) if we assume that at steady state the
oxygen difference is equal to Yd. This relationship has the following form:
It can be shown that (3) has the following discrete state space representation:
x(k + 1) = ~x(k) + ru(k), (4)
y(k) = Clx(k), (5)
where
(0.9474 -0.0038~
4=\0.0487 0.9999]' (6)
{0.0487~
r = \0.0012j , (7)
and
C=(0 0.2357), (8)
when the sampling period is h = 0.5 min and a zero-order hold is assumed on the
system input u(t).
The purpose of the pole placement method is to arrange a feedback of the state
variables so that the values of the poles of the closed-loop system assume the
values prescribed by the desired transient response characteristics. Since the two
state variables cannot be measured directly the use of an observer, given by the
state equation,
.~(k) = ~.~(k - 1) + ru(k - 1) + X [ y ( k - 1) - C2(k - 1)], (9)
is required.
The matrix K can be computed analytically [4] by
x=e( )Wol(0 l) T, (10)
where P(~) is the matrix polynomial
p ( ~ ) = c~ 2 + p t ~ + p21. (11)
Here p~ and Pz are the coefficients of the characteristic equation of the matrix
and Wo ~ is the inverse of the observability matrix of (4).
Then the linear control law is given by the intuitively reasonable relationship
u(k) = - L:~(k), (12)
where a~(k) is the output of the observer.
G. Hassapis / Computer-based measurement of wastewater BOD 75
(x(k+l)~
=
( , O1)(x(k)~ q- (:) u(k) q-
(0) Yd" (17)
\x3(k + 1)J -C \x3(k)] 1
The pole placement design, explained previously, is now applied to the space
representation of the new system and leads to the following control law:
n(k)=[1-u(k)]/u(k), (18)
where
where
/'11.1479'~
+ ~ 2.5166)Y(k-1). (20)
D ~i xiO<~
0
I) 0 - b
i ....i0
Iq
~Tf - 1[i
/
....~:o ',i!b 411 6il ~i~ Joo
Ti m~ i i'l 0. 5 ~T~in
Fig. 1. Response curves of a closed-loop system to a step-type disturbance: (a), pole placement
controller; (b), linear quadratic controller; (c), PID + lead compensator.
8 <I0"~
6
a
4
-4
0 20 40 60 80 J.O0
l'i mt~ i n O. 5 ITfi rl
The solution of the linear quadratic (LQ) regulator problem for the discrete time
system defined by (4) and (5) requires the determination of the feedback law:
u(k) = - L2(k), (2 l)
which minimizes the loss function:
N-1
d = ~ .U(k)Q.~(k) + Ru2(k). (22)
k=O
G. Hassapis / Computer-based measurement of wastewater BOD 77
o=(; (23)
R=I. (24)
It is proved [4] that the matrix L can be computed from the following equation
The Q and R matrices selected, when compared to other matrix forms that could
convert J to known performance indices [5], such as the integral square error,
integral of time multiplied square error etc., lead to a closed-loop system with the
fastest transient response.
The matrix equations (25) and (26) may also be used to establish the vector 2(k)
estimation law if the symbols L, ~, F are substituted by K a', q~a` and C a`, and the
matrices Q and R provide the covariances of the assumed superimposed noise on
the system states and the output measurement, respectively. The form of these
matrices that is considered is
(00"01 0
(27)
Q= 0.01)
and
R=I. (28)
The control and state estimation laws obtained are
/0.01015
+ 1/. (301
Curve b in Fig. 1 illustrates the transient response of the system when this control
algorithm is applied. The curves in Fig. 3 illustrate the system responses to random
disturbances as in Section 2.1.
78 G. Hassapis / Computer-based measurement of wastewater BOD
I] 10"!i:
(i
4 a
....2.
.... 4 i i
20 40 (i0 80 100
rt me i t'l O. [!i mi r~
Fig. 3. T i m e r e s p o n s e s of a c l o s e d - l o o p system w i t h a linear q u a d r a t i c c o n t r o l l e r to: (a), c o n t r o l l e r
o u t p u t d i s t u r b a n c e ; (b), r e a c t o r o u t p u t d i s t u r b a n c e .
The possibility of using digital PID algorithms for this control application has
also been investigated. Euler's approximations [4] for the four different structures
in which PID controllers appear in industrial control systems [6], have been
simulated, after being tuned by the 10% overshoot method [5] to offset the same
step load disturbance used for the previous designs. The pulse transfer functions
of these four different controller structures are given in the Appendix. The first
function refers to a standard or otherwise non-interacting controller where the
proportional, integral and derivative terms act on the error signal independently
but the controller gain multiplies all three terms. The second function refers to the
so-called parallel controller in which the integral and derivative terms are indepen-
dent of the controller gain. In the third function the integral and derivative terms
interact in the way shown in the Appendix and for this reason the corresponding
controller is usually called an interacting controller. The last function refers to a
non-interacting controller followed by a lead compensator, which is designed to
introduce a 70 ° phase angle. All these functions include a filter in the derivative
term.
As one can easily see in Fig. 4 the system described by (4) in the Appendix can
stabilize faster when the fourth algorithm is used. The response that corresponds
to this algorithm is also shown in Fig. 2 whereas the disturbance response is shown
in Fig. 5.
3. Algorithm evaluation
The main objective of this work was to find a control algorithm that could drive
the system considered to the dissolved-oxygen set point as fast as possible, once
the B O D of the wastewater stream received has been changed. According to Fig. 2
the best way,~to achieve this is to implement the linear quadratic control (LQC)
algorithm. This algorithm results in a 50% faster settling time and 80% less over-
G, Hassapis / Computer-based measurement of wastewater BOD 79
D 0,(i:
0
I)
i 0. 4
'r
.f.,
0.2
i
rl
0
!}~-...?,
~'
"~12 ...................... ...... - ......
ffl
/
t ....0,2
20 40 (i0 [l0 1.00
ti mtI irl 0. !; mi I'1
Fig. 4. Responses of a closed-loop system to a step-type disturbance; (a), non-interacting P I D controller;
(b), p a r a l l e l P I D c o n t r o l l e r ; (c), i n t e r a c t i n g P I D c o n t r o l l e r ; (d), n o n - i n t e r a c t i n g P I D + lead compensator.
O. 015
O, 01
O. 005
-.0, 005
-~(). 01
....O. 015
0 20 40 (i0 II0 I00
Tlmo i iq 0.5 Nn
Fig. 5. Time responses of a closed-loop system with PI.D+ compensator to: (a), controller output
disturbance; (b), reactor output disturbance.
shoot when it is compared with the algorithm with the next best performance,
which is the algorithm derived by applying the pole placement method. Since all
the other algorithms deviate significantly from the response of the LQ algorithm
any adverse influence of modeling or other errors on this algorithm and in favor
of the others could not really alter the observed differences. Regarding the sensi-
tivity of the control algorithms to modeling errors, as Fig. 3 discloses, t h e LQ
algorithm is also the best.
4. Controller implementation
For the realization of the actions described by eqns. (25) to (30) two oxygen
probes have been used to measure the incoming and outgoing reactor fluids, and
two dosimetric pumps to adjust the ratio of the wastewater to the fresh water.
Each oxygen probe provides, through an electronic circuit, a signal in the range
of 0-5 V, corresponding to an actual oxygen concentration range of 500 mg/1, and
each pump has a capacity of 1 l/rain. The difference of the outputs of the two
80 G. Hassapis / Computer-based measurement of wastewater BOD
oxygen probes are digitized by an A/D converter and these data, after being
converted to the proper engineering units, constitute at each sampling instant the
y(k) value to be used in the LQ algorithm calculations. The value computed by
the algorithm at the next sampling instant n(k + 1) is used to adjust the preset
values of two shift registers appropriately, the outputs of which control the opera-
tion of the pumps. The entire experimental set-up was operated in a 30°C con-
trolled-temperature environment. A schematic diagram of the experimental set-up,
showing the additional construction details is given in Fig. 6. In the controller
constructed the following implementation issues have been considered.
(a) To eliminate disturbances with frequencies higher than the Nyquist fre-
quency associated with the sampling rate a sixth-order digital low-pass
Chebychev prefilter with a cut-off frequency 0.01 Hz and a sampling rate
of 200 Hz has been used at the process output. The cut-off frequency is
slightly below the Nyquist frequency, corresponding to the chosen sam-
pling rate of 0.5 min and well above the bandwidth of the reactor which
varies, depending on the value of the BOD of the influent stream, in the
range of 0.0001 to 0.001 Hz. The order, type and cut-off frequency of the
filter have been selected so that frequency aliasing is avoided and so that
Ul(t) [ BOD
2u2(t) Cornputer__~
~ Pr'nter
Yl(t) y2ct)
~ Air
• ..c
0 t..
q
02-EI~ e2
I Ulow, U ~ Ulow,
sat u = ~u, Ulow ~ U ~ Uhigh, (32)
Uhigh, U ~ Uhigh,
(c) A 12-bit A/D converter has been used to digitize the measured difference
of dissolved oxygen and a double-precision floating point arithmetic has
been chosen to provide a relative number accuracy of approximately 16
significant decimal digits. These selections reduced errors because of quan-
tization in A/D and the digital representation of the various parameters as
well as round-off errors in arithmetic operations.
As was explained in section 1 of the paper the control algorithm parameters
should be changed from time to time to compensate for the changes incurred in
the parameters of the reactor model by the BOD variations of the wastewater. A
least-squares algorithm [4] executed at every other sampling instant has been used
to identify the changes in the model parameters. The sequence of the last inputs
u(1), u(2).... , u(10) applied to the pumps are always recorded during closed-loop
system operation along with the corresponding sequence of outputs y(1), y(2) .... ,
y(10). Then the matrices
f--y(1) u(1)l
F _ , (33)
\-y(9) u(9)/
fy(2) 1
\y(10)/
and
o = ( t i e ) - lrwy (35)
82 G. Hassapis / Computer-based measurement of wastewater BOD
are formed. The matrix O contains the least-squares estimate of the parameters in
the following equation:
y(k) = Olxl(k - 1) + 02x2(k - 1) + blu(k - 1). (36)
This equation is obtained if in the system eq. (4) k is replaced by k - 1, x2(k) is
expressed in terms of x l ( k - 1 ) , x z ( k - 1) and u ( k - 1), and the new expression for
xz(k) is replaced in (5). Having found O and holding the last computed values for
three elements of qi and F, new values for the other three elements are found by
solving the following system of equations:
5. Experimental results
300
250
200
1,50
lO0 300
50 1.00 1.50 200 Z;O
g[ IYIf~ [ rl iIli P'IUt 0 {;
3,015
D '3.Of
0
[ [~,005
n
g
I
: f:. ,%E:
?0
50
40
30
20
iO
:i00
[i II~e 111 ITti I'/L£L~H;
300
B ,',:.0
1
0
D
2OO
rl
ITl
].SO
g
/I 100
~0 i
6. Conclusions
In this paper it has been shown by computer simulation and verified experimen-
tally that a self-tuned linear quadratic control algorithm, implemented on a small
computer at a sampling period of 0.5 rain, can be used to speed up drastically the
response time of a BOD measuring device. The measurements obtained by using
84 G. Hassapis / Computer-based measurement of wastewater BOD
this control strategy are in adequate agreement with the results of the laboratory
analysis of wastewater samples.
The criterion used to select the sampling period of 0.5 min was the algorithm
execution time limit imposed by a 16-bit single-processor microcomputer. If, how-
ever, multiprocessor systems are considered then the control algorithm can be
executed at a higher sampling rate, the limit of which depends on the speed of the
response of the sensors and actuators rather than the speed of the computer.
Acknowledgement
This work has been supported by grant 3293/4o3-1988 from the Greek Ministry
of Industry, Research and Development Council.
References
[1] H. Heckershoff,Ein MeBgerat zur kontinuierlichenBestimmungder Substratkonzentration
von Abwasserund der Atmungsgeschwindigkeityon Belebtschlammen,Dissertation,Technical
University, Berlin, 1983.
[2] G. Reigler,Continuousshort-timeBOD measurement,Korrespondenz Abwasser 31 (1984) 369.
[3] M. Winkler, Biological Treatment of Waste Water, Ellis Harwood, Chichester,UK, 1981.
[4] K.J. Astrom and B. Wittenmark, Computer Controlled Systems, Theory and Design, Prentice-
Hall, EnglewoodCliffs,NJ, 1984.
[5] K. Ogata, Modern Control Engineering, Prentice-Hall,EnglewoodCliffs, NJ, 1970.
[6] J.P. Gerry, Process Plus V3.x Operating Manual, Gerry EngineeringSoftware,LockportIL, 1988.
[7] C. Moller, J. Little and S. Bankert, MATLAB User's Manual Version 3.0-PC, MathWorks Inc.,
Sherborn, MA, 1987.
1. Non-interacting algorithm
0.5 0.6867(z- 1) )'~)
H i ( z ) = 1.2793 (1 +
5.538(z - 1) + 0.5 + 0.06687(z- 1 "
2. Parallel algorithm
0.5 0.85546(z- 1)
H2(z) = 1.2793 +
4.3288(z -- 1) + 0.5 + 0.085546(z - 1)"
3. Interacting algorithm
0.5))( 0.25 + 0.4646(z- 1) )
Ha(z) = 1.1419(1 +
k 4.432(z- 1 0.25 + 0.0422(z - 1)+ 0.036(z- 1) 2 "