echo.models.base.edge module

class echo.models.base.edge.Edge(vertices: tuple[Port, Port], tariff: list | None = None, uid: str = NOTHING, edge_name: str = NOTHING)

Bases: object

Edges are used to connect nodes. For an edge (x, y) where x and y are nodes, the edge value is equal to the flow from x->y plus the flow from y->x.

add_edge_to_model(model: EchoConcreteModel) → None

Applies edge constraint: port1 = -1 *port2 to a concrete model.

Parameters:

model – pyomo concrete model

Returns:

None

add_vertices(obj1: Port, obj2: Port) → None

Adds edge vertices (which are ports on nodes)

Parameters:
  • obj1 – port object

  • obj2 – port object

Returns:

None

edge_name: str
get_max_flow_along_edge(forwards: bool = True) → ndarray | list | float | int | None

Returns the max flow along an edge.

Parameters:

forwards – True is flow is from the 0th port to the 1st port in self.vertices. False if from 1st to the 0th. Defaults to True.

Returns:

The max flow across this edge.

Return type:

ConstraintValueType

tariff: list | None
uid: str
verify_edge() → None

Verifies that flows on ports associated with either end of an edge are the same.

Returns:

None

Raises:

ConfigurationError – If the flows on the ports at either end of an edge are not the same.

vertices: tuple[Port, Port]