CS 680
Spring, 2003
Ethan Bolker
hw10
Due Monday, April 28, in class.
.
Continuing with the elevator simulation - a little bit at a time.
For ongoing discussions, be sure to watch the forum
and some $CS310/elevators/thoughts.html.
- Begin by writing a short .els file that
specifies one elevator in a building with just two floors. Then you
don't have to worry about choosing a random number to determine which
floor a Passenger leaves at.
Hard code the
arrival of just a few passengers at specific times. Don't use
random number generators to create new PassengerArrival events.
Choose simple numbers for
the travel and door opening and closing and entry and exit times in
the input file so
that you can work
out in advance exactly what the sequence of events should be.
Imagine and code the simplest possible elevator logic.
-
Start instrumenting your simulator so that it produces output
statistics when requested. Here's a possible syntax. You can add to it
a little at a time while you're thinking about harder problems. But
it's important to start it soon so that you can use it for debugging
as you develop the simulation.
Elevator Simulation
(date)
Simulation input parameters:
[choose some reasonable syntax - perhaps the one from ElsData.toString()]
Trip statistics:
Passenger arrival rate average trip time
floor expected actual from main to main
0 xxx xxx xxx xxx
1 xxx xxx xxx xxx
2 xxx xxx 0 0
3 xxx xxx xxx xxx
...
Simulation statistics:
Simulated time: xxx
Elapsed time: xxx
CPU time: xxx
Number of trips: xxx
Number of Events scheduled: xxx
Number of Events created: xxx
-
Introduce randomness into Passenger arrivals. If Passengers are
supposed to arrive at the Elevator on a floor at a rate of R/second
then the average time between arrivals should be 1/R seconds. Each
PassengerArrivalEvent should schedule the next one about that many
seconds later. Choose the random number with the right average value
from an exponential distribution. We'll discuss exponential
distributions in class. You will find code for generating random
numbers from such a distribution in $CS680/elevators/Exponential.java.
-
Draw conclusions from your simulator.
Here are some questions you will want to try to answer:
- How long (in simulated time) do you need to run the simulation so
that the results are reliable - that is, so that repeated runs produce
average trip times (for each particular trip)
that are close enough to each other so that you can draw conclusions.
- Do the results from your simulator match those from a classmate's?
- How well do the results of the simulation match your experience
in the Healey Library?
- When you fix all the parameters except the input rate, how does
average waiting time for a particular trip vary as arrival rate varies?
- What arrival rate saturates the system (so that the number of
passengers waiting at each floor just keeps growing without bound and
the average trip time is infinite)?
- Which of the input parameters are the most critical? (Elevator
speed? time to open and close doors? time for passengers to enter and
leave?)
- How does the choice of the elevator dispatch algorithm affect
passenger trip times?
Back to the CS680 home page.