Skip to main content

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

Hi Abdullah,

You can use the tripinfo.xml file to calculate the total distance traveled by all vehicles at the end of the simulation.  The tripinfo file contains the total travel distance for every vehicle which has finished its trip. You just need to parse it. 

Thanks,

On Fri, Feb 12, 2021 at 3:26 PM . Abdullah <ab11@xxxxxxxxxxx> wrote:
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
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top