for each one of them. For each kind of faults, we as-
sociate a queue to save the occurrence of each fault,
in particular the fault type, the occurrence time and
the treatment time. Therefore, we have three kinds of
queues: to save the faults affecting sensors, we use the
sensor fault queue denoted by Queue
S
j
(1 ≤ j ≤ N
S
,
where N
S
represents the number of all fault queues
associated to sensor), to save the faults affecting ac-
tuators, we use the actuator fault queue denoted by
Queue
A
j
(1 ≤ j ≤ N
A
, where N
A
represents the num-
ber of all fault queues associated to actuator) and for
faults affecting Control Components, we define com-
ponent fault queue denoted by Queue
CC
j
(1 ≤ j ≤ N
CC
,
where N
CC
represents the number of all fault queues
associated to control component).
The agent manages the system’s reactivity when
faults stored in queues should be treated. The general
algorithm is based on well-known scheduling poli-
cies. Our goal is to have an optimal behavior of the
agent for a safety system.
Formalization
We introduce the notations used in the algorithm:
• N
S
(resp. N
A
, N
CC
) represents the number of the
whole fault queues related to a sensor (resp. an
actuator, a control component)
• Queue
S
j
(resp. Queue
A
j
, Queue
CC
j
) represents a
queue associated to a defined kind of a fault con-
cerning a sensor (resp. an actuator, a control com-
ponent). This queue saves different occurrences
of faults and their characteristics especially time
occurrence and time treatment
• GWT
S
(resp. GW T
A
, GW T
CC
) represents the
global waiting time for the different faults in a
queue related to a sensor (resp. an actuator, a con-
trol component)
• MGW T
S
(resp. MGW T
A
, MGW T
CC
) represents
the mean global waiting time for the different
faults in a queue related to a sensor (resp. an ac-
tuator, a control component)
For the sake of simplicity, we present here only
the main steps of the algorithm applied to the differ-
ent fault queues related to a sensor and these steps are
the same for the others (i.e. fault queues related to
an actuator or a control component). Let N
S
be the
number of faults queues that handle faults occuring
at run-time related to a sensor. Let Fault
i
be an oc-
currence of a fault related to the queue Queue
S
j
such
that 1 ≤ i ≤ Queue
S
j
.length(). We assume that the
agent computes the waiting time of each fault Fault
i
denoted by W T
i, j
. The waiting time is a measure of
the total time that a fault waits in a queue. It corre-
sponds to the duration between the occurrence time of
the fault (denoted by time
i, j
) and the end of its treat-
ment time by the agent (denoted by treatmentT
i, j
).
W T
i, j
= treatmentT
i, j
- time
i, j
We denote in addition by GW T
S
j
the global wait-
ing times of all the faults belonging to the same queue
Queue
S
j
. It is equal to the sum of the different waiting
times of different faults Fault
i
divided by their num-
ber where 1 ≤ i ≤ Queue
S
j
.length().
GW T
S
j
=
∑
Queue
S
j
.length()
i=1
W T
i, j
Queue
S
j
.length()
We denote also by Mean Global Waiting Time
(denoted here MGW T
S
) the sum of the global wait-
ing times of all faults in queues related to a sensor
divided by their number N
S
.
MGW T
S
=
∑
N
j=1
GW T
S
j
N
S
We distinguish in the agent’s algorithm two peri-
odic actions : fault occurrence and fault management.
When a fault occurs, the agent searches the kind of
this fault and puts it in the associated queue. The
fault management is a periodic task where the agent
treats a fault, calculates the waiting time associated to
this fault and then deletes it from the corresponding
queue. Finally, the agent calculates the mean global
waiting time for faults related to sensors, actuators
or control components. We present in the following
the detailed algorithm of the agent handling different
faults. This algorithm tries in particular to minimize
the global waiting time of faults in a queue.
Detailed Agent’s Algorithm
(0) Initialization
∀ j ∈ [1..N
S
] Queue
S
j
.clear();
∀ j ∈ [1..N
A
] Queue
A
j
.clear();
∀ j ∈ [1..N
CC
] Queue
CC
j
.clear();
(1) Fault occurrence
For each period ∆
If occurrence(fault) then
fault.time ← currentTime();
Switch type(fault)
case f ault
S
:
∃ j ∈ [1..N
S
]/ f ault.kind = j
Queue
S
j
.push( f ault);
case f ault
A
:
∃ j ∈ [1..N
A
]/ f ault.kind = j
Queue
A
j
.push( f ault);
case f ault
CC
:
∃ j ∈ [1..N
CC
]/ f ault.kind = j
Queue
CC
j
.push( f ault);
(2) Fault management
ICSOFT 2011 - 6th International Conference on Software and Data Technologies
278