# Architecting an Agent-Based Fault Diagnosis Engine for IEC 61499 Industrial Cyber-Physical Systems
## 2 Background
### The IEC 61499 Function Block Reference Architecture  
At present, no single reference software architecture for the creation of ICPSs dominates. The capabilities of PLCs grew rapidly as industry began to find innovative ways of automating manufacturing operations. That demanded more robust, fault-tolerant software architectures to run PLC applications on. The IEC 61499 standard introduced in 2005 addresses the limitations of the earlier IEC 61131 standard [26] by providing an object-oriented, event-driven architecture that scales well [2]. Figure 2 shows a custom FB that has been developed from a standard Basic Function Block (BFB) type definition. This FB processes a temperature reading in degrees Fahrenheit that is received from another FB that interfaces with a temperature sensor. The IEC 61499 standard defines a convention that _Data Inputs_ such as TEMP_F are drawn on the left side of the function block symbol. When new data have been made available from another connected FB to the input TEMP_F, the _Input Event_ REB is triggered. Each function block implements its own Moore-type finite state machine [27]. The _Output Events_ and _Data Outputs_ shown on the right of the FB symbol depend only on the current state and the values of the Data Inputs it has received. The IEC 61499 _Execution Control Chart_ (ECC) [28] shown in Figure 2 details the states and state transitions possible for this FB. For each state transition, one or more software algorithms are triggered to process the data and make control decisions. After the algorithms have executed, the converted temperature is output via TEMP_C and the output event CNF is triggered. If the temperature cannot be converted, the ECC transitions to the error state and the output event ERROR is triggered. This event-driven behaviour and the ability to encapsulate both state management and algorithms in an FB facilitates loose-coupling and scalability. However, event-driven systems present issues when interactive diagnostic approaches are used since the actions of the diagnoser can interfere with the timing of the ICPS.  
Figure 1: A Franka Emika Panda Collaborative Robot operating as part of an ICPS.  
[PERSON] comments that one of the advantages of ICPSs is the cost saving that modularity, adaptability and re-usability offer when implementing larger, distributed systems [29]. IEC 61499 provides a way to encapsulate capabilities in reusable units that are wired together to create event-driven logic and control. Encapsulation encourages component re-use by enabling developers to craft new FB applications from well-proven resources. The standard function block type definitions provides templates that are used to craft specialized FBs from. The custom Service Interface Function Block template interfaces well to physical sensors and actuators. In this way, trusted libraries evolve as generations of FBs share and refine field-proven resources. IEC 61499 also supports partitioning of applications to work collaboratively on separate, distributed platforms, providing scalability and redundancy. The IEC 61499 architecture has gained wide acceptance, being used in PLCs for industrial automation [30] and in the Intelligent Electronic Devices (IEDs) of Smart Electricity Grids [31; 32].