echo.models.agnostic.aggregation module

class echo.models.agnostic.aggregation.AggregationNode(uid: str = NOTHING, node_name: str = NOTHING, objective: NumericExpression | float = 0, ports: dict[str, Port] = NOTHING, *, port_units: Units)

Bases: Node

Arbitrary commodity aggregation node.

This node has an additional variable, ‘total’, which equals the sum of all ports defined on the node. port_units attribute is used for validation, all ports must be the same commodity.

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.

add_port(name: str, port: FlexSink | None = None) → 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

port_units: Units
ports: dict[str, Port]
property total: 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.