The LTSA tool provides you with a very simple editor for writing models in the FSP language. But unlike other modelling tools (e.g., most UML ones), editing is just the first step with this tool. It can:
Here is the LTSA user manual and the FSP Quick Reference guide, which are also included at the end of your handouts.
So a model for the above specification would be something like:
BOMB = (start -> timeout -> explode -> STOP).We have a process that models the bomb (called BOMB - all process names are in capital letters) - this process can engage in the start action, then in the timeout action, then in the explode action and at that point it behaves like the STOP process (which does nothing).
Now from the "Build" menu option, select "Parse". This lets you know if your specification contains syntax errors.
If you have no syntax errors, then select "Check -> Compile". This will generate the state machine (Labelled Transition System - LTS) that corresponds to your specification.
You can also experiment with actually "animating" the model of the bomb. Select "Check -> Run -> Default". An animator window comes up. On the right, you have the actions that can be performed by the Bomb. The "ticked" ones are those that are eligible at the current state.
Go to "Window" and select the "Alphabet" option. Another tab is now available (along with "Edit", "Output" and "Draw"), called "Alphabet". Select that tab and see what the alphabet of the BOMB process is.
LAMP = (switch_on -> switch_off -> LAMP).
public class Lamp { // Variables missing Lamp() { // Code missing } public void switch_on() { // Code missing } public void switch_off() { // Code missing } public static void main(String [] args) { Lamp l = new Lamp(); l.switch_on(); l.switch_off(); l.switch_off(); } }