Information Technology Reference
In-Depth Information
The state of the object is made up from all region states with an active parent
region. Sub regions of inactive states are ignored for the moment, but can be
used to support history pseudo states. The transitions from Locked to Unlocked
and from FlashAndSound to Flash in the CAS are translated to the following:
transition Locked to Unlocked Transition 0=
1
requires ((Region 2=AlarmSystemRegion 2 Locked)
2
and (not
consumed Region 2) and (events <>
[nil])
3
and (( hd events) [0] = received AlarmSystem Unlock)) :
4
Region 2:=AlarmSystemRegion 2 Unlocked ;
5
/
set consumed flags
/
6
consumed Region 2:= true
7
end ;
8
transition FlashAndSound to Flash Transition 0=
9
requires ((Region 0 Alarm Region 0=
10
AlarmSystem Region 0 Alarm Region 0 FlashAndSound)
11
and (Region 0=AlarmSystemRegion 0 Alarm)
12
and (not
consumed Region 0 Alarm Region 0)
13
and (events
<>
[nil ])
14
and (( hd events) [0] = time trigger FlashAndSound 30 Flash)) :
15
Region 0 Alarm Region 0:=
AlarmSystem Region 0 Alarm Region 0 Flash ;
16
/
set consumed flags
/
17
consumed Region 0 Alarm Region 0:= true
18
end
19
The consumed flags in the OOAS-code are necessary to guarantee standard-
conforming behavior of transitions in orthogonal regions that are triggered by the
same event. When the consumed flag for a region is set, it means that the event has
already been processed by the region. Hence the transitions of the region depend-
ing on events must not fire as long as the flag is set: each transition tests for its
region's consumed flag being false and sets it when it is done. The dequeue action
then resets all flags. Transitions in sub-states may also consume events for the re-
gion and in fact have priority over transitions with the same trigger in higher level
regions. To ensure this behavior, before processing the next transition, the con-
sumed flags for regions whose child regions have the flag set, are set. Furthermore,
transitions within sub-state machines are put first in a prioritized composition to
mirror the priority of transitions given by the standard, as can be seen below.
actions
1
mark Region 0 conditional consumed =
2
requires
consumed Region 0= false
3
and (
consumed Region 0 Alarm Region 0):
4
consumed Region 0:= true
5
end ;
6
/
other actions
/
7
do
8
( transition FlashAndSound to Flash Transition 0;
9
call AcousticAlarm SetOff)
10
//
11
mark Region 0 conditional consumed()
12
//
13
(
14
transition Unlocked to Locked Transition 0=
15
[]
/
other transition paths
/
16
)
17
// dequeue()
18
od
19
Search WWH ::




Custom Search