# Architecting an Agent-Based Fault Diagnosis Engine for IEC 61499 Industrial Cyber-Physical Systems
## 3 Architecting the Engine
### Managing Agent Beliefs
The engine architecture facilitates this with interaction belief skills and domain knowledge of the IEC 61499 function block architecture, enabling the agents to build their own model of the application they are examining. This addresses some of the concerns that creating models is labor-intensive [41; 45]. For fault diagnosis,  
Figure 10: An FB application as a Directed Graph and the Function Block Node structure. First-Order beliefs such as these are sufficient to form this model of the ICPS that the agents are examining. The third belief structure captures dynamic diagnostic beliefs. As an agent investigates a fault, it forms new beliefs as it observes the FB application that is executing and interacts with it. It may also modify existing beliefs to better align them with new evidence. **Definition 7** (Dynamic diagnostics belief). : _A belief \(b=\langle\triangle,v\rangle\) is a dynamic diagnostics belief if \(\triangle\) is represented as a pair \((FB_{i},f_{q})\) where_  
* \(FB_{i}\) _is a function block instance of the system under diagnosis, and_
* \(f_{q}\) _is a valid fault code for_ \(FB_{i}\)_, obtained from a set of fault codes_ \(F\)_._  
In this belief structure, a belief about what is happening is a fuzzy logic opinion about a particular FB, sensor, actuator, or algorithm in the FB application. The set \(B=\{b_{0},b_{1},\ldots,b_{n}\}\) captures the agent's beliefs, where \(b_{i}\) represents either a single BFB or a network of BFBs connected as a CFB. A BFB or CFB represents the smallest unit of functionality an agent can test and hence beliefs are atomic at this level. Before the Team Manager shown in Figure 6 instructs the agent to begin operating, it provides a set of goals that can include monitoring for fault signatures and executing diagnostic plans. The agent is also provided with a definition of what constitutes normal behavior for each FB via the set of diagnostic packages. One example of normal behavior is the appearance of temperature readings at 500 ms intervals from Z_TEMPERATURE TEMP. These propagate through the controller to appear at Z_CONTROLZONE_TEMP. The agent then pursues its _Monitor_ goal, watching for normal temperature fluctuations. All DP instances pass events and data through transparently to other FBs as well as back to the agent. The agent continues pursuing this goal until one or more of its primary beliefs about normal operation are invalidated. The agent establishes an initial belief for the _Monitor_ goal such that:  
\[b_{0}=\langle FB_{\texttt{2\_TEMPERATURE}},\ v_{\text{undetermined}},\ f_{0}\rangle\]  
For an agent, the pursuit of its _Monitor_ goal is the repeated re-evaluation of each of its beliefs by observing or performing prescribed tests at defined intervals. Whenever the agent determines that the FB is operating within tolerance, it reinforces its belief so that \(v_{\text{undetermined}}\to v_{\text{true}}\). Other primary beliefs track and remember what is being observed in different parts of the FB application. Invalidating any one of these beliefs in \(B\) causes the agent to signal the Team Manager Agent that it has completed its primary _Monitor_ goal successfully by finding a potential fault. The Team Manager Agent will then assign the agent a _Diagnostic_ goal. The agent then adopts a divide-and-conquer strategy for diagnosing faults in the temperature sensor subsystem described earlier in Figure 9. A range of nominal Fahrenheit temperatures are injected via DP1 and captured as Celsius values at DP2. Out-of-range values such as absolute zero (\(-459.67\) F) should trigger the ERROR event, captured by another DP. If all test values are converted and captured correctly, the agent updates the \(v\) of the \(b_{\texttt{F\_TO\_C\_CONV}}\) to \(true\). The agent continues down the fault path checking each subsequent FB, updating its beliefs until all FBs have been tested. This process caters for the possibility of multiple fault candidates.