The Brown Book
Documentation for the PooPyLab project
run.py File Reference

Namespaces

 run
 Global functions for running simulations.
 

Functions

def PooPyLab.utils.run.check_global_cnvg (wwtp)
 Check global convergence of the WWTP PFD. More...
 
def PooPyLab.utils.run.show_concs (wwtp)
 Print the concentrations of the branches of each unit in the WWTP's PFD. More...
 
def PooPyLab.utils.run._wwtp_active_vol (reactors=[])
 Return the sum of asm reactors' active volume. More...
 
def PooPyLab.utils.run.initial_guess (params={}, reactors=[], inf_flow=1.0, plant_inf=[])
 Return the initial guess as the start of integration towards steady state. More...
 
def PooPyLab.utils.run._forward (me, visited=[])
 Set the flow data source by visiting process units along the flow paths. More...
 
def PooPyLab.utils.run.forward_set_flow (wwtp)
 Set the _upstream_set_mo_flow flag of those influenced by the starters. More...
 
def PooPyLab.utils.run._BFS (_to_visit, _visited)
 Breadth First Search type of traverse. More...
 
def PooPyLab.utils.run.traverse_plant (wwtp, plant_inf)
 Visit every process units on the PFD starting from the influent. More...
 
def PooPyLab.utils.run._sum_of_known_inflows (me, my_inlet_of_unknown_flow)
 Return the sum of all known flow rates of the inlet of a process unit. More...
 
def PooPyLab.utils.run._backward (me)
 Set the flow data source by visiting process units against the flow paths. More...
 
def PooPyLab.utils.run.backward_set_flow (start=[])
 Back tracing to set the flows of the inlet units for those in starters. More...
 
def PooPyLab.utils.run.get_steady_state (wwtp=[], target_SRT=5, verbose=False, diagnose=False)
 Integrate the entire plant towards a steady state at the target SRT. More...
 

Function Documentation

◆ check_global_cnvg()

def PooPyLab.utils.run.check_global_cnvg (   wwtp)

Check global convergence of the WWTP PFD.

Parameters
wwtplist of process units in a WWTP's PFD
Return
bool

◆ show_concs()

def PooPyLab.utils.run.show_concs (   wwtp)

Print the concentrations of the branches of each unit in the WWTP's PFD.

Parameters
wwtplist of process units in a WWTP's PFD
Return
None

◆ _wwtp_active_vol()

def PooPyLab.utils.run._wwtp_active_vol (   reactors = [])
private

Return the sum of asm reactors' active volume.

Parameters
reactorslist of reactors whose active volumes are of interest.
Return
total active volume (float), m3

◆ initial_guess()

def PooPyLab.utils.run.initial_guess (   params = {},
  reactors = [],
  inf_flow = 1.0,
  plant_inf = [] 
)

Return the initial guess as the start of integration towards steady state.

The approach here is similar to that outlined in the IWA ASM1 report, where the total volume of all the reactors is treated as one CSTR.

Parameters
paramsmodel parameters adjusted to the project temperature;
reactorsreactors whose volume will be used;
inf_flowwwtp's influent flow rate, m3/d;
plant_infmodel components for the entire wwtp's influent.
Return
list of ASM 1 component concentrations [float]

◆ _forward()

def PooPyLab.utils.run._forward (   me,
  visited = [] 
)
private

Set the flow data source by visiting process units along the flow paths.

This function is to be called by forward_set_flow(). It follows the flow paths and decide whether additional flow data sources can be decided based on what's known.

Parameters
mecurrent process unit under analysis;
visistedlist of process units visited already.
Return
None
See
forward_set_flow().

◆ forward_set_flow()

def PooPyLab.utils.run.forward_set_flow (   wwtp)

Set the _upstream_set_mo_flow flag of those influenced by the starters.

Parameters
wwtplist of all units in a wwtp.
Return
None
See
_forward().
backward_set_flow();
_backward();
_sum_of_known_inflows().

◆ _BFS()

def PooPyLab.utils.run._BFS (   _to_visit,
  _visited 
)
private

Breadth First Search type of traverse.

Parameters
_to_visitlist of process units to be visited;
_visitedlist of process units visited.
Return
list of process units in their visited order.

◆ traverse_plant()

def PooPyLab.utils.run.traverse_plant (   wwtp,
  plant_inf 
)

Visit every process units on the PFD starting from the influent.

Parameters
wwtplist of all process units on the WWTP's PFD;
plant_infplant influent unit.
Return
None
See
_BFS();

◆ _sum_of_known_inflows()

def PooPyLab.utils.run._sum_of_known_inflows (   me,
  my_inlet_of_unknown_flow 
)
private

Return the sum of all known flow rates of the inlet of a process unit.

Parameters
mecurrent process unit;
my_inlet_of_unknown_flowdischarger w/ flow into "me" unknown.
Return
float, m3/d

◆ _backward()

def PooPyLab.utils.run._backward (   me)
private

Set the flow data source by visiting process units against the flow paths.

This function is to be called by backward_set_flow(). It decide whether additional flow data sources can be decided based on (_mo_flow + _so_flow). If so, proceed and set the inflow and trace further upstream of "me".

Parameters
mecurrent process unit under analysis;
visistedlist of process units visited already.
Return
None
See
backward_set_flow();
forward_set_flow();
_forward().

◆ backward_set_flow()

def PooPyLab.utils.run.backward_set_flow (   start = [])

Back tracing to set the flows of the inlet units for those in starters.

Parameters
startlist of units whose inflow = mainstream flow + sidestream flow.
Return
None
See
_backward();
forward_set_flow();
_forward();
_sum_of_known_inflows().

◆ get_steady_state()

def PooPyLab.utils.run.get_steady_state (   wwtp = [],
  target_SRT = 5,
  verbose = False,
  diagnose = False 
)

Integrate the entire plant towards a steady state at the target SRT.

Constant influent flows and loads are required. If the user only knows the dynamic influent characteristics, the averages should be used as the influent conditions.

Parameters
wwtpall process units in a wastewater treatment plant
target_SRTtarget solids retention time (d) for the steady state
verboseflag for more detailed output
diagnoseflag for the use of cProfile for performance analysis
Return
None
See
utils.pdf;
forward_set_flow();
backward_set_flow();
traverse_plant()