# Architecting an Agent-Based Fault Diagnosis Engine for IEC 61499 Industrial Cyber-Physical Systems
## 3 Architecting the Engine
### The Logical View  
Figure 5 presents the Logical View of the engine from the Rozanski and Woods Functional Viewpoint. A layered architectural style was chosen since the self-contained GORITE Team Manager subsystem provides the primary interface to the diagnostic agents. The refinement of the agent subsystem is discussed further in Section 3.3. This was driven by later evaluations that identified the need to multi-thread agents to better manage their scheduling and resources. The engines' communication subsystem operates in the agent layer, providing the interface to the separate FB application layer. Sub-applications of the FB application can run on their own hardware platforms as distributed device instances in this lower layer. While agents are often created using object-oriented design patterns, there is a distinct difference in the way agents interact with other components in multi-agent frameworks. Objects implement methods and functions and cannot refuse to execute when called by a component that holds a reference to an instance of that object. In contrast, an agent  
Figure 4: The system context view of the fault diagnostic engine. Figure 5: The layered architectural style of the fault diagnostic engine. operates in a contract or agreement with other subsystems. When requested to perform a task or provide a service, an agent will evaluate its current priorities and only comply if it can [50; 77]. An _active agent_ encompasses its own thread of control [50]. Unlike object instances which can only undergo a change of state when one of their methods is called, agents can initiate a state change based on their own deliberations. Adapting the notation of [PERSON] and [PERSON] [78], an active agent \(ag\) can be defined as:  
**Definition 1** (Active Agent). : \(ag=\langle Sit,Act,Dat,f_{sit}\rangle\) _is a tuple where:_  
1. _Sit is the set of situations that an agent can be in. The characteristics of the agents' situation_ \(sit_{j}\in Sit\) _is defined by the nature of the goal it is pursuing or an individual task within that goal it is performing._
2. _Act is the set of actions that an agent can perform in that environment._
3. _Dat is the set of internal data the agent maintains about its state and the environment it is situated in._
4. \(f_{sit}\) _is a function defined for the current situation over the data values that allows the agent to determine its next actions such that_ \(f_{sit}:\ Sit\times Dat\to Act\)_._  
Within GORITE, teams of agents are assembled and allocated goals. A goal that an agent attempts to achieve is defined in terms of the set of actions \(Ga\) that the agent can perform to work towards a desired outcome. [PERSON] et al. make no distinction between the traditional BDI concept of a plan and a goal; a plan in GORITE is just an explicit goal [3]. The pursuit of a goal is evidenced as a set of _behaviors_. The behavior _Beh_ of an individual agent \(ag_{i}\) is described by the set of actions that it takes in its environment while it is attempting to achieve a particular goal:  
**Definition 2** (Behaviour). : \(Bel_{task}=\{act_{1},\ act_{2},\ \ldots,\ act_{t}\}\) _where_  
1. \(act_{n}\in Act\)_, are the actions the agent_ \(ag_{i}\) _is capable of performing, and_
2. \(act_{t}\) _is the action that causes the agent to terminate its operations when that task is completed. Since agents have the ability to self-determine what the appropriate course of action might be in a given environment, it is possible that a number of different behaviors could be exhibited that still achieve the same outcome._  
Since agents have the ability to choose from a number of alternatives what the appropriate course of action might be in a given situation or environment, and it is possible that a number of different behaviors could be exhibited that still achieve the same outcome. Agents only begin executing activities when they are assigned a goal to pursue.