Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ev): modularize charging strategies #3587

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sebhoerl
Copy link
Contributor

Problem:

  • Currently, there is a lot of hard-coding regarding how the ChargingLogic is defined, which simulates the charging procses inside a Charger. Furthermore, there is a lot of hardcoded logic regarding the ChargingStrategy which defines when a vehicle decides to unplug or how much energy to charge.
  • In particular, it is not easy to define flexible charging behaviors that are dependent on the vehicle type, because a ChargingStrategy is created per charger. However, the strategy should be more related to the user/vehicle and how they interact with charger.

Solution:

  • There is now a ChargingStrategy.Factory that is dependent on the respective Charger and ElectricVehicle. It instanciates a ChargingStrategy whenever a vehicle starts to interact with a charger (planning how much time it will take, actually plugging in, ...).
  • Whenever a vehicle is assigned/added to a charger, one now not only needs to pass the ElectricVehicle to the Charger, but at the same time a ChargingStrategy.
  • Internally, the ChargingLogic objects now work with a ChargingVehicle record, which combines an ElectricVehicle and a ChargingStrategy.

Notes:

  • A better default charging strategy has been introduced. It has a hardcoded maximum SoC (1.0) until which vehicles charge, but a maximumSoC attribute of the Vehicle is used instead if it exists.
  • ChargingStrategy.Factory is now a modal binding in DVRP. This means that each DVRP mode can define a different behavior how (until which SoC, etc.) vehicles charge. In particular, this also allows to define different charging startegies for DVRP vehicles and standard vehicles in the simulation. By default, the modal bindings are redirected to the global binding.

Changset:

  • The first commit removes the default logic from the ChargingStrategy interface to avoid confusion.
  • The second commit disentangles the injection/instanciation of ChargingLogic and ChargingStrategy and a lot of code duplication has been removed.
  • The third commit is the largest and transforms the inflexible per-charger ChargingStrategy into a modular element using ChargingStrategy.Factory.
  • The fourth commit introduces a better default logic for ChargeUpToMaxSocStrategy.
  • The fifth commit introduces modal bindings for ChargingStrategy.Factory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant