Purpose: practice modeling a system using JML
Please note: A big part of practical formal methods is having conversations with your client so that your model reflects what they really want. To give you practive with that, projects in this class are somewhat underspecified and require that you go somewhat beyond what is specifically covered in class. I look forward to helping you with that, which is why some class meetings are canceled for project work, but you need to ask for help.
Other details:
Your team has a Subversion repository for the projects. The repository URL is:
http://svn.csse.rose-hulman.edu/repos/csse373-201130-teamNN
where NN is your assigned team number.
Your task is to construct a JML model of the lift system from P2 that describes:
I'm providing a simulator for the hardware and for the humans who would push buttons in the lifts. I'm also providing a text-based view of the system that displays its state.
You will annotate two classes, control.LiftController and control.FloorController, with JML specifications, test them using JMLUnitNG, and run the simulator using these classes.
HigherExpectations project from your project team SVN repository. Study the provided code, noting the following:
The build.xml file includes targets for:
FloorController and LiftController. main.Main. This class creates instances of LiftSimulator, which simulate the hardware of a lift car, and instance of FloorSimulator, which simulator the buttons in the hallway for calling a lift in a particular direction. For each simulator, Main also creates an instance of your LiftController or FloorController as appropriate. LiftController knows about its LiftSimulator, and vice versa. This lets the simulator tell the controller when an event occurs, such as a button press or arriving at a floor. This arrangement also lets the controller tell the simulator to open the lift door, or start moving up, etc. FloorSimulator knows about its FloorController. This lets the simulator tell the controller when a button has been pressed. FloorController knows about every LiftController. This lets the floor controller tell all the lifts when a floor call button has been pressed. LiftController knows about every FloorController. This lets the lift controller poll all the floors looking for pending floor call requests.
Your primary task is to add JML specifications to control.LiftController and control.FloorController, implement and test them using JMLUnitNG, and run the simulator using these classes.
Annotate the class as follows:
To guide you, the ILiftController and IFloorController interfaces provide informal, javadoc descriptions of all the methods. Also, note that the interfaces include initially clauses that constrain your constructors.
You may also find your (or my) Alloy model from P2 useful. I did.
The simulator is designed to throw an exception and stop the simulation if your control algorithm makes an illegal request, such as asking a lift to move while its doors are open, open its doors while its moving, or do anything while out of service. Your controller will have to track the state of the system to avoid making such requests.
I will evaluate your work using this grading rubric [pdf].
Turn in your work by committing your Eclipse project to your team repository.