The Brown Book
Documentation for the PooPyLab project
PooPyLab.unit_procs.streams.splitter Class Reference

Stream element with an inlet, a mainstream outlet, and a sidestream outlet. More...

Inheritance diagram for PooPyLab.unit_procs.streams.splitter:
PooPyLab.unit_procs.base.poopy_lab_obj PooPyLab.unit_procs.physchem.final_clarifier PooPyLab.unit_procs.streams.pipe PooPyLab.unit_procs.bio.asm_reactor PooPyLab.unit_procs.streams.effluent PooPyLab.unit_procs.streams.influent PooPyLab.unit_procs.streams.WAS

Public Member Functions

def __init__ (self)
 Constructor for "splitter".
 
def set_flow_data_src (self, branch='Main', flow_ds=flow_data_src.TBD)
 Set the flow data source of the branch specified by the user. More...
 
def get_flow_data_src (self)
 Return the flow data source tags of all three branches.
 
def assign_initial_guess (self, init_guess_lst)
 Assign the intial guess to the unit before simulation. More...
 
def is_converged (self, limit=1E-6)
 Return the convergence status of the unit. More...
 
def get_type (self)
 Return the type string of the process unit. More...
 
def has_sidestream (self)
 Return whether the unit has a sidestream. More...
 
def add_upstream (self, discharger, upst_branch='Main')
 Add the discharger's branch to inlet. More...
 
def has_discharger (self)
 Return whether the unit's inlet has been connected. More...
 
def get_upstream (self)
 Return the _inlet {} of the unit. More...
 
def totalize_inflow (self)
 Combine the individual flows specified in the self._inlet into one. More...
 
def blend_inlet_comps (self)
 Calculate the flow weighted average model component concentrations. More...
 
def update_combined_input (self)
 Update both total inflow and blended concentrations (model components).
 
def remove_upstream (self, discharger)
 Remove an existing discharger from inlet. More...
 
def set_downstream_main (self, rcvr)
 Define the main outlet by specifying the receiving process unit.
 
def main_outlet_connected (self)
 Return whether the mainstream outlet is connected. More...
 
def get_downstream_main (self)
 Return the process unit connected at the mainstream outlet. More...
 
def set_mainstream_flow_by_upstream (self, f=True)
 Set whether the mainstream flow = (total inflow - side outflow).
 
def set_mainstream_flow (self, flow=0)
 Define the mainstream outlet flow. More...
 
def get_main_outflow (self)
 Return the mainstream outflow. More...
 
def get_main_outlet_concs (self)
 Return a copy of the mainstream outlet concentrations. More...
 
def set_downstream_side (self, rcvr)
 Define the downstream side outlet's connection. More...
 
def side_outlet_connected (self)
 Return True if the main outlet is connected, False if not. More...
 
def get_downstream_side (self)
 Return the process unit connected to the side outlet. More...
 
def set_sidestream_flow (self, flow=0)
 Define the flow rate for the sidestream. More...
 
def sidestream_flow_defined (self)
 Return whether the sidestream flow rate has been defined. More...
 
def get_side_outflow (self)
 Return the sidestream outlet flow rate. More...
 
def get_side_outlet_concs (self)
 Return a copy of the sidestream outlet concentrations. More...
 
def set_flow (self, dschgr, flow)
 Specify the flow from the discharger. More...
 
def discharge (self)
 Pass the total flow and blended components to the downstreams. More...
 
def get_TSS (self, br='Main')
 Return the Total Suspended Solids of the specified branch.
 
def get_VSS (self, br='Main')
 Return the Volatile Suspended Solids of the specified branch.
 
def get_COD (self, br='Main')
 Return the Chemical Oxygen Demand (total) of the specified branch.
 
def get_sCOD (self, br='Main')
 Return the soluble COD of the specified branch.
 
def get_pCOD (self, br='Main')
 Return the particultate COD of the specified branch.
 
def get_TN (self, br='Main')
 Return the total nitrogen of the specified branch. More...
 
def get_orgN (self, br='Main')
 Return the organic nitrogen of the specified branch.
 
def get_inorgN (self, br='Main')
 Return the inorganic nitrogen of the specified branch.
 
def get_pN (self, br='Main')
 Return the particulate nitrogen of the specified branch.
 
def get_sN (self, br='Main')
 Return the soluble nitrogen of the specified branch.
 
def set_as_SRT_controller (self, setting=False)
 Set the current splitter as an Solids Retention Time controller. More...
 
def is_SRT_controller (self)
 Return whether a splitter is an SRT controller.
 

Private Member Functions

def _discharge_main_outlet (self)
 Pass the flow and concentrations to the main outlet. More...
 
def _discharge_side_outlet (self)
 Pass the flow and concentrations to the side outlet. More...
 
def _branch_flow_helper (self)
 Calculate 1 of the 3 branches' flow based on the other 2. More...
 
def _check_conc_cnvg (self, curr_comps=[], prev_comps=[], abs_lim=1E-6)
 Check the convergence of model components (concentrations). More...
 
def _sum_helper (self, branch='Main', index_list=[])
 Sum up the model components indicated by the index_list. More...
 

Private Attributes

 __name__
 
 _type
 type string of the process unit
 
 _inlet
 upstream units and their flows in the format of {unit: Flow}
 
 _main_outlet
 mainstream outlet, a single receiver
 
 _side_outlet
 sidestream outlet, a single receiver
 
 _has_discharger
 flag on whether there are upstream units
 
 _has_sidestream
 flag on whether there is a sidestream, always True for a splitter
 
 _mo_connected
 flag on whether the mainstream outlet is connected
 
 _so_connected
 flag on whether the sidestream outlet is connected
 
 _upstream_set_mo_flow
 whether the mainstream outflow is by inflow - sidestream outflow
 
 _in_flow_ds
 flow data source tag for inlet
 
 _mo_flow_ds
 flow data source tag for mainstream outlet
 
 _so_flow_ds
 flow data source tag for sidestream outlet
 
 _so_flow_defined
 flag to confirm it has received _so_flow > 0 m3/d
 
 _mo_flow
 mainstream outflow, m3/d
 
 _so_flow
 sidestream outflow, m3/d
 
 _total_inflow
 total inlet flow, m3/d
 
 _SRT_controller
 flag on whether this splitter is SRT controller
 
 _in_comps
 inlet model components
 
 _mo_comps
 mainstream outlet model components
 
 _so_comps
 sidestream outlet model components
 
 _prev_mo_comps
 mainstream outlet model components for the previous round
 
 _prev_so_comps
 sidestream outlet model components for the previous round
 
 _converged
 flag on convergence status
 

Static Private Attributes

int __id
 

Detailed Description

Stream element with an inlet, a mainstream outlet, and a sidestream outlet.

There are three connection points for the flows to get in and out of a splitter an inlet, a mainstream outlet, and a sidestream outlet.

General Functions
It is assumed that there is no significant biochemical reactions happening across a splitter unit. It only maintains the flow balance around the three connections. Therefore, the model components (as concentrations) are identical for all the connections after proper flow and load updates.
Flow balance is maintained using the flow data source tags of two of the three connection points (see below for more details).
Special Functions
When specified as an SRT (solids retention time) controller, a splitter would have to be connected with a WAS (waste activated sludge) unit at its sidestream.

Member Function Documentation

◆ set_flow_data_src()

def PooPyLab.unit_procs.streams.splitter.set_flow_data_src (   self,
  branch = 'Main',
  flow_ds = flow_data_src.TBD 
)

Set the flow data source of the branch specified by the user.

   This function helps to decide how a stream process unit (splitter,
   pipe, influent, effluent, WAS, etc.) performs flow balance
   calculations.

   For instance, if the user defines both the mainstream and sidestream
   outlet flow rates, then the inlet flow rate will be calculated as the
   sum of the two branches. As another example, if the user only defines
   the sidestream branch flow rate, then the mainstream branch flow will
   be determined as (total_inflow - sidestream_outflow).

   When setting the flow data source of a branch, the function will check
   to see whether the flow data sources for the other two brachnes can
   also be determined.
Parameters
branch'Main'|'Side'|'Inlet'
flow_dsflow_data_source.TBD|.UPS|.DNS|.PRG
Return
None
See
_branch_flow_helper(),
set_mainstream_flow_by_upstream(),
totalize_inflow(),
utils.flow_data_src.

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ assign_initial_guess()

def PooPyLab.unit_procs.streams.splitter.assign_initial_guess (   self,
  init_guess_lst 
)

Assign the intial guess to the unit before simulation.

   All three branches of a stream element will get the same model
   components.
Parameters
init_guess_lstlist of model components (concentrations)
Return
None

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.bio.asm_reactor, and PooPyLab.unit_procs.streams.influent.

◆ is_converged()

def PooPyLab.unit_procs.streams.splitter.is_converged (   self,
  limit = 1E-6 
)

Return the convergence status of the unit.

   This function checks the absolute changes of flows and concentrations
   between last round of simulation and current. If all changes are within
   the tolerance limit, it flags the self._converged True.

   The same absolute changes will be used in evaluting the convergence of
   splitter, clarifier, pipe, effluent, WAS, and other unit processes that
   do not have splicit definitions of change rate terms (dy/dt = f(...)).

   This function is redefined for unit processes like asm_reactor whose
   models have specific dy/dt terms.
Parameters
limitLimit within which the simulation is considered converged
Return
True/False
See
_check_conc_cnvg()

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent, and PooPyLab.unit_procs.bio.asm_reactor.

◆ get_type()

def PooPyLab.unit_procs.streams.splitter.get_type (   self)

Return the type string of the process unit.

Parameters
None
Return
str

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ has_sidestream()

def PooPyLab.unit_procs.streams.splitter.has_sidestream (   self)

Return whether the unit has a sidestream.

Parameters
None
Return
bool

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ add_upstream()

def PooPyLab.unit_procs.streams.splitter.add_upstream (   self,
  discharger,
  upst_branch = 'Main' 
)

Add the discharger's branch to inlet.

   This function add an upstream unit's (discharger's) outlet, as
   specified by the ups_branch parameter, to the current inlet.

   The function first checks whether the specified discharger is already
   in self._inlet. If so, does nothing. Otherwise, add the discharger into
   self._inlet and put 0.0 m3/d as a place holder for the corresponding
   flow rate.

   An error message will display if upst_branch is neither 'Main' nor
   'Side'. And the specified discharger will NOT be added to self._inlet
   as a result.

   After adding the discharger into self._inlet. This function calls the
   discharger's set_downstream_main()/set_downstream_side() to connect its
   mainstream/sidestream outlet to the current unit's inlet.

   Upon sucessful addition of the specified discharger and its branch, the
   self._has_discharger flag is set to True.
Parameters
dischargerthe process unit to be added to self._inlet;
upst_branchbranch of the discharger to get flow from.
See
set_downstream_main(),
set_downstream_side(),
remove_upstream().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ has_discharger()

def PooPyLab.unit_procs.streams.splitter.has_discharger (   self)

Return whether the unit's inlet has been connected.

Parameters
None
Return
bool

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ get_upstream()

def PooPyLab.unit_procs.streams.splitter.get_upstream (   self)

Return the _inlet {} of the unit.

Parameters
None
Return
{unit_addr: flow into self._inlet}

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ totalize_inflow()

def PooPyLab.unit_procs.streams.splitter.totalize_inflow (   self)

Combine the individual flows specified in the self._inlet into one.

   There are scenarios to be managed here:

       1) When the mainstream outlet branch's flow is to be calculated
       using the total inflow (self._upstream_set_mo_flow == True): The
       total inflow is calculated using the individual flows specified in
       self._inlet; and

       2) When both flow rates for the mainstream and sidestream outlet
       branches have been specified (either by user or simulation run
       time), i.e. self._upstream_set_mo_flow == False: the total inflow
       will be the sum of the two branches. This calculated total inflow
       is to be passed upstream by the main loop to maintain the WWTP's
       flow balance.
Parameters
None
Return
float
See
utils.datatypes.flow_data_src,
set_flow_data_src(),
set_mainstream_flow_by_upstream(),
_branch_flow_helper(),
blend_inlet_comps(),
update_combined_input().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ blend_inlet_comps()

def PooPyLab.unit_procs.streams.splitter.blend_inlet_comps (   self)

Calculate the flow weighted average model component concentrations.

Note
This function does not totalize inlet flow. It only uses the current flow rates. It is adviced to call totalize_inflow() first.
See
totalize_inflow()

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ remove_upstream()

def PooPyLab.unit_procs.streams.splitter.remove_upstream (   self,
  discharger 
)

Remove an existing discharger from inlet.

   This function first checks whether the specified discharger to be
   removed exists in self._inlet:

       If so, proceed and remove it from self._inlet. Then it finds
       out which branch of the discharger is originally connected to
       current unit's inlet, inform the original discharger to update its
       corresponding branch's connection. The _has_discharger flag will be
       checked and updated when an upstream discharger is removed
       successfully.

       If not, an error message will be displayed and nothing will be
       removed from the self._inlet.
Parameters
dischargerAn inlet unit to be removed.
Return
None
See
add_upstream()

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ main_outlet_connected()

def PooPyLab.unit_procs.streams.splitter.main_outlet_connected (   self)

Return whether the mainstream outlet is connected.

Parameters
None
Return
bool

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ get_downstream_main()

def PooPyLab.unit_procs.streams.splitter.get_downstream_main (   self)

Return the process unit connected at the mainstream outlet.

Parameters
None
Return
poopy_lab_obj

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ set_mainstream_flow()

def PooPyLab.unit_procs.streams.splitter.set_mainstream_flow (   self,
  flow = 0 
)

Define the mainstream outlet flow.

    If the specified flow is less than 0 m3/d, the current unit's
    mainstream outlet flow will be set to 0 m3/d. An error message will
    display.

    Upon successful setting of the mainstream flow rate, the mainstream
    outlet's flow data source will be set to flow_data_src.PRG, and the
    _upstream_set_mo_flow flag False.
Parameters
flowflow rate in m3/d, shall be no less than 0.
Return
None
See
set_sidestream_flow(),
totalize_inflow(),
set_flow_data_src().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ get_main_outflow()

def PooPyLab.unit_procs.streams.splitter.get_main_outflow (   self)

Return the mainstream outflow.

Parameters
None
Return
float, m3/d

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ get_main_outlet_concs()

def PooPyLab.unit_procs.streams.splitter.get_main_outlet_concs (   self)

Return a copy of the mainstream outlet concentrations.

Parameters
None
Return
list

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ set_downstream_side()

def PooPyLab.unit_procs.streams.splitter.set_downstream_side (   self,
  rcvr 
)

Define the downstream side outlet's connection.

   An influent unit can not receive any flow from the current unit. An
   error message will be displayed if the specified receiver is of the
   influent type.

   If the specified receiver is already connected to the current unit's
   sidestream outlet branch, nothing will be done.

   Successful connection of the receiver and current unit's sidestream
   outlet will set the _so_connected flag to True.
Parameters
rcvrreceiver of the current unit's sidestream outlet flow.
See
add_upstream(),
set_downstream_main().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.pipe.

◆ side_outlet_connected()

def PooPyLab.unit_procs.streams.splitter.side_outlet_connected (   self)

Return True if the main outlet is connected, False if not.

Parameters
None
Return
bool

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ get_downstream_side()

def PooPyLab.unit_procs.streams.splitter.get_downstream_side (   self)

Return the process unit connected to the side outlet.

Parameters
None
Return
poopy_lab_obj

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ set_sidestream_flow()

def PooPyLab.unit_procs.streams.splitter.set_sidestream_flow (   self,
  flow = 0 
)

Define the flow rate for the sidestream.

   If the specified flow is less than 0 m3/d, n error message will
   display.

   Upon successful setting of the sidestream flow rate, the sidestream
   outlet's flow data source will be set to flow_data_src.PRG.
Parameters
flowflow rate in m3/d, shall be no less than 0.
Return
None
See
set_mainstream_flow(),
totalize_inflow(),
set_flow_data_src().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.pipe.

◆ sidestream_flow_defined()

def PooPyLab.unit_procs.streams.splitter.sidestream_flow_defined (   self)

Return whether the sidestream flow rate has been defined.

Parameters
None
Return
bool

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ get_side_outflow()

def PooPyLab.unit_procs.streams.splitter.get_side_outflow (   self)

Return the sidestream outlet flow rate.

Parameters
None
Return
float

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ get_side_outlet_concs()

def PooPyLab.unit_procs.streams.splitter.get_side_outlet_concs (   self)

Return a copy of the sidestream outlet concentrations.

Parameters
None
Return
list

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ set_flow()

def PooPyLab.unit_procs.streams.splitter.set_flow (   self,
  dschgr,
  flow 
)

Specify the flow from the discharger.

   Please see the _discharge_main_outlet() and _discharge_side_outlet()
   for the use of this function.
Parameters
dschgrdischarger
flowflow rate in m3/d
Return
None
See
discharge().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.influent.

◆ _discharge_main_outlet()

def PooPyLab.unit_procs.streams.splitter._discharge_main_outlet (   self)
private

Pass the flow and concentrations to the main outlet.

   This function identifies the process unit connected to the mainstream
   outlet, then call its set_flow() and update_combined_input() so that
   the flow and concentrations from the current unit is passed onto the
   mainstream outlet.

See

discharge();
get_downstream_main();
set_flow();
update_combined_input();
_discharge_side_outlet();

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ _discharge_side_outlet()

def PooPyLab.unit_procs.streams.splitter._discharge_side_outlet (   self)
private

Pass the flow and concentrations to the side outlet.

   This function identifies the process unit connected to the sidestream
   outlet, then call its set_flow() and update_combined_input() so that
   the flow and concentrations from the current unit is passed onto the
   sidestream outlet.

See

discharge();
get_downstream_side();
set_flow();
update_combined_input();
_discharge_main_outlet();

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ discharge()

def PooPyLab.unit_procs.streams.splitter.discharge (   self)

Pass the total flow and blended components to the downstreams.

   Record the main- and sidestream outlet concentrations from the previous
   iteration. Update the concentrations for the two outlet branches. Pass
   the flows and concentrations onto the downstream units.
See
_branch_flow_helper();
_discharge_main_outlet();
_discharge_side_outlet().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.WAS, PooPyLab.unit_procs.streams.effluent, PooPyLab.unit_procs.streams.influent, and PooPyLab.unit_procs.physchem.final_clarifier.

◆ get_TN()

def PooPyLab.unit_procs.streams.splitter.get_TN (   self,
  br = 'Main' 
)

Return the total nitrogen of the specified branch.

TN = TKN + NOx_N

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ _branch_flow_helper()

def PooPyLab.unit_procs.streams.splitter._branch_flow_helper (   self)
private

Calculate 1 of the 3 branches' flow based on the other 2.

   1) Side outlet flow (_so_flow) can be set by
     1A) either WAS (_SRT_controller) or direct user input
     2A) upstream (non _SRT_controller)
   2) Main outlet flow (_mo_flow) can be set by
     2A) upstream automatically
     2B) direct user/run_time input
   3) Inlet flow is dependent on the two outlet branches' settings back
   tracing will be required to make sure flows are balanced if both main
   and side outlet flows are set either by user or run time SRT control.
See
set_flow_data_src(),
discharge().

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

Reimplemented in PooPyLab.unit_procs.streams.effluent, PooPyLab.unit_procs.streams.influent, and PooPyLab.unit_procs.streams.pipe.

◆ _check_conc_cnvg()

def PooPyLab.unit_procs.streams.splitter._check_conc_cnvg (   self,
  curr_comps = [],
  prev_comps = [],
  abs_lim = 1E-6 
)
private

Check the convergence of model components (concentrations).

Parameters
curr_compscurrent model components
prev_compsprevous round model components
abs_limabsolute limit for convergence
Retrun
list of bool for each model component's convergence status
See
is_converged()

Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.

◆ set_as_SRT_controller()

def PooPyLab.unit_procs.streams.splitter.set_as_SRT_controller (   self,
  setting = False 
)

Set the current splitter as an Solids Retention Time controller.

   There are specific rules for connected an SRT controlling splitter.
   Once set, the splitter shall have a sidestream connected to a pipe
   followed by a WAS (waste activated sludge) unit.

   Once set True, the sidestream flow will be determined during simulation
   by the downstream WAS unit.
Parameters
settingTrue/False
Return
None
See
utils.pfd.check();
utils.pfd._check_connection().

Reimplemented in PooPyLab.unit_procs.physchem.final_clarifier.

◆ _sum_helper()

def PooPyLab.unit_procs.streams.splitter._sum_helper (   self,
  branch = 'Main',
  index_list = [] 
)
private

Sum up the model components indicated by the index_list.

Parameters
branch{'Inlet'|'Main'|'Side'}
index_lista list of indices for the model components to use
Return
float

The documentation for this class was generated from the following file: