Information Technology Reference
In-Depth Information
AlarmSystem_StateMachine
Region_0
Region_1
Alarm
Activate Alarms /entry
Deactivate Alarms /exit
when oclIsInState(Unlocked)
IsOpen
OpenOrUnlocked
when oclIsInState(Closed)
and oclIsInState(Locked)
Close
Open
FlashAndSound
when oclIsInState(IsOpen)
Closed
30 / Deactivate Sound
ClosedAndLocked
Flash
Region_2
20
Unlocked
300
Armed
Show Armed /entry
Show Unarmed /exit
when oclIsInState(Closed)
SilentAndOpen
Lock
Unlock
Locked
when oclIsInState(IsOpen)
Fig. 3. Car Alarm System - State machine implemented using orthogonal regions
UML standard does not request true parallel execution we decided to use the
interleaving semantics provided by the non-deterministic choice operator. There-
fore, concurrent execution of active classes can be trivially mapped to a parallel
composition of classes of an OOAS (cf. Section 3). The resulting interleavings of
the active objects represent all possible “sequentializations”.
The second source of concurrency are orthogonal regions of state machines.
State machines and states may be split into two or more parallel active regions, so
called orthogonal regions. To discuss our support of orthogonal regions, we extend
the testing-model presented in Section 2. Instead of permitting an input signal,
e.g., Open , only at certain places, we take a more realistic view and add two or-
thogonal regions. Each of the new regions has two states and the state machine
may flip between these states when encountering a matching input signal. This
may happen at any time and “runs” in parallel with the main-logic of the car-
alarm-system. Fig. 3 shows the resulting state machine that includes all behavior
that was possible in our first CAS-version. Notice that the UML standard does
not specify the order in which parallel enabled and selected transitions have to
fire (cf. [1], State Machine, p. 566 ). Hence we are allowed to map this type of con-
currency to non-deterministic choice over enabled transitions again.
Since we need to memorize the state of each region of the state machine
(notice that sub-states of a state automatically lie in a separate region) we need
to introduce a state variable for every region in the OOAS. Below we sketch the
state variable definitions for the CAS with regions.
types
1
/
enumeration types for class state variables
/
2
AlarmSystem Region 2= { AlarmSystem Region 2 Unlocked ,
. . . } ;
3
AlarmSystem Region 0 Alarm Region 0= {
AlarmSystem Region 0 Alarm Region 0 Initial 0, ... } ;
4
AlarmSystem Region 0= { AlarmSystem Region 0 Initial 0, ... } ;
5
AlarmSystem Region 1= { AlarmSystem Region 1 Initial 0,
AlarmSystem Region 1 IsOpen , AlarmSystem Region 1 Closed }
6
var
7
/
class state variables
/
8
Region 2:AlarmSystemRegion 2=AlarmSystemRegion 2 Initial 0;
9
Region 0 Alarm Region 0:AlarmSystemRegion 0 Alarm Region 0
= ...;
10
Region 0:AlarmSystemRegion 0 = ...;
11
Region 1:AlarmSystemRegion 1 = ...;
12
Search WWH ::




Custom Search