Top Banner
Graphical Systems Modeling with UML / SysML State machine diagrams © Piotr Ciskowski
21

Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Apr 03, 2018

Download

Documents

doananh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Graphical Systems Modeling

with UML / SysML

State machine diagrams

© Piotr Ciskowski

Page 2: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

behavior

• sequence diagram

• activity diagram

• state machine diagram

• interaction overview diagram

• communication diagram

• timing diagram

• package diagram

Perspectives - views:

Use case

view

Logical view

architecture

• class diagram

• object diagram

• composite structure diagram

• package diagram

Dynamic View

Implementation View

Deployment View

system scope& functionality

•use case diagram• package diagram

software

• component diagram

• package diagram

hardware

• deployment diagram

• package diagram

Page 3: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

State machine diagram

• state - a situation during which some condition holds

- static or dynamic

• state machine - behavior of a single object

- sequence of states it goes through - in reaction to events

• state machine diagram - graphical representation of states and transitions

- directed graph

� states

� transitions

� events

� actions

� guard conditions

Page 4: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

State machine diagram

• state - a situation during which some condition holds

- static or dynamic

• state machine - behavior of a single object

- sequence of states it goes through - in reaction o events

• state machine diagram - graphical representation of states and transitions

- directed graph

• examples:

� switch: on/off

� washing mashine: prewash, wash, rinse, spin, dry

� ATM: idle, active, out-of-service

� project: submitted, evaluated, accepted, rejected,

monitored, audited, finished, delayed

Page 5: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

State machine diagram

• state - a situation during which some condition holds

- static or dynamic

• state machine - behavior of a single object

- sequence of states it goes through - in reaction o events

• state machine diagram - graphical representation of states and transitions

- directed graph

• symbol: rounded rectangle

• name: - capital letter

- nouns: Washing, Drying

- adjectives: Idle, Active, Processed, etc.

Page 6: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

COMPARTMENTS

Page 7: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

State machine diagram

• sections / compartments:

� name

� internal activities - entry / exit / do

� internal transitions

� decomposition

Page 8: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Example – fax machine

• state parameters

• entry / exit / do actions

• transition

Page 9: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Example – mobile phone

• composite states

• transitions

• guard conditions

Page 10: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Example – mobile phone

• composite states

• transitions

• guard conditions

Page 11: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Example – ATM

• high level behavioral diagram

Page 12: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

STATES – SIMPLE & COMPOSITE

Page 13: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

States

• simple - no sub-states

- no regions

• composite - divided into two or more substates – sequential or concurrent

• substates / submachine states

Page 14: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

HISTORY

Page 15: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

History

• shallow - come back to the most recent active substate

• deep - come back to the most recent active configuration

Page 16: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

PSEUDOSTATES

Page 17: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Pseudostates

• abstract

• activity diagams → state machine diagrams

� forks / joins

� decisions

� junctions

� entry / exit points

Page 18: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

TRANSITIONS

Page 19: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

Transitions

• notation:

<triggers> [ <guard conditions> ] / <behavior expressions>

• trigger - events that may induce state transition: - mandatory

- signals

- calls

- time events

- change events

• guard conditions - must be met for transition to be triggered - optional

• behavior expressions - operations, attributes, actions sequence etc. - optional

performed during transition

Page 20: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

SUMMARY

Page 21: Graphical Systems Modeling with UML / SysMLstaff.iiar.pwr.wroc.pl/.../W.06.State.machine.diagrams-STUD.pdf · Graphical Systems Modeling with UML / SysML ... • state machine diagram

State machine diagram

Steps:

1. identify objects that need state diagrams

2. identify their states

3. define hierarchy of states, substates, orthogonal regions

4. link states and substates with transitions

5. add pseudostates

6. specify details of states and transitions using complete and appropriate notation