statecharts tool
play

Statecharts - Tool Joo Pimentel O CTOBER /2014 REQUIREMENTS - PowerPoint PPT Presentation

Statecharts - Tool Joo Pimentel O CTOBER /2014 REQUIREMENTS ENGINEERING LAB Agenda Introduction Using the tool Installing & Running Creating a project Creating statecharts Getting to know the environment


  1. Statecharts - Tool João Pimentel O CTOBER /2014 REQUIREMENTS ENGINEERING LAB

  2. Agenda Introduction  Using the tool  Installing & Running  Creating a project  Creating statecharts  Getting to know the environment  Inserting elements  Editing elements  Simulation  Events  Variables and Actions  Practice  Conclusion  2

  3. Yakindu Statecharts Tool “The free to use, open source toolkit YAKINDU Statechart Tools (SCT) provides an integrated modeling environment for the specification and development of reactive, event-driven systems based on the concept of statecharts.” at http://statecharts.org 3

  4. Features  Modeling  Syntax checking  Simulation  Integration with Java code  Code generation  Java  C  C++ 4

  5. Download 5

  6. Online resources - documentation 6

  7. Online resources - forum 7

  8. YAKINDU – INSTALLING & RUNNING 8

  9. Installing If you get the “ Full Eclipse” version, all you need to do is to extract the downloaded file 9

  10. Running (1/3) And then just run the Eclipse execution file from the folder you’ve just extracted 10

  11. Running (2/3) During startup you’ll be prompted with the usual “ Select a worspace ” window You can choose any folder to store your projects ’ files, then press “OK” 11

  12. Running (3/3) You are then greeted with the regular Eclipse welcome window 12

  13. CREATING A NEW PROJECT 13

  14. Creating a new project (1/4) File/New/Java Project 14

  15. Creating a new project (2/4) 15

  16. Creating a new project (3/4) Close the “ Welcome ” window, if still open 16

  17. Creating a new project (4/4) 17

  18. CREATING A NEW STATECHART 18

  19. Creating a new statechart (1/5) 19

  20. Creating a new statechart (2/5) Yakindu/Statechart Model 20

  21. Creating a new statechart (3/5) 1) Write a name for your statechart, with the “. sct ” extension 21

  22. Creating a new statechart (4/5) 22

  23. Creating a new statechart (5/5) 23

  24. GETTING TO KNOW THE ENVIRONMENT 24

  25. Project Explorer Browse your project’s files 25

  26. Outline Zoomed out view of your statechart 26

  27. Problems/Properties Problems : warnings and errors in your current project Properties : properties of the selected element 27

  28. Problems 28

  29. Main Panel (1/4) The actual modeling 29

  30. Main Panel (2/4) Text area for declarations and actions 30

  31. Main Panel (3/4) The actual statechart 31

  32. Main Panel (3/4) Palette of modeling elements 32

  33. Perspective 33

  34. INSERTING ELEMENTS 34

  35. Pallete 35

  36. Inserting elements To insert an element, select the element in the Palette (1) and then draw it in the statechart (2) 36

  37. Inserting transitions (1/2) To insert a transition, select “ Transition ” in the Palette (1) and then drag (2) and drop (3) from the origin state to the target state... 37

  38. Inserting transitions (2/2) ... and lastly you can detail the transition: event (condition) / action 38

  39. Inserting super-states (1/2) Super-states are called “ Composite States” – it can be added in the same way as regular states 39

  40. Inserting super-states (2/2) If you need to turn a state into a super-state, you just need to add a “ Region ” to that state 40

  41. Inserting orthogonal states (1/3) To insert an orthogonal state, select “ Orthogonal State ” in the pallete (drop-down menu of “ Composite State ”), then just insert it as a regular state 41

  42. Inserting orthogonal states (2/3) The orthogonal state starts with 2 sub-states. To add more, insert a region 42

  43. EDITING ELEMENTS 43

  44. Editing elements (1/2) Option 1) Double-click the element; write; press Enter. 44

  45. Editing elements (2/2) Option 2) Click the element (1); go to the Properties panel (2); edit. 45

  46. SIMULATION 46

  47. Running a simulation (1/) Create a statechart 47

  48. Running a simulation (2/) In the Run menu (1), select “ Run As” (2), “Statechart Simulation (3) 48

  49. Running a simulation (3/) The tool will change to the “SC Simulation ” perspective Active states are highlighted in red (1) 49

  50. Practice Create this statechart and simulate its execution 50

  51. EVENTS 51

  52. After  Syntax: after time unit  Unit:  s – seconds  ms – milliseconds  us – microseconds  ns – nanoseconds  empty – implies seconds 52

  53. Custom Events  You can write any event in your transitions (1)  But you need to declare the events (2) 53

  54. Defining events (general)  You can define general events interface: in event pressCapsLocks in event pressEnter in event ... 54

  55. Defining events (scoped)  Or you can define scoped events interface Keyboard: in event pressCapsLocks in event pressEnter in event ... 55

  56. Events in a simulation During simulation, the declared events appear in a list of events, which can be clicked to simulate the occurrence of that event 56

  57. VARIABLES AND ACTIONS 57

  58. Variables (declaring 1/2) internal: var varName:varType = startingValue Ex: var count:integer = 0 58

  59. Variables (declaring 2/2)  Possible types:  integer  real  boolean  string 59

  60. Variables (modifying)  Variable can be modified by actions 60

  61. Actions  Transition  event [condition] / action  State  entry / action  exit / action 61

  62. Variables (conditions)  Variables can also be used to define conditions  event [condition] / action 62

  63. Variables (simulation) During simulation, the current value of variables is also displayed in the “ Simulation View ” 63

  64. PRACTICE 64

  65. Traffic Lights v1 65

  66. Traffic Lights v2 66

  67. Interface Buttons 67

  68. Telephone 68

  69. Final Practice Create the statechart for a meeting , and simulate its execution 69

  70. THANK YOU AND SEE YOU LATER! 70

Recommend


More recommend