1 cs 691z/791z topics in software engineering chapter 20: advanced statechart modeling [arlow and...
Post on 21-Dec-2015
219 views
TRANSCRIPT
11
CS 691z/791zTopics in Software
Engineering
Chapter 20: Advanced Statechart Modeling [Arlow and Neustadt, 2002]
March 8, 2007
22
OutlineOutline
Basic statecharts: Brief review Composite states Sequential composite states Concurrent composite states Submachine communication History Submachine state
33
Basic Basic Statecharts:Statecharts:ReviewReview
Example of statechart[SD, 2001]
Stopped MoveWithSpeedOne
MoveWithSpeedTwo
Blocked
go1_command /speedOne()
target_reached /stop()
go2_command /speedTwo()
go2_command /speedOne()
limit_reached or otheremergency condition /
stop ()
permission_to_restart /reset ()
limit_reached or otheremergency condition /
stop ()
stateinitial state
transition
event action
change_direction_command /reverseDirection()
final state
off
off
From the stopped state, the 2-speed motor brings the probe in atarget position by "accelerating" with speed 1, "crusing" with speed2, "deccelerating" with speed 1, and then stopping. If out of limitsor in case of another emergency, the motor stops immediately andrequires the operator's permission to restart working.
44
Composite statesComposite states
A composite state contains one or more nested state machines (submachines), Fig 20.2 [Arlow & Neustadt, 2002]
A composite state (or superstate) has substates A substate can be itself a superstate
55
Sequential composite states… A superstate that contains a single nested machine is a
sequential composite state, Fig 20.3 [Arlow & Neustadt, 2002]
66
.Concurrent composite states...Concurrent composite states.. Concurrent composite states consist of two or more sub-Concurrent composite states consist of two or more sub-
machines that execute in parallelmachines that execute in parallel. . InIn Fig 20.4 [Arlow & Neustadt, Fig 20.4 [Arlow & Neustadt, 2002] there are two such composite states, 2002] there are two such composite states, InitializingSystemInitializingSystem and and MonitoringMonitoring
77
..Concurrent composite states.
The The composite state composite state InitializingSystem, , Fig 20.5 [Arlow & Neustadt, Fig 20.5 [Arlow & Neustadt, 2002]2002]
88
……Concurrent composite statesConcurrent composite statesThe The composite state composite state MonitoringMonitoring,, Fig 20.6 [Arlow & Neustadt, 2002]Fig 20.6 [Arlow & Neustadt, 2002]
99
Submachine communication..
There are two ways for asynchronous submachine communication: Communication via attributes:
The modeled reactive object has a set of attributes that can be used by submachines
The communication mechanism: one machine sets attributes and the other uses the attribute values in guard conditions of their transitions
Communication via sync states: A sync state is a special state that has the sole role of
remembering each firing of its input transition (similar to a queue)
The communication mechanism: one machine leaves a message in a queue and the other reads messages from the queue
1010
.Submachine communication..Submachine communication. Example of communication via attributes, Fig. 20.7 [A&N, Example of communication via attributes, Fig. 20.7 [A&N,
2002]2002]
1111
..Submachine communication..Submachine communication
UML syntax for sync States Fig. 20.8 [A&N, 2002]
Example of communication via sync states, Fig. 20.7 [A&N,2002]
1212
History.Example of using the Example of using the shallow historyshallow history indicator indicator Fig 20.10 [Arlow & Neustadt, 2002]Fig 20.10 [Arlow & Neustadt, 2002]