Introduction

An expment can be thought of as a well-defined set of components, each with their specific behaviours. These behaviours can be represented by simple, finite state machines. Control of the experiment is equivalent to controlling and synchronizing the state changes of those state machines, and AFECS provides the facilities to do this. An algorithm that coordinates state changes is called service.
   The unique feature which sets this framework apart from conventional control systems is its incorporation of intelligent agent concepts.  An agent is a software entity capable of acting intelligently on behalf of a component or user, in order to accomplish a given task. A group of specialized agents cooperate and work together to solve problems that are beyond their individual capabilities. 
   AFECS provides a group of normative agents for agent management and coordination. These manager agents are responsible for creating and deploying agents on a platform, educating them (based on knowledge provided by the user), distributing them over the network, and recovering them in case of unsatisfactory behaviour. The efforts of these specialized agents ensure control system reliability and robustness.
   Different types of “stem cell” agents are also provided by the framework. After creation they are specialized by the control system designer to become representative agents for various real world components of the control system.

Agents

Control systems designed using AFECS are composed of agents that are groups of threads in a single process or separate processes running on different machines. The architecture of the AFECS based control system can be seen as a hierarchy of agents, each with responsibility for a component of the experiment. An agent encapsulates control/monitoring algorithms, as well as external interface details of the controlled, real-world component. This provides clear separation of the control and application layers of each component, and seamless integration of legacy software components into the experiment control environment (platform). Agents are active objects, having more than one behavior, and can engage in multiple, simultaneous activities. Their behaviors can be added or removed at run time. 
  Agents can be organized into hierarchical tree structures that reflect the basic organization of the experiment control system itself. An agent in the tree can have only one supervisor agent and can supervise many others. At the top of the tree is a single agent (grand supervisor), which represents the overall state of the entire experiment. An example diagram of a control system is shown in figure 1.
It is important to mention that communication between agents is accomplished by means of  message passing, using  cMsg publish-subscribe communication protocol.
 

Agent Containers

   The software architecture of the system is based on the coexistence of multiple JVMs (Java Virtual Machines). Software agents are grouped into virtual clusters or domains according to their specialized functionalities. Agents in the same domain may share a single JVM, which plays the role of a basic agent container. An agent container provides a complete run time environment for agent execution and allows them to concurrently run on the same host. Agents in the same domain may also be distributed over multiple containers. The Front-End is a special container running the normative agents, taking care of agents’ management and overall coordination of the system. It also maintains agents’ registry database, and agent discovery facilities.
 

Agent Hierarchi

   Supervisor agents (S) coordinate and control group of agents. They ensure that partial, local solutions to the control problems of a specific domain are integrated into global experiment control. Agents in the hierarchal tree transmit messages between themselves containing commands and status information. Normally, a human operator sends commands to the “grand supervisor” agent, which forwards them to supervisor agents down the tree, who in turn forward them to component agents and so on. The results of the commands are sent back up the tree so that the human operator is made aware of any changes in the state of the system. Any agent in the hierarchy can perform actions on receiving a command and can return the results from that command.