connection

This module consists of an abstract parent class, Connection, and three child classes, Pipe, Delivery, Wire, and Wireless.

class pype_schema.connection.Connection[source]

Abstract class for all connections

Variables:
  • id (str) – Connection ID

  • contents (ContentsType) – Contents moving through the node

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this connection

  • bidirectional (bool) – Whether flow can go from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

add_tag(tag)[source]

Adds a tag to the node

Parameters:

tag (Tag) – Tag object to add to the node

get_dest_id()[source]
Returns:

name of the destination node

Return type:

str

get_dest_node(recurse=False)[source]

Gets a connection’s destination node, returning its entry point if recurse is True

Parameters:

recurse (bool) – Return entry_point if True. Otherwise just return destination

Returns:

The destination node corresponding to connection

Return type:

pype_schema.Node

get_entry_point()[source]
Returns:

name of the entry point Node (if it exists - None otherwise)

Return type:

str

get_exit_point()[source]
Returns:

name of the exit point Node (if it exists - None otherwise)

Return type:

str

get_num_dest_units()[source]
Returns:

number of units in the destination node

Return type:

int

get_num_source_units()[source]
Returns:

number of units in the source node

Return type:

int

get_source_id()[source]
Returns:

name of the source node

Return type:

str

get_source_node(recurse=False)[source]

Gets a connection’s source node returning its exit point if recurse is True

Parameters:

recurse (bool) – Return exit_point if True. Otherwise just return source

Returns:

The source node corresponding to connection

Return type:

pype_schema.Node

get_tag(tag_name)[source]

Adds a tag to the node

Parameters:

tag_name (str) – Name of the tag to receive

remove_tag(tag_name)[source]

Removes a tag from the node

Parameters:

tag_name (str) – name of tag to remove

class pype_schema.connection.Delivery(id, contents, source, destination, tags={}, bidirectional=False, exit_point=None, entry_point=None)[source]

A class to represent a connection via delivery, such as monthly chemical deliveries or weekly trash disposal.

Parameters:
  • id (str) – Delivery ID

  • contents (ContentsType) – Contents moving through the connection

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • frequency (pint.Quantity or float) – If a pint quantity it will be interpreted based on units. E.g., 0.25 days will be interpreted as 0.25 days between deliveries, or in other words 4 deliveries per day. Whereas 0.25 / day would indicate there is a quarter of a delivery per day, or more intuitively 4 days between each delivery. If unitless, assumed to be number of days between delivery

  • tags (dict of Tag) – Data tags associated with this pump

  • bidirectional (bool) – Whether deliveries are made from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

Variables:
  • id (str) – Pipe ID

  • contents (ContentsType) – Contents moving through the connection.

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this pipe

  • bidirectional (bool) – Whether deliveries are made from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

class pype_schema.connection.Wire(id, contents, source, destination, tags={}, bidirectional=False, exit_point=None, entry_point=None)[source]

A class for representing electrical connections.

Parameters:
  • id (str) – Wire ID

  • contents (ContentsType) – Contents moving through the connection.

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this wire

  • bidirectional (bool) – Whether electricity can flow from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

Variables:
  • id (str) – Pipe ID

  • contents (ContentsType) – Contents moving through the connection.

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this pipe

  • bidirectional (bool) – Whether electricity can flow from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

class pype_schema.connection.Wireless(id, contents, source, destination, tags={}, bidirectional=False, exit_point=None, entry_point=None)[source]

A class for representing electrical connections.

Parameters:
  • id (str) – Wireless connection ID

  • contents (ContentsType) – Contents moving through the connection.

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this wire

  • bidirectional (bool) – Whether data can flow from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children

Variables:
  • id (str) – Pipe ID

  • contents (ContentsType) – Contents moving through the connection.

  • source (Node) – Starting point of the connection

  • destination (Node) – Endpoint of the connection

  • tags (dict of Tag) – Data tags associated with this pipe

  • bidirectional (bool) – Whether data can flow from destination to source. False by default

  • exit_point (Node) – The child node from which this connection leaves its source. Default is None, indicating the source does not have any children

  • entry_point (Node) – The child node at which this connection enters its destination. Default is None, indicating the destination does not have any children