Professional Documents
Culture Documents
New in STOAT 4.2 PDF
New in STOAT 4.2 PDF
2
Introduction .................................................................................................................. 3
New Process Models..................................................................................................... 5
Screening .............................................................................................................................. 5
Grit trap ............................................................................................................................... 6
Sand filtration ...................................................................................................................... 7
UV disinfection .................................................................................................................... 9
Chlorination ....................................................................................................................... 13
Reactive settlers ................................................................................................................. 14
Collocation biofilm models ............................................................................................... 14
Instrumentation ................................................................................................................. 15
Introduction
STOAT 4.1 was released in May 1999. This version, STOA4.2, was released
in August 2001. This release contains many small enhancements and
corrections that have been made in the intervening two years. In addition to
these there have been the following:
There have been several new process models added, and extensions to
existing process models. The range of preliminary and tertiary treatment
models has been increased, and there is now support for reactive
secondary clarifiers. In addition, there is a new process model, NIVAPlant,
available from the Norwegian Water Research Institute, NIVA. NIVAPlant
encompasses the Norwegian knowledge of chemically-assisted
sedimentation, both to enhance the removal of TSS and BOD/COD and
also to remove phosphorus. If you wish to add NIVAPlant to your STOAT
please contact Harsha Ratnaweera of NIVA at the following e-mail
address: Harsha.Ratnaweera@niva.no. We would be interested in
knowing about your interest in NIVAPlant, or if you have models that you
would like advertised as being available through STOAT. You can e-mail
us at STOAT@wrcplc.co.uk. This guide includes information on how you
can write your own models to work with STOAT.
At the end of a simulation you can now view the results from the process
models graphically, as well as tables of summary statistics and time
series. Where the process has a single stage the results will be displayed
as line plots, and multiple stage processes will be displayed as threedimensional graphs. At present the biofilm models do not support
graphical output, as this requires four-dimensional graphs time (T),
distance into the biofilm (Y), distance along the reactor (X), and the value
at this (T, Y, X) point.
Support for the DHI/WRc Integrated Catchment Simulator (ICS) and
improved support for Wallingford Softwares InfoWorks system.
The ICS allows you to run simulations using sewer models (MOUSE),
sewage works models (STOAT) and river models (MIKE), with data
exchange between the three programs. This provides for a great
improvement in the support for modelling the feasibility of real-time
control of the entire catchment. More information on the ICS can be
found by e-mailing WRc at ICS@wrcplc.co.uk
InfoWorks allows you to carry out similar integrated modelling, using
STOAT along with Wallingford Softwares sewer model HydroWorks
and their river model ISIS. These two enhancements further position
STOAT as the tool designed for ease of use when studying catchmentwide decision modelling.
A spin-off from the DHI ICS system is that there is now a COM
interface that allows STOAT To be controlled by other programs. This
is currently being used as part of a research project by NIVA to send
3
The data entry forms are shown below. The bar spacing affects the
screenings production. The screenings production1 can also be changed
under sewage calibration, by choosing either Average or Maximum.
Screenings are assumed to be gross solids that are not captured by traditional
sampling methods and therefore the screening model has no effect on the
sewage quality passing through it.
Grit trap
The grit trap data entry forms are shown below. At present the volume of the
grit trap has no process significance all that is required is that be a value
greater than zero. The grit removal is specified as g/l, and is the removal of
nonvolatile suspended solids from the influent stream.
Sand filtration
Bypass
Influent
Backwash
Effluent
There are two sand filtration models, Simple and Time varying. Both are
mass-balance based models.
The Simple model is a steady-state approximation to the back-wash
performance. The bypass stream is never used. You must connect an outlet
stream to this connector, but there is never any flow down it. For this model
performance is defined by specifying what fraction of the incoming flow is
diverted as the backwash, and what is the efficiency of solids removal the
recovery fraction. There is a continuous flow through both the backwash and
effluent streams.
The Time varying model also uses a simple equation to calculate the
efficiency of solids removal, but now that efficiency may vary over time, and
you also specify a backwash frequency and period during the backwash
period all flow is diverted through the bypass line, the backwash stream only
has a flow during the backwash period and the effluent stream only has a flow
outside the backwash period. The backwash flow is assumed to come from a
clean source, and is not explicitly modelled.
The clean efficiency is the efficiency at the start of each operating cycle. The
efficiency falls off with time, but will never fall off below the worst efficiency.
The equation relating the fall-off in performance with time is given by
Efficiency = Best efficiency exp(-fouling coefficient time)
The phase time is used to set up an operating stagger when several sand
filters are present on the flowsheet.
UV disinfection
The UV intensity in a uniform lamp array can be estimated from the following
chart:
FJ Loge et al, 1996, Water Environment Research 68(5) 900-916. Original work in
WEF, 1995, Comparison of UV irradiation to chlorination: Guidance for achieving
optimal UV performance, ISBN 95-060880, WEF # 91-WWD-1
An example of its use is given in the following figure: Start at the spacing axis.
Move horizontally left to the UV density in the reactor. Move down until you
intersect the appropriate UV absorbance coefficient, . Move left until you
intersect the UV intensity. The UV absorbance coefficient is calculated using
%UV transmittance over 1 cm at 254 nm
= 2.303 log 10
100
10
11
The model can be calibrated by adjusting the WERF parameters, but this will
obviously require access to coliform count results.
A:
12
Chlorination
13
Reactive settlers
STOAT has added the following reactive settlers for the secondary settling
tank:
ASAL 1
ASAL 2
ASAL 3
ASAL 5
ASM 1
ASM 2d
ASM 2w3
ASM 3
This should be used with the ASAL 1/1A and OXID 1 aeration tanks
This should be used with the ASAL 2/2A and OXID 2 aeration tanks
This should be used with the ASAL 3/3A and OXID 3 aeration tanks
This should be used with the ASAL 5/5A and OXID 5 aeration tanks
This should be used with the IAWQ #1 aeration tanks
This should be used with the IAWQ #2d aeration tanks
This should be used with the IAWQ #2w aeration tanks
This should be used with the IAWQ #3aeration tanks
When selecting a reactive settler model we recommend that you adopt the
following procedure:
1. Set up all the aeration tanks to use the required kinetic model (ASAL 1,
IAWWQ #1, etc.)
2. Set up the secondary settlers to use the desired matching kinetic model
3. Close the settler Name and dimensions dialogue, then re-open. On the
second page of the dialogue you are asked to enter the name of the
activated sludge tank that will be used to pick up the kinetic data. The list
of allowable names will be filtered to display only those that are valid for
the chosen settling tank reaction model.
The models ASL 1, ASAL 2 and ASAL 5 are sufficiently simple on their data
needs that this is repeated under Sewage Calibration rather than being taken
from the corresponding aeration tank. For the models ASAL 3, ASM 1, ASM
2d, ASM 2w and ASM 3 the reaction kinetic parameters are always taken
from the associated aeration basin.
Collocation biofilm models
New biofilm models have been added, based loosely on collocation equations
for the soluble components. These models are referred to as BOD coll (1) and
The ASM 2w model is a variant of ASM 2d developed by WRc. The model differs
from the standard ASM 2d model in the handling of the switching function for
heterotrophic usage of VFA and fermentable COD. Where the standard model uses
the term (for VFA) of
SA
SA
SA
. This change has better mathematical consistency than
K A + SA + SF K A / KF
the standard ASM 2 version. The ASM 2w model will only show a difference
compared to ASM 2d when there are substantial quantities of VFA in the aerobic
section of the aeration tank.
14
COD coll (1). They usually give the same results as the standard finitedifference models, but with substantially reduced computation times4. We
would recommend that the standard model be used first, and if computation
speed is an issue then you should switch to the collocation method. There will
be small differences between the two models - usually this is negligible,
unless the biofilm is close to a nitrifying/non-nitrifying position, when the full
model will be more accurate.
Instrumentation
There are two new instrumentation models: noisy probe and delay sampler.
The measurement has a level of noise added to it, using two Normal
functions. The first adds noise independent of the measured value:
For white noise the mean, , has the value zero.
Noise = N ( , )
The second noise function allows the mean and standard deviation to be
dependent on the measured value:
16
After this you can then choose how the data should be displayed graphically
or in tables.
17
The results will then be displayed. For most processes the graphs will be
displayed as a three-dimensional plot. For some processes, that only ever
have one stage, the results will be presented as simple line graph. Staged
processes display one parameter per graph, with a series of tabs allowing you
to quickly switch between different parameters.
By right-clicking over the graph you will get a series of menus that allow you
to rotate and modify the graph.
18
The most useful are likely to be View 3D, which allows you to experiment with
rotation and view angles, and Plot cube, which allows you to distort the
different axes to better view the image.
19
User-defined Models
You can now add your own models to STOAT. More details are given in the
appendix.
STOAT ASM
STOAT .2 has a partner product, STOAT ASM Activated Sludge Model.
Many wastewater modellers focus only on activated sludge. For those people
we have STOAT ASM as a lower-priced entry into the STOAT world. Any
models developed by STOAT ASM are fully compatible with the full STOAT
package, and can easily be upgraded to STOAT later. If you need to deliver a
copy of your STOAT models to your clients then STOAT ASM may be a lowcost way of handing over a working version for them to use.
20
21
Program file
For an example of the contents of a program file please study the file BULK1.F90.
This indicates
The two entry points that STOAT is looking for: USER and USERS
How to declare that these entry points are to be made available. Note that the
syntax is specific to Digital/Compaq Visual Fortran and would have to be modified
if you are using a different Fortran compiler, or a compiler for another language
(e.g. C or C++). Also note that the entry points USER and USERS are defined
using an ALIAS command to be exported in 'undecorated' format.
Menu files
The menu file contains information about the screen representation of your model.
When no model is specified STOAT will display a question mark in a box. When you
specify a model this will change to the symbol that you have defined for the model. If
you add streams to a screen symbol and subsequently change the process to a
different model with a different number of inlets or outlets then the performance of
STOAT may be unpredictable. Always settle for the models before adding
streams.
The menu file contains the following information:
[CONNECTIONS]
IMAGE = <image file name, usually an icon, but possibly a bitmap>
INLETn, NAME = <Name>, X = <X>, Y = <Y>
OUTLETn, NAME = <Name>, X = <X>, Y = <Y>
Where n is 1-3: up to 3 inlets and 3 outlets per process.
<Name> is a name that will be used to help users identify connections.
<X> and <Y> are the X and Y co-ordinates for the connections on your image.
[UNIT SPECIFICATION]
This must be specified, even if empty, for STOAT to automatically add an entry for
the number of stages and, optionally, an entry for the number of recycle streams.
NAME = <Name>, MAX = <Max>, MIN = <Min>, DEFUALT = <Default value>
[KINETICS CALIBRATION]
22
[INITIAL CONDITIONS]
These follow the same format as above
[RECYCLES]
ENABLED
No [RECYCLES] entry means that there will be no user prompts for internal recycle
streams.
[DISTRIBUTION]
This has the same format as for unit specification, but with an optional SUM =
<Sum> keyword if the sum of values for a stage must equal some defined number typically 1, where the values are fractional distributions across the stages (e.g.,
volume fractions).
[DERIVED PARAMETERS]
NAME = <Name>
The derived parameters are defined for each stage.
Example
The following material gives an example of implementing a model for bulking
activated sludge (See Low F/M bulking model of J. Kapeller and R.Brodman, 1995,
Water Science and technology 31(2), 225 ff. for more details) . Sample output from
the model is given in the following figure.
23
24
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
NAME
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
[INITIAL CONDITIONS]
NAME = "Temperature", MIN = 0, MAX = 30
NAME = "Oxygen", MIN=0, MAX = 10
NAME = "SH", MIN = 0, MAX = 1E6
NAME = "SL", MIN = 0, MAX = 1E6
NAME = "SI", MIN = 0, MAX = 1E6
NAME = "NH4", MIN = 0, MAX = 1E6
NAME = "NO3", MIN = 0, MAX = 1E6
NAME = "NO2", MIN = 0, MAX = 1E6
NAME = "NO", MIN = 0, MAX = 1E6
NAME = "XF", MIN = 0, MAX = 1E6, DEFAULT = 100
NAME = "XB", MIN = 0, MAX = 1E6, DEFAULT = 100
NAME = "XNS", MIN = 0, MAX = 1E6, DEFAULT = 10
NAME = "XNB", MIN = 0, MAX = 1E6, DEFAULT = 10
NAME = "XH", MIN = 0, MAX = 1E6
NAME = "XL", MIN = 0, MAX = 1E6
NAME = "XSurf", MIN = 0, MAX = 1E6
25
26
Fortran routines
!
!
!
!
!
!
!
!
In these two routines, USER is used to specify the values for the
differential equations DY()/dy = f(Y(), ...)
USER should NOT be used to assign values to the streams.
USERS is used to specify values for the outlet streams.
It should not be used to specify values for any other parameters,
with the possible exception of DERIVED().
27
!
!
!
!
!
!
!
!
!
!
!
!
!
!
(in)
(in )
(in)
(in)
(in)
(in)
(inout)
(in)
::
::
::
::
::
::
::
::
28
29
= y(NumberOfStages, 2)
= y(NumberOfStages, 3)
= y(NumberOfStages, 4)
= y(NumberOfStages, 5)
= y(NumberOfStages, 6)
= y(NumberOfStages, 7)
= y(NumberOfStages, 8)
= y(NumberOfStages, 9)
= y(NumberOfStages, 10) * iTSSBM
= y(NumberOfStages, 11) * iTSSBM
= y(NumberOfStages, 12) * iTSSBM
= y(NumberOfStages, 13) * iTSSBM
= Sum(y(NumberOfStages, 10:14))
= y(NumberOfStages, 15) ! 'low' MW
= y(NumberOfStages, 16) ! 'surfactants'
= y(NumberOfStages, 17) ! 'inerts'
= y(NumberOfStages, 18)
= out.c.xvih + out.c.xnvh + out.c.xvia + out.c.xnva &
Sum(y(NumberOfStages, 14:17)) / s1
end
subroutine bulk1_hydraulics(sin, sRAS, T, dT, y, dy, NumberOfStages, &
Volume, Feed, RASFeed, s2, From, To, Q, &
NumberOfRecycles)
implicit none
include 'stream.fi'
record /stream/ sin, sRAS
integer:: NumberOfStages
integer:: NumberOfRecycles
double precision:: T, dT
double precision:: s2 ! biomass COD:VSS ratio
double precision, dimension(NumberOfStages, 17):: y, dy
double precision, dimension(NumberOfStages):: Volume, Feed, RASFeed, &
From, To, Q
! Local variables
double precision:: Qin, QRAS, QSewage
double precision:: XBOD1, XBOD2
integer:: Stage, FromStage, ToStage, i
double precision:: QMLSS, Q1, Q2
30
QSewage = sin.flow
QRAS
= sRAS.flow
dT = QSewage * sin.T + QRAS * sRAS.T - (QRAS + QSewage) * T
dT = dT / sum(Volume)
dy = 0d0
Qin = 0d0
do Stage = 1, NumberOfStages
Q1 = Qsewage * Feed(Stage)
Q2 = QRAS * RASFeed(Stage)
dy(Stage, 1) = Q1 * sin.c.o2
+ Q2 * sRAS.c.o2
dy(Stage, 2) = Q1 * sin.c.sbod + Q2 * sRAS.c.sbod
! Volatile fatty acid term in STOAT used to hold the low molecular weight
soluble
! degradable COD fraction in Kapeller's model.
dy(Stage, 3) = Q1 * sin.c.vfa + Q2 * sRAS.c.vfa
dy(Stage, 4) = Q1 * sin.c.scod + Q2 * sRAS.c.scod
dy(Stage, 5) = Q1 * sin.c.nh3 + Q2 * sRAS.c.nh3
dy(Stage, 6) = Q1 * sin.c.no3 + Q2 * sRAS.c.no3
dy(Stage, 7) = Q1 * sin.c.no2 + Q2 * sRAS.c.no2
! Soluble degradable organic nitrogen fraction in STOAT used to hold the
! dissolved nitrous oxide (NO) component in Kapeller's model
dy(Stage, 8) = Q1 * sin.c.son + Q2 * sRAS.c.son
! Mapping STOAT components to Kapeller's model::
! Viable heterotrophs (XVIH)
: Floc formers
! Nonviable heterotrophs (XNVH)
: 'Bulking' biomass
! Viable autotrophs (XVIA)
: Nitrosomonas
! Nonviable autotrophs (XNVA)
: Nitrobacter
! Degradable particulate COD (XBOD): High-molecular weight particulate cOD
! Stored PHB (PHB1)
: Low-molecular weight particulate COD
! Stored PHB (PHB2)
: Surfactant COD
! Nondegradable COD (XCOD)
: Nondegradable COD
dy(Stage, 9) = Q1 * s2 * sin.c.XVIH + Q2 * s2 * sRAS.c.XVIH
dy(Stage, 10) = Q1 * s2 * sin.c.XNVH + Q2 * s2 * sRAS.c.XNVH
dy(Stage, 11) = Q1 * s2 * sin.c.XVIA + Q2 * s2 * sRAS.c.XVIA
dy(Stage, 12) = Q1 * s2 * sin.c.XNVA + Q2 * s2 * sRAS.c.XNVA
!
! Biomass COD was added to XBOD to ensure that the COD balance is correctly
! reported. In STOAT the biomass terms are reported as having units
! of suspended solids, not COD. We must subtract the
! biomass COD from XBOD before assigning it to the
! XH fraction in kapeller's model
!
XBOD1 = sin.c.xbod &
- s2 * (sin.c.xvih + sin.c.xnvh + sin.c.xvia + sin.c.xnva)
XBOD2 = sRAS.c.xbod &
- s2 * (sRAS.c.xvih + sRAS.c.xnvh + sRAS.c.xvia + sRAS.c.xnva)
dy(Stage, 13) = Q1 * XBOD1 + Q2 * XBOD2
dy(Stage, 14) = Q1 * sin.c.phb1 + Q2 * sRAS.c.phb1
dy(Stage, 15) = Q1 * sin.c.phb2 + Q2 * sRAS.c.phb2
dy(Stage, 16) = Q1 * sin.c.xcod + Q2 * sRAS.c.xcod
dy(Stage, 17) = Q1 * sin.c.xnvs + Q2 * sRAS.c.xnvs
if (Stage > 1) then
dy(Stage, :) = dy(Stage, :) + Qin * y(Stage - 1, :)
end if
! Add internal recycle flows
Qin = Q1 + Q2 + Qin
do i = 1, NumberOfRecycles
FromStage = From(i)
ToStage
= To(i)
QMLSS
= Q(i)
if (QMLSS < 0) QMLSS = abs(QMLSS) * Qsewage
if (FromStage .eq. Stage) then
Qin = Qin - QMLSS
31
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
precision::
32
!
! Assign kinetic values
!
mumaxF = p( 1) * exp(p( 2)
mumaxB = p( 3) * exp(p( 4)
mumaxNS = p( 5) * exp(p( 6)
mumaxNB = p( 7) * exp(p( 8)
bF
= p( 9) * exp(p(10)
bB
= p(11) * exp(p(12)
bNS
= p(13) * exp(p(14)
bNB
= p(15) * exp(p(16)
YF
= p(17)
YB
= p(18)
YNS
= p(19)
YNB
= p(20)
KO2F
= p(21)
KO2B
= p(22)
KO2NS
= p(23)
KO2NB
= p(24)
KO2NO2 = p(25)
KO2NO
= p(26)
KH
= p(27)
KHNO2
= p(28)
KLF
= p(29)
KLB
= p(30)
KLFNO2 = p(31)
KNH4F
= p(32)
KNH4B
= p(33)
KNH4NS = p(34)
KNH4NB = p(35)
KNO
= p(36)
KNO3
= p(37)
KNO2
= p(38)
KNO2NB = p(39)
beta1
= p(40)
beta2
= p(41)
beta3
= p(42)
beta4
= p(43)
beta5
= p(44)
beta6
= p(45)
beta7
= p(46)
iNO2
= p(47)
iNO3
= p(48)
iXBF
= p(49)
iXBB
= p(50)
iXBNS
= p(51)
iXBNB
= p(52)
iLysF
= p(53)
iLysB
= p(54)
iLysNS = p(55)
iLysNB = p(56)
iNH
= p(57)
iNL
= p(58)
fLHF
= p(59)
fLHB
= p(60)
fLHNS
= p(61)
fLHNB
= p(62)
fLLF
= p(63)
fLLB
= p(64)
fLLNS
= p(65)
fLLNB
= p(66)
fLSF
= p(67)
fLSB
= p(68)
fLSNS
= p(69)
fLSNB
= p(70)
fIF
= p(71)
fIB
= p(72)
*
*
*
*
*
*
*
*
(T
(T
(T
(T
(T
(T
(T
(T
15d0))
15d0))
15d0))
15d0))
15d0))
15d0))
15d0))
15d0))
33
fINS
= p(73)
fINB
= p(74)
kHi
= p(75) * exp(p(76) * (T - 15d0))
KLo
= p(77) * exp(p(78) * (T - 15d0))
KS
= p(78) * exp(p(80) * (T - 15d0))
betaH
= p(81)
betaL
= p(82)
beta_surf
= p(83)
KXSurf = p(84)
iTSSBM = p(85)
fH
= p(86)
fL
= p(87)
KO2Hyd = p(88)
KNO3Hyd = p(89)
KO2Surf = p(90)
KNO3Surf = p(91)
!
! Define stoichiometry matrix
!
! O2
s( 1, 1) = -(1d0
s( 1, 2) = -(1d0
s( 1, 10) = -(1d0
s( 1, 12) = -iNO2
s( 1, 14) = -iNO3
/
/
YF) / YF
YF) / YF
YB) / YB
YNS
YNB
! SI -- nondegradable, soluble
s( 4, 16) = fH
s( 4, 17) = fL
s( 4, 18) = fH
s( 4, 19) = fL
! SNH4
s( 5, 1)
s( 5, 2)
s( 5, 3)
s( 5, 4)
s( 5, 5)
s( 5, 6)
s( 5, 7)
s( 5, 8)
s( 5, 9)
s( 5, 10)
=
=
=
=
=
=
=
=
=
=
-iXBF
-iXBF
-iXBF
-iXBF
-iXBF
-iXBF
-iXBF
-iXBF
iLysF
-iXBB
34
s(
s(
s(
s(
s(
s(
s(
s(
s(
5,
5,
5,
5,
5,
5,
5,
5,
5,
11)
12)
13)
14)
15)
16)
17)
18)
19)
=
=
=
=
=
=
=
=
=
iLysB
-1d0 / YNS - iXBNS
iLysNS
-iXBNB
iLysNB
iNH
iNL
iNH
iNL
! SNO2
s( 6, 3)
s( 6, 4)
s( 6, 5)
s( 6, 6)
s( 6, 12)
s( 6, 14)
=
=
=
=
=
=
(1d0 - YF)
(1d0 - YF)
-(1d0 - YF)
-(1d0 - YF)
1d0 / YNS
-1d0 / YNB
/
/
/
/
(1.14d0
(1.14d0
(0.57d0
(0.57d0
*
*
*
*
YF)
YF)
YF)
YF)
! SNO3
s( 7, 3) = -(1d0 - YF) / (1.14d0 * YF)
s( 7, 4) = -(1d0 - YF) / (1.14d0 * YF)
s( 7, 14) = 1d0 / YNB
! SNO
s( 8,
s( 8,
s( 8,
s( 8,
5)
6)
7)
8)
YF)
YF)
YF)
YF)
/
/
/
/
(0.57d0
(0.57d0
(1.14d0
(1.14d0
*
*
*
*
YF)
YF)
YF)
YF)
! XF -- floc formers
s( 9, 1) = 1d0
s( 9, 2) = 1d0
s( 9, 3) = 1d0
s( 9, 4) = 1d0
s( 9, 5) = 1d0
s( 9, 6) = 1d0
s( 9, 7) = 1d0
s( 9, 8) = 1d0
s( 9, 9) = -1d0
! XB -- bulking biomass
s(10, 10) = 1d0
s(10, 11) = -1d0
! XNS -- Nitrosomonas
s(11, 12) = 1d0
s(11, 13) = -1d0
! XNB -- Nitrobacter
s(12, 14) = 1d0
s(12, 15) = -1d0
! XH -- high molecular weight, particulate
s(13, 16) = -1d0
s(13, 18) = -1d0
s(13, 20) = 1d0
s(13, 21) = 1d0
! XL -- low molecular weight, particulate
s(14, 17) = -1d0
s(14, 19) = -1d0
! XS -- surfactant, particulate
s(15, 9) = fLSF
s(15, 11) = fLSB
s(15, 13) = fLSNS
s(15, 15) = fLSNB
s(15, 20) = -1d0
35
36
OUR(Stage) = 0d0
NUR(Stage) = 0d0
do Reaction = 1, NumberofReactions
do Comp = 1, NumberOfComponents
if (s(Comp, Reaction) <> 0) then
dy(Stage, Comp) = dy(Stage, Comp) &
+ Rho(Reaction) * s(Comp, Reaction)
end if
end do
OUR(Stage) = Sum(Rho * s(1, :))
NUR(Stage) = Sum(Rho * s(6, :)) + Sum(Rho * s(7, :)) + Sum(Rho * s(8,
:))
end do
dy(Stage, 1) = dy(Stage, 1) + KLa(Stage) * Alpha(Stage) * (Beta(Stage) *
SatO2(T) - SO2)
QO2(Stage) = KLa(Stage) * Alpha(Stage) * (Beta(Stage) * SatO2(T) - SO2) *
Volume(Stage) * 1d-3 ! kg/h
end do
contains
double precision function ON(S, K)
double precision:: S, K
if (K == 0 .and. S == 0) then
ON = 0
else
ON = S / (K + abs(S))
endif
end function ON
double precision function OFF(S, K)
double precision:: S, K
OFF = K / (abs(S) + K)
end function OFF
double precision function SatO2(T)
double precision:: T
SatO2 = exp(1d0/(t*0.004065d0 + 0.372017d0))
end function SatO2
end
37