Bus Bunching Simulator - How it works
Queuing at the bus stop
Each bus stop has associated with it a timer to indicate at what time the next prospective passenger will join the queue.
Initially this is a random time of 240 seconds ±100%.
When this event becomes due, a new passenger is placed in the queue and a random selection of his destination is made which can be any of the other stops.
The timer is reset to 240 seconds ahead ±100%.
Bus Progression
The buses are initially set at even distances along the route.
An initial speed is set which is 40kph ±70%.
The time at which each bus will arrive at the next stop is calculated.
On arrival at a stop, the bus will normally wait for 15 seconds to simulate the time lost in slowing down and accelerating away.
Boarding and alighting will then commence with 10 seconds ±100% taken for each passenger to board
and 5 seconds ±100% for alighting.
This process continues until all the passengers due to alight at the stop have done so
or until there are no passengers in the queue or until the bus is full.
At this point, a new speed is selected (40kph ±70%) and the bus will be free to move off again.
If there are no passengers wishing to alight and either the queue is empty or the bus is full,
the bus will pass the stop without stopping although a new speed will be calcuated for the next section of the route.
There is a limit of two buses at the stop.
If any additional buses arrive and if there are passengers wishing to alight, they will queue for access to the stop.
Otherwise the bus will pass the stop without stopping even if there are passengers queuing.
Tram Operation
Slightly different rules apply if a tramway is being simulated.
Because trams cannot overtake, a limit may placed on the speed of the trams between stops so as to ensure that the tram cannot arrive before the previous tram.
In addition, there can only be one tram at a stop.
Trams arriving at an occupied stop are held in a queue irrespective of whether there are any passengers to alight or board.
Animation
The program uses a simulated clock which is not more than 50 times faster than real time.
In order to prevent undue jerkiness, a snapshot is taken every 4 seconds if the next due event is later.
This interval will adjust itself to somewhere between 1 and 20 seconds depending on whether the required clock acceleration is being achieved.