dow is reached; During this time, commands from the
driver or the passenger are ignored, and R5) If an up
button is pressed and released before a threshold time
limit, then it is interpreted as an auto-up command,
and the window rolls up to its top limit; however,
if the button is pressed for more than the threshold
value, then the glass moves up step by step till the
button is released or the top limit is reached; similar
behaviour occurs when the down button is pressed.
4.2 Incremental Modeling
We will refine the Controller block in Figure 5(a);
Figure 5(b) shows the refined RRMD after the follow-
ing elementary refinements: (a) block Ex Comm (Ex-
ecute Command) is a refinement of Controller which
takes the open input sel comm (selected command) ,
and produces the outputs up out (glass to go up) and
down out (glass to go down) to be fed to the actuator,
and (b) the open input sel comm is closed by making
it an output of SelCommand (Select Command).
In the second refinement, we make the block Sel-
Command deterministic. This relates to the require-
ment that driver commands have higher priority. This
block receives two open inputs v dri and v pass (for
validated driver and passenger commands). When
v dri is present, sel comm gets the value of v dri; oth-
erwise, it gets the value of v pass. The state machine
in Figure 6(c) models this behaviour.
Next we refine Ex comm based on the require-
ment of the obstacle conditions. The state diagram of
the Ex comm block models this behaviour; see Fig-
ure 6(b). A new variable mode models that control
can be either in normal or obstacle mode. When in
normal mode, and an obstacle is detected, the mode
changes to obstacle mode. Control stays there till time
out occurs or the bottom window limit is reached.
Thereafter, control moves to normal mode. Figure
6(a) shows the new RRMD. The state diagram of
Ex comm has four transitions and two new state vari-
ables: timer o and mode; timer o models the progress
of time. The loop around Ex comm shows these vari-
ables (Figure 6(a)); Ex comm is thus a state holding
block. The transitions require two extra inputs obs –
whether obstacle is present – and endstop – whether
any of the top limits is reached. The former being an
environmental input originates from PE, and the latter
is an internal input. Therefore, we create a new block
(X in the figure) in the control flow path between PE
and Ex comm to produce the value of endstop.
The block Ex comm is further refined to model
the behaviour as specified by requirement R5, the de-
tails are beyond the scope of this paper.
5 TOOL SUPPORT FOR RRMDs
The controller executes in two orthogonal dimen-
sions. Firstly, the controller executes in a cyclic loop,
acquiring inputs, processing them and then making
some decisions about control. Simultaneously and in-
dependently the controller can be thought of as pro-
gressing in a control mode dimension. In this dimen-
sion the control responds to inputs by changing its
state and consequent behaviour. The control mode be-
haviour progresses every time the processing loop is
ready to make decisions about control. We model a
RRMD by synchronising state machines in UML-B.
Figure 7 is the UML-B representation of the
RRMD in Figure 6. In the UML-B syntax, control
flow edges become states, and blocks of a RRMD be-
come transitions. For example, block PE becomes
a single transition (state machine of PE has a single
transition). Block SelCommand has two transitions,
so two parallel transitions in the UML-B model: se-
lectDri and selectPass. This kind of encoding is true
when blocks are not state-holding. When a block is
state-holding as in case of Ex comm, we create an or-
thogonal state machine (Figure 7). The state machine
in the left encodes the outer control loop behaviour
of the RRMD in Figure 6(a); the state machine in the
right is same as the block state machine of Ex comm.
In the first state machine (Figure 7), the single transi-
tion between states PRIORITIZED and ENVIRON-
MENT represents the block Ex comm; this single
transition is labelled with all the transition names of
the state machine in the mode state machine (in the
right). During execution, both these state machines
are synchronized on the same transition labels.
Each RRMD corresponds to an Event-B model.
The UML-B tool can make this translation. In a
UML-B model, invariants can be added to the states
of the UML-B state machine. Upon translation, these
invariants are directly lifted to the Event-B model.
Tools like Rodin Platform (Abrial et al., 2010) can be
used to discharge the proof obligations. The UML-B
model and Event-B translation with proofs are avail-
able as a Rodin archive (Snook, 2012).
Figure 7: UML-B representation of the RRMD in Figure 6.
MODELSWARD2013-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
146