Frequently Asked Questions for CS 2704 Project 2

Last modified on 10/14/1999.

System Initialization

Order of Event Processing

Elevator and Passenger Movement

Selecting a Destination

Q. Which takes precedence, Rule 1 or an init command?

A.  If there is no init command for an elevator, then Rule 1 will apply.  It is likely, but not guaranteed, that test files will include an init command for each elevator.

Q. What about init commands that come in the middle of the input file?

A.  There won't be any.  All init commands will come immediately after the header specifying the start time, number of elevators and floors, etc.

Q. Should a display or stats command be carried out before or after the elevators are updated?

A.  After.  See the following item for more info.

Q. In what order do things occur when the simulation clock "ticks"?

A.  When the simulation clock "ticks":

  1. If the next input command is a call or a fail or a fix, and its timestamp has been reached, process that command now. 
  2. Update the state of each elevator, in numerical order.
  3. If the next input command is a display or stats, and its timestamp has been reached, process that command now.

Thus, display and stats commands will show the state of the system AFTER the elevators have updated, but calls, failures and fixes will take place BEFORE the elevators have updated.

Q. Is it possible for two elevators to stop on the same floor (at the same or overlapping times)?

A.  Yes.  For example, suppose there is an outstanding call on floor 5, and no other calls.  Suppose that Elevator 0 arrives on floor 5 to service the call at 02:05:14.  Suppose that Elevator 3 is carrying a passenger who wants to get off on floor 5 and Elevator 3 also reaches floor 5 at 02:05:14.  Then Elevator 0 would handle the call (since it is updated first), but Elevator 3 would stop anyway because it's carrying a passenger who wants that floor.

Q. If two elevators do stop on the same floor at exactly the same time, which one do passengers board?

A.  The "first one to stop", which will be the elevator with the lower number.  Note:  this is NOT saying the elevator with the lower number of passengers!

Q. Rule 12(a,c): what if there are multiple calls that qualify here?

A.  OK, that's a hole in the spec.  In this case, an elevator should choose the closest floor (in the correct direction)

Q. What if call is made and an elevator is already stopped on that floor?

A.  Assuming the elevator is in working order, the passenger who made the call would enter that elevator immediately (so the call would be served immediately).  

Q. In the situation above, would the elevator reset its delay (wait another 10 seconds)?

A.  Yes.  So, if an elevator acquires a passenger while it is waiting on a floor, it would begin another 10-second wait cycle.  (It's actually somewhat easier to do it this way, I believe.)

Q. In the situation above, what if there are multiple elevators stopped on the floor?

A.  The passenger would enter the one with the lowest number.


Q. What if an elevator fails just as it reaches a floor?

A.  When an elevator fails, no one can either enter or leave it. So if there's an outstanding call for that floor, it will still be outstanding, and if there are any passengers on that elevator, they're stuck there until the elevator is fixed (or the simulation ends).


Please send comments and suggestions to Mike Parks at