echo.models.carbon package

class echo.models.carbon.CarbonAggregation(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0)

Bases: Node

This node has an additional variable, ‘total’, which equals the sum of all ports defined on the node.

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 total: str
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.carbon.CarbonPort(uid: str = NOTHING, port_name: str = NOTHING, initial_value: dict[tuple[int, int], float] | float = 0, initial_value_ref: str | None = None, initial_value_scaling: int | None = None, import_constraint_value: ConstraintValueType | None = None, export_constraint_value: ConstraintValueType | None = None, active_periods: dict[tuple[int, int], Any] | None = None, slack: bool = False, objective: en.numeric_expr.NumericExpression | float = 0, allow_dangling_port: bool = False, flows: Flows = Flows.Both, import_constraint: FlowConstraint = FlowConstraint.NoConstraint, export_constraint: FlowConstraint = FlowConstraint.NoConstraint, flow_type: OptimisationType = OptimisationType.Variable, units: Units = Units.CO2)

Bases: FlexPort

A flexible carbon port

units: Units
class echo.models.carbon.CarbonSink(uid: str = NOTHING, port_name: str = NOTHING, initial_value: dict[tuple[int, int], float] | float = 0, initial_value_ref: str | None = None, initial_value_scaling: int | None = None, import_constraint_value: ConstraintValueType | None = None, export_constraint_value: ConstraintValueType | None = None, active_periods: dict[tuple[int, int], Any] | None = None, slack: bool = False, objective: en.numeric_expr.NumericExpression | float = 0, allow_dangling_port: bool = False, import_constraint: FlowConstraint = FlowConstraint.NoConstraint, export_constraint: FlowConstraint = FlowConstraint.NoConstraint, flow_type: OptimisationType = OptimisationType.Variable, units: Units = Units.CO2, flows: Flows = Flows.Import)

Bases: CarbonPort

A variable sink of CO2

flows: Flows
class echo.models.carbon.CarbonSource(uid: str = NOTHING, port_name: str = NOTHING, initial_value: dict[tuple[int, int], float] | float = 0, initial_value_ref: str | None = None, initial_value_scaling: int | None = None, import_constraint_value: ConstraintValueType | None = None, export_constraint_value: ConstraintValueType | None = None, active_periods: dict[tuple[int, int], Any] | None = None, slack: bool = False, objective: en.numeric_expr.NumericExpression | float = 0, allow_dangling_port: bool = False, import_constraint: FlowConstraint = FlowConstraint.NoConstraint, export_constraint: FlowConstraint = FlowConstraint.NoConstraint, flow_type: OptimisationType = OptimisationType.Variable, units: Units = Units.CO2, flows: Flows = Flows.Export)

Bases: CarbonPort

A variable source of CO2

flows: Flows

Submodules