i
r
3
l
1
l
2
l
Normal execution
Interruption
Initial
1
•
Figure 3: Stopwatch automaton of an interruptible task.
• I ∈ C(X)
L
maps an invariant to each location,
•
˙
X ∈ ({0, 1}
X
)
L
maps an activity to each location.
• SWA of an interruptible task
We model the acceptable behavior of Task
i
by the
Stopwatch automaton shown in Fig. 3. The loca-
tion l
1
indicates that the resource is waiting to start
the task, l
2
that the resource is executing its task and
l
3
that the task is interrupted after having started. In
this automaton, the clock y
i
in l
3
does not progress
while x
i
evolves to express that the task is interrupted
but the time remains progressing. The labels s
i
and
r
i
represent respectively the stop and the resumption
of Task
i
in the physical system, while label σ
i
corre-
sponds to the end of this task. ε
i
which is the always
true event, represents the necessary condition to start
the task. Here it starts immediately.
The guard g
2
of the arc l
2
g
2
−→ l
3
expresses that the
interruption can occur at any instant during the ac-
ceptable duration while the guard g
3
associated to
l
3
g
3
−→ l
2
expresses that the resumption must occur be-
fore exceeding the acceptable duration. The execution
of task
i
, during its acceptable duration is represented
by the guard g
4
of the arc l
2
g
4
−→ l
1
.
Figure 3 shows that Task
i
leaves the acceptable be-
havior to faulty state l
4
either from the location l
2
or
l
3
. The guards of arcs towards l
4
are identical and
given by g
5
= ¬g
4
= (x
i
= γ
i
∧ y
i
< α
i
). It expresses
the fact that the acceptable duration of execution was
expired and Task
i
is not executed.
2.3 Time Space State Delimiting the
Acceptable Behavior
The acceptable behavior of a system S is represented
by a stopwatch automaton A. It is obtained by the
composition of the different tasks automata accord-
ing to the system specifications which represent the
relation between these tasks.
Property 1 The trajectories which lead Task
i
to the
state l
1
× (0, 0) from l
2
× (x
i
, y
i
) where x
i
∈ [α
i
, γ
i
)
and y
i
∈ [α
i
, β
i
], represent all the possible evolutions
characterizing the execution of Task
i
.
The trajectories specified in Property 1 represent only
a part of the possible ones. Thus, the synthesis prob-
lem of monitoring can be set as follows: given a stop-
watch automaton A representing a system S, restrict
the possible trajectories of this automaton in a way
that all remaining ones satisfy Property 1, for all the
tasks of S. As a result, we obtain an automaton A
∗
where all its trajectories characterize the acceptable
execution of S. The calculation of the time space con-
taining these trajectories E
∗
of A
∗
is the core of our
synthesis algorithm. This is realized using of the For-
ward and backward reachability analysis. (Alur et al.,
1995)
• Forward analysis of monitoring SWA:
We use the forward analysis operators to calculate all
the possible trajectories in the system. In other words:
the reachable time space E in the automaton A men-
tioned above. The forward operators look for all the
reachable states of a stopwatch automaton from its
initial state remaining in the locations of automaton
while the time progresses or by firing its transitions.
The reachable time space by forward analysis in loca-
tions l
2
and l
3
of the automaton shown in Figure 3 is
given in Figure 4.1. Note that the values of the stop-
watches given by g
4
in Figure 3 define a polyhedron.
We denote it as D
i
, and call it as the desired space of
Task
i
(Fig 4.2). Note also that the trajectories spec-
ified in Property 1 lead the task only to D
i
. These
trajectories represent only a part of the ones which are
contained in reachable time space (Fig. 4.1). Thus,we
must delimit the time space containing only these tra-
jectories to characterize the acceptable execution.
• Backward analysis of monitoring SWA:
It is not hard to see that the time space E
∗
of A
∗
can
be obtained by removing from the time space of A
the states from which system’s evolutions do not lead
to D
i
of each interruptible task. In other words, one
needs first to apply the backward operators (called
as predecessors and annotated as Pre operators) to
the guards of arcs representing the desired space of
all the tasks over the automaton A. Then, E
∗
=E ∩
( Pre(D
i
)). The intuition behind the using the pre-
decessors operators for a guard representing D
i
of
Task
i
is that we look for all the states that lead to this
space D
i
from the initial state of A.
Applying the backward analysis for the automaton
given in Figure 3 gives the time space shown in Figure
4.3. The intersection of this space and that of forward
analysis is given in Figure 4.4. It is the space charac-
terizing the execution acceptable of Task
i
. One of the
trajectories contained in synthesized space (Fig. 4.4)
shows that the task reaches a faulty state, only from
the location l
3
with the dynamics ˙x = 1 and ˙y = 0. Fig-
ure 4.5 presents the final monitoring automaton A
∗
.
ICINCO 2007 - International Conference on Informatics in Control, Automation and Robotics
222