echo.models.agnostic.time_varying module

class echo.models.agnostic.time_varying.TimeVaryingPiecewiseIONode(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, max_output: float | None = None, min_output: float | None = None, max_input: float | None = None, min_input: float | None = None, input_port_ref: str = 'input', output_port_ref: str = 'output', input_points: dict | None = None, output_points: dict | None = None, input_points_ref: str | None = None, output_points_ref: str | None = None, *, input_port_unit: Units, output_port_unit: Units)

Bases: InputOutputNode

A Node with an input and output and time varying piecewise relationship between input and output.

The relationship between input and output is defined at each time interval by an array of input–>output point pairs, which are used to construct a piecewise constraint. Attributes input_port_unit and output_port_unit define node’s commodity.

add_constant_input_points(input_points: float | int | list, time_periods: int, expansion_periods: int = 1) → None

Tiles constant input points array across time and expansion periods

add_constant_output_points(output_points: float | int | list, time_periods: int, expansion_periods: int = 1) → None

Tiles constant output points array across time and expansion periods.

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

input_points: dict | None
input_points_ref: str | None
load_input_output_values_from_profile(model: EchoConcreteModel, profile_df: DataFrame) → None

If input/output point string references are provided, load values from profile.

input_points_ref/output_points_ref will override input_points/output_points values provided in the instance’s attributes (if any) with values from profile dataframe.

output_points: dict | None
output_points_ref: str | None
verify_points_values() → None