0

I wanted to get the waiting time of vehicles in SUMO and work it into the TraCI interface. For example I want to receive the getwaitingtime() of each vehicle Id within a certain area of the network.(meaning they are stopped or waiting in a queue). Then I want to add the total waiting time of Vehicles based on lane or each direction. After the total Time is added I want to assign this value to lets say X. and Use the value of X to perform some mathematical calculations and give decision to change the traffic light.

getwaitingtime(). VehID().

1 Answers1

0

When the vehicle is stopped it doesn't accumulate waiting time. Rather you can do this check using isStopped command. This will return True for each simulation step the vehicle is stopped or is in a stopped state.

As for the accumulation of waiting time, the waiting time counter is set to 0 each time the vehicle's speed is greater than 0.1 ms. So getWaitingTime might not give you an accurate measure of the total waiting time for a single vehicle. Use getAccumulatedWaitingTime to get the accumulated waiting time for the pre-defined or user-defined waiting time memory. This accumulated waiting time can be tested against the simulation time steps (aggregate) and then you can know for sure if the vehicle has been in the queue for a long time or not.

FrainBr33z3
  • 1,085
  • 1
  • 6
  • 12
  • Thanks. I am really new to SUMO and Traci so i dont have much idea. How would one create a variable that stores these accumulated waiting time for each vehicle? – Saurabh Bikram Basnet Jul 12 '19 at 15:59
  • @SaurabhBikramBasnet Hello! Just create a variable in python and keep adding to it the value received from the `getAccumulatedWaitingTime` function. It is fairly starightforward. Any python tutorial will give you this solution. Hope this helps – FrainBr33z3 Jul 22 '19 at 09:35