I am using planner to plan vehicle routes, i create plan every X seconds (usually 20), for that i need vehicles loaded before they enter network (e.g. from time 0 to 20). For now i accomplish this by parsing the routes.rou.xml file, but i would like to be able to do this using TraCI.
I read at: https://sumo.dlr.de/docs/Simulation/VehicleInsertion.html, that vehicles are loaded in chunks, but by setting "--route-steps 0" i can load all vehicles at once (all of them are in traci.simulation.getLoadedIDList()
at time step 0), which is not ideal for longer simulation with thousands of cars, but even with the vehicles loaded, I am unable to find any function to retrieve their time of departure. At: https://sumo.dlr.de/docs/TraCI/Vehicle_Value_Retrieval.html#Device_and_LaneChangeModel_Parameter_Retrieval_0x7e I didnt find any variable corresponding to departure time of vehicle and traci.vehicle.getParameter(vehicle_id, 'depart')
returns empty string.
So i would like to know how to either force SUMO to load vehicles every X seconds (time steps), or find time of departure of vehicle (found by their id) using TraCI.
If I understand your question correctly you want to force sumo to always read ahead the route file for at least X seconds and to retrieve the intended departure time via traci. I am afraid both things are currently not possible. The --route-steps
you mentioned allows to configure the look ahead in a way but only to define the chunk size sumo reads so --route-steps 100
will read 0 to 100 first then 100 to 200 and so on. So most of the time you may have the required look ahead but not always. Furthermore you cannot retrieve intended departure via traci yet, but there is at least an open ticket for that: https://github.com/eclipse/sumo/issues/7693. Maybe leave a comment there so that people know it is still needed. Until then parsing the route file is your only option, unfortunately.