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,

I have tried the --tripinfo-output option to get the total distance traveled by all vehicles but it only gives me the values for those vehicles that have reached their destination. Is there a way get distance travelled by both vehicles that are still in the networking and those that have finished their journey, together at the end of a simulation.

On Sat, Feb 13, 2021 at 12:29 PM . Abdullah <ab11@xxxxxxxxxxx> wrote:
Thank you Lokesh and Jakob for the ideas. I'll try them both and see how it goes. Thank you again.

On Sat, Feb 13, 2021 at 4:55 AM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
You can also use --statistic-output and multiply the number of arrived vehicles ('inserted' - 'running')  with vehicleTripStatistic attribute 'routeLength' .

Am Sa., 13. Feb. 2021 um 01:37 Uhr schrieb Lokesh Das <lokeshcsedu@xxxxxxxxx>:
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
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user


--
Thank you.
Abdullah


--
Thank you.
Abdullah

Back to the top