Elevator Simulation

Elevator Simulation

The simulation operates in two modes. The first mode is activated by pressing the go button. Then the simulation continuosly runs triggered by a clock until the stop or reset button is pressed. In the second mode one can step through the simulation manually by pressing the step button.

The user can call the elevator to a particular floor by pressing the corresponding press button. These buttons are enabled if no request on that floor is pending. Note that the buttons to call the elevator and the buttons that usually reside inside the elevator are not modelled seperately. Therefore we do not show the latter buttons at all.

The simulation contains four different controllers. The SimpleController just moves the elevator to the lowest floor with a pending request. It is not very careful in coordinating the operation of the door and moving up and down. The second controller SafeController is an improvement over the first controller since it does not violate the Safety-property, that the door must be kept closed as long the elevator is moving. However it still has some problems which are solved by the third controller.

The LiveController fulfills the Liveness-property that each request is eventually acknowledged, i.e. after pressing the button on a particular floor, the elevator will eventually reach this floor and open its door.

The last controller MinMaxController implements the well-known elevator-principle. In particular it stops on each floor on which a request is pending, going up until the highest floor with a request is reached. Then it turns and starts going down until the lowest floor with a pending request is reached, stopping again on each floor with a pending request.

There is still some space left for optimization. For example the controller does not open the door at the same time it stops the elevator. If you implement a better controller or you find some bugs in the four controllers above then please let me know. Here are the sources elsim.zip. You can also just download the binary elsim.jar and run the application with java -jar elsim.jar.