feat(ev): modularize charging strategies #3587
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
ChargingLogic
is defined, which simulates the charging procses inside aCharger
. Furthermore, there is a lot of hardcoded logic regarding theChargingStrategy
which defines when a vehicle decides to unplug or how much energy to charge.ChargingStrategy
is created per charger. However, the strategy should be more related to the user/vehicle and how they interact with charger.Solution:
ChargingStrategy.Factory
that is dependent on the respectiveCharger
andElectricVehicle
. It instanciates aChargingStrategy
whenever a vehicle starts to interact with a charger (planning how much time it will take, actually plugging in, ...).ElectricVehicle
to theCharger
, but at the same time aChargingStrategy
.ChargingLogic
objects now work with aChargingVehicle
record, which combines anElectricVehicle
and aChargingStrategy
.Notes:
1.0
) until which vehicles charge, but amaximumSoC
attribute of theVehicle
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:
default
logic from theChargingStrategy
interface to avoid confusion.ChargingLogic
andChargingStrategy
and a lot of code duplication has been removed.ChargingStrategy
into a modular element usingChargingStrategy.Factory
.ChargeUpToMaxSocStrategy
.ChargingStrategy.Factory