echo.models.agnostic.tellegen package

class echo.models.agnostic.tellegen.MultiCommodityTellegenNode(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: NumericExpression | float = 0)

Bases: Node

A node with ports that have multiple commodities. A tellegen constraint is applied per commodity.

apply_node_constraints(model: EchoConcreteModel) → None

Apply Tellegen constraint for same commodity ports.

class echo.models.agnostic.tellegen.PartitionedMultiCommodityTellegenNode(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: NumericExpression | float = 0, partitions: dict[str, list[Port]] = NOTHING, default_partition: str = 'default_partition')

Bases: Node

A node with partitions of ports, ports in each partition may have multiple commodities. A tellegen constraint is applied per partition per commodity.

add_port(name: str, port: Port, partition: str | None = None) → None

Override base add_port method, add addition argument which is partition name to which add the port.

If partition is not specified, adds to the default partition.

apply_node_constraints(model: EchoConcreteModel) → None

Apply Tellegen constraint for same commodity ports within each partition.

default_partition: str
partitions: dict[str, list[Port]]
class echo.models.agnostic.tellegen.TellegenNode(uid: str = NOTHING, node_name: str = NOTHING, objective: NumericExpression | float = 0, ports: dict[str, Port] = NOTHING)

Bases: Node

A node that implements a Tellegen constraint requiring that port values sum to zero.

add_port(name: str, port: Port) → None
apply_node_constraints(model: EchoConcreteModel) → None

Apply constraints associated with this node to a concrete model.

Intended to be overridden in subclasses.

Define constraints as functions that returns a Constraint, EqualityExpression or InequalityExpression.

Define a subfunction of the form detailed in the example below, then apply with setattr. For example:

def apply_node_constraints(self, model: EchoConcreteModel) -> None:
def tellegen_node_rule(model: EchoConcreteModel, p: int, t:int) -> EqualityExpression:

a = 0 for port in node_ports.values():

a += getattr(model, port.port_name)[p, t]

return a == 0

node_ports = self.ports con_name = “reliability_con_” + self.node_name setattr(model, con_name, en.Constraint(model.Expansion, model.Time, rule=tellegen_node_rule))

Parameters:

model – The model to add the constraints to.

Returns:

None

ports: dict[str, Port]
property units: Units | None
verify_node() → None

Checks there is at least one port associated with this node.

Raises:

ConfigurationError – If there are no ports present on this node.

class echo.models.agnostic.tellegen.ThreeWayValveNode(uid: str = NOTHING, node_name: str = NOTHING, objective: NumericExpression | float = 0, ports: dict[str, Port] = NOTHING, input_port_name: str = 'input_port', output_port_name_1: str = 'output_port_1', output_port_name_2: str = 'output_port_2', mutually_exclusive_port_flows: tuple[str, str] = None, *, units: Units)

Bases: TellegenNode

A node that implements a Tellegen constraint requiring that port values sum to zero.

ThreeWayValveNode node implements additional constraints between ports, there is one input (import) port and two output (export) ports. At each time the flow is allowed through only one output port.

add_node_to_model(model: EchoConcreteModel, profile: DataFrame) → None

Add this node to a concrete model.

Parameters:
  • model – The concrete model to add the node to.

  • profile – The data associated with this node.

apply_node_constraints(model: EchoConcreteModel) → None

Apply constraints associated with this node to a concrete model.

Intended to be overridden in subclasses.

Define constraints as functions that returns a Constraint, EqualityExpression or InequalityExpression.

Define a subfunction of the form detailed in the example below, then apply with setattr. For example:

def apply_node_constraints(self, model: EchoConcreteModel) -> None:
def tellegen_node_rule(model: EchoConcreteModel, p: int, t:int) -> EqualityExpression:

a = 0 for port in node_ports.values():

a += getattr(model, port.port_name)[p, t]

return a == 0

node_ports = self.ports con_name = “reliability_con_” + self.node_name setattr(model, con_name, en.Constraint(model.Expansion, model.Time, rule=tellegen_node_rule))

Parameters:

model – The model to add the constraints to.

Returns:

None

property binary_variable_flow_through_mutually_exclusive_port_1: str
property constraint_neg_flow_mutually_exclusive_port_1: str
property constraint_neg_flow_mutually_exclusive_port_2: str
property constraint_pos_flow_mutually_exclusive_port_1: str
property constraint_pos_flow_mutually_exclusive_port_2: str
create_ports() → None
input_port_name: str
mutually_exclusive_port_flows: tuple[str, str]
output_port_name_1: str
output_port_name_2: str
set_ports(input_port: FlexSink, output_port_1: FlexSource, output_port_2: FlexSource) → None
units: Units

Submodules