echo.models.electrical.ev package

class echo.models.electrical.ev.EVBase(uid: str = NOTHING, node_name: str = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, transformations: dict[str, Transform] = NOTHING, charge_mode: EVChargeMode | None = None, connection_port_name: str = 'cp', ports: dict[str, ElectricalDemand | ElectricalPort | MobileElectricalStorage] = NOTHING, charging_efficiency: float = 1, depth_of_discharge_limit: float = 0, discharging_efficiency: float = 1, enable_trip_slack: bool = False, soc_conserv: float | list[float] | list[list[float]] | ndarray | None = None, soc_conserv_cost: float | None = None, usage_power_limit: float | None = None, available: ndarray | list | None = None, initial_state_of_charge: float | None = None, interval_duration: int | None = None, set_stateful_attrs_at_init: bool = True, tod_charging: ndarray | list | str | None = None, usage: ndarray | list | None = None, port_dict_name_to_port_name_map: dict[str, str] | None = None, port_dict_name_to_port_uid_map: dict[str, str] | None = None, *, charging_power_limit: float, discharging_power_limit: float, max_capacity: float)

Bases: TransformNode

Base class for EVV0G, EVV1G and EVV2G.

Parameters:
  • available (ArrayType | list | str | None) – A List or ArrayType of bools representing the ability for the EV to charge. The bools can have values of [False, True] or [0, 1]. 0 and False indicate the EV is not available for charging, 1 and True indicate the EV is available for charging. If set_state_attrs_at_init is True, this must be supplied. If set_stateful_attrs_at_init is False, this must be provided later using set_stateful_attrs(). ArrayType | list represents data, while a str represents the column name in a pandas dataframe.

  • charge_mode (EVChargeMode | None) – Charge mode of the EV. This is set upon instantiation of EV child classes. Defaults to None.

  • charging_efficiency (float | None) – The efficiency of the battery charging process for the EV. Float as a fraction between 0.0 and 1.0 inclusive. Unitless. Defaults to 1.0.

  • charging_power_limit (float) – The maximum charging rate of the EV’s battery. Positive float in power units.

  • connection_point_name (str | None) – Name of connection point port. Defaults to “cp”.

  • depth_of_discharge_limit (float, optional) – The minimum value of the state of ElectricalStorage of the EV. Same as min_soc but expressed as percentage, not energy. Float as a percentage (of max_capacity) between 0.0 and 100.0. Unitless. Defaults to 0.0.

  • discharging_efficiency (float | None) – The efficiency of the battery discharging process for the EV. Float as a fraction between 0.0 and 1.0 inclusive. Unitless. Defaults to 1.0.

  • discharging_power_limit (float) – The maximum discharging rate of the EV’s battery. This includes discharging for travelling and V2G actions. If usage_power_limit is set then discharging_power_limit represents maximum V2G generation power only. Negative float in power units.

  • enable_trip_slack (bool | None) – Enabling trip slack allows the EV to meet usage requirements even if other constraints/requirements are breached. That is, it allows the state of charge of the EV’s battery to go below min to avoid the optimisation failing due to infeasible EV trips. For example, an EV can complete a journey requiring 20 kWh of energy if though there is only 15 kWh of energy in the EV battery. Setting enable_trip_slack to True will introduce additional energy into the system, though there is a cost to do so. This can cause issues when conducting analysis on systems with enable_trip_slack=True, so use with caution. Defaults to False.

  • initial_state_of_charge (float | None) – The initial charge present in the EV’s battery. If set_state_attrs_at_init is True, this must be supplied. If set_stateful_attrs_at_init is False, it must be provided later using set_stateful_attrs(). Positive float with units of energy (not percentage).

  • interval_duration (int) – Length of time interval between time series data points. Used mostly for conversion between power and energy. If set_stateful_attrs_at_init is False, this can be set after EV object instantiation using self.set_state_attrs(). Units of minutes.

  • max_capacity (float) – The storage capacity of the EV’s battery. Positive float in energy units.

  • port_dict_name_to_port_name_map (dict[str, str] | None) – Defines port name to port object map. It is recommended not to use this unless you know what you are doing. If None, it will defined once ports are built. Defaults to None.

  • port_dict_name_to_port_uid_map (dict[str, str] | None) – Defines port uid to port object map. It is recommended not to use this unless you know what you are doing. If None, it will defined once ports are built. Defaults to None.

  • set_stateful_attrs_at_init (bool | None) – Set attributes with state at object instantiation (True) or defer to later (False). If deferring to later, self.set_stateful_attrs() must be used to set these attributes. Attributes with state are available and initial_state_of_charge. Defaults to True.

  • soc_conserv (TimeExpandableType | None) – Conservative state of charge limit below which the EV should not discharge to the grid. This reflects that an EV owner would want to ensure a certain amount of charge is available impromptu trips. This lower bound only applies while the EV is available to charge. Defaults to None.

  • soc_conserv_cost (float | None) – The cost placed on going below the conservative state of charge limit. That is, the conservative state of charge lower limit will be ignored if it would result in saving (or gaining) more money than this cost. Units of $/kWh. Defaults to None.

  • tod_charging (ArrayType | list | str | None) – Time of day charging allows the EV to charge only during certain time windows (1=allowed, 0=not allowed). Most commonly used with V0G charging. Defaults to None.

  • usage (ArrayType | list | None) – An array representing the average power consumption from driving of the EV during a time interval. Units of power.

  • usage_power_limit (float | None) – The maximum power that can be used during an EV trip. If not None, it allows discharging_power_limit to represent only the maximum power flow from an EVV2G back into an electrical network, and not the maximum power output during a trip. Negative float in power units. Defaults to None, however if None, it will be set to discharging_power_limit.

available: ndarray | list | None
charge_mode: EVChargeMode | None
charging_efficiency: float
charging_power_limit: float
connection_port_name: str
depth_of_discharge_limit: float
discharging_efficiency: float
discharging_power_limit: float
enable_trip_slack: bool
initial_state_of_charge: float | None
interval_duration: int | None
max_capacity: float
port_dict_name_to_port_name_map: dict[str, str] | None
port_dict_name_to_port_uid_map: dict[str, str] | None
ports: dict[str, ElectricalDemand | ElectricalPort | MobileElectricalStorage]
set_port_uid_maps() → None

Sets the two maps for port names and port uids, if they aren’t already set.

Parameters:

None

Returns:

None

set_stateful_attrs_at_init: bool
soc_conserv: float | list[float] | list[list[float]] | ndarray | None
soc_conserv_cost: float | None
tod_charging: ndarray | list | str | None
usage: ndarray | list | None
usage_power_limit: float | None
verify_node() → None

Checks data with state has been set for the node and each port.

Parameters:

None

Returns:

None

class echo.models.electrical.ev.EVV0G(uid: str = NOTHING, node_name: str = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, transformations: dict[str, Transform] = NOTHING, charge_mode: EVChargeMode | None = None, connection_port_name: str = 'cp', ports: dict[str, ElectricalDemand | ElectricalPort | MobileElectricalStorage] = NOTHING, charging_efficiency: float = 1, depth_of_discharge_limit: float = 0, discharging_efficiency: float = 1, enable_trip_slack: bool = False, soc_conserv: float | list[float] | list[list[float]] | ndarray | None = None, soc_conserv_cost: float | None = None, usage_power_limit: float | None = None, available: ndarray | list | None = None, initial_state_of_charge: float | None = None, interval_duration: int | None = None, set_stateful_attrs_at_init: bool = True, tod_charging: ndarray | list | str | None = None, usage: ndarray | list | None = None, port_dict_name_to_port_name_map: dict[str, str] | None = None, port_dict_name_to_port_uid_map: dict[str, str] | None = None, V0G_delta: ndarray | list | None = None, V0G_SOC: ndarray | list | None = None, V0G_trip_infeasibility: ndarray | list | None = None, charge_status: EVChargeStatus | None = None, *, charging_power_limit: float, discharging_power_limit: float, max_capacity: float)

Bases: EVBase

This EV object takes an available and usage dataset to precalculate a demand profile.

Once plugged in for charging, it assumes charging at the maximum rate until the battery is full.

V0G_SOC: ndarray | list | None
V0G_delta: ndarray | list | None
V0G_trip_infeasibility: ndarray | list | None
add_node_to_model(model: EchoConcreteModel, profile: DataFrame | None = None) → None

Fix the battery state of charge, the slack variable, and battery charging/discharging for EV.

Parameters:
  • model – The concrete model to add the EV to

  • profile

Returns:

None

charge_status: EVChargeStatus | None
set_stateful_attrs(available: ndarray | list, usage: ndarray | list, initial_state_of_charge: float, interval_duration: int, tod_charging: ndarray | list | str | None = None) → None

Injects attributes with state into EV node and ports.

Parameters:
  • available – A List or ArrayType of bools representing the ability for the EV to charge. The bools can have values of [False, True] or [0, 1]. 0 and False indicate the EV is not available for charging, 1 and True indicate the EV is available for charging.

  • usage – An array representing the average power consumption from driving of the EV during a time interval. Units of power.

  • initial_state_of_charge – The initial charge present in the EV’s battery. Positive float of energy units, not percentage. Positive float with units of energy.

  • interval_duration – The duration between timestamps. Units of minutes.

  • tod_charging – Time of day charging allows the EV to charge only during certain time windows (1=allowed, 0=not allowed). Most commonly used with V0G charging. Defaults to None.

Returns:

None

class echo.models.electrical.ev.EVV1G(uid: str = NOTHING, node_name: str = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, transformations: dict[str, Transform] = NOTHING, charge_mode: EVChargeMode | None = None, connection_port_name: str = 'cp', ports: dict[str, ElectricalDemand | ElectricalPort | MobileElectricalStorage] = NOTHING, charging_efficiency: float = 1, depth_of_discharge_limit: float = 0, discharging_efficiency: float = 1, enable_trip_slack: bool = False, soc_conserv: float | list[float] | list[list[float]] | ndarray | None = None, soc_conserv_cost: float | None = None, usage_power_limit: float | None = None, available: ndarray | list | None = None, initial_state_of_charge: float | None = None, interval_duration: int | None = None, set_stateful_attrs_at_init: bool = True, tod_charging: ndarray | list | str | None = None, usage: ndarray | list | None = None, port_dict_name_to_port_name_map: dict[str, str] | None = None, port_dict_name_to_port_uid_map: dict[str, str] | None = None, *, charging_power_limit: float, discharging_power_limit: float, max_capacity: float)

Bases: EVBase

An EV with demand managed charging.

set_stateful_attrs(available: ndarray | list | str, usage: ndarray | list | str, initial_state_of_charge: float, interval_duration: int) → None

Injects attributes with state into EV node and ports.

Parameters:
  • available – A List or ArrayType of bools representing the ability for the EV to charge. The bools can have values of [False, True] or [0, 1]. 0 and False indicate the EV is not available for charging, 1 and True indicate the EV is available for charging.

  • usage – An array representing the average power consumption from driving of the EV during a time interval. Units of power.

  • initial_state_of_charge – The initial charge present in the EV’s battery. Positive float of energy units, not percentage. Positive float with units of energy.

  • interval_duration – The duration between timestamps. Units of minutes.

Returns:

None

class echo.models.electrical.ev.EVV2G(uid: str = NOTHING, node_name: str = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, transformations: dict[str, Transform] = NOTHING, charge_mode: EVChargeMode | None = None, connection_port_name: str = 'cp', ports: dict[str, ElectricalDemand | ElectricalPort | MobileElectricalStorage] = NOTHING, charging_efficiency: float = 1, depth_of_discharge_limit: float = 0, discharging_efficiency: float = 1, enable_trip_slack: bool = False, soc_conserv: float | list[float] | list[list[float]] | ndarray | None = None, soc_conserv_cost: float | None = None, usage_power_limit: float | None = None, available: ndarray | list | None = None, initial_state_of_charge: float | None = None, interval_duration: int | None = None, set_stateful_attrs_at_init: bool = True, tod_charging: ndarray | list | str | None = None, usage: ndarray | list | None = None, port_dict_name_to_port_name_map: dict[str, str] | None = None, port_dict_name_to_port_uid_map: dict[str, str] | None = None, *, charging_power_limit: float, discharging_power_limit: float, max_capacity: float)

Bases: EVBase

An EV with demand managed charging and generation managed discharging for purposes of providing energy to an electrical network.

set_stateful_attrs(available: ndarray | list | str, usage: ndarray | list | str, initial_state_of_charge: float, interval_duration: int) → None

Injects attributes with state into EV node and ports.

Parameters:
  • available – A List or ArrayType of bools representing the ability for the EV to charge. The bools can have values of [False, True] or [0, 1]. 0 and False indicate the EV is not available for charging, 1 and True indicate the EV is available for charging.

  • usage – An array representing the average power consumption from driving of the EV during a time interval. Units of power.

  • initial_state_of_charge – The initial charge present in the EV’s battery. Positive float of energy units, not percentage. Positive float with units of energy.

  • interval_duration – The duration between timestamps. Units of minutes.

Returns:

None

class echo.models.electrical.ev.EVWithProfile(uid: str = NOTHING, node_name: str = NOTHING, ports: dict[str, Port] = NOTHING, objective: en.numeric_expr.NumericExpression | float = 0, charge_mode: EVChargeMode = EVChargeMode.DemandProfile, port_name: str = 'demand', port_uid: str = NOTHING, charging_power_limit: float = None, set_stateful_attrs_at_init: bool = True, demand: dict | ndarray | list | None = None)

Bases: Node

An EV defined through a timeseries profile of demand.

This EV object is to be used when real world (or modelled) charging data is available; essentially acting as a pure load.

charging_power_limit (float | None): The maximum charging power of the vehicle. Used for data sanity checks only.

Positive float in units of power.

demand (dict[str, float] | ArrayType | list[float] | None): The demand data for the EV. Values must be positive

floats. Values in units of power.

set_stateful_attrs_at_init (bool | None): Set attributes with state at object instantiation (True) or

defer to later (False). If deferring to later, self.set_stateful_attrs() must be used to set these attributes. Attributes with state are available and initial_state_of_charge. Defaults to True.

charge_mode: EVChargeMode
charging_power_limit: float
demand: dict | ndarray | list | None
port_name: str
port_uid: str
set_stateful_attrs(demand: dict | ndarray | list) → None

Injects attributes with state into EV node and ports.

Parameters:

demand – Timeseries data specifying if the load from the EV charging.

Returns:

None

set_stateful_attrs_at_init: bool
verify_node() → None

Checks data with state has been set for the node and each port.

Parameters:

None

Returns:

None

class echo.models.electrical.ev.MobileElectricalStorage(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, flow_type: OptimisationType = OptimisationType.Variable, import_constraint: FlowConstraint = FlowConstraint.Fixed, export_constraint: FlowConstraint = FlowConstraint.Fixed, depth_of_discharge_limit: float = 0, min_soc: float = 0, charging_efficiency: float = 1, discharging_efficiency: float = 1, fixed_storage_capacity: bool = True, storage_capacity_cost: float | None = None, regularise: bool = False, enable_trip_slack: bool = False, soc_conserv: float | list[float] | list[list[float]] | ndarray | None = None, soc_conserv_cost: float | None = None, available: ndarray | list | None = None, units: Units = Units.KW, *, max_capacity: float, charging_power_limit: float, discharging_power_limit: float, initial_state_of_charge: float | None = None)

Bases: MobileStorage

units: Units

Submodules