IWA’s Activated Sludge Model (ASM) model

There are four versions of activated sludge models developed by a task force of International Water Association: ASM1, ASM2, ASM2d AND ASM3. Most commercial sotewares are based on one of the four models especially ASM3. ASM are capable of simulating time curves of each operating parameter while mass balances are rigorously kept.

Table 1. IWA’s ASM models (IWA)

  ASM1 ASM2 ASM2d ASM3
Year

Published

1987 1995 1999 1999
Components COD, TN COD, TN, TP COD, TN, TP COD, TN, TP
Remark New comprehensive model Biological phosphorus removal was added to ASM1 Role of PAO in denitrification was added to ASM2 New discoveries were added to ASM2d

While the general concept of ASM is found here, following is one example of computer coding of ASM1 based on Matlab 4.1. As can be seen here, the codings for basic calculation are relatively simple and easy to follow.

———————————————————————————————————————————–

clear

dt = 0.5e-3; % day step size
days = 200; % day days of simulation
time=(0:dt:days);
QX=zeros(1:length(time));
FMA=QX;FMR=QX;SND=QX;SNH=QX;SNO=QX;SS=QX;XBA=QX;XBH=QX;XI=QX;XND=QX;XP=QX;XS=QX;

bA = 0.05; % g SS g COD-1 heterotrophic yield

bH = 0.22; % day-1 heterotrophic decay
fp = 0.08; % g non-biodegradable/g biomass
iXB= 0.086; % g N/g COD in biomass
iXP= 0.06; %
ka = 0.08;
kh = 3; % day-1 hydrolysis constant
KS = 20; % mg COD L-1 half reaction constant for COD removal
KOA=0.4; % mg O2 L-1 half reaction constant for O2 in anoxic tank
KOH=0.2;
KNH=1.0;
KNO=0.5;
KX =0.03;
YA =0.24; % g SS g COD-1 autotrophic yield
YH =0.67; % g SS g COD-1 heterotrophic yield
ng =0.8;
nh =0.4;
uA =0.8; % day-1 growth of autotrophic bacteria
uH =6.0; % day-1 growth of heterotrophic bacteria

Q0 = 30; % L day-1 influent flow rate
QX(1) = 0; % L day-1 daily sludge removal
SND0=15; % mg N L-1 soluble organic N
SNH0=15; % mg N L-1 NH4-N
SNO0=1; % mg N L-1 NO3-N
SO =2.0; % mg O2 L-1 DO in aeration tank
SS0=200; % mg O2 L-1 soluble COD in influent
VH=5; % L Volume of aeration tank
XI0=3; % mg L-1 inert material concentration in influent
XND0=9; % mg N L-1 particulate N in influent
XS0=100; % mg COD L-1 particulate COD in influent
XTE=0; % mg SS L-1 SS in effluent

% initial values
SND(1) = 5; % mg N L-1 soluble organic N in aeration tank
SNH(1) = 1; % mg N L-1 NH4-N in aeration tank
SNO(1) =20; % mg N L-1 NO3-N in aeration tank
SS(1) = 5; % mg COD L-1 soluble COD in aeration tank
XBA(1)=800; % mg COD L-1 autotrophic bacteria in aeration tank
XBH(1)=8000; % mg COD L-1 autotrophic bacteria in anoxic tank
XI(1)=10; % mg L-1 inert material concentration in anoxic tank
XND(1)=2; % mg N L-1 particulate N in aeration tank
XP(1)=12; % mg N L-1 particulate N in aeration tank
XS(1)=60; % mg N L-1 soluble N in aeration tank

TSS(1)=(XBA(1)+XBH(1)+XS(1)+XP(1))/1.2+XI(1); % mg SS L-1 Total current MLSS
TS=TSS(1)*VH;

for i=2:days/dt+1

r1 = uH*SS(i-1)/(KS+SS(i-1))*SO/(KOH+SO)*XBH(i-1);
r2 = uH*SS(i-1)/(KS+SS(i-1))*KOH/(KOH+SO)*SNO(i-1)/(KNO+SNO(i-1))*ng*XBH(i-1);
r3 = uA*SNH(i-1)/(KNH+SNH(i-1))*SO/(KOA+SO)*XBA(i-1);
r4 = bH*XBH(i-1);
r5 = bA*XBA(i-1);
r6 = ka*SND(i-1)*XBH(i-1);
r7 = kh*XS(i-1)/XBH(i-1)/(KX+XS(i-1)/XBH(i-1))*(SO/(KOH+SO)+nh*KOH/(KOH+SO)*SNO(i-1)/(KNO+SNO(i-1)))*XBH(i-1);
r8 = r7*XND(i-1)/XS(i-1);

XBA(i)=XBA(i-1)+(r3-r5-QX(i-1)*XBA(i-1)/VH)*dt;
XBH(i)=XBH(i-1)+(r1+r2-r4-QX(i-1)*XBH(i-1)/VH)*dt;
XS(i)=XS(i-1)+((Q0*XS0-QX(i-1)*XS(i-1))/VH+(1-fp)*(r4+r5)-r7)*dt;
XI(i)=XI(i-1)+(Q0*XI0-QX(i-1)*XI(i-1))/VH*dt;
XP(i)=XP(i-1)+(fp*(r4+r5)-QX(i-1)*XP(i-1)/VH)*dt;
SS(i)=SS(i-1)+((Q0*SS0-Q0*SS(i-1))/VH-1/YH*(r1+r2)+r7)*dt;
SNH(i)=SNH(i-1)+((Q0*SNH0-Q0*SNH(i-1))/VH-iXB*(r1+r2)-(iXB+1/YA)*r3+r6)*dt;
SNO(i)=SNO(i-1)+((Q0*SNO0-Q0*SNO(i-1))/VH-(1-YH)/2.86/YH*r2+r3/YA)*dt;
SND(i)=SND(i-1)+((Q0*SND0-Q0*SND(i-1))/VH-r6+r8)*dt;
XND(i)=XND(i-1)+((Q0*XND0-Q0*XND(i-1))/VH+(iXB-fp*iXP)*(r4+r5)-r8)*dt;

TSS(i)=(XBA(i)+XBH(i)+XS(i)+XP(i))/1.2+XI(i);

QX(i)=QX(i-1)+dt*0.001*(TSS(i)-8000);

if QX(i) < 0
QX(i)=0;
end
if QX(i) > 0.05*Q0
QX(i)=0.05*Q0;
end

end

FMA=Q0*(SS0+XS0)./(VH*(XBA+XBH)/1.2); % apparent F/M
FMR=Q0*(SS0+XS0)./(VH*(XBA+XBH)/1.2); % real F/M
NM=Q0*(SNH0+SNO0+SND0+XND0)./(VH*(XBA+XBH)/1.2);

r=XTE/(XBA(i)+XBH(i)+XS(i)+XI(i)*1.2+XP(i))*1.2;
XIE(i)=r*XI(i);

count=1;
table(count,:) = [time(1) QX(1) FMA(1) FMR(1) SND(1) SNH(1) SNO(1) SS(1) XBA(1) XBH(1) XI(1) XND(1) XP(1) XS(1)];
for k=1:(i-1)
if rem(k*dt, 0.5) == 0
count=count+1;
table(count,:) = [time(k) QX(k) FMA(k) FMR(k) SND(k) SNH(k) SNO(k) SS(k) XBA(k) XBH(k) XI(k) XND(k) XP(k) XS(k)];
end
end

save MBR6.txt table -ascii