gym_acnportal.gym_acnsim.interfaces

This module extends the acnportal.acnsim Interface class with Interfaces that RL agents and gym environments use to obtain information about a Simulator.

Module Contents

Classes

GymTrainedInterface

Interface between OpenAI Environments and the ACN Simulation

GymTrainingInterface

Interface between OpenAI Environments and the ACN Simulation

class gym_acnportal.gym_acnsim.interfaces.GymTrainedInterface

Bases: acnportal.acnsim.Interface

Interface between OpenAI Environments and the ACN Simulation Environment.

classmethod from_interface(cls, interface: acnportal.acnsim.Interface)gym_acnportal.gym_acnsim.interfaces.GymTrainedInterface

Generates an instance of this class from an Interface-like object. Note that the _simulator of the input interface is not copied into the new GymTrainedInterface-like object generated here, so changes from elsewhere to the _simulator will be reflected in this object’s _simulator.

Args:

interface (Interface):

Returns:

GymTrainedInterface:

property station_ids(self)List[str]

Return a list of space ids of stations the in the network.

Returns:

List[str]: List of station ids in the network.

property active_station_ids(self)List[str]

Returns a list of active EVSE station ids for use by the algorithm.

Returns:
List[str]: List of EVSE station ids with an EV plugged in

that is not finished charging.

property is_done(self)bool

Returns if the simulation is complete (i.e. event queue is empty).

Returns:

bool: True if simulation is complete.

property charging_rates(self)numpy.ndarray

Returns the charging_rates of the simulator at all times.

Returns:
np.ndarray: numpy array of all charging rates. Each row

represents the charging rates of a station; each column represents the charging rates at an iteration.

is_feasible_evse(self, load_currents: Dict[str, List[float]])bool

Return if each EVSE in load_currents can accept the pilots assigned to it.

Args:
load_currents (Dict[str, List[number]]): Dictionary mapping

load_ids to schedules of charging rates.

Returns: bool: True if all pilots are valid for the EVSEs to

which they are sent.

is_feasible(self, load_currents: Dict[str, List[float]], linear: bool = False, violation_tolerance: Optional[float] = None, relative_tolerance: Optional[float] = None)bool

Overrides Interface.is_feasible with extra feasibility checks. These include:

  • Checking for stations in a schedule but not in the network.

  • Checking that the schedule doesn’t violate any constraints on

EVSE charging rates.

last_energy_delivered(self)float

Return the actual energy delivered in the last period, in amp-periods.

TODO: This is known to produce a warning in acnportal 0.2.2

Returns:
float: Total energy delivered in the last period, in

amp-periods.

current_constraint_currents(self, input_schedule: object)object

TODO Args:

input_schedule:

Returns:

class gym_acnportal.gym_acnsim.interfaces.GymTrainingInterface

Bases: gym_acnportal.gym_acnsim.interfaces.GymTrainedInterface

Interface between OpenAI Environments and the ACN Simulation

Environment.

This class of interface facilitates training by allowing an agent to step the Simulator by a single iteration.

step(self, new_schedule: Dict[str, List[float]], force_feasibility: bool = True)Tuple[bool, bool]

Step the simulation using the input new_schedule until the simulator requires a new charging schedule. If the provided schedule is infeasible, steps the simulation only if force_feasibility is False, otherwise doesn’t step the simulation.

Args:

new_schedule (Dict[str, List[float]]): Dictionary mapping station ids to a schedule of pilot signals. force_feasibility (bool): If True, do not allow an

Returns:

bool: True if the simulation is completed bool: True if the schedule was feasible

Warns:
UserWarning: If the length of the new schedule is less than

the Simulator’s max_recompute parameter. This warning is raised because stepping the Simulator with a schedule of length less than max_recompute could cause the pilot signals to be updated with 0’s after the schedule runs out of entries.