Charging Network¶
-
class
acnportal.acnsim.network.
ChargingNetwork
(violation_tolerance=1e-05, relative_tolerance=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 constrants (A).
- relative_tolerance (float) – Relative amount by which an input charging schedule may violate network constrants (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, constraints=None, time_indices=None, linear=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.Array
-
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)¶ 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, linear=False, violation_tolerance=None, relative_tolerance=None)¶ 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, station_id)¶ Attach EV to a specific EVSE.
Parameters: - ev (EV) – EV object which will be attached to the EVSE.
- station_id (str) – ID of the EVSE.
Returns: None
Raises: KeyError
– Raised when the station id has not yet been registered.
-
register_evse
(evse, voltage, phase_angle)¶ Register an EVSE with the network so it will be accessible to the rest of the simulation.
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)¶ Remove a network constraint.
Parameters: name (str) – Name of constriant 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)¶ Detach EV from a specific EVSE.
Parameters: station_id (str) – ID of the EVSE. Returns: None Raises: KeyError
– Raised when the station id has not yet been registered.
-
update_constraint
(name, current: acnportal.acnsim.network.current.Current, limit, new_name=None)¶ Update a network constraint with a new aggregate current, limit, and name.
Parameters: - name (str) – Name of constriant 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, i, period)¶ 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 staion 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.