REQUIREMENTS ENGINEERING LAB
Statecharts - Tool
João Pimentel OCTOBER/2014
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
REQUIREMENTS ENGINEERING LAB
João Pimentel OCTOBER/2014
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
at http://statecharts.org
3
“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.”
Modeling Syntax checking Simulation Integration with Java code Code generation
Java C C++
4
5
6
7
8
9
10
11
You can choose any folder to store your projects’ files, then press “OK”
12
13
File/New/Java Project
14
15
16
Close the “Welcome” window, if still open
17
18
19
20
Yakindu/Statechart Model
21
1) Write a name for your statechart, with the “.sct” extension
22
23
24
25
Browse your project’s files
26
Zoomed out view of your statechart
27
Problems: warnings and errors in your current project Properties: properties of the selected element
28
29
The actual modeling
30
Text area for declarations and actions
31
The actual statechart
32
Palette of modeling elements
33
34
35
36
To insert an element, select the element in the Palette (1) and then draw it in the statechart (2)
37
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...
38
... and lastly you can detail the transition: event (condition) / action
39
Super-states are called “Composite States” – it can be added in the same way as regular states
40
If you need to turn a state into a super-state, you just need to add a “Region” to that state
41
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
42
The orthogonal state starts with 2 sub-states. To add more, insert a region
43
44
Option 1) Double-click the element; write; press Enter.
45
Option 2) Click the element (1); go to the Properties panel (2); edit.
46
47
Create a statechart
48
In the Run menu (1), select “Run As” (2), “Statechart Simulation (3)
49
The tool will change to the “SC Simulation” perspective Active states are highlighted in red (1)
50
Create this statechart and simulate its execution
51
Syntax: after time unit Unit:
s – seconds ms – milliseconds us – microseconds ns – nanoseconds empty – implies seconds
52
You can write any event in your transitions (1)
But you need to declare the events (2)
53
You can define general events
interface: in event pressCapsLocks in event pressEnter in event ...
54
Or you can define scoped events
interface Keyboard: in event pressCapsLocks in event pressEnter in event ...
55
During simulation, the declared events appear in a list of events, which can be clicked to simulate the occurrence of that event
56
57
internal: var varName:varType = startingValue
58
Possible types:
integer real boolean string
59
Variable can be modified by actions
60
Transition
event [condition] / action
State
entry / action exit / action
61
Variables can also be used to define conditions
event [condition] / action
62
63
During simulation, the current value of variables is also displayed in the “Simulation View”
64
65
66
67
68
69
Create the statechart for a meeting, and simulate its execution
70