CS 680
Spring, 2003
Ethan Bolker
hw8

Parts 1, 2 and 3 below are due Wednesday, April 16, 3 PM. .

In this assignment we'll begin the construction of the elevator simulation that you will write for your final project. You may do it in C++ or in Java. (Will anyone choose C++?).

Problem statement: A building is to be equipped with a bank of elevators. Customers arrive at random times at the elevators on one of the floors and press an up or a down button at that floor. When an elevator arrives at the floor it discharges any passengers who want to get off. Then it signals the direction (up or down) that it will go next and waits while any passengers who want to go that way get on.

The architect wants to know the average trip time between floors, broken down into

and has asked us to construct a software package to simulate the system, so that she can experiment with different numbers and speeds of elevators.

Input: Input to the simulation will be a file with the following format:

   2 	// number of elevators
  12 	// capacity of each elevator
  2.5	// time for passenger to leave elevator (after doors are open)
        // time for passenger to enter elevator
  1.3	// time for doors to open once elevator has arrived at a floor
  	// time for doors to close after last passenger has gotten on
	// time for elevator to travel from LL2 to LL1
        // LL1 to 2
        // and so on ... to floor 11
	// passengers per second wanting to leave floor LL2
	// to leave LL1
	// and so on ...
   1.0	// probability that a passenger on board leaves at LL2
	//  ditto at LL1
	// and so on ...
	// measured average total trip time from 2-LL2
	// from 2-LL1
	// and so on ...
	// measured average total trip time to 2 from LL2
	// to 2 from LL1
	// and so on ...
We will model the near set of two elevators in the Healey Library. elevators. All times are measured in seconds. The travel times between floors are different because the floors are different distances apart.

The UMass librarian has given us permission to get actual values for all the input parameters by observing what happens at the elevators. We'll also measure actual trip times. Then you can compare the measured results with the predictions from your simulator.

The best way to specify the traffic is probably

   // multiple lines of the form  
   x y z 
   // where z = number of passengers per second requesting
   // a trip from floor x to floor y
But I've asked you collect this data instead:
   r1 r2 r3 ... // ri = average arrival rate in passengers per second 
                // requesting a trip from floor i
   p1 p2 p3 ... // probability that a passenger on board leaves elevator
	        // when when it stops at floor i
With some straightforward probability theory we can probably derive the first set of traffic parameters from the second.

Output: To be specified later.

Discrete event simulation: One of the purposes of this assignment is to learn how discrete event simulations work. The program architecture separates managing the sequence of events from managing the state changes caused by those events. The event management is generic, and useful for simulating many kinds of processes (tollbooths and supermarket checkout lines as well as elevator systems) while the particular actions triggered by events are particular to the domain being modeled.

You may write the event management framework yourself (it's not too hard) or borrow one from anywhere you like (with attribution). A Google search for java discrete event simulation will turn up interesting things to read, perhaps even code you want to download.

Programming the elevators: The central logic of the system is the logic the elevators use to decide where to go next when. You will want to separate this control logic from the rest of the application with an API that allows you to experiment with different algorithms. You can find discussions (and possibly code) with a Google search for elevator algorithms. (These algorithms are also used to schedule disk arm movement when reading and writing data blocks. That's why they get so much attention in the literature.)

Project development cycle: Here's a rough outline of the steps that will be called for between now and the end of the semester:

  1. Collect measurement data in the Healey Library so we have reasonable values for the simulator input parameters. Do this unobtrusively at a busy time (a class changeover time). You should probably spend at least half an hour at this task, recording the data called for above.

    When you have collected your data, fill in the spreadsheet at $CS680/hw8/elevatorInput.xls and leave it in your cs68/hw8 directory.

  2. Write use cases for the externally observable behavior of the elevator system.

  3. Create CRC cards for the objects you will need.

  4. Decide how you will build the application in small steps each of which can be tested.

  5. Loop through the construction, writing tests (first!), writing code, refactoring.

Other issues: I've bulleted these items here so I don't forget to address them, either in class or on line.


Back to the CS680 home page.