Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four...

12
1 Statecharts and STATEMATE Presented by Darren Liccardo Stephanie Augsburger October 3, 2000 October 3, 2000 2 Outline Background and Motivation for Statecharts Statechart Concepts and Formalisms – Clustering and Refinement – Orthogonality: Independence and concurrency – Special entrances, states, and unclustering – Actions and activities – Semantics Statechart Tool: STATEMATE October 3, 2000 3 Background: System Types Classification: Transformational vs. Reactive Transformational systems can be sufficiently specified by a function or input/output relation Examples: Data Processing, Plant Control Methods exist to manage complex transformational systems Supported by languages and implemented tools that perform well in practice October 3, 2000 4 Complex Reactive Systems Event driven by external and internal stimuli System behavior: Set of allowed input sequences and output events, conditions, and actions Hard to formulate clear levels of abstraction Difficult to describe in a clear and realistic, yet formal and rigorous manner • Examples

Transcript of Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four...

Page 1: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

1

Statecharts and STATEMATE

Presented by

Darren Liccardo

Stephanie Augsburger

October 3, 2000

October 3, 2000 2

Outline

• Background and Motivation for Statecharts

• Statechart Concepts and Formalisms– Clustering and Refinement

– Orthogonality: Independence and concurrency

– Special entrances, states, and unclustering

– Actions and activities

– Semantics

• Statechart Tool: STATEMATE

October 3, 2000 3

Background: System Types

• Classification: Transformational vs. Reactive– Transformational systems can be sufficiently specified

by a function or input/output relation

– Examples: Data Processing, Plant Control

– Methods exist to manage complex transformational systems

– Supported by languages and implemented tools that perform well in practice

October 3, 2000 4

Complex Reactive Systems

• Event driven by – external and internal stimuli

• System behavior: – Set of allowed input sequences and output events,

conditions, and actions

• Hard to formulate clear levels of abstraction• Difficult to describe in a clear and realistic, yet

formal and rigorous manner• Examples

Page 2: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

2

October 3, 2000 5

Automobiles

QuickTime™ and aSorenson Video decompressorare needed to see this picture.

October 3, 2000 6

Cellular Phone

October 3, 2000 7

Missiles, Avionics, and Space

October 3, 2000 8

Motivation

• Goal: – Create a highly structured and economical

visual description language for dealing with complex reactive systems

• This formalism should be practical, yet rigorous enough to be amenable to detailed computer simulation

Page 3: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

3

Statechart Formalisms

A Precursor: Finite State Machines

October 3, 2000 10

Finite State Machines

• Instantaneous– Transitions

– Assignments

– Transmission

• Time– Discrete

– Infinite

• Broadcasting of events

• event(condition)

October 3, 2000 11

Practical Use of FSMs

October 3, 2000 12

Finite State Machine Shortfalls

• Clustering states into a superstate:– “in all airborne states, when yellow handle is

pulled seat will be ejected”

• Independence and orthogonality – “gearbox change of state is independent of

braking system”

Page 4: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

4

October 3, 2000 13

Finite State Machine Shortfalls

• General transitions – “When selection button is pressed enter

selected mode.”

• Refinement of states– “display-mode consists of time-display, date-

display, and stopwatch-display”

Statechart Formalisms

A conceptual extension of FSMs

October 3, 2000 15

Statecharts

• A visual formalism– Confront the shortfalls of finite state machines– Represent complex reactive systems

• Extension of finite state machines– Statecharts = state machines + depth +

orthogonality + broadcast-communication

October 3, 2000 16

Running Example: Citizen Multi-Alarm III Wristwatch

• Four user buttons

• Can display time, date, and various setting

• Two alarms, hour chime

• stopwatch

Page 5: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

5

Clustering and Refinement

Adding depth to FSM

October 3, 2000 18

XOR Composition

• If in state D, then in state A⊕C

• Superstate encapsulates commonalities of multiple states

• Generalized transitions– β transitions from any

state in superstate D

to state B

October 3, 2000 19

Clustering and Refinement

• Design through abstraction– Clustering: A bottom up approach

– Refinement: A top down approach

October 3, 2000 20

Refinement of displays state

displays

Page 6: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

6

October 3, 2000 21

Default Transitions

• Generalized entrances are ambiguous

Ride Control

Sport

Tour

α

γ

β

October 3, 2000 22

History

• Revisit the last state that was left

October 3, 2000 23

Equivalent Visualizations

• but be careful…

October 3, 2000 24

Further Refinement of displays state

Page 7: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

7

October 3, 2000 25

Ambiguous Transitions

• Default contradiction

• γ is under specified

• α is over specified

Orthogonality

Adding Independence and concurrency to FSM

October 3, 2000 27

AND Decomposition

• Superstate encapsulates– Concurrency (synchronization)

– Independence

• Natural representation of real systems

• Reduces exponential blowup of states to a linear semantics

• Transitions to and from orthogonal states

October 3, 2000 28

AND Decomposition

• If in state Y, then in state A ^ D• A = B ⊕ C• D = E ⊕ F ⊕ G• Y =

(B⊕C)^(E⊕F⊕G)

Page 8: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

8

October 3, 2000 29

Exponential Blowup of States

• Exponential Enumeration of state Y

October 3, 2000 30

Transitions to and from Orthogonal States

• Transitions may have multiple beginnings and ends

October 3, 2000 31

Top Level Wristwatch

Other Features

Adding Special Entrances and Unclustering to FSM

Page 9: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

9

October 3, 2000 33

Other Features

• Special Entrances– Condition

– Selection

• Parameterized States

• Unclustering

October 3, 2000 34

Conditional Entrances

• Same event, different conditions

October 3, 2000 35

Selective Entrances

• Select state by event

October 3, 2000 36

Parameterized States

• Collapse a uniform state structure

Page 10: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

10

October 3, 2000 37

Unclustering

• Abstraction navigation• Complexity

Management

Actions and Activities

Specifying Mealy Machine Behavior for statecharts

October 3, 2000 39

Transitions with Actions

• Mealy machine output

• Transition Label– Event(condition)/action

• The action is carried out when the event takes place in the presence of the condition.

October 3, 2000 40

States with Activities

• Activities take nonzero time

• Associated Actions– Start(activity)

– Stop(activity)

• Associated Condition– Active(activity)

Page 11: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

11

October 3, 2000 41

Actions and Activities

• State instructions: entry, exit, throughout Statechart Semantics

Ambiguities and formal representations of statecharts

October 3, 2000 43

Semantic Ambiguities

• Recursive charts

• Probabilistic charts (Markov Model)

• Broadcast communication

October 3, 2000 44

Formal Representation

• State tree (directed graph)

• Set of transitions– Ordered pair of configurations (source, target)

– Event(condition)/action

– Default and History

Page 12: Statecharts and STATEMATE • Background and Motivation ...€¦ · Alarm III Wristwatch • Four user buttons • Can display time, date, and various setting • Two alarms, hour

12

October 3, 2000 45

Summing it all up

• Reactive Systems require special approaches

• Need for clear and rigorous behavioral description

• Statecharts are one possible formalism for specifying reactive behavior

• Future is visual languages, an example of which is STATEMATE…

October 3, 2000 46

STATEMATE

StatemateStephanie