echo.models.base.transform module

class echo.models.base.transform.Transform(uid: str = NOTHING, lhs_terms: list[TransformTerm] = NOTHING, rhs: NumericExpression | float = 0)

Bases: object

An object for carrying a generic linear node transformation.

property lhs: list[TransformTerm]

lhs is an alias for lhs_terms

lhs_terms: list[TransformTerm]
rhs: NumericExpression | float
property transform_name: str
uid: str
class echo.models.base.transform.TransformNode(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: NumericExpression | float = 0, transformations: dict[str, Transform] = NOTHING)

Bases: Node

Implements node constraints using Transforms

add_emission_transformation(emitting_port: Port, carbon_port: Port, emission_factor: float) → None

Creates an emission transformation and adds to the node.

Parameters:
  • emitting_port – port object that generates emissions when exporting (when negative)

  • carbon_port – port object that represents carbon flows out of the node

  • emission_factor – a ratio = emissions generated/emitting unit generated (float), or an array of values

Returns:

None

add_input_output_transformation(input_port: Port, output_port: Port, input_weight: float) → None

Adds an input/output transformation to this node.

Parameters:
  • input_port – The input port for the transformation

  • output_port – The output port for the transformation

  • input_weight – The weighting for the TransformTerm of the input port.

Returns:

None

add_transformation(transformation_obj: Transform) → None

Adds a transformation object to a node.

Parameters:

transformation_obj – The Transform to be added to the node.

Returns:

None

apply_node_constraints(model: EchoConcreteModel) → None

Add the constraints assoicated with this node to a concrete model.

Parameters:

model – The concrete model the constraints associated with this node will be added to.

transformations: dict[str, Transform]
verify_node() → None

Checks if the node has ports (super), and if the node has transformations.

Returns:

None

Raises:

ConfigurationError – If no transformations are associated with this node.

class echo.models.base.transform.TransformTerm(var: 'Port', rule: 'TransformRule', weight: 'TimeExpandableType')

Bases: object

rule: TransformRule
var: Port
weight: float | list[float] | list[list[float]] | ndarray