-
Notifications
You must be signed in to change notification settings - Fork 449
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(drt): add/remove vehicles dynamically during qsim #3104
base: master
Are you sure you want to change the base?
Conversation
This is a first draft. There are probably certain things to clean up still. And obviously the events files of the taxi contrib need to be updated. |
very nice. was thinking about this functionality long time ago. This enables to investigate exciting use cases, for example for goods+people DRT. Let's merge when the conflicts are solved :) |
Hi @tschlenther, thanks for the feedback. The idea was indeed to switch vehicles from one drt mode to another, and this was only the first step here. As it turns out, the next step is much more complicated ;) The main reason is that a lot of code in DRT assumes that one vehicle belongs to one mode, especially in the analysis. If one switches vehicles from one mode to another there is a lot of confusion: If a task started with mode A, then the vehicle switches, and the task ends in mode B, the analysis code needs to know about this, so everywhere some kind of "vehicle removed" "vehicle added" events need to be considered. This then also means that each analysis handler needs to listen to all DRT events, not only those with a specific mode. In general, I have the feeling we would need to have something like a global fleet manager for DRT which tracks which mode a vehicle belongs to at any time, and which then also has the functionality to send vehicles from one fleet to another. But this would require quite a bit of refactoring and we would need to agree on new conventions regarding the analysis scripts. We can discuss this a bit more in detail, and I think I even have a first draft for this "fleet manager" somewhere. |
This is a draft for introducing dynamic vehicle fleets in DVRP/DRT. The PR fixes #3086.
Major changes:
Fleet
is now an object with its own logic. In particular, it generates generats events when vehicles are added and removed;VehicleAddedEvent
andVehicleRemovedEvent
.Fleet
from aFleetSpecification
, users now need to implement aFleetCreator
. However, it works 99% analogously to the previous logic of creating a fleet. In most cases, this is changing two lines of code (see code changes in the unit tests). The change is necessary asFleet
has now become a container object to which vehicles are added at start-up or later on during the simulation.Fleet
, (2)QSim
, (3)DynActivityEngine
and DRT vehicles also need to get an initial task assigned. For that, two helper classes have been introduced:FleetExtensionHelper
(is a MobsimEngine), andDrtFleetExtensionHelper
(delegates to the former).All of this functionality is covered by
RunDrtExampleIT.testRunWithVariableFleetSize
. Here is an example of the integration test's output. Three vehicles are added dynamically between 8h00 and 12h00, thus, giving additional capacity during that period: