echo.models.base.port module
- class echo.models.base.port.Port(uid: str = NOTHING, port_name: str = NOTHING, units: Units = Units.NA, initial_value: dict[tuple[int, int], float] | float = 0, initial_value_ref: str | None = None, initial_value_scaling: int | None = None, flow_type: OptimisationType = OptimisationType.NA, flows: Flows = Flows.NA, import_constraint: FlowConstraint = FlowConstraint.NA, import_constraint_value: ndarray | list | float | int | None = None, export_constraint: FlowConstraint = FlowConstraint.NA, export_constraint_value: ndarray | list | float | int | None = None, active_periods: dict[tuple[int, int], Any] | None = None, slack: bool = False, objective: NumericExpression | float = 0, allow_dangling_port: bool = False)
Bases:
object- active_periods: dict[tuple[int, int], Any] | None
- add_objective(model: EchoConcreteModel) None
Populates the port attribute ‘objectives’ with any pyomo expressions that are needed :param model: pyomo concrete model
- add_port_to_model(model: EchoConcreteModel, profile: DataFrame | None) None
Creates pyomo vars, params, and constraints for the port.
- allow_dangling_port: bool
- constrain_pos_neg(model: EchoConcreteModel) None
Applies a mixed integer constraint that splits a port var into positive and negative components
- property export_con_val: str
- export_constraint: FlowConstraint
- export_constraint_value: ndarray | list | float | int | None
- property export_slack: str
- property export_slack_max: str
- static factory_pos_neg_flows(var_name: str, pos_name: str, neg_name: str) Callable
- flow_type: OptimisationType
- property import_con_val: str
- import_constraint: FlowConstraint
- import_constraint_value: ndarray | list | float | int | None
- property import_slack: str
- property import_slack_max: str
- initial_value: dict[tuple[int, int], float] | float
- initial_value_ref: str | None
- initial_value_scaling: int | None
- property is_pos: str
- property neg: str
- objective: NumericExpression | float
- port_name: str
- property pos: str
- process_initial_value(initial_val: dict[tuple[int, int], int | float] | list[int | float] | ndarray | str, expansion_periods: int = 1, time_periods: int | None = None) None
- set_active_periods_from_array(array: list[bool] | list[int], expansion_periods: int = 1, time_periods: int | None = None) None
Sets port active periods
- Parameters:
array – array, list of active periods as bool values
expansion_periods – number of expansion periods (int)
- set_flow_constraints(max_import: ndarray | list | float | int | None, max_export: ndarray | list | float | int | None, slack: bool | None = False) None
Sets the values of port flow constraints.
- Parameters:
max_import – max allowable import into port (float, array, or None)
max_export – max allowable export out of port (float, array, or None)
slack – bool, whether we want to allow slack in the constraint
- set_initial_value(initial_value: dict) None
Sets initial port value which will be used to initialise the pyomo var/param
- Parameters:
initial_value – dict of initial values
- Returns:
None
- set_initial_value_from_array(array: list[float] | ndarray, expansion_periods: int = 1, time_periods: int | None = None) None
Sets initial port value which is used to initialise the pyomo var/param
- Parameters:
array – array, list of initial values. Should have either: length = time_periods, or length = time_periods*expansion_periods
time_periods – int, optional number of time periods. If=None, assume that time_periods = len(array)
expansion_periods – number of expansion periods
- set_initial_value_from_timeseriesdata(time_series_data: TimeSeriesData) None
- slack: bool
- uid: str
- verify_port() None
Used to verify that a port has been set up appropriately