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

statecharts tool
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

REQUIREMENTS ENGINEERING LAB

Statecharts - Tool

João Pimentel OCTOBER/2014

slide-2
SLIDE 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

slide-3
SLIDE 3

Yakindu Statecharts Tool

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.”

slide-4
SLIDE 4

Features

 Modeling  Syntax checking  Simulation  Integration with Java code  Code generation

 Java  C  C++

4

slide-5
SLIDE 5

Download

5

slide-6
SLIDE 6

Online resources - documentation

6

slide-7
SLIDE 7

Online resources - forum

7

slide-8
SLIDE 8

YAKINDU – INSTALLING & RUNNING

8

slide-9
SLIDE 9

Installing

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

9

slide-10
SLIDE 10

Running (1/3)

And then just run the Eclipse execution file from the folder you’ve just extracted

10

slide-11
SLIDE 11

Running (2/3)

During startup you’ll be prompted with the usual “Select a worspace” window

11

You can choose any folder to store your projects’ files, then press “OK”

slide-12
SLIDE 12

Running (3/3)

You are then greeted with the regular Eclipse welcome window

12

slide-13
SLIDE 13

CREATING A NEW PROJECT

13

slide-14
SLIDE 14

Creating a new project (1/4)

File/New/Java Project

14

slide-15
SLIDE 15

Creating a new project (2/4)

15

slide-16
SLIDE 16

Creating a new project (3/4)

16

Close the “Welcome” window, if still open

slide-17
SLIDE 17

Creating a new project (4/4)

17

slide-18
SLIDE 18

CREATING A NEW STATECHART

18

slide-19
SLIDE 19

Creating a new statechart (1/5)

19

slide-20
SLIDE 20

Creating a new statechart (2/5)

20

Yakindu/Statechart Model

slide-21
SLIDE 21

Creating a new statechart (3/5)

21

1) Write a name for your statechart, with the “.sct” extension

slide-22
SLIDE 22

Creating a new statechart (4/5)

22

slide-23
SLIDE 23

Creating a new statechart (5/5)

23

slide-24
SLIDE 24

GETTING TO KNOW THE ENVIRONMENT

24

slide-25
SLIDE 25

Project Explorer

25

Browse your project’s files

slide-26
SLIDE 26

Outline

26

Zoomed out view of your statechart

slide-27
SLIDE 27

Problems/Properties

27

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

slide-28
SLIDE 28

Problems

28

slide-29
SLIDE 29

Main Panel (1/4)

29

The actual modeling

slide-30
SLIDE 30

Main Panel (2/4)

30

Text area for declarations and actions

slide-31
SLIDE 31

Main Panel (3/4)

31

The actual statechart

slide-32
SLIDE 32

Main Panel (3/4)

32

Palette of modeling elements

slide-33
SLIDE 33

Perspective

33

slide-34
SLIDE 34

INSERTING ELEMENTS

34

slide-35
SLIDE 35

Pallete

35

slide-36
SLIDE 36

Inserting elements

36

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

slide-37
SLIDE 37

Inserting transitions (1/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...

slide-38
SLIDE 38

Inserting transitions (2/2)

38

... and lastly you can detail the transition: event (condition) / action

slide-39
SLIDE 39

Inserting super-states (1/2)

39

Super-states are called “Composite States” – it can be added in the same way as regular states

slide-40
SLIDE 40

Inserting super-states (2/2)

40

If you need to turn a state into a super-state, you just need to add a “Region” to that state

slide-41
SLIDE 41

Inserting orthogonal states (1/3)

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

slide-42
SLIDE 42

Inserting orthogonal states (2/3)

42

The orthogonal state starts with 2 sub-states. To add more, insert a region

slide-43
SLIDE 43

EDITING ELEMENTS

43

slide-44
SLIDE 44

Editing elements (1/2)

44

Option 1) Double-click the element; write; press Enter.

slide-45
SLIDE 45

Editing elements (2/2)

45

Option 2) Click the element (1); go to the Properties panel (2); edit.

slide-46
SLIDE 46

SIMULATION

46

slide-47
SLIDE 47

Running a simulation (1/)

47

Create a statechart

slide-48
SLIDE 48

Running a simulation (2/)

48

In the Run menu (1), select “Run As” (2), “Statechart Simulation (3)

slide-49
SLIDE 49

Running a simulation (3/)

49

The tool will change to the “SC Simulation” perspective Active states are highlighted in red (1)

slide-50
SLIDE 50

Practice

50

Create this statechart and simulate its execution

slide-51
SLIDE 51

EVENTS

51

slide-52
SLIDE 52

After

 Syntax: after time unit  Unit:

 s – seconds  ms – milliseconds  us – microseconds  ns – nanoseconds  empty – implies seconds

52

slide-53
SLIDE 53

Custom Events

 You can write any event in your transitions (1)

 But you need to declare the events (2)

53

slide-54
SLIDE 54

Defining events (general)

 You can define general events

interface: in event pressCapsLocks in event pressEnter in event ...

54

slide-55
SLIDE 55

Defining events (scoped)

 Or you can define scoped events

interface Keyboard: in event pressCapsLocks in event pressEnter in event ...

55

slide-56
SLIDE 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

slide-57
SLIDE 57

VARIABLES AND ACTIONS

57

slide-58
SLIDE 58

Variables (declaring 1/2)

internal: var varName:varType = startingValue

Ex: var count:integer = 0

58

slide-59
SLIDE 59

Variables (declaring 2/2)

 Possible types:

 integer  real  boolean  string

59

slide-60
SLIDE 60

Variables (modifying)

 Variable can be modified by actions

60

slide-61
SLIDE 61

Actions

 Transition

 event [condition] / action

 State

 entry / action  exit / action

61

slide-62
SLIDE 62

Variables (conditions)

 Variables can also be used to define conditions

 event [condition] / action

62

slide-63
SLIDE 63

Variables (simulation)

63

During simulation, the current value of variables is also displayed in the “Simulation View”

slide-64
SLIDE 64

PRACTICE

64

slide-65
SLIDE 65

Traffic Lights v1

65

slide-66
SLIDE 66

Traffic Lights v2

66

slide-67
SLIDE 67

Interface Buttons

67

slide-68
SLIDE 68

68

Telephone

slide-69
SLIDE 69

Final Practice

69

Create the statechart for a meeting, and simulate its execution

slide-70
SLIDE 70

THANK YOU AND SEE YOU LATER!

70