Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Calculate total distance travelled

Hi,

I am trying to calculate the total distance travelled by all vehicles in a network from start to end of a simulation. Currently, I am doing the following after every simulation step: get the list of all vehicle ids using traci.vehicle.getIDList() and then iterate over the list and call traci.vehicle.getDistance(vehid) and save this value to add up later. 

This becomes very slow as the number of vehicles increases over time. If I do this once at the end of the simulation then I lose the information about vehicles that have reached their destination between start and end. 

I was wondering if there is a way of finding the total distance travelled once at the end of the simulation that also takes into account of all the vehicles that have left the network.   

--
Thank you.
Abdullah

Back to the top