citylearn.electric_vehicle_charger module

class citylearn.electric_vehicle_charger.Charger(episode_tracker: EpisodeTracker, charger_simulation: ChargerSimulation, charger_id: str = None, efficiency: float = None, max_charging_power: float = None, min_charging_power: float = None, max_discharging_power: float = None, min_discharging_power: float = None, charge_efficiency_curve: Dict[float, float] = None, discharge_efficiency_curve: Dict[float, float] = None, connected_electric_vehicle: ElectricVehicle = None, incoming_electric_vehicle: ElectricVehicle = None, time_step_ratio: int = None, **kwargs)[source]

Bases: Environment

as_dict() dict[source]

Return a dictionary representation of the charger and connected EV data.

associate_incoming_car(electric_vehicle: ElectricVehicle)[source]

Associates incoming electric_vehicle to the charger.

Parameters:

electric_vehicle (object) – electric_vehicle instance to be connected to the charger.

property charge_efficiency_curve: dict

Efficiency curve for charging containing power levels and corresponding efficiency values.

property charger_id: str

ID of the charger.

property charger_simulation: ChargerSimulation
property connected_electric_vehicle: ElectricVehicle

Electric_Vehicle currently connected to charger

property discharge_efficiency_curve: dict

Efficiency curve for discharging containing power levels and corresponding efficiency values.

property efficiency: float

Technical efficiency.

property electricity_consumption: List[float]

Electricity consumption time series.

get_efficiency(power: float, charging: bool) float[source]

Returns the efficiency corresponding to a given power level.

If no efficiency curve is set, returns self.efficiency. If a curve is set, interpolates efficiency from the appropriate curve.

Parameters:
  • power (float) – The charging or discharging power level (normalized between 0 and 1).

  • charging (bool) – Whether the power level corresponds to charging (True) or discharging (False).

Returns:

The interpolated efficiency at the given power level.

Return type:

float

property incoming_electric_vehicle: ElectricVehicle

Electric_Vehicle incoming to charger

property max_charging_power: float

Maximum charging power in kW.

property max_discharging_power: float

Maximum discharging power in kW.

property min_charging_power: float

Minimum charging power in kW.

property min_discharging_power: float

Minimum discharging power in kW.

next_time_step()[source]

Advance to next time_step

property past_charging_action_values_kwh: List[float]

Actions given to charge/discharge in [kWh]. Different from the electricity consumption as in this an action can be given but no electric_vehicle being connect it will not consume such energy

property past_connected_evs: List[ElectricVehicle]

Each timestep with the list of Past connected Evs or None in the case no electric_vehicle was connected

plug_car(electric_vehicle: ElectricVehicle)[source]

Connects a electric_vehicle to the charger.

Parameters:

electric_vehicle (object) – electric_vehicle instance to be connected to the charger.

render_simulation_end_data() dict[source]

Return a dictionary containing all simulation data across all time steps. The returned dictionary is structured with a general charger name and, for each time step, a dictionary with the charger data, EV data (if connected), and electricity consumption.

Returns:

result – A JSON-like dictionary with the charger name and per-time-step data.

Return type:

dict

reset()[source]

Resets the Charger to its initial state by disconnecting all electric_vehicles.

property time_step_ratio: float

Electricity consumption time series.

update_connected_electric_vehicle_soc(action_value: float)[source]

Updates the SOC of the connected electric vehicle based on the charging/discharging action.

Parameters:

action_value (float) – The normalized charging or discharging action (range [-1, 1]).