Documenting Control Problems with Statecharts - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Documenting Control Problems with Statecharts

Description:

Operator issues series of asynchronous commands. Software responds by guiding controlled domain toward ... Statecharts can capture depth (common substructure) ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 15
Provided by: crwal
Category:

less

Transcript and Presenter's Notes

Title: Documenting Control Problems with Statecharts


1
Documenting Control Problems with Statecharts
  • Charles Wallace
  • Michigan Technological University
  • wallace_at_mtu.edu

2
Control problems
  • Operator autonomous agent (possibly human)
  • Controlled domain manipulated by operator
  • Operator issues series of asynchronous commands
  • Software responds by guiding controlled domain
    toward desired state,
  • ignoring commands that are not sensible or not
    safe in given context
  • Challenge for control problems How to document
    controlled domain?
  • (more accurately our model of the controlled
    domain)
  • Simplifying assumptions
  • finite number of discrete, readily
    distinguishable states
  • state changes in discrete, atomic steps

M. Jackson.  Problem Frames. Addison Wesley,
2000.
3
Finite-state automata (FSAs)
  • clear, intuitive documentation technique
  • but many problems not nicely expressible in FSA
    terms
  • One serious challenge vast number of possible
    states
  • Often possible to collapse states into
    equivalence classes

Monday
Wednesday
Friday
Saturday
Sunday
Tuesday
Thursday
Weekday
Weekend
4
Shortcomings of FSAs
Different states with some similar
properties can't capture their similarities in
FSA terms
......
q1
q2
qn
a
a
a
n distinct a-transitions needed
r
5
Shortcomings of FSAs
Parallel composition of machines leads to state
space explosion
a
a
b
b
q1
q2
q3
r1
r2
r3
a
a
q1r1
q2r1
q3r1
b
b
b
a
a
q1r2
q2r2
q3r2
b
b
b
a
a
q1r3
q2r3
q3r3
6
A solution Statecharts
Venn diagrams good at representing set-theoretic
properties (inclusion/exclusion, intersection,
union,...)
A
B
Higraphs advantages of both - "blobs" can
intersect, contain blobs, etc. - plus, blobs can
be connected with arcs
D. Harel.  On visual formalisms.  Comm. ACM
31(5), 1988, 514--530.
7
Statecharts can capture depth (common
substructure)
a
Q
......
......
q1
q2
qn
q17
r
a
a
s
The a-transition from Q defines the default
behavior for q1..qn The state q17 overrides this
behavior q1 is specified as the default initial
state for Q, via the arrow - thus, the
a-transition from r leads to q1
8
Statecharts can capture orthogonality (parallel
composition)
QR
a
a
b
b
q1
q2
q3
r1
r2
r3
Q
R
QR is partitioned into states Q and R States in
QR are essentially pairs (qi,ri) (if youre in
QR, youre in both Q and R)
9
Statecharts can capturebroadcast communication
State change in one substate can "trigger" state
change in another
QR
a/b
a/c
b
c
q1
q2
q3
r1
r2
r3
From state (q1,r1), the a-transition in Q
triggers a b-event, leading to state (q2,r2)
Note this is different from Mealy or Moore
automata --- in those formalisms, output only
affects environment
10
History pseudostatesallow memory within
nested states
  • When entering a superstate, which substate(s)
    should be entered?
  • Options
  • Transition directly to substate
  • Resort to default initial state
  • Use of history pseudostate,
  • which remembers most recently visited substate
  • Shallow history state remembers one level of
    nesting
  • for deeper levels, defaults used
  • Deep history state remembers all levels of
    nesting

H
H
11
History pseudostates example
a
Q
R
c
q1
c
r1
q11
q12
r11
r12
H
c
c
b
b
b
b
c
q2
c
r2
q21
q22
r21
r22
c
H
c
a
last visited state in R r22 ? shallow history
state H leads to r21
last visited state in Q q22 ? deep history
state H leads to q22
12
Harels digital watch example
  • User input four buttons a, b, c, d
  • Modes time, alarm, hourly chime, stopwatch
  • User navigates using a
  • Date display accessible from time mode via d
  • Time, alarm update accessible via c, exit via
    b
  • Watch reverts to time display after two minutes
  • unless its in stopwatch mode

13
update
c
displays
t-min
min
c
c
hour
sec
b
date
c
c
d
date
day
c
d
c
time
a
2-min not in(stopwatch)
a
alarm
a
c
c
b
chime
stopwatch
t-min
min
hour
a
c
c
up-alarm
14
Focus on stopwatch state (NB Earlier, this was a
black box) Once started, stopwatch is either
running/stopped, and either in regular or lap
mode If user navigates out of stopwatch and
back, watch resumes previous substates
a
time
stopwatch
zero
H
din(off)
b
b
chime
a
reg
on
b
din(on)
d
b
lap
off
disp
run
Write a Comment
User Comments (0)
About PowerShow.com