Introduction
The run control component of the JLAB CODA data acquisition system is designed to play the supervisory role in the overall data production environment of the experiment. The run control system is designed to reflect the structure of CODA itself, thus it is composed of separate elements (components) that are likely to be implemented as separate processes running on different machines. This design consistent with the AFECS approach, providing distributed control application entities that collaborate dynamically to satisfy control objectives of the DAQ system. The architecture of the run control can be seen as a hierarchy of AFECS control agents, each with responsibility for a well defined component or part of the DAQ system (EB:Event Builder, ET:Event Transfer, ER:Event Recorder, ROC:Readout Controller, etc.). The AFECS agent encapsulates control/monitoring algorithms, as well as external interface details of the real world component. This provides significant advantages, namely clear separation of the control and application layers of the component, and seamless integration of legacy software components into the run control environment. The agent state is the simplified external view of the current working condition of the CODA component or slow control component of the data production system, under its responsibility. Each agent is capable of receiving control messages from other agents or the outside world. These messages can cause an agent to execute actions which potentially will change the visible state or monitor the state of the component. The agents are organized into a hierarchical tree structures that reflect the basic organization of the DAQ system itself. An agent in the control tree can have only one supervisor agent and can supervise many other agents. At the top of the tree is a single agent, which represents the overall state of the entire online system. Every agent under supervisor agent represents one of the major elements of the CODA data acquisition system.Obviously an agent of a sub-system itself can be a supervisor of the agents responsible for individual sub-components. The distributed nature of the run control system allows for grouping of agents into specialized virtual clusters or domains.
The agents in the hierarchical tree transmit messages between themselves to exchange control commands and status information. In the basic scenario a human operator sends control commands through the graphical interface(GUI) to the supervisor agent, which forwards them to the sub-system agents, who in turn forward them to component representing agents and so on. The result of the control directives 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 either perform some actions on the commands or return results of the commands it receives.