node
This module consists of an abstract parent class, Node
, and a number of child classes,
e.g. Facility
, Tank
, Pump
, Digestion
, etc.
- class pype_schema.node.Aeration(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, tags={})[source]
A generic class for an aeration basin.
- Parameters:
id (str) – Aerator ID
input_contents (ContentsType or list of ContentsType) – Contents entering the aeration basin
output_contents (ContentsType or list of ContentsType) – Contents leaving the aeration basin
min_flow (pint.Quantity or int) – Minimum flow rate of a single aeration basin
max_flow (pint.Quantity or int) – Maximum flow rate of a single aeration basin
design_flow (pint.Quantity or int) – Design flow rate of a single aeration basin
num_units (int) – Number of aeration basins running in parallel
volume (pint.Quantity or int) – Volume of a single aeration basin in cubic meters
tags (dict of Tag) – Data tags associated with this aerator
- Variables:
id (str) – Aerator ID
input_contents (list of ContentsType) – Contents entering the aeration basin
output_contents (list of ContentsType) – Contents leaving the aeration basin
num_units (int) – Number of aeration basins running in parallel
volume (pint.Quantity or int) – Volume of a single aeration basin in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single aeration basin
max_flow (pint.Quantity or int) – Maximum flow rate of a single aeration basin
design_flow (pint.Quantity or int) – Design flow rate of a single aeration basin
- class pype_schema.node.Battery(id, energy_capacity, charge_rate, discharge_rate, rte, leakage, tags={})[source]
A generic battery with metadata such as roundtrip efficiency (RTE), energy capacity, and charge/discharge rates.
- Parameters:
id (str) – Battery ID
energy_capacity (int) – Energy storage capacity of the battery in kWh
charge_rate (int) – Maximum charge rate of the battery in kW
discharge_rate (int) – Maximum discharge rate of the battery in kW
rte (float) – Round trip efficiency of the battery
tags (dict of Tag) – Data tags associated with this battery
- Variables:
id (str) – Battery ID
input_contents (list of ContentsType) – Contents entering the battery.
output_contents (list of ContentsType) – Contents leaving the battery.
energy_capacity (int) – Energy storage capacity of the battery in kWh
charge_rate (int) – Maximum discharge rate of the battery in kW
discharge_rate (int) – Maximum discharge rate of the battery in kW
rte (float) – Round trip efficiency of the battery
leakage (pint.Quantity) – Leakage of the battery as a Pint Quantity
- class pype_schema.node.Boiler(id, input_contents, min_gen, max_gen, design_gen, num_units, tags={})[source]
A class representing a boiler that produces heat through natural gas combustion.
- Parameters:
id (str) – Boiler ID
input_contents (ContentsType or list of ContentsType) – Contents entering the boiler
min_gen (int) – Minimum generation capacity of a single boiler
max_gen (int) – Maximum generation capacity of a single boiler
design_gen (int) – Design generation capacity of a single boiler
num_units (int) – Number of boiler units running in parallel
tags (dict of Tag) – Data tags associated with this boiler
- Variables:
id (str) – Boiler ID
input_contents (list of ContentsType) – Contents entering the boiler (biogas, natural gas, or a blend of the two)
output_contents (list of ContentsType) – Contents leaving the boiler (Electricity)
min_gen (int) – Minimum generation capacity of a single boiler
max_gen (int) – Maximum generation capacity of a single boiler
design_gen (int) – Design generation capacity of a single boiler
- num_unitsint
Number of boiler units running in parallel
- tagsdict of Tag
Data tags associated with this boiler
- thermal_efficiencyfunction
Function which takes in the current kWh and returns the efficiency as a fraction
- class pype_schema.node.Chlorination(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, dosing_rate={}, residence_time=None, tags={})[source]
A class for a chlorination basin.
- Parameters:
id (str) – Chlorinator ID
input_contents (ContentsType or list of ContentsType) – Contents entering the chlorinator
output_contents (ContentsType or list of ContentsType) – Contents leaving the chlorinator
min_flow (pint.Quantity or int) – Minimum flow rate of a single chlorinator
max_flow (pint.Quantity or int) – Maximum flow rate of a single chlorinator
design_flow (pint.Quantity or int) – Design flow rate of a single chlorinator
num_units (int) – Number of chlorinators running in parallel
volume (pint.Quantity or int) – Volume of a single chlorinator in cubic meters
dosing_rate (dict of DosingType:float) – Dosing information for the chlorinator (key: DosingType, value: rate)
residence_time (pint.Quantity or float) – Residence time of the chlorinator
tags (dict of Tag) – Data tags associated with this chlorinator
- Variables:
id (str) – Chlorinator ID
input_contents (list of ContentsType) – Contents entering the chlorinator
output_contents (list of ContentsType) – Contents leaving the chlorinator
num_units (int) – Number of chlorinators running in parallel
volume (pint.Quantity or int) – Volume of a single chlorinator in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single chlorinator
max_flow (pint.Quantity or int) – Maximum flow rate of a single chlorinator
design_flow (pint.Quantity or int) – Design flow rate of a single chlorinator
dosing_rate (dict of DosingType:float) – Dosing information for the chlorinator (key: DosingType, value: rate)
residence_time (pint.Quantity or float) – Residence time of the chlorinator
tags (dict of Tag) – Data tags associated with this chlorinator
- class pype_schema.node.Clarification(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, tags={})[source]
A class representing a generic clarifier, sedimentation tank, or settling basin.
- Parameters:
id (str) – Clarifier ID
input_contents (ContentsType or list of ContentsType) – Contents entering the clarifier
output_contents (ContentsType or list of ContentsType) – Contents leaving the clarifier
min_flow (pint.Quantity or int) – Minimum flow rate of a single clarifier
max_flow (pint.Quantity or int) – Maximum flow rate of a single clarifier
design_flow (pint.Quantity or int) – Design flow rate of a single clarifier
num_units (int) – Number of clarifiers running in parallel
volume (pint.Quantity or int) – Volume of the clarifier in cubic meters
tags (dict of Tag) – Data tags associated with this clarifier
- Variables:
id (str) – Clarifier ID
input_contents (list of ContentsType) – Contents entering the clarifier
output_contents (list of ContentsType) – Contents leaving the clarifier
num_units (int) – Number of clarifiers running in parallel
volume (pint.Quantity or int) – Volume of a single clarifier in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single clarifier
max_flow (pint.Quantity or int) – Maximum flow rate of a single clarifier
design_flow (pint.Quantity or int) – Design flow rate of a single clarifier
tags (dict of Tag) – Data tags associated with this clarifier
- class pype_schema.node.Cogeneration(id, input_contents, min_gen, max_gen, design_gen, num_units, tags={})[source]
A class representing a cogeneration engine that produces both heat and electricity through biogas and/or natural gas combustion.
- Parameters:
id (str) – Cogenerator ID
input_contents (ContentsType or list of ContentsType) – Contents entering the cogenerator
min_gen (int) – Minimum generation capacity of a single cogenerator
max_gen (int) – Maximum generation capacity of a single cogenerator
design_gen (int) – Design generation capacity of a single cogenerator
num_units (int) – Number of cogenerator units running in parallel
tags (dict of Tag) – Data tags associated with this cogenerator
- Variables:
id (str) – Cogenerator ID
input_contents (list of ContentsType) – Contents entering the cogenerator (biogas, natural gas, or a blend of the two)
output_contents (list of ContentsType) – Contents leaving the cogenerator (Electricity)
min_gen (int) – Minimum generation capacity of a single cogenerator
max_gen (int) – Maximum generation capacity of a single cogenerator
design_gen (int) – Average generation capacity of a single cogenerator
num_units (int) – Number of cogenerator units running in parallel
tags (dict of Tag) – Data tags associated with this cogenerator
electrical_efficiency (function) – Function which takes in the current kWh and returns the electrical efficiency as a fraction
thermal_efficiency (function) – Function which takes in the current kWh and returns the thermal efficiency as a fraction
- set_electrical_efficiency(efficiency_curve)[source]
Set the cogeneration efficiency to the given function
- Parameters:
efficiency_curve (function) – function takes in the current kWh and returns the fractional efficency
- class pype_schema.node.Conditioning(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, tags={})[source]
A class for representing biogas conditioners. The conditioner prepares ‘raw’ biogas from the digester by removing impurities and readying it for combustion for Cogeneration.
- Parameters:
id (str) – Conditioner ID
input_contents (ContentsType or list of ContentsType) – Contents entering the biogas conditioner
output_contents (ContentsType or list of ContentsType) – Contents leaving the biogas conditioner
min_flow (pint.Quantity or int) – Minimum flow rate of a single biogas conditioner
max_flow (pint.Quantity or int) – Maximum flow rate of a single biogas conditioner
design_flow (pint.Quantity or int) – Design flow rate of a single biogas conditioner
num_units (int) – Number of biogas conditioners running in parallel
tags (dict of Tag) – Data tags associated with this biogas conditioner
- Variables:
id (str) – Conditioner ID
input_contents (list of ContentsType) – Contents entering the biogas conditioner
output_contents (list of ContentsType) – Contents leaving the biogas conditioner
num_units (int) – Number of biogas conditioners running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate of a single biogas conditioner
max_flow (pint.Quantity or int) – Maximum flow rate of a single biogas conditioner
design_flow (pint.Quantity or int) – Design flow rate of a single biogas conditioner
- class pype_schema.node.Digestion(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, digester_type, tags={})[source]
A class representing a sludge digester, either aerobic or anaerobic.
- Parameters:
id (str) – Digester ID
input_contents (ContentsType or list of ContentsType) – Contents entering the digester (e.g. biogas or wastewater)
output_contents (ContentsType or list of ContentsType) – Contents leaving the digester (e.g. biogas or wastewater)
min_flow (pint.Quantity or int) – Minimum flow rate through the digester
max_flow (pint.Quantity or int) – Maximum flow rate through the digester
design_flow (pint.Quantity or int) – Design flow rate through the digester
num_units (int) – Number of digesters running in parallel
volume (pint.Quantity or int) – Volume of the digester in cubic meters
digester_type (DigesterType) – Type of digestion (aerobic or anaerobic)
tags (dict of Tag) – Data tags associated with this digester
- Variables:
id (str) – Digester ID
input_contents (list of ContentsType) – Contents entering the digester (e.g. biogas or wastewater)
output_contents (list of ContentsType) – Contents leaving the digester (e.g. biogas or wastewater)
num_units (int) – Number of digesters running in parallel
volume (pint.Quantity or int) – Volume of the digester in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate through the digester
max_flow (pint.Quantity or int) – Maximum flow rate through the digester
design_flow (pint.Quantity or int) – Design flow rate through the digester
digester_type (DigesterType) – Type of digestion (aerobic or anaerobic)
tags (dict of Tag) – Data tags associated with this digester
- class pype_schema.node.Disinfection(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, dosing_rate={}, residence_time=None, tags={})[source]
A generic class for a disinfection process, such as chlorination, ozone, or UV light.
- Parameters:
id (str) – Disinfector ID
input_contents (ContentsType or list of ContentsType) – Contents entering the disinfector
output_contents (ContentsType or list of ContentsType) – Contents leaving the disinfector
min_flow (pint.Quantity or int) – Minimum flow rate of a single disinfector
max_flow (pint.Quantity or int) – Maximum flow rate of a single disinfector
design_flow (pint.Quantity or int) – Design flow rate of a single disinfector
num_units (int) – Number of disinfectors running in parallel
volume (pint.Quantity or int) – Volume of a single disinfectors in cubic meters
dosing_rate (dict of DosingType:float) – Dosing information for the disinfector (key: DosingType, value: rate)
residence_time (pint.Quantity or float) – Residence time of the disinfector
tags (dict of Tag) – Data tags associated with this disinfector
- Variables:
id (str) – Disinfector ID
input_contents (list of ContentsType) – Contents entering the disinfector
output_contents (list of ContentsType) – Contents leaving the disinfector
num_units (int) – Number of disinfector running in parallel
volume (pint.Quantity or int) – Volume of a single disinfector in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single disinfector
max_flow (pint.Quantity or int) – Maximum flow rate of a single disinfector
design_flow (pint.Quantity or int) – Design flow rate of a single disinfector
dosing_rate (dict of DosingType:float) – Dosing information for the disinfector (key: DosingType, value: rate)
residence_time (pint.Quantity or float) – Residence time of the disinfector
tags (dict of Tag) – Data tags associated with this disinfector
- class pype_schema.node.Facility(id, input_contents, output_contents, elevation, min_flow, max_flow, design_flow, tags={}, nodes={}, connections={})[source]
A class representing any industrial facility from wastewater treatment to desalination to solid waste management.
- Parameters:
id (str) – Facility ID
input_contents (ContentsType or list of ContentsType) – Contents entering the network.
output_contents (ContentsType or list of ContentsType) – Contents leaving the network.
elevation (pint.Quantity or int) – Elevation of the facility
min_flow (pint.Quantity or int) – Minimum flow rate through the facility
max_flow (pint.Quantity or int) – Maximum flow rate through the facility
design_flow (pint.Quantity or int) – Design flow rate through the facility
tags (dict of Tag) – Data tags associated with this facility
nodes (dict of Node) – nodes in the facility, e.g. pumps, tanks, or processes
connections (dict of Connections) – connections in the facility, e.g. pipes
- Variables:
id (str) – Facility ID
input_contents (list of ContentsType) – Contents entering the facility.
output_contents (list of ContentsType) – Contents leaving the facility.
elevation (pint.Quantity or int) – Elevation of the facility in meters above sea level
tags (dict of Tag) – Data tags associated with this facility
min_flow (pint.Quantity or int) – Minimum flow rate through the facility
max_flow (pint.Quantity or int) – Maximum flow rate through the facility
design_flow (pint.Quantity or int) – Design flow rate through the facility
nodes (dict of Node) – nodes in the facility, e.g. pumps, tanks, or processes
connections (dict of Connections) – connections in the facility, e.g. pipes
- class pype_schema.node.Filtration(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, dosing_rate={}, settling_time=0.0, tags={})[source]
The parent class for a wide range of filtration methods, such as sand filters, trickling filters, or reverse osmosis membranes.
- Parameters:
id (str) – Filter ID
input_contents (ContentsType or list of ContentsType) – Contents entering the filter
output_contents (ContentsType or list of ContentsType) – Contents leaving the filter
min_flow (pint.Quantity or int) – Minimum flow rate of a single filter
max_flow (pint.Quantity or int) – Maximum flow rate of a single filter
design_flow (pint.Quantity or int) – Design flow rate of a single filter
num_units (int) – Number of filters running in parallel
volume (pint.Quantity or int) – Volume of a single filter in cubic meters
dosing_rate (dict of DosingType:float) – Dosing information for the filter (key: DosingType, value: rate)
settling_time (float) – time it takes for the filter to reach the desired operation mode in seconds
tags (dict of Tag) – Data tags associated with this filter
- Variables:
id (str) – Filter ID
input_contents (list of ContentsType) – Contents entering the filter
output_contents (list of ContentsType) – Contents leaving the filter
num_units (int) – Number of filters running in parallel
volume (pint.Quantity or int) – Volume of a single filter in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single filter
max_flow (pint.Quantity or int) – Maximum flow rate of a single filter
design_flow (pint.Quantity or int) – Design flow rate of a single filter
dosing_rate (dict of DosingType:float) – Dosing information for the filter (key: DosingType, value: rate)
settling_time (float) – time it takes for the filter to reach the desired operation mode
- class pype_schema.node.Flaring(id, num_units, min_flow, max_flow, design_flow, tags={})[source]
- Parameters:
id (str) – Flare ID
num_units (int) – Number of flares running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate of a single flare
max_flow (pint.Quantity or int) – Maximum flow rate of a single flare
design_flow (pint.Quantity or int) – Design flow rate of a single flare
tags (dict of Tag) – Data tags associated with this flare
- Variables:
id (str) – Flare ID
input_contents (list of ContentsType) – Contents entering the flare
num_units (int) – Number of flares running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate of a single flare
max_flow (pint.Quantity or int) – Maximum flow rate of a single flare
design_flow (pint.Quantity or int) – Design flow rate of a single flare
- class pype_schema.node.Joint(id, input_contents, output_contents, tags={})[source]
A joint in the network, where multiple pipes meet.
- Parameters:
id (str) – Joint ID
input_contents (ContentsType or list of ContentsType) – Contents entering the joint
output_contents (ContentsType or list of ContentsType) – Contents leaving the joint
tags (dict of Tag) – Data tags associated with this joint
- class pype_schema.node.ModularUnit(id, input_contents, output_contents, num_units, tags={}, nodes={}, connections={})[source]
Modular Unit in the network, such as a reverse osmosis skid.
- Parameters:
id (str) – ModularUnit ID
input_contents (ContentsType or list of ContentsType) – Contents entering the ModularUnit.
output_contents (ContentsType or list of ContentsType) – Contents leaving the ModularUnit.
tags (dict of Tag) – Data tags associated with this ModularUnit
nodes (dict of Node) – nodes in the ModularUnit, e.g. pumps, tanks, or filters
connections (dict of Connections) – connections in the ModularUnit, e.g. pipes
num_units (int) – Number of units running in parallel
- Variables:
id (str) – ModularUnit ID
input_contents (list of ContentsType) – Contents entering the ModularUnit.
output_contents (list of ContentsType) – Contents leaving the ModularUnit.
tags (dict of Tag) – Data tags associated with this ModularUnit
nodes (dict of Node) – nodes in the ModularUnit, e.g. pumps, tanks, or filters
num_units (int) – Number of units running in parallel
connections (dict of Connections) – connections in the ModularUnit, e.g. pipes
- class pype_schema.node.Network(id, input_contents, output_contents, tags={}, nodes={}, connections={}, num_units=1)[source]
A water utility represented as a set of connections and nodes
- Parameters:
id (str) – Network ID
input_contents (ContentsType or list of ContentsType) – Contents entering the network.
output_contents (ContentsType or list of ContentsType) – Contents leaving the network.
tags (dict of Tag) – Data tags associated with this network
nodes (dict of Node) – nodes in the network, e.g. pumps, tanks, or facilities
connections (dict of Connections) – connections in the network, e.g. pipes
num_units (int, default 1) – Number of units in the network
- Variables:
id (str) – Network ID
input_contents (list of ContentsType) – Contents entering the network.
output_contents (list of ContentsType) – Contents leaving the network.
nodes (dict of Node) – nodes in the network, e.g. pumps, tanks, or facilities
connections (dict of Connections) – connections in the network, e.g. pipes
num_units (int) – Number of networks running in parallel
- add_connection(connection)[source]
Adds a connection to the network
- Parameters:
connection (Connection) – Connection object to add to the network
- add_node(node)[source]
Adds a node to the network
- Parameters:
node (Node) – Node object to add to the network
- get_list_of_type(desired_type, recurse=False)[source]
Searches the Facility and returns a list of all objects of desired_type
- Parameters:
desired_type (Node or Connection subclass)
recurse (bool) – Whether or not to get objects recursively. Default is False, meaning that only direct children will be returned.
- Returns:
Objects of desired_type inside this Facility. If recurse is True, all children, grandchildren, etc. are returned. If False, only direct children are returned.
- Return type:
list of desired_type
- remove_connection(connection_name, recurse=False)[source]
Removes a connection from the network :Parameters: * connection_name (str) – name of connection to remove
recurse (bool)
- Raises:
KeyError – if connection_name is not found
- remove_node(node_name, recurse=False)[source]
Removes a node from the network
- Parameters:
node_name (str) – name of node to remove
recurse (bool) – Whether or not to removed nodes recursively. Default is False, meaning that only direct children will be removed.
- Raises:
KeyError – if node_name is not found
- class pype_schema.node.Node[source]
Abstract class for all nodes
- Variables:
id (str) – Node ID
input_contents (list of ContentsType) – Contents entering the node.
output_contents (list of ContentsType) – Contents leaving the node.
- get_all_connections(recurse=False)[source]
Gets all Connection objects associated with this Node
- Parameters:
recurse (bool) – Whether or not to get connections recursively. Default is False, meaning that only direct children will be returned.
- Returns:
Connection objects inside this Node. If recurse is True, all children, grandchildren, etc. are returned. If False, only direct children are returned.
- Return type:
list of Connection
- get_all_connections_from(node)[source]
Gets all connections leaving the specified Node, including those from a different level of the hierarchy with exit_point specified.
Paremeters
- nodeNode
pype_schema Node object for which we want to get connections
- returns:
List of Connection objects leaving the specified node
- rtype:
list of Connection
- get_all_connections_to(node)[source]
Gets all connections entering the specified Node, including those from a different level of the hierarchy with entry_point specified.
Paremeters
- nodeNode
pype_schema Node object for which we want to get connections
- returns:
List of Connection objects entering the specified node
- rtype:
list of Connection
- get_all_nodes(recurse=False)[source]
Gets all Node objects associated with this Node
- Parameters:
recurse (bool) – Whether or not to get nodes recursively. Default is False, meaning that only direct children will be returned.
- Returns:
Node objects inside this Node. If recurse is True, all children, grandchildren, etc. are returned. If False, only direct children are returned.
- Return type:
- get_all_tags(virtual=True, recurse=False)[source]
Gets all Tag objects associated with this Node
- Parameters:
virtual (bool) – Whether to include VirtualTag objects or just regular Tag. True by default.
recurse (bool) – Whether or not to get tags recursively. Default is False, meaning that only tags involving direct children (and this Node itself) will be returned.
- Returns:
Tag objects inside this Node. If recurse is True, all children, grandchildren, etc. are returned. If False, only direct children are returned.
- Return type:
list of Tag and VirtualTag
- get_capacities()[source]
Gets a dictionary of capacity-related attributes
- Returns:
Dictionary of attribute names and values
- Return type:
- get_connection(connection_name, recurse=False)[source]
Get a connection from the network
- Parameters:
connection_name (str) – name of connection to retrieve
recurse (bool) – Whether or not to get connections recursively. Default is False, meaning that only direct children will be returned.
- Returns:
Connection object if node is found. None otherwise
- Return type:
Connection or None
- get_efficiencies()[source]
Gets a dictionary of efficiency-related attributes
- Returns:
Dictionary of attribute names and values
- Return type:
- get_node(node_name, recurse=False)[source]
Get a node from the network
- Parameters:
node_name (str) – name of node to retrieve
recurse (bool) – Whether or not to get nodes recursively. Default is False, meaning that only direct children will be returned.
- Returns:
Node object if node is found. None otherwise
- Return type:
Node or None
- get_node_or_connection(obj_id, recurse=False)[source]
Gets the Node or Connection object with name obj_id
- Parameters:
obj_id (str) – name of the object to query
recurse (bool) – Whether or not to get connections or nodes recursively. Default is False, meaning that only direct children will be returned.
- Returns:
object with the name obj_id
- Return type:
Node or Connection
- get_parent(child_obj)[source]
Gets the parent object of a Tag, Connection, or Node object, as long as both child_obj and its parent object are children of self
- Parameters:
child_obj (Tag, VirtualTag, Connection, or Node) – object for which we want the parent object
- Returns:
parent object of child_obj
- Return type:
Node or Connection
- get_parent_from_tag(tag)[source]
Gets the parent object of a Tag object, as long as both the tag and its parent object are children of self
- Parameters:
tag (Tag or VirtualTag) – object for which we want the parent object
- Returns:
parent object of the Tag
- Return type:
Node or Connection
- get_tag(tag_name, recurse=False)[source]
Gets the Tag object associated with tag_name
- Parameters:
tag_name (str)
recurse (bool) – Whether or not to get tags recursively. Default is False, meaning that only tags involving direct children (and this Node itself) will be returned.
- Returns:
pype_schema Tag object associated with the variable name. Returns None if the tag_name is not found
- Return type:
Tag or VirtualTag
- remove_tag(tag_name)[source]
Removes a tag from the node
- Parameters:
tag_name (str) – name of tag to remove
- select_objs(source_id=None, dest_id=None, source_unit_id=None, dest_unit_id=None, exit_point_id=None, entry_point_id=None, source_node_type=None, dest_node_type=None, exit_point_type=None, entry_point_type=None, contents_type=None, tag_type=None, obj_type=None, recurse=False)[source]
Selects from this Node all Node, Connection, or Tag objects which match source/destination node class, unit ID, and contents. (If none given, returns all objects in self)
- Parameters:
source_id (str) – Optional id of the source node to filter by. None by default
dest_id (str) – Optional id of the destination node to filter by. None by default
source_unit_id (int, str) – Optional unit id of the source to filter by. None by default
dest_unit_id (int, str) – Optional unit id of the destination to filter by. None by default
exit_point_id (str) – Optional id of the exit_point node to filter by. None by default
entry_point_id (str) – Optional id of the entry_point node to filter by. None by default
source_node_type (class) – Optional source Node subclass to filter by. None by default
dest_node_type (class) – Optional destination Node subclass to filter by. None by default
exit_point_type (class) – Optional exit_point Node subclass to filter by. None by default
entry_point_type (class) – Optional entry_point Node subclass to filter by. None by default
contents_type (ContentsType) – Optional contents to filter by. None by default
tag_type (TagType) – Optional tag type to filter by. None by default
obj_type ([Node, Connection, VirtualTag, Tag]) – The type of object to filter by. None by default
recurse (bool) – Whether to search for objects within nodes. False by default
- Raises:
ValueError – When a source/destination node type is provided to subset tags
TypeError – When the objects to select among are not of type {pype_schema.Tag, pype_schema.Connection, pype_schema.Node}
- Returns:
List of Tag, Connection, or Node objects subset according to source/destination id and contents_type
- Return type:
- select_tags(tag, source_id=None, dest_id=None, source_unit_id=None, dest_unit_id=None, exit_point_id=None, entry_point_id=None, source_node_type=None, dest_node_type=None, exit_point_type=None, entry_point_type=None, tag_type=None, recurse=False, virtual=False)[source]
Helper function for selecting Tag objects from inside a Node.
- Parameters:
tag (Tag) – Tag object to check against the search criteria
source_id (str) – Optional id of the source node to filter by. None by default
dest_id (str) – Optional id of the destination node to filter by. None by default
source_unit_id (int, str) – Optional unit id of the source to filter by. None by default
dest_unit_id (int, str) – Optional unit id of the destination to filter by. None by default
exit_point_id (str) – Optional id of the exit_point node to filter by. None by default
entry_point_id (str) – Optional id of the entry_point node to filter by. None by default
source_node_type (class) – Optional source Node subclass to filter by. None by default
dest_node_type (class) – Optional destination Node subclass to filter by. None by default
exit_point_type (class) – Optional exit_point Node subclass to filter by. None by default
entry_point_type (class) – Optional entry_point Node subclass to filter by. None by default
tag_type (TagType) – Optional tag type to filter by. None by default
recurse (bool) – Whether to search for objects within nodes. False by default
virtual (bool) – True if tag is being queried as part of a VirtualTag. False by default
- Returns:
True if tag meets the filtering criteria
- Return type:
- select_virtual_tags(virtual_tag, source_id=None, dest_id=None, source_unit_id=None, dest_unit_id=None, exit_point_id=None, entry_point_id=None, source_node_type=None, dest_node_type=None, exit_point_type=None, entry_point_type=None, tag_type=None, recurse=False)[source]
Helper function for selecting VirtualTag objects from inside a Node.
- Parameters:
virtual_tag (VirtualTag) – VirtualTag object to check against the search criteria
source_id (str) – Optional id of the source node to filter by. None by default
dest_id (str) – Optional id of the destination node to filter by. None by default
source_unit_id (int, str) – Optional unit id of the source to filter by. None by default
dest_unit_id (int, str) – Optional unit id of the destination to filter by. None by default
exit_point_id (str) – Optional id of the exit_point node to filter by. None by default
entry_point_id (str) – Optional id of the entry_point node to filter by. None by default
source_node_type (class) – Optional source Node subclass to filter by. None by default
dest_node_type (class) – Optional destination Node subclass to filter by. None by default
exit_point_type (class) – Optional exit_point Node subclass to filter by. None by default
entry_point_type (class) – Optional entry_point Node subclass to filter by. None by default
contents_type (ContentsType) – Optional contents to filter by. None by default
tag_type (TagType) – Optional tag type to filter by. None by default
recurse (bool) – Whether to search for objects within nodes. False by default
- Returns:
True if virtual_tag meets the filtering criteria
- Return type:
- set_contents(contents, attribute='input_contents')[source]
Set the input or output contents of a node
- Parameters:
contents (ContentsType or list of ContentsType) – Single value or list of ContentsType entering/exiting the node.
attribute ([“input_contents”, “output_contents”]) – Attribute to set (either input_contents or output_contents)
- class pype_schema.node.Pump(id, input_contents, output_contents, elevation, min_flow, max_flow, design_flow, power_rating, num_units, pump_type=PumpType.Constant, efficiency=None, tags={})[source]
Any kind of pump, such as constant speed, variable frequency drive (VFD), energy recovery device (ERD), and air blower.
- Parameters:
id (str) – Pump ID
input_contents (ContentsType or list of ContentsType) – Contents entering the pump
output_contents (ContentsType or list of ContentsType) – Contents leaving the pump
elevation (pint.Quantity or int) – Elevation of the pump in meters above sea level
power_rating (pint.Quantity or int) – Rated power of a single pump (in horsepower)
num_units (int) – Number of pumps running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate supplied by the pump
max_flow (pint.Quantity or int) – Maximum flow rate supplied by the pump
design_flow (pint.Quantity or int) – Design flow rate supplied by the pump
pump_type (PumpType) – Type of pump (either VFD, ERD, AirBlower or Constant)
efficiency (float) – efficiency of the pump
tags (dict of Tag) – Data tags associated with this pump
- Variables:
id (str) – Pump ID
input_contents (list of ContentsType) – Contents entering the pump
output_contents (list of ContentsType) – Contents leaving the pump
elevation (pint.Quantity or int) – Elevation of the pump in meters above sea level
power_rating (pint.Quantity or int) – Rated power of a single pump (in horsepower)
num_units (int) – Number of pumps running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate supplied by the pump
max_flow (pint.Quantity or int) – Maximum flow rate supplied by the pump
design_flow (pint.Quantity or int) – Design flow rate supplied by the pump
pump_type (PumpType) – Type of pump (either VFD, ERD, AirBlower or Constant)
pump_curve (function) – Function which takes in the current flow rate and returns the energy required to pump at that rate
- class pype_schema.node.ROMembrane(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, area, permeability, selectivity, dosing_rate={}, settling_time=0.0, tags={})[source]
A class for representing a reverse osmosis membrane process.
- Parameters:
id (str) – ROMembrane ID
input_contents (ContentsType or list of ContentsType) – Contents entering the RO membrane
output_contents (ContentsType or list of ContentsType) – Contents leaving the RO membrane
min_flow (pint.Quantity or int) – Minimum flow rate of the RO membrane
max_flow (pint.Quantity or int) – Maximum flow rate of the RO membrane
design_flow (pint.Quantity or int) – Design flow rate of a single filter
num_units (int) – Number of RO membranes running in parallel
volume (pint.Quantity or int) – Volume of the RO membrane in cubic meters
area (float) – Area of the RO membrane in square meters
permeability (float) – Permeability of the RO membrane
selectivity (float) – Selectivity of the RO membrane
dosing_rate (dict of DosingType:float) – Dosing information for the RO membrane (key: DosingType, value: rate)
settling_time (float) – time it takes for the filter to reach the desired operation mode
tags (dict of Tag) – Data tags associated with the RO membrane
- Variables:
id (str) – ROMembrane ID
input_contents (list of ContentsType) – Contents entering the RO membrane
output_contents (list of ContentsType) – Contents leaving the RO membrane
num_units (int) – Number of RO membranes running in parallel
volume (pint.Quantity or int) – Volume of a single filter in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single filter
max_flow (pint.Quantity or int) – Maximum flow rate of a single filter
design_flow (pint.Quantity or int) – Design flow rate of a single filter
area (float) – Area of the RO membrane in square meters
permeability (float) – Permeability of the RO membrane
selectivity (float) – Selectivity of the RO membrane
dosing_rate (dict of DosingType:float) – Dosing information for the RO membrane (key: DosingType, value: rate)
settling_time (float) – time it takes for the filter to reach the desired operation mode
tags (dict of Tag) – Data tags associated with the RO membrane
- class pype_schema.node.Reactor(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, residence_time, dosing_rate={}, pH=None, tags={})[source]
A reactor modeled as a basic tank with chemical dosing point(s).
- Parameters:
id (str) – Reactor ID
input_contents (ContentsType or list of ContentsType) – Contents entering the reactor
output_contents (ContentsType or list of ContentsType) – Contents leaving the reactor
min_flow (pint.Quantity or int) – Minimum flow rate through the reactor
max_flow (pint.Quantity or int) – Maximum flow rate through the reactor
design_flow (pint.Quantity or int) – Design flow rate through the reactor
num_units (int) – Number of reactor in parallel
volume (pint.Quantity or int) – Volume of the reactor in cubic meters
residence_time (pint.Quantity or float) – Residence time of the reactor
dosing_rate (dict of DosingType:float) – Dosing information for the reactor (key: DosingType, value: rate)
pH (float) – pH value for the reactor
tags (dict of Tag) – Data tags associated with this reactor
- Variables:
id (str) – Reactor ID
input_contents (list of ContentsType) – Contents entering the reactor
output_contents (list of ContentsType) – Contents leaving the reactor
min_flow (pint.Quantity or int) – Minimum flow rate through the reactor
max_flow (pint.Quantity or int) – Maximum flow rate through the reactor
design_flow (pint.Quantity or int) – Design flow rate through the reactor
num_units (int) – Number of reactors
volume (pint.Quantity or int) – Volume of the reactor in cubic meters
residence_time (pint.Quantity or float) – Residence time of the reactor
dosing_rate (dict of DosingType:float) – Dosing information for the reactor (key: DosingType, value: rate)
pH (float) – pH value for the reactor
num_units – Number of reactors in parallel
- class pype_schema.node.Reservoir(id, input_contents, output_contents, elevation, volume, tags={})[source]
A generic reservoir used to represent lakes and oceans in addition to manmade bodies of water.
- Parameters:
id (str) – Reservoir ID
input_contents (ContentsType or list of ContentsType) – Contents entering the reservoir.
output_contents (ContentsType or list of ContentsType) – Contents leaving the reservoir.
elevation (pint.Quantity or int) – Elevation of the reservoir in meters above sea level
volume (pint.Quantity or int) – Volume of the reservoir in cubic meters
tags (dict of Tag) – Data tags associated with this reservoir
- Variables:
id (str) – Reservoir ID
input_contents (list of ContentsType) – Contents entering the reservoir.
output_contents (list of ContentsType) – Contents leaving the reservoir.
elevation (pint.Quantity or int) – Elevation of the reservoir in meters above sea level
volume (pint.Quantity or int) – Volume of the reservoir in cubic meters
tags (dict of Tag) – Data tags associated with this reservoir
- class pype_schema.node.Screening(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, tags={})[source]
A class representing the screening process for removing large solids from the intake of a facility, such as a bar screen.
- Parameters:
id (str) – Screen ID
input_contents (ContentsType or list of ContentsType) – Contents entering the screen
output_contents (ContentsType or list of ContentsType) – Contents leaving the screen
min_flow (pint.Quantity or int) – Minimum flow rate of a single screen
max_flow (pint.Quantity or int) – Maximum flow rate of a single screen
design_flow (pint.Quantity or int) – Design flow rate of a single screen
num_units (int) – Number of screens running in parallel
tags (dict of Tag) – Data tags associated with this screen
- Variables:
id (str) – Screen ID
input_contents (list of ContentsType) – Contents entering the screen
output_contents (list of ContentsType) – Contents leaving the screen
num_units (int) – Number of screens running in parallel
min_flow (pint.Quantity or int) – Minimum flow rate of a single screen
max_flow (pint.Quantity or int) – Maximum flow rate of a single screen
design_flow (pint.Quantity or int) – Design flow rate of a single screen
- class pype_schema.node.StaticMixer(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, residence_time, dosing_rate={}, pH=None, tags={})[source]
A tank containing a static mixer, typically used for coagulation in water treatment.
- Parameters:
id (str) – StaticMixer ID
input_contents (ContentsType or list of ContentsType) – Contents entering the mixer
output_contents (ContentsType or list of ContentsType) – Contents leaving the mixer
min_flow (pint.Quantity or int) – Minimum flow rate through the mixer
max_flow (pint.Quantity or int) – Maximum flow rate through the mixer
design_flow (pint.Quantity or int) – Design flow rate through the mixer
num_units (int) – Number of mixers in parallel
volume (pint.Quantity or int) – Volume of the mixer in cubic meters
residence_time (pint.Quantity or float) – Residence time of the mixer
dosing_rate (dict of DosingType:float) – Dosing information for the mixer (key: DosingType, value: rate)
pH (float) – pH value for the mixer
tags (dict of Tag) – Data tags associated with this mixer
- Variables:
id (str) – StaticMixer ID
input_contents (list of ContentsType) – Contents entering the mixer
output_contents (list of ContentsType) – Contents leaving the mixer
min_flow (pint.Quantity or int) – Minimum flow rate through the mixer
max_flow (pint.Quantity or int) – Maximum flow rate through the mixer
design_flow (pint.Quantity or int) – Design flow rate through the mixer
num_units (int) – Number of mixers in parallel
volume (pint.Quantity or int) – Volume of the mixer in cubic meters
residence_time (pint.Quantity or float) – Residence time of the mixer
dosing_rate (dict of DosingType:float) – Dosing information for the mixer (key: DosingType, value: rate)
pH (float) – pH value for the mixer
- class pype_schema.node.Tank(id, input_contents, output_contents, elevation, volume, num_units=1, tags={})[source]
A generic class to represent a storage tank. Any input_contents and output_contents can be provided and metadata such as volume and elevation can be specified.
- Parameters:
id (str) – Tank ID
input_contents (ContentsType or list of ContentsType) – Contents entering the tank
output_contents (ContentsType or list of ContentsType) – Contents leaving the tank
elevation (pint.Quantity or int) – Elevation of the tank in meters above sea level
volume (pint.Quantity or int) – Volume of the tank in cubic meters
num_units (int) – Number of identical tanks in parallel
tags (dict of Tag) – Data tags associated with this tank
- Variables:
id (str) – Tank ID
input_contents (list of ContentsType) – Contents entering the tank.
output_contents (list of ContentsType) – Contents leaving the tank.
elevation (pint.Quantity or int) – Elevation of the tank in meters above sea level
volume (pint.Quantity or int) – Volume of the tank in cubic meters
num_units (int) – Number of identical tanks in parallel
- class pype_schema.node.Thickening(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, tags={})[source]
A class to represent a general thickener, such as gravity belt, dissolved air float (DAF), or centrifugal thickening.
- Parameters:
id (str) – Thickener ID
input_contents (ContentsType or list of ContentsType) – Contents entering the thickener
output_contents (ContentsType or list of ContentsType) – Contents leaving the thickener
min_flow (pint.Quantity or int) – Minimum flow rate of a single thickener
max_flow (pint.Quantity or int) – Maximum flow rate of a single thickener
design_flow (pint.Quantity or int) – Design flow rate of a single thickener
num_units (int) – Number of thickeners running in parallel
volume (pint.Quantity or int) – Volume of a single thickener in cubic meters
tags (dict of Tag) – Data tags associated with this thickener
- Variables:
id (str) – Thickener ID
input_contents (list of ContentsType) – Contents entering the thickener
output_contents (list of ContentsType) – Contents leaving the thickener
num_units (int) – Number of thickeners running in parallel
volume (pint.Quantity or int) – Volume of a single thickener in cubic meters
min_flow (pint.Quantity or int) – Minimum flow rate of a single thickener
max_flow (pint.Quantity or int) – Maximum flow rate of a single thickener
design_flow (pint.Quantity or int) – Design flow rate of a single thickener
tags (dict of Tag) – Data tags associated with this thickener
- class pype_schema.node.UVSystem(id, input_contents, output_contents, min_flow, max_flow, design_flow, num_units, volume, residence_time, intensity, area, tags={})[source]
- Parameters:
id (str) – UV System ID
input_contents (list of ContentsType) – Contents entering the UV system
output_contents (list of ContentsType) – Contents leaving the UV system
num_units (int) – Number of UV systems running in parallel
residence_time (pint.Quantity or float) – Time in seconds that the water is exposed to UV light
intensity (pint.Quantity or float) – Intensity of the UV light in W/m^2
area (pint.Quantity or float) – Application area of the UV light in m^2
tags (dict of Tag) – Data tags associated with this chlorinator
- Variables:
id (str) – UVSystem ID
num_units (int) – Number of chlorinators running in parallel
residence_time (pint.Quantity or float) – Time in seconds that the water is exposed to UV light
dosing_rate (dict of DosingType:float) – UV intensity in the UV system
dosing_area (dict of DosingType:float) – Area of the UV system that is exposed to UV light
tags (dict of Tag) – Data tags associated with this chlorinator