0

I am new to SUMO and Python. Currently I am trying to model a bus route that has two buses on a single route. At times these two buses can tend to bunch up during the simulation and I was wondering how exactly can I implement a Python code that prevents bus bunching from happening within my simulation? I do not have an extensive background in transportation engineering and theory so I am not all too familiar with traffic control algorithms and how they are implemented in Python, but I do know the fundamentals of transportation engineering. Is there some code or easily understood body of work that I can be pointed to prevent bus bunching from occurring within my simulation?

Thank you

1 Answers1

0

The difficulty of the implementation mainly depends on the strategy you want to implement to avoid bunching. But in any case you would need to detect first that the buses are bunched. This can be done by regularly checking the upcoming stop via traci.vehicle.getStops("busID1", 1). If you have your two buses at the same stop then you can for instance remove one using traci.vehicle.remove or let it stop longer by changing the duration using traci.vehicle.setStop.

Michael
  • 3,510
  • 1
  • 11
  • 23
  • Sorry for not clarifying this in the beginning, but the strategy I was trying to implement was the "Holding Strategy", where if there is a bus that arrives at the same stop as the bus ahead of it, the follower bus sits at the arrived bus stop for some time duration to allow for the bus ahead of it to move an adequate distance ahead to prevent another collapse of the headway between the two buses. – Ifezue Obiako Oct 18 '21 at 22:20
  • This should be possible with the approach above. getStops gives you the information at which stop (if any) the bus is currently stopping and setStop lets you change the duration. – Michael Oct 22 '21 at 05:55