Research Article

Discrete Event Simulation of Bus Terminals: A Modular Approach with a High Spatial Resolution

Algorithm 1.

Driving through the cells of a section.
for Each cell in section do
  if Cell is free then
   Calculate departure time
  else
   Calculate new arrival time
   Calculate departure time
   for Each previous cell occupied by vehicle do
    Delay departure time
   end for
   for Each following vehicle that will be delayed do
    for Each cell follower occupies or have future arrival time to do
     if Follower not already in cell then
      Delay arrival time of follower
     end if
     Delay departure time of follower
    end for
    Store the delay of follower
   end for
  end if
  Store arrival and departure times calculate preliminary arrival time to next cell
end for