This project addresses an elevator controller challenge. For details of the problem specification, see Challenge.md.
Time limit: 4 hours
I wrote the submission in Java, using IntelliJ IDEA (Community 2017.2). All the project files are packaged, if you have IntelliJ. Otherwise, a Makefile builds things by hand. Details below.
A few notes about the state of the project.
-
The framework is present, but I ran out of time before getting to any scheduling or detailed event handling.
-
A Driver class simulates device events (button presses, etc.) and hands those stimuli to the associated objects. Unfortunately, the objects (call buttons, the elevator) don't do much with them.
-
The next steps (obviously) would be to add more event handling for the elevator, moving the car to different floors, opening doors, etc.
-
The
Elevator
class is intended to handle incoming events and also to generate its own events for the controller. For example, when the elevator stops at a floor, changes direction, etc., it could emit its own events for the controller. In turn, the controller could send new events to theElevator
car, moving an idle car up or down if its scheduler considered that appropriate. -
A text file,
events.sim
, holds one event per line. TheDriver
class reads the lines and simulates activity that would be generated by humans or electromechanical devices. The format of the simulation file is:timestamp device-ID stimulus-type floor
The idea of the file is to build a script that drives the operation of the system. Once the simulation starts, the system itself would generate new events that drive additional activity.
-
See the javadoc for more information.
Compile the java:
make all
Run the java:
make run
Make the javadoc:
make doc
Read the javadoc:
browse doc/index.html