Charging Network¶
-
class
acnportal.acnsim.network.
ChargingNetwork
(violation_tolerance: float = 1e-05, relative_tolerance: float = 1e-07)¶ The ChargingNetwork class describes the infrastructure of the charging network with information about the types of the charging station_schedule.
Parameters: - violation_tolerance (float) – Absolute amount by which an input charging schedule may violate network constraints (A).
- relative_tolerance (float) – Relative amount by which an input charging schedule may violate network constraints (A).
-
active_evs
¶ Return all EVs which are connected to an EVSE and which are not already fully charged.
Returns: List of EVs which can currently be charged. Return type: List[EV]
-
active_station_ids
¶ Return IDs for all stations which have an active EV attached.
Returns: - List of the station_id of all stations which have an
- active EV attached.
Return type: List[str]
-
add_constraint
(current: acnportal.acnsim.network.current.Current, limit: float, name: Optional[str] = None) → None¶ Add an additional constraint to the constraint DataFrame.
Parameters: - current (Current) – Aggregate current which is constrained. See Current for more info.
- limit (float) – Upper limit on the aggregate current.
- name (str) – Name of this constraint.
Returns: None
-
constraint_current
(input_schedule: numpy.ndarray, constraints: Optional[List[str]] = None, time_indices: Optional[List[int]] = None, linear: bool = False)¶ Return the aggregate currents subject to the given constraints. If constraints=None, return all aggregate currents.
Parameters: - input_schedule (np.Array) – 2-D matrix with each row corresponding to an EVSE and each column corresponding to a time index in the schedule.
- constraints (List[str]) – List of constraint id’s for which to calculate aggregate current. If None, calculates aggregate currents for all constraints.
- time_indices (List[int]) – List of time indices for which to calculate aggregate current. If None, calculates aggregate currents for all timesteps.
- 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.
Returns: Aggregate currents subject to the given constraints.
Return type: np.ndarray
-
constraints_as_df
() → pandas.core.frame.DataFrame¶ Returns the network constraints in a pandas DataFrame.
The index is the constraint IDs, and the columns are station IDs. The magnitudes (constraint limits) must be accessed separately.
Returns: The network constraints as a DataFrame. Return type: pd.DataFrame
-
current_charging_rates
¶ Return the current actual charging rate of all EVSEs in the network. If no EV is attached to a given EVSE, that EVSE’s charging rate is 0. In the returned array, the charging rates are given in the same order as the list of EVSEs given by station_ids
Returns: - numpy ndarray of actual charging rates of all EVSEs in the
- network.
Return type: np.Array
-
get_ev
(station_id: str) → acnportal.acnsim.models.ev.EV¶ Return the EV attached to the specified EVSE.
Parameters: station_id (str) – ID of the EVSE. Returns: The EV attached to the specified station. Return type: EV
-
is_feasible
(schedule_matrix: numpy.ndarray, linear: bool = False, violation_tolerance: Optional[float] = None, relative_tolerance: Optional[float] = None) → bool¶ Return if a set of current magnitudes for each load are feasible.
For a given constraint, the larger of the violation_tolerance and relative_tolerance is used to evaluate feasibility.
Parameters: - schedule_matrix (np.Array) – 2-D matrix with each row corresponding to an EVSE and each column corresponding to a time index in the schedule.
- 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_matrix 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_matrix 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
-
phase_angles
¶ Return dictionary of phase angles for all EVSEs in the network.
Returns: - Dictionary mapping EVSE ids their input phase angle. [
- degrees]
Return type: Dict[str, float]
-
plugin
(ev: acnportal.acnsim.models.ev.EV, station_id: str = None) → None¶ Attach EV to a specific EVSE.
Parameters: - ev (EV) – EV object which will be attached to the EVSE.
- [Depreciated] –
- station_id (str) – ID of the EVSE.
Returns: None
Raises: KeyError
– Raised when the station id has not yet been registered.
-
post_charging_update
()¶ Hook to define actions to take after the charging update.
-
register_evse
(evse: acnportal.acnsim.models.evse.BaseEVSE, voltage: float, phase_angle: float) → None¶ Register an EVSE with the network so it will be accessible to the rest of the simulation. This can only be called before any constraints have been registered in order to prevent dimensionality mismatch between the EVSE list and the
Parameters: - evse (EVSE) – An EVSE object.
- voltage (float) – Voltage feeding the EVSE (V).
- phase_angle (float) – Phase angle of the voltage/current feeding the EVSE (degrees).
Returns: None
-
remove_constraint
(name: str) → None¶ Remove a network constraint.
Parameters: name (str) – Name of constraint to remove. Returns: None
-
station_ids
¶ Return the IDs of all registered EVSEs.
Returns: List of all registered EVSE IDs. Return type: List[str]
-
unplug
(station_id: str, session_id: str = None) → None¶ Detach EV from a specific EVSE.
Parameters: - station_id (str) – ID of the EVSE.
- session_id (str) – ID of the session to be unplugged.
Returns: None
Raises: KeyError
– Raised when the station id has not yet been registered.
-
update_constraint
(name: str, current: acnportal.acnsim.network.current.Current, limit: float, new_name: Optional[str] = None) → None¶ Update a network constraint with a new aggregate current, limit, and name.
Parameters: - name (str) – Name of constraint to update.
- current (Current) – New current to update constraint with
- limit (float) – New upper limit to update constraint with
- new_name (str) – New name to give constraint
Returns: None
-
update_pilots
(pilots: numpy.ndarray, i: int, period: float) → None¶ Update the pilot signal sent to each EV. Also triggers the EVs to charge at the specified rate.
Note that if a pilot is not sent to an EVSE the associated EV WILL NOT charge during that period. If station_id is pilots or a list does not include the current time index, a 0 pilot signal is passed to the EVSE. Station IDs not registered in the network are silently ignored.
Parameters: - pilots (np.Array) – numpy array with a row for each station_id and a column for each time. Each entry in the Array corresponds to a charging rate (in A) at the station given by the row at a time given by the column.
- i (int) – Current time index of the simulation.
- period (float) – Length of the charging period. [minutes]
Returns: None
-
voltages
¶ Return dictionary of voltages for all EVSEs in the network.
Returns: Dictionary mapping EVSE ids their input voltage. [V] Return type: Dict[str, float]
-
exception
acnportal.acnsim.network.
StationOccupiedError
¶ Exception which is raised when trying to add an EV to an EVSE which is already occupied.