Homework 4: Interface Automata Homework


For this homework, you have to model a car locking/lights/climatization system in flexi.

How to Install Flexi

NOTES

The Assignment

You have to model the control system that controls door locks, headlights, courtesy lights, and climatization of a car. It helps, to do the assignment, to know how a car works, so if you don't have one, I advise you to rent one. Just kidding!

The control system must consist of four different modules; each module should be modeled as one (or more, if you like) interface automata. Below I list the four modules, with their (approximative) function, and a partial list of their inputs and outputs. You must try to build somewhat "smart" modules. In particular, below I list only the signals that each controller sends to and receives from the car; the controllers must communicate one to the other in order to carry out their function. I leave it to you to design the inter-controller communication. Your solution will be graded for correctness, but also for the sophistication of the inter-controller interaction, and for the smartness of the global control solution. I give sample names to the signals, you can choose other names, but be sure to explain their function.

If you need, you are welcome to create auxiliary modules, for instance, to work as timers.

1. Lock Controller

The lock controller decides whether the doors are locked or unlocked. It has many goals: avoid forgetting the car parked and unlocked, avoid locking the keys inside the car, avoid kids from being able to open the rear doors if the signal "kids_locks_on" is received, enable the driver to open all doors by turning the key in a door lock twice, etc etc. The limit is your imagination, and your frustration with the last car you drove.

If something is too difficult to implement, explain the source of the difficulty: you don't have to handle all signals below, but try to produce an interesting solution.

2. Headlights.

This should be a smart headlights controller. You should make it difficult to park with the lights on, and you should coordinate headlights usage with the lock system.

3. Courtesy Lights.

This should be a smart courtesy lights controller. You should make it difficult to park with the lights on, and you should coordinate courtesy lights usage with the lock system.
  • Inputs from car:
    • Courtesy_switch_on.
    • Courtesy_switch_off.
    • Courtesy_switch_door. This is the setting in which they are on only when a door is open.
  • Outputs to the car:
    • Turn_courtesy_lights_on.
    • Turn_courtesy_lights_off.

4. Climatization.

This should be a smart climatization controller. You may want to switch climatization off when a door is open, or when the engine is not running.
  • Inputs from car:
    • Is_hot.
    • Is_cold.
    • User_says_no_AC. AC cannot be used.
    • User_says_yes_AC. AC can be used.
  • Outputs to the car:
    • Turn_AC_on.
    • Turn_AC_off.
    • Turn_heat_on.
    • Turn_heat_off.

Advice

Start simple, and add complexity to your model in a gradual way. In order to get a good grade, your model needs to compose without incompatibilities, and it's better to turn in a working, but simpler, example, rather than a complex non-working (or worse, non-parsing) model.

You may want to draw your examples on paper before putting them into the flexi input format.

What you have to do

  • First, make a model, and check that the interface automata are compatible.
  • Look (if you can) at the input assumptions; what do they say? Try to give a few environment scenarios that are not allowed. For example, will the system panic if two copies of the key are used, for instance, one to start the engine, the other to lock the doors?
  • Construct some interface automaton representing the driver and a chaotic family, and see if everything is compatible.
  • Formulate some properties, in English, that you would like to check about your design (e.g., don't get to a state where you cannot lock or unlock the doors). We will see later in class how to do this specification.