150 likes | 359 Views
State charts in SysML. Announcements. 15 July 2004 – I-Logix announce that BAe systems are standardising on Statemate for development of Eurofighter Typhoon - using MDD – Model-driven Development Dec 14 2004 Statemate chosen for use by MBDA in the development of METEOR.
E N D
Announcements • 15 July 2004 – I-Logix announce that BAe systems are standardising on Statemate for development of Eurofighter Typhoon • - using MDD – Model-driven Development • Dec 14 2004 Statemate chosen for use by MBDA in the development of METEOR
Model–driven Development • Design behaviour using diagrammatic notations • Demonstrate and evaluate the behaviour early in the development process • Generate the delivered code/part directly from the model, perhaps guided by the designer with additional decisions.
Statemate • A state machine design tool based on David Harel’s state charts (incorporated into UML) • Allows • Simulation – what would happen if the following sequence of events occurred. • Analysis – prove that the system can never lock up • Code generation – to C for loading into embedded processors
Basic State Machine • The basic concepts in this notation are: • state • A mode of the object/component/sub-system • transition • A change of state caused by an event or input, perhaps back to the same state • event • the input which causes a transition to occur • action • An action which occurs when a transition is made
Exercise • 1.1. What sequence of noises does it make when the sequence ABACAC is in put? • 1.2 What about BABAAC? • 1.3 What kind of error in the machine does the sequence ACCBA reveal? • 1.4 What kind error in the machine does the input BABC reveal? • 1.5 What kind of error does the sequence ABAXAC reveal? • 1.6 Give other examples of good and bad input.
JavaScript Simulator • Web Simulator
Another Simulator • This simulator takes a text file (written in an XML vocabulary) and builds a model which can be executed or visualized. • Local CEMS FSM simulator • Web Simulator
Noise machine model <stm name="Noise Machine"> <initialState id="1" /> <finalState id="4"/> <state id="1"/> <state id="2"/> <state id="3"/> <state id="4"/> <event id="A"/> <event id="B"/> <event id="C"/> <transition from="1" to="2" input="A"> <action> print "boing" </action> </transition> <transition from="1" to="3" input="B"> <action> print "clack" </action> </transition> <transition from="1" to="4" input="C"> <action> print "clang" </action> </transition> <transition from="2" to="1" input="A"> <action> print "hiss" </action> </transition> <transition from="2" to="3" input="B"> <action> print "bang" </action> </transition> <transition from="2" to="2" input="C"> <action> print "pong" </action> </transition> <transition from="3" to="2" input="A"> <action> print "ping" </action> </transition> </stm>
Physical devices • Mechanical devices can be modelled with FSMs too
Exercise 3 • A vending machine can accept 5, 10 and 20p coins up to a total value of 30p. There is one dispense button. When pressed, the machine issues a cold drink can and pockets the 30p. • Define a suitable state machine. Note that the amount entered so far must be described only in the state of the machine, not in a separate counter.
Chinese clock • Operating for clock • Time display:- • The normal display of Hour Minute and Month day are alternate move. • Time setting:- • 1) push S1 once, display shows MONTH, push S2 to advance month • 2) push S1 twice, display shows DAY of MONTH, push S2 to advance DAY • 3) push S1 third, display shows hour and AM/PM indicator. Push S2 to advance hour • 4) push S1 fourth time, display shows MINUTES. Push S2 to advance MINUTES • 5) push S1 fifth time, display shows normal running mode • 6) push S1 One more time, display will alternate TIME and DATE each 2 seconds