zach401 / acnportal

Research tools for the Adaptive Charging Network
BSD 3-Clause "New" or "Revised" License
75 stars 32 forks source link

ENH: ChargingNetwork.unplug() should check if it is unplugging the right EV. #80

Closed zach401 closed 3 years ago

zach401 commented 4 years ago

Is your feature request related to a problem? Please describe. In the current implementation, ChargingNetwork.unplug() takes only station_id as an argument and unplugs whatever EV is connected to that station. However, this poses a problem if the EV is not actually at that EVSE, for example if we all the EV to swap with another EV after it is finished charging.

Describe the solution you'd like The easiest approach is to include session_id as an argument (it is already included in the UnplugEvent), and just check if that session_id matches the session_id of the EV connected to the station.

This is not the most elegant solution, but it prevents us needing to invalidate previously serialized simulations.

Describe alternatives you've considered My preferred approach is that instead of taking in a station_id string, unplug() should take in an EV object. It can then correctly find where that EV is plugged in and unplug it as needed.

The main challenge for this is that we are updating what is stored in an UnplugEvent which would cause problems if we want to deserialize from a previous version. Because of this potentially serious issue, I recommend the first option.

zach401 commented 4 years ago

@sunash