Statecharts aka Harel Charts Visual Modelling 1. Higraph formalism - - PowerPoint PPT Presentation

statecharts aka harel charts
SMART_READER_LITE
LIVE PREVIEW

Statecharts aka Harel Charts Visual Modelling 1. Higraph formalism - - PowerPoint PPT Presentation

Statecharts aka Harel Charts Visual Modelling 1. Higraph formalism 2. Statechart formalism (combines Higraphs and State Automata) Diverse applications. In particular: concurrent systems behaviour Hans Vangheluwe hv@cs.mcgill.ca Modelling and


slide-1
SLIDE 1

Statecharts aka Harel Charts

Visual Modelling

  • 1. Higraph formalism
  • 2. Statechart formalism (combines Higraphs and State Automata)

Diverse applications. In particular: concurrent systems behaviour

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 1/30

slide-2
SLIDE 2

Higraphs: Visualising Information

  • complex
  • non-quantitative, structural
  • topological, not geometrical
  • Euler

– Venn diagrams (Jordan curve: inside/outside):

enclosure, intersection

– graphs (nodes, edges: binary relation); hypergraphs

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 2/30

slide-3
SLIDE 3

Venn diagrams, Euler circles

R P Q P&Q&R P&R Q&R B A P&Q

  • topological notions (syntax):

enclosure, exclusion, intersection

  • Used to represent (denote) mathematical set operations:

union, difference, intersection

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 3/30

slide-4
SLIDE 4

Hypergraphs

a b c d e f g h i a graph a hypergraph

  • topological notion (syntax): connectedness
  • Used to represent (denote) relations between sets.
  • Hyperedges: non longer binary relation (

X

X):

2X (undirected),

2X

2X (directed).

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 4/30

slide-5
SLIDE 5

Higraphs: combining graphs and Venn diagrams

  • sets + cartesian product
  • hypergraphs

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 5/30

slide-6
SLIDE 6

Blobs: set inclusion, not membership

A D E

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 6/30

slide-7
SLIDE 7

Unique Blobs (atomic sets, no intersection)

B A C P Q R S U E K L M N O P W T V F D X

  • atomic blobs are identifiable sets
  • ther blobs are union of enclosed sets (e.g., K

L

M

N

O

P)

  • empty space meaningless, identify intersection (e.g., N

K

W)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 7/30

slide-8
SLIDE 8

Unordered Cartesian Product: Orthogonal Components

B A C P Q R S U E K L M N O P W X Y T V F D G H

K

G

H

H

G

✄ ✝

L

M

✞ ✂ ✝

N

O

P

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 8/30

slide-9
SLIDE 9

Meaningless syntactic constructs

A C D B

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 9/30

slide-10
SLIDE 10

Simple Higraph

J

blobs

  • rthogonal

components

A B D E C F L I H G K M

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 10/30

slide-11
SLIDE 11

Induced Acyclic Graph (blob/orth comp alternation)

✟✠✟ ✡✠✡ ☛✠☛ ☞✠☞ ✌✠✌ ✍✠✍ ✎✠✎ ✏✠✏ ✑✠✑ ✒✠✒ ✓✠✓ ✔✠✔ ✕✠✕ ✖✠✖ ✗✠✗ ✘✠✘ ✙✠✙ ✚✠✚ ✛✠✛ ✜✠✜ ✢✠✢ ✣✠✣ ✤✠✤ ✥✠✥ ✦✠✦ ✧✠✧ ★✠★ ✩✠✩ ✪✠✪ ✫✠✫ ✬✠✬ ✭✠✭ ✮✠✮ ✯✠✯ ✰✠✰ ✱✠✱ ✲✠✲ ✳✠✳ ✴✠✴ ✵✠✵ ✶✠✶ ✷✠✷ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✸ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✹ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✺ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✻ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✼ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✽ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✾ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❀ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❁ ❂✠❂✠❂✠❂✠❂✠❂✠❂✠❂ ❃✠❃✠❃✠❃✠❃✠❃✠❃✠❃ ❄✠❄✠❄✠❄✠❄✠❄✠❄✠❄ ❅✠❅✠❅✠❅✠❅✠❅✠❅✠❅ ❆✠❆✠❆✠❆✠❆✠❆✠❆✠❆ ❇✠❇✠❇✠❇✠❇✠❇✠❇✠❇ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❉ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❊ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋ ❋
  • ✠●✠●✠●✠●✠●✠●✠●
❍✠❍✠❍✠❍✠❍✠❍✠❍✠❍ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ ❖ P P P P P P P P P P P P P P P P ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘ ❘

h c j k f i e d l b OR level (blob level) AND level (orthogonal component level) OR level AND level OR level g a m

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 11/30

slide-12
SLIDE 12

Adding (hyper) edges

A P Q R U K L M N P W X Y T V F D S O C B E

  • hyperedges
  • attach to contour of any blob
  • inter-level possible (e.g., denote global variables binding)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 12/30

slide-13
SLIDE 13

Clique Example

A B C D E

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 13/30

slide-14
SLIDE 14

Clique: fully connected semantics

A B C D E

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 14/30

slide-15
SLIDE 15

Entity Relationship Diagram (is-a)

WORKS FOR EMPLOYEES IS A PAID ON IS A PILOTS CAN FLY AIRCRAFT SALARIES DATES SECRETARIES

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 15/30

slide-16
SLIDE 16

Higraph version of E-R diagram

employees

  • thers

pilots for paid

  • n

dates months can fly equipment aircraft nuts bolts arrived in years ... ... secretaries works salaries

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 16/30

slide-17
SLIDE 17

Extending the E-R diagram

employees for paid

  • n

can fly secretaries

  • thers

pilots men women works married

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 17/30

slide-18
SLIDE 18

Formally (syntax)

A higraph H is a quadruple

H

✄ ✝

B

E

σ

π

B: finite set of all unique blobs E: set of hyperedges

X

X

❙ ✁

2X

❙ ✁

2X

2X

The subblob (direct descendants) function σ

σ : B

2B σ0

x

✞ ✄ ❯

x

❱ ❙

σi

1

y

σi

x

σ

y

✞ ❙

σ

❲ ✝

x

✞ ✄ ❲

∞ i

1

σi

x

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 18/30

slide-19
SLIDE 19

Subblobs

cycle free

x

❭❫❪

σ

❲ ✝

x

The partitioning function π associates equivalence relationship with x

π : B

2B

B

Equivalence classes πi are orthogonal components of x

π1

x

✞ ❙

π2

x

✞ ❙❛❵ ❵ ❵ ❙

πkx

x

kx

1 means a single orthogonal component (no partitioning)

Blobs in different orthogonal components of x are disjoint

y

z

σ

x

: σ

❲ ✝

y

✞ ✆

σ

❲ ✝

z

✞ ✄

/

unless in the same equivalence class

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 19/30

slide-20
SLIDE 20

Simple Higraph

J

blobs

  • rthogonal

components

A B D E C F L I H G K M

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 20/30

slide-21
SLIDE 21

Induced Orthogonal Components

B

✄ ❯

A

B

C

D

E

F

C

G

H

I

J

K

L

M

E

✄ ❯ ✝

I

H

✞ ❙ ✝

B

J

✞ ❙ ✝

L

C

✞ ❱

ρ

A

✞ ✄ ❯

B

C

H

J

❱ ❙

ρ

G

✞ ✄ ❯

H

I

❱ ❙

ρ

B

✞ ✄ ❯

D

E

❱ ❙

ρ

C

✞ ✄ ❯

E

F

❱ ❙

ρ

J

✞ ✄ ❯

K

L

M

ρ

D

✞ ✄

ρ

E

✞ ✄

ρ

F

✞ ✄

ρ

H

✞ ✄

ρ

I

✞ ✄

ρ

K

✞ ✄

ρ

L

✞ ✄

ρ

M

✞ ✄

/ π

J

✞ ✄ ❯ ✝

K

K

✞ ❙ ✝

K

L

✞ ❙ ✝

L

L

✞ ❙ ✝

L

K

✞ ❙ ✝

M

M

✞ ❱

Induces equivalence classes π1

J

✞ ✄ ❯

K

L

and π2

J

✞ ✄ ❯

M

, . . . These are the orthogonal components

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 21/30

slide-22
SLIDE 22

Higraph applications (add specific meaning)

  • 1. E-R diagrams
  • 2. data-flow diagrams (activity diagrams)

edges represent (flow of) data

  • 3. inheritance
  • 4. Statecharts

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 22/30

slide-23
SLIDE 23

Statecharts = state diagrams + depth + orthogonality + broadcast

  • Reactive Systems (event driven, react to internal and external stimuli)
  • like Petri Nets, CSP

, CCS, sequence diagrams, . . .

  • graphical but formal and rigourous for

– analysis – code generation

  • solve FSA problems:

– flat

hierarchy

re-use

– represent large number of transitions concisely – represent large number of (product)states concisely – sequential

concurrent

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 23/30

slide-24
SLIDE 24

Depth (XOR), semantics through flattening

❞❡❞ ❢❡❢ ❣❡❣ ❤❡❤ ✐❥

e g(c) g(c) f C A A C B B f f e

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 24/30

slide-25
SLIDE 25

Orthogonality (AND), semantics through flattening

❦❧❦ ♠❧♠ ♥❧♥ ♦❧♦ ♣❧♣ q❧q r❧r s❧s

B,F B,E C,E H C,G B,G B C E G F H I Y A D C,F I h k e g e e f e p p e h e n e m k g

[in(G)]

n f h p m|p m|p k p p g

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 25/30

slide-26
SLIDE 26

Broadcasting (output events)

A H D C G E F I J B e f/g n g h m/e n/f e

Input Segment: nmnn

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 26/30

slide-27
SLIDE 27

History States

H Red Green Yellow Manual t t to_manual resume t Autonomous

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 27/30

slide-28
SLIDE 28

Stopwatch Example

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 28/30

slide-29
SLIDE 29

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 29/30

slide-30
SLIDE 30

Extensions

  • time: after(10s)
  • guards: [OC in(C)]
  • parametrized events: ev(p1,p2)
  • narrowcast: destination.ev(p1,p2),

destination->ev(p1,p2)

  • states vs. variables
  • arrow: R, negative arrow: not R, absence of arrow: don’t know
  • don’t know blobs
  • Zoom outs (interface)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Higraphs/Statecharts 30/30