Activated Sludge Model No.2d (ASM2d)

class qsdsan.processes.ASM2d(components=None, iN_SI=0.01, iN_SF=0.03, iN_XI=0.02, iN_XS=0.04, iN_BM=0.07, iP_SI=0.0, iP_SF=0.01, iP_XI=0.01, iP_XS=0.01, iP_BM=0.02, iTSS_XI=0.75, iTSS_XS=0.75, iTSS_BM=0.9, f_SI=0.0, Y_H=0.625, f_XI_H=0.1, Y_PAO=0.625, Y_PO4=0.4, Y_PHA=0.2, f_XI_PAO=0.1, Y_A=0.24, f_XI_AUT=0.1, K_h=3.0, eta_NO3=0.6, eta_fe=0.4, K_O2=0.2, K_NO3=0.5, K_X=0.1, mu_H=6.0, q_fe=3.0, eta_NO3_H=0.8, b_H=0.4, K_O2_H=0.2, K_F=4.0, K_fe=4.0, K_A_H=4.0, K_NO3_H=0.5, K_NH4_H=0.05, K_P_H=0.01, K_ALK_H=0.1, q_PHA=3.0, q_PP=1.5, mu_PAO=1.0, eta_NO3_PAO=0.6, b_PAO=0.2, b_PP=0.2, b_PHA=0.2, K_O2_PAO=0.2, K_NO3_PAO=0.5, K_A_PAO=4.0, K_NH4_PAO=0.05, K_PS=0.2, K_P_PAO=0.01, K_ALK_PAO=0.1, K_PP=0.01, K_MAX=0.34, K_IPP=0.02, K_PHA=0.01, mu_AUT=1.0, b_AUT=0.15, K_O2_AUT=0.5, K_NH4_AUT=1.0, K_ALK_AUT=0.5, K_P_AUT=0.01, k_PRE=1.0, k_RED=0.6, K_ALK_PRE=0.5, path=None, **kwargs)

Activated Sludge Model No. 2d in original notation.

Parameters:
  • components (class:CompiledComponents, optional) – Components corresponding to each entry in the stoichiometry array, defaults to thermosteam.settings.chemicals.

  • iN_SI (float, optional) – Nitrogen content of inert soluble COD, in [g N/g COD]. The default is 0.01.

  • iN_SF (float, optional) – Nitrogen content of fermentable substrate, in [g N/g COD]. The default is 0.03.

  • iN_XI (float, optional) – Nitrogen content of inert particulate COD, in [g N/g COD]. The default is 0.02.

  • iN_XS (float, optional) – Nitrogen content of slowly biodegradable substrate, in [g N/g COD]. The default is 0.04.

  • iN_BM (float, optional) – Nitrogen content of biomass, in [g N/g COD]. The default is 0.07.

  • iP_SI (float, optional) – Phosphorus content of inert soluble COD, in [g P/g COD]. The default is 0.0.

  • iP_SF (float, optional) – Phosphorus content of fermentable substrate, in [g P/g COD]. The default is 0.01.

  • iP_XI (float, optional) – Phosphorus content of inert particulate COD, in [g P/g COD]. The default is 0.01.

  • iP_XS (float, optional) – Phosphorus content of slowly biodegradable substrate, in [g P/g COD]. The default is 0.01.

  • iP_BM (float, optional) – Phosphorus content of biomass, in [g P/g COD]. The default is 0.02.

  • iTSS_XI (float, optional) – TSS to COD ratio for inert particulate COD, in [g TSS/g COD]. The default is 0.75.

  • iTSS_XS (float, optional) – TSS to COD ratio for slowly biodegradable substrate, in [g TSS/g COD]. The default is 0.75.

  • iTSS_BM (float, optional) – TSS to COD ratio for biomass, in [g TSS/g COD]. The default is 0.9.

  • f_SI (float, optional) – Production of soluble inerts in hydrolysis, in [g COD/g COD]. The default is 0.0.

  • Y_H (float, optional) – Heterotrophic yield coefficient, in[g COD/g COD]. The default is 0.625.

  • f_XI_H (float, optional) – Fraction of inert COD generated in heterotrophic biomass lysis, in [g COD/g COD]. The default is 0.1.

  • Y_PAO (float, optional) – PAO yield coefficient, in[g COD/g COD]. The default is 0.625.

  • Y_PO4 (float, optional) – PP requirement (PO4 release) per PHA stored, in [g P/g COD]. The default is 0.4.

  • Y_PHA (float, optional) – PHA requirement for PP storage, in [g COD/g P]. The default is 0.2.

  • f_XI_PAO (float, optional) – Fraction of inert COD generated in PAO lysis, in [g COD/g COD]. The default is 0.1.

  • Y_A (float, optional) – Autotrophic yield, in [g COD/g N]. The default is 0.24.

  • f_XI_AUT (float, optional) – Fraction of inert COD generated in autotrophic biomass lysis, in [g COD/g COD]. The default is 0.1.

  • K_h (float, optional) – Hydrolysis rate constant, in [d^(-1)]. The default is 3.0.

  • eta_NO3 (float, optional) – Reduction factor for anoxic hydrolysis, dimensionless. The default is 0.6.

  • eta_fe (float, optional) – Anaerobic hydrolysis reduction factor, dimensionless. The default is 0.4.

  • K_O2 (float, optional) – O2 half saturation coefficient for hydrolysis, in [g O2/m^3]. The default is 0.2.

  • K_NO3 (float, optional) – Nitrate half saturation coefficient for hydrolysis, in [g N/m^3]. The default is 0.5.

  • K_X (float, optional) – Slowly biodegradable substrate half saturation coefficient for hydrolysis, in [g COD/g COD]. The default is 0.1.

  • mu_H (float, optional) – Heterotrophic maximum specific growth rate, in [d^(-1)]. The default is 6.0.

  • q_fe (float, optional) – Fermentation maximum rate, in [d^(-1)]. The default is 3.0.

  • eta_NO3_H (float, optional) – Reduction factor for anoxic heterotrophic growth, dimensionless. The default is 0.8.

  • b_H (float, optional) – Lysis and decay rate constant, in [d^(-1)]. The default is 0.4.

  • K_O2_H (float, optional) – O2 half saturation coefficient for heterotrophs, in [g O2/m^3]. The default is 0.2.

  • K_F (float, optional) – Fermentable substrate half saturation coefficient for heterotrophic growth, in [g COD/m^3]. The default is 4.0.

  • K_fe (float, optional) – Fermentable substrate half saturation coefficient for fermentation, in [g COD/m^3]. The default is 4.0.

  • K_A_H (float, optional) – VFA half saturation coefficient for heterotrophs, in [g COD/m^3]. The default is 4.0.

  • K_NO3_H (float, optional) – Nitrate half saturation coefficient for heterotrophs, in [g N/m^3]. The default is 0.5.

  • K_NH4_H (float, optional) – Ammonium (nutrient) half saturation coefficient for heterotrophs, in [g N/m^3]. The default is 0.05.

  • K_P_H (float, optional) – Phosphorus (nutrient) half saturation coefficient for heterotrophs, in [g P/m^3]. The default is 0.01.

  • K_ALK_H (float, optional) – Alkalinity half saturation coefficient for heterotrophs, in [mol(HCO3-)/m^3]. The default is 0.1.

  • q_PHA (float, optional) – Rate constant for storage of PHA, in [d^(-1)]. The default is 3.0.

  • q_PP (float, optional) – Rate constant for storage of PP, in [d^(-1)]. The default is 1.5.

  • mu_PAO (float, optional) – PAO maximum specific growth rate, in [d^(-1)]. The default is 1.0.

  • eta_NO3_PAO (float, optional) – Reduction factor for anoxic growth of PAO, dimensionless. The default is 0.6.

  • b_PAO (float, optional) – PAO lysis rate constant, in [d^(-1)]. The default is 0.2.

  • b_PP (float, optional) – PP lysis rate constant, in [d^(-1)]. The default is 0.2.

  • b_PHA (float, optional) – PHA lysis rate constant, in [d^(-1)]. The default is 0.2.

  • K_O2_PAO (float, optional) – O2 half saturation coefficient for PAO, in [g O2/m^3]. The default is 0.2.

  • K_NO3_PAO (float, optional) – Nitrate half saturation coefficient for PAO, in [g N/m^3]. The default is 0.5.

  • K_A_PAO (float, optional) – VFA half saturation coefficient for PAO, in [g COD/m^3]. The default is 4.0.

  • K_NH4_PAO (float, optional) – Ammonium (nutrient) half saturation coefficient for PAO, in [g N/m^3]. The default is 0.05.

  • K_PS (float, optional) – Phosphorus half saturation coefficient for storage of PP, in [g P/m^3]. The default is 0.2.

  • K_P_PAO (float, optional) – Phosphorus (nutrient) half saturation coefficient for PAO, in [g P/m^3]. The default is 0.01.

  • K_ALK_PAO (float, optional) – Alkalinity half saturation coefficient for PAO, in [mol(HCO3-)/m^3]. The default is 0.1.

  • K_PP (float, optional) – Poly-phosphate half saturation coefficient for storage of PHA, in [g P/g COD]. The default is 0.01.

  • K_MAX (float, optional) – Maximum ratio of poly-phosphate to PAO, in [g P/g COD]. The default is 0.34.

  • K_IPP (float, optional) – Inhibition coefficient for poly-phosphate storage, in [g P/g COD]. The default is 0.02.

  • K_PHA (float, optional) – PHA half saturation coefficient, in [g COD/g COD]. The default is 0.01.

  • mu_AUT (float, optional) – Autotrophic maximum specific growth rate, in [d^(-1)]. The default is 1.0.

  • b_AUT (float, optional) – Autotrophic decay rate, in [d^(-1)]. The default is 0.15.

  • K_O2_AUT (float, optional) – O2 half saturation coefficient for autotrophs, in [g O2/m^3]. The default is 0.5.

  • K_NH4_AUT (float, optional) – Ammonium (nutrient) half saturation coefficient for autotrophs, in [g N/m^3]. The default is 1.0.

  • K_ALK_AUT (float, optional) – Alkalinity half saturation coefficient for autotrophs, in [mol(HCO3-)/m^3]. The default is 0.5.

  • K_P_AUT (float, optional) – Phosphorus (nutrient) half saturation coefficient for autotrophs, in [g P/m^3]. The default is 0.01.

  • k_PRE (float, optional) – Rate constant for phosphorus precipitation with Fe(OH)3, in [m^3/g Fe(OH)3/d]. The default is 1.0.

  • k_RED (float, optional) – Rate constant for redissoluation of FePO4, in [d^(-1)]. The default is 0.6.

  • K_ALK_PRE (float, optional) – Alkalinity half saturation coefficient for P precipitation, in [mol(HCO3-)/m^3]. The default is 0.5.

  • path (str, optional) – Alternative file path for the Gujer matrix. The default is None.

Examples

>>> from qsdsan import processes as pc
>>> cmps = pc.create_asm2d_cmps()
>>> asm2d = pc.ASM2d()
>>> asm2d.show()
ASM2d([aero_hydrolysis, anox_hydrolysis, anae_hydrolysis, hetero_growth_S_F, hetero_growth_S_A, denitri_S_F, denitri_S_A, ferment, hetero_lysis, PAO_storage_PHA, aero_storage_PP, anox_storage_PP, PAO_aero_growth_PHA, PAO_anox_growth, PAO_lysis, PP_lysis, PHA_lysis, auto_aero_growth, auto_lysis, precipitation, redissolution])

References

[1] Henze, M.; Gujer, W.; Mino, T.; Loosdrecht, M. van. Activated Sludge Models: ASM1, ASM2, ASM2d and ASM3; IWA task group on mathematical modelling for design and operation of biological wastewater treatment, Ed.; IWA Publishing: London, 2000.

[2] Rieger, L.; Gillot, S.; Langergraber, G.; Ohtsuki, T.; Shaw, A.; Takács, I.; Winkler, S. Guidelines for Using Activated Sludge Models; IWA Publishing: London, New York, 2012; Vol. 11. https://doi.org/10.2166/9781780401164.

class qsdsan.processes.mASM2d(components=None, path=None, electron_acceptor_dependent_decay=True, pH_ctrl=7.0, f_SI=0.0, Y_H=0.625, Y_PAO=0.625, Y_PO4=0.4, Y_PHA=0.2, Y_A=0.24, f_XI_H=0.1, f_XI_PAO=0.1, f_XI_AUT=0.1, k_h=3.0, mu_H=6.0, mu_PAO=1.0, mu_AUT=1.0, q_fe=3.0, q_PHA=3.0, q_PP=1.5, b_H=0.4, b_PAO=0.2, b_PP=0.2, b_PHA=0.2, b_AUT=0.15, eta_NO3=0.6, eta_fe=0.4, eta_NO3_H=0.8, eta_NO3_PAO=0.6, eta_NO3_Hl=0.5, eta_NO3_PAOl=0.33, eta_NO3_PPl=0.33, eta_NO3_PHAl=0.33, eta_NO3_AUTl=0.33, K_O2=0.2, K_O2_H=0.2, K_O2_PAO=0.2, K_O2_AUT=0.5, K_NO3=0.5, K_NO3_H=0.5, K_NO3_PAO=0.5, K_NO3_AUT=0.5, K_X=0.1, K_F=4.0, K_fe=4.0, K_A_H=4.0, K_A_PAO=4.0, K_NH4_H=0.05, K_NH4_PAO=0.05, K_NH4_AUT=1.0, K_P_H=0.01, K_P_PAO=0.01, K_P_AUT=0.01, K_P_S=0.2, K_PP=0.01, K_MAX=0.34, K_IPP=0.02, K_PHA=0.01, k_mmp=(8.4, 240, 1.0, 72, 1.0, 1e-05, 1e-05), pKsp=(8.45, 13.5, 5.7, 29.1, 7.4, 18.2, 26.4), K_dis=(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), K_AlOH=0.001, K_FeOH=0.001, pKa=(14, 9.25, 6.37, 10.32, 2.12, 7.21, 12.32, 4.76), **kwargs)

Modified ASM2d. Compatible with ADM1p for plant-wide simulations. Includes an algebraic pH solver and precipitation/dissolution of common minerals.

Parameters:
  • components (CompiledComponents, optional) – Can be created with the create_masm2d_cmps function.

  • path (str, optional) – File path for an alternative Petersen Matrix. The default is None.

  • electron_acceptor_dependent_decay (bool, optional) – Whether biomass decay kinetics is dependent on concentrations of electron acceptors. The default is True.

  • pH_ctrl (float or None, optional) – Whether to fix pH at a specific value or solve for pH (None). The default is 7.0.

  • k_h (float, optional) – Hydrolysis rate constant, in [d^(-1)]. The default is 3.0.

  • eta_NO3_Hl (float, optional) – Anoxic reduction factor for endogenous respiration of heterotrophs, unitless. The default is 0.5.

  • eta_NO3_PAOl (float, optional) – Anoxic reduction factor for lysis of PAOs, unitless. The default is 0.33.

  • eta_NO3_PPl (float, optional) – Anoxic reduction factor for lysis of PP, unitless. The default is 0.33.

  • eta_NO3_PHAl (float, optional) – Anoxic reduction factor for lysis of PHA, unitless. The default is 0.33.

  • eta_NO3_AUTl (float, optional) – Anoxic reduction factor for decay of autotrophs, unitless. The default is 0.33.

  • K_NO3_AUT (float, optional) – Half saturation coefficient of NOx- for autotrophs [mg-N/L]. The default is 0.5.

  • K_P_S (float, optional) – Half saturation coefficient of ortho-P for PP storage [mg-P/L]. The default is 0.2.

  • k_mmp (iterable[float], optional) – Rate constants for multi-mineral precipitation/dissolution [mg-precipitate/L/(unit of solubility product)/d]. Follows the exact order of mASM2d._precipitates. The default is (5.0, 300, 0.05, 150, 50, 1.0, 1.0).

  • pKsp (iterable[float], optional) – Solubility of minerals, in order of mASM2d._precipitates. The default is (6.45, 13.16, 5.8, 23, 7, 21, 26).

  • K_dis (iterable[float], optional) – Saturation coefficient for the switching function of mineral dissolution [mg-precipitate/L]. The default is (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0).

  • K_AlOH (float, optional) – Half saturation coefficient of aluminum hydroxide for AlPO4 precipitation [mg-Al(OH)3/L]. The default is 0.001.

  • K_FeOH (float, optional) – Half saturation coefficient of ferric hydroxide for FePO4 precipitation [mg-Fe(OH)3/L]. The default is 0.001.

  • pKa (iterable[float], optional) – Equilibrium coefficient values of acid-base pairs, unitless, following the order of mASM2d._acid_base_pairs. The default is (14, 9.25, 6.37, 10.32, 2.12, 7.21, 12.32, 4.76).

Examples

>>> import qsdsan.processes as pc
>>> cmps = pc.create_masm2d_cmps()
>>> asm = pc.mASM2d()
>>> asm.show()
mASM2d([aero_hydrolysis, anox_hydrolysis, anae_hydrolysis, hetero_growth_S_F, hetero_growth_S_A, denitri_S_F, denitri_S_A, ferment, hetero_lysis, storage_PHA, aero_storage_PP, anox_storage_PP, PAO_aero_growth_PHA, PAO_anox_growth, PAO_lysis, PP_lysis, PHA_lysis, auto_aero_growth, auto_lysis, CaCO3_precipitation_dissolution, struvite_precipitation_dissolution, newberyite_precipitation_dissolution, ACP_precipitation_dissolution, MgCO3_precipitation_dissolution, AlPO4_precipitation_dissolution, FePO4_precipitation_dissolution])
>>> # Calculate process rate given state variable values and fixed pH.
>>> import numpy as np
>>> state_arr = np.ones(len(cmps))
>>> rhos = asm.rate_function(state_arr)  # reaction rate for each process
>>> for i,j in zip(asm.IDs, rhos):
...     print(f'{i}{(40-len(i))*" "}{j:.3g}')
aero_hydrolysis                         2.27
anox_hydrolysis                         0.182
anae_hydrolysis                         0.0606
hetero_growth_S_F                       0.471
hetero_growth_S_A                       0.471
denitri_S_F                             0.0503
denitri_S_A                             0.0503
ferment                                 0.0333
hetero_lysis                            0.356
storage_PHA                             0.594
aero_storage_PP                         1.06
anox_storage_PP                         0.0851
PAO_aero_growth_PHA                     0.778
PAO_anox_growth                         0.0622
PAO_lysis                               0.174
PP_lysis                                0.174
PHA_lysis                               0.174
auto_aero_growth                        0.33
auto_lysis                              0.111
CaCO3_precipitation_dissolution         0
struvite_precipitation_dissolution      0
newberyite_precipitation_dissolution    0
ACP_precipitation_dissolution           0
MgCO3_precipitation_dissolution         0
AlPO4_precipitation_dissolution         1.82e-11
FePO4_precipitation_dissolution         1.82e-11
>>> # Estimate pH given state variable values.
>>> Ka = asm.rate_function.params['Ka']
>>> unit_conversion = asm.rate_function.params['mass2mol']
>>> h_ion = asm.solve_pH(state_arr, Ka, unit_conversion)
>>> pH = -np.log10(h_ion)
>>> print(f'{pH:.2f}')
8.40

References

[1] Henze, M., Gujer, W., Mino, T., & van Loosdrecht, M. (2000). Activated Sludge Models: ASM1, ASM2, ASM2d and ASM3. In IWA task group on mathematical modelling for design and operation of biological wastewater treatment (Ed.), Scientific and Technical Report No. 9. IWA Publishing.

[2] Solon, K., Flores-Alsina, X., Kazadi Mbamba, C., Ikumi, D., Volcke, E. I. P., Vaneeckhaute, C., Ekama, G., Vanrolleghem, P. A., Batstone, D. J., Gernaey, K. V., & Jeppsson, U. (2017). Plant-wide modelling of phosphorus transformations in wastewater treatment systems: Impacts of control and operational strategies. Water Research, 113, 97–110. https://doi.org/10.1016/j.watres.2017.02.007

property electron_acceptor_dependent_decay

[bool] Whether the decay rate is dependent on electron acceptor (O2, NO3-) concentrations

set_parameters(**parameters)

Set values to stoichiometric and/or kinetic parameters.