Interface¶
This module contains methods for directly interacting with the _simulator.
-
class
acnportal.acnsim.interface.
Interface
(simulator)¶ Interface between algorithms and the ACN Simulation Environment.
-
active_evs
¶ Returns a list of active EVs for use by the algorithm.
Returns: List of EVs currently plugged in and not finished charging Return type: List[EV]
-
allowable_pilot_signals
(station_id)¶ Returns the allowable pilot signal levels for the specified EVSE. One may assume an EVSE pilot signal of 0 is allowed regardless of this function’s return values.
Parameters: station_id (str) – The ID of the station for which the allowable rates should be returned. Returns: If the range is continuous or not list[float]: The sorted set of acceptable pilot signals. If continuous this range will have 2 values the min and the max acceptable values. [A]Return type: bool
-
current_time
¶ Get the current time (the current _iteration) of the simulator.
Returns: The current _iteration of the simulator. Return type: int
-
evse_phase
(station_id)¶ Returns the phase angle of the EVSE.
Parameters: station_id (str) – The ID of the station for which the allowable rates should be returned. Returns: phase angle of the EVSE. [degrees] Return type: float
-
evse_voltage
(station_id)¶ Returns the voltage of the EVSE.
Parameters: station_id (str) – The ID of the station for which the allowable rates should be returned. Returns: voltage of the EVSE. [V] Return type: float
-
get_constraints
()¶ Get the constraint matrix and corresponding EVSE ids for the network.
Returns: Matrix representing the constraints of the network. Each row is a constraint and each Return type: np.ndarray
-
get_demand_charge
(start=None)¶ Get the demand charge for the given period. ($/kW)
Parameters: start (int) – Time step of the simulation where price vector should begin. If None, uses the current timestep of the simulation. Default None. Returns: Demand charge for the given period. ($/kW) Return type: float
-
get_prev_peak
()¶ Get the highest aggregate peak demand so far in the simulation.
Returns: Peak demand so far in the simulation. (A) Return type: float
-
get_prices
(length, start=None)¶ Get a vector of prices beginning at time start and continuing for length periods. ($/kWh)
Parameters: - length (int) – Number of elements in the prices vector. One entry per period.
- start (int) – Time step of the simulation where price vector should begin. If None, uses the current timestep of the simulation. Default None.
Returns: Array of floats where each entry is the price for the corresponding period. ($/kWh)
Return type: np.ndarray[float]
-
is_feasible
(load_currents, linear=False, violation_tolerance=None, relative_tolerance=None)¶ Return if a set of current magnitudes for each load are feasible.
Wraps Network’s is_feasible method.
For a given constraint, the larger of the violation_tolerance and relative_tolerance is used to evaluate feasibility.
Parameters: - load_currents (Dict[str, List[number]]) – Dictionary mapping load_ids to schedules of charging rates.
- linear (bool) – If True, linearize all constraints to a more conservative but easier to compute constraint by ignoring the phase angle and taking the absolute value of all load coefficients. Default False.
- violation_tolerance (float) – Absolute amount by which schedule may violate network constraints. Default None, in which case the network’s violation_tolerance attribute is used.
- relative_tolerance (float) – Relative amount by which schedule may violate network constraints. Default None, in which case the network’s relative_tolerance attribute is used.
Returns: If load_currents is feasible at time t according to this set of constraints.
Return type: bool
-
last_actual_charging_rate
¶ Return the actual charging rates in the last period for all active EVs.
Returns: A dictionary with the session ID as key and actual charging rate as value. Return type: Dict[str, number]
-
last_applied_pilot_signals
¶ Return the pilot signals that were applied in the last _iteration of the simulation for all active EVs.
Does not include EVs that arrived in the current _iteration.
Returns: A dictionary with the session ID as key and the pilot signal as value. Return type: Dict[str, number]
-
max_pilot_signal
(station_id)¶ Returns the maximum allowable pilot signal level for the specified EVSE.
Parameters: station_id (str) – The ID of the station for which the allowable rates should be returned. Returns: the maximum pilot signal supported by this EVSE. [A] Return type: float
-
max_recompute_time
¶ Return the maximum recompute time of the simulator.
Returns: Maximum recompute time of the simulator in number of periods. [periods] Return type: int
-
min_pilot_signal
(station_id)¶ Returns the minimum allowable pilot signal level for the specified EVSE.
Parameters: station_id (str) – The ID of the station for which the allowable rates should be returned. Returns: the minimum pilot signal supported by this EVSE. [A] Return type: float
-
period
¶ Return the length of each timestep in the simulation.
Returns: Length of each time interval in the simulation. [minutes] Return type: int
-
remaining_amp_periods
(ev)¶ Return the EV’s remaining demand in A*periods.
Returns: the EV’s remaining demand in A*periods. Return type: float
-
-
exception
acnportal.acnsim.interface.
InvalidScheduleError
¶ Raised when the schedule passed to the simulator is invalid.