3 MULTI-AGENT BASED
ARCHITECTURE
We formalize in this section the networked real-time
microcontrollers that we assume adaptive to their en-
vironment. The distributed system is composed of n
STM32F4 controllers to be linked with a token ring
topology and serial ports. After applying a reconfigu-
ration scenario, the coherence between the microcon-
trollers can not be guaranteed. We propose a multi-
agent architecture where we propose for each micro-
controller a Request Agent RA that defines the recon-
figurations to be applied locally, and a Coordination
Agent CA which manages any coordination with re-
mote controllers after any reconfiguration scenario.
3.1 Request Agent Modeling
The request agent RA is responsible of the local soft-
ware reconfigurations in the microcontroller. We con-
sider three forms of reconfigurations to be locally ap-
plied at run-time: (i) Architectural Reconfiguration
allowing the addition-removal of OS tasks at run-
time to-from the controller, (ii) Scheduling Recon-
figuration allowing the modification of the compo-
sition of tasks without modifying their architecture,
(iii) Data Reconfiguration allowing the modification
of values of data while keeping the same architecture
and scheduling. The idea of our paper is as follows:
suppose that a Request Agent of a controller wants
to apply a deep reconfiguration that changes the ar-
chitecture (adds-removes tasks), the scheduling (the
composition of some tasks) and the values of some
data. This reconfiguration should be applied with
the agreement of remote controllers in order to ap-
ply a coherent and correct distributed behavior of the
whole system. We model the agent RA by nested state
machines which are studied in several researches be-
fore(Rausch and Hanisch, 1995) (Hanisch and Luder,
). We assume that the architecture level is specified by
an architecture state machine SAm for each microcon-
troller m ∈ [1, n] where each state represents a partic-
ular proposed architecture. We define for each state
SAm
i
of SAm a composition state machine to be de-
noted by SCm. It represents the different schedules
that can be applied if this particular architecture SAm
i
is applied. The data level is specified by data state ma-
chine state machines such that each one SDm
k
corre-
sponds to a particular state SCM
i, j
of SCM
i
. The agent
automatically applies at run-time different reconfig-
uration scenarios where each scenario is denoted by
ς
i, j,k,h
and corresponds to (i) an architecture state in
the top level, (ii) scheduling state in the second level,
(iii) data state in the bottom level as follows:
• The architecture State SAm
i
: a state of SAm that
corresponds to a particular set of tasks to be lo-
cally executed in the microcontroler,
• The Composition State SCm
i, j
: a state describing
a possible scheduling of these tasks according to
user requirements. This state belongs to a state
machine that corresponds (in the second level) to
SAm
i
,
• The Data State SDm
k,h
: a state that corresponds in
the third level to particular values of data that we
attach to the tasks of SAm
i
.
3.2 Coordinator Agent
The coordination agent CA of a microcontroller co-
ordinates with remote controllers to look for the ap-
plication of the desired reconfigurations from RA
i
. In
a particular controller i (i = 1...n), the controller CA
i
sends a request to the remote coordinatoragents of the
rest of controllers. These coordinators analyze this
request with their RA agents to possibly decide if the
request of CA
i
is acceptable or not. If all the coordi-
nators of the different remote microcontrollers agree
the request ofCA
i
, then this reconfiguration is applied
since the coherence is guaranteed.
3.3 Token
To apply this protocol, we propose three types of to-
kens: (i) Architecture Token, (ii) Scheduling Token,
(iii) Data Token. The Coordination Agent sends first
a Token Agent in order to have an authorization from
remote controllers. This token has a priority and can
be rejected from the network if another Architecture
Token with a higher priority is sent. The Coordination
Agent waits the authorization from all remote con-
trollers before applying effectively this reconfigura-
tion. The architecture of the different distributed tasks
is fixed at this level in the different controllers. CA
sends now a new Scheduling Token in order to define
the scheduling of the local tasks and also in the rest
of controllers. When an agreement is received, CA
sends then a Data Token in order to ask the applica-
tion of reconfigurations allowing the modification of
data. This step-by-step reconfiguration is useful since
it is not important to apply architectural, scheduling
and data reconfigurations at the same time. We note
finally that these tokens are described in the transi-
tions of the nested state machines of each RA.
3.3.1 Token Architecture
The architecture token is defined by a Matrix where
the lines represent the microcontrollers of the system
ICSOFT-EA2014-9thInternationalConferenceonSoftwareEngineeringandApplications
466