Search code examples
pythonsumo

How to obtain the total delay or total timeloss in SUMO and TraCI


I am working on a project to optimize traffic light control for an isolated intersection using SUMO with TraCI in Python. I would like to minimize the total delay for all vehicles with respect to how they would drive if they never had to wait for other traffic or traffic lights.

I saw that it's possible to output the timeloss for each vehicle once it has reached its destination by using --tripinfo-output <FILE>. Is there also a built-in method to obtain the current value of average or total delay?


Solution

  • It is currently not possible to retrieve this value via TraCI. You can either parse and sum up the values in the tripinfo file or if you just need statistics in the end you can run sumo with the additional --duration-log.statistics option which will output an average time loss in the end. Furthermore you can retrieve the current value in the sumo GUI when displaying network parameters (provided you use the option above).