Stream element with an inlet, a mainstream outlet, and a sidestream outlet. More...
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 |
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.
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.
branch | 'Main'|'Side'|'Inlet' |
flow_ds | flow_data_source.TBD|.UPS|.DNS|.PRG |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
init_guess_lst | list of model components (concentrations) |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.bio.asm_reactor, and PooPyLab.unit_procs.streams.influent.
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.
limit | Limit within which the simulation is considered converged |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent, and PooPyLab.unit_procs.bio.asm_reactor.
def PooPyLab.unit_procs.streams.splitter.get_type | ( | self | ) |
Return the type string of the process unit.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.has_sidestream | ( | self | ) |
Return whether the unit has a sidestream.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
discharger | the process unit to be added to self._inlet; |
upst_branch | branch of the discharger to get flow from. |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
def PooPyLab.unit_procs.streams.splitter.has_discharger | ( | self | ) |
Return whether the unit's inlet has been connected.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.get_upstream | ( | self | ) |
Return the _inlet {} of the unit.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
def PooPyLab.unit_procs.streams.splitter.blend_inlet_comps | ( | self | ) |
Calculate the flow weighted average model component concentrations.
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
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.
discharger | An inlet unit to be removed. |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
def PooPyLab.unit_procs.streams.splitter.main_outlet_connected | ( | self | ) |
Return whether the mainstream outlet is connected.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.get_downstream_main | ( | self | ) |
Return the process unit connected at the mainstream outlet.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
flow | flow rate in m3/d, shall be no less than 0. |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
def PooPyLab.unit_procs.streams.splitter.get_main_outflow | ( | self | ) |
Return the mainstream outflow.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
def PooPyLab.unit_procs.streams.splitter.get_main_outlet_concs | ( | self | ) |
Return a copy of the mainstream outlet concentrations.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
rcvr | receiver of the current unit's sidestream outlet flow. |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.pipe.
def PooPyLab.unit_procs.streams.splitter.side_outlet_connected | ( | self | ) |
Return True if the main outlet is connected, False if not.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.get_downstream_side | ( | self | ) |
Return the process unit connected to the side outlet.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
flow | flow rate in m3/d, shall be no less than 0. |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.pipe.
def PooPyLab.unit_procs.streams.splitter.sidestream_flow_defined | ( | self | ) |
Return whether the sidestream flow rate has been defined.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.get_side_outflow | ( | self | ) |
Return the sidestream outlet flow rate.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
def PooPyLab.unit_procs.streams.splitter.get_side_outlet_concs | ( | self | ) |
Return a copy of the sidestream outlet concentrations.
None |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
dschgr | discharger |
flow | flow rate in m3/d |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
Reimplemented in PooPyLab.unit_procs.streams.influent.
|
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
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
|
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
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
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.
def PooPyLab.unit_procs.streams.splitter.get_TN | ( | self, | |
br = 'Main' |
|||
) |
Return the total nitrogen of the specified branch.
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
|
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.
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.
|
private |
Check the convergence of model components (concentrations).
curr_comps | current model components |
prev_comps | prevous round model components |
abs_lim | absolute limit for convergence |
Reimplemented from PooPyLab.unit_procs.base.poopy_lab_obj.
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.
setting | True/False |
Reimplemented in PooPyLab.unit_procs.physchem.final_clarifier.
|
private |
Sum up the model components indicated by the index_list.
branch | {'Inlet'|'Main'|'Side'} |
index_list | a list of indices for the model components to use |