Skip to content

Commit

Permalink
added doctest for AerobicDigester
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Nov 22, 2024
1 parent b120586 commit 0310be2
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 2 deletions.
3 changes: 2 additions & 1 deletion qsdsan/processes/_aerobic_digestion_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Please refer to https://github.com/QSD-Group/QSDsan/blob/main/LICENSE.txt
for license details.
'''

import numpy as np
from qsdsan import Process
from thermosteam import settings
_load_components = settings.get_default_chemicals
Expand Down Expand Up @@ -95,6 +95,7 @@ def __init__(self, ID, k_dig=0.04, components=None):
conserved_for=consrv,
parameters=('k_dig',))
self.k_dig=k_dig
self._stoichiometry = np.asarray(self._stoichiometry, dtype=float)

@property
def k_dig(self):
Expand Down
99 changes: 98 additions & 1 deletion qsdsan/sanunits/_suspended_growth_bioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,104 @@ def _design(self):
from ..processes import ASM_AeDigAddOn

class AerobicDigester(CSTR):
"""
Models an aerobic digester with activated sludge models, is a subclass of CSTR.
An additional degradation process of particulate inert organic materials is
considered in addition to typical activated sludge processes.
Parameters
----------
activated_sludge_model : :class:`CompiledProcesses`, optional
The activated sludge model used for the biochemical reactions. The default is None.
organic_particulate_inert_degradation_process : :class:`Process`, optional
The degradation process of the particulate inert organic materials. The default is None.
See Also
--------
:class:`qsdsan.processes.ASM1`
:class:`qsdsan.processes.ASM2d`
:class:`qsdsan.processes.mASM2d`
:class:`qsdsan.processes.ASM_AeDigAddOn`
:class:`qsdsan.sanunites.CSTR`
Examples
--------
>>> from qsdsan import WasteStream, processes as pc, sanunits as su
>>> cmps = pc.create_asm1_cmps()
>>> twas = WasteStream('thickened_WAS')
>>> twas.set_flow_by_concentration(
... flow_tot=50,
... concentrations=dict(
... S_I=30, S_S=1, X_I=17000, X_S=800, X_BH=38000, X_BA=2300,
... X_P=6500, S_O=0.5, S_NH=2, S_ND=1, X_ND=65, S_NO=10,
... S_N2=25, S_ALK=84),
... units=('m3/d', 'mg/L'))
>>> asm = pc.ASM1()
>>> AED = su.AerobicDigester('AED', ins=twas, outs=('digested_WAS',),
... V_max=3000, activated_sludge_model=asm,
... DO_ID='S_O', aeration=1.0)
>>> AED.simulate(t_span=(0, 400), method='BDF')
>>> AED.show()
AerobicDigester: AED
ins...
[0] thickened_WAS
phase: 'l', T: 298.15 K, P: 101325 Pa
flow (g/hr): S_I 62.5
S_S 2.08
X_I 3.54e+04
X_S 1.67e+03
X_BH 7.92e+04
X_BA 4.79e+03
X_P 1.35e+04
S_O 1.04
S_NO 20.8
S_NH 4.17
S_ND 2.08
X_ND 135
S_ALK 175
S_N2 52.1
H2O 1.99e+06
WasteStream-specific properties:
pH : 7.0
Alkalinity : 2.5 mg/L
COD : 64631.0 mg/L
BOD : 23300.3 mg/L
TC : 22923.3 mg/L
TOC : 22839.3 mg/L
TN : 4712.0 mg/L
TP : 1009.0 mg/L
TK : 223.2 mg/L
TSS : 48450.0 mg/L
outs...
[0] digested_WAS
phase: 'l', T: 298.15 K, P: 101325 Pa
flow (g/hr): S_I 62.5
S_S 3.58e+04
X_I 1.04e+04
X_S 123
X_BH 9.6e+03
X_BA 1.59e+03
X_P 2.77e+04
S_O 2.08
S_NO 4.17e+03
S_NH 0.101
S_ND 0.975
X_ND 8.74
S_N2 2.51e+03
H2O 2e+06
WasteStream-specific properties:
pH : 7.0
Alkalinity : 2.5 mg/L
COD : 40987.6 mg/L
BOD : 15416.1 mg/L
TC : 13985.1 mg/L
TOC : 13985.1 mg/L
TN : 3534.1 mg/L
TP : 458.2 mg/L
TK : 89.3 mg/L
TSS : 17813.2 mg/L
"""
def __init__(self, ID='', ins=None, outs=(), thermo=None,
init_with='WasteStream', V_max=1000, activated_sludge_model=None,
organic_particulate_inert_degradation_process=None,
Expand All @@ -1319,7 +1416,7 @@ def organic_particulate_inert_degradation_process(self, proc):
elif proc is None:
if self._model is None: self._dig_addon = None
else:
ID = self._model.ID + '_particulate_inert_degrade'
ID = self._model.__class__.__name__ + '_particulate_inert_degrade'
self._dig_addon = ASM_AeDigAddOn(
ID=ID,
components=self.thermo.chemicals
Expand Down

0 comments on commit 0310be2

Please sign in to comment.