Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] discussion on using traci to compute throughput of intersections

Hi all,

I noticed that the throughput flow of intersections can be accessed in the output file of loop detectors. But I am wondering can we use traci to get the real-time throughput between time [t-interval, t]?

# Loop[j] is the lsit for loop detector j
Loop = [[] for x in range(Num_detectors)]
Count = [[] for x in range(Num_detectors)]

Loop[j].append(traci.inductionloop.getLastStepVehicleIDs(str(j)))
if Loop[j][step] != Loop[j][step-1]:
Count[j].append(1)
else:
Count[j].append(0)

To get how many vehicles passed the intersection, I retrived the ID list on a loop detector and try to check whether it changed last time. Is it the correct way? 

Thank you,
Hao

Back to the top