agent based framework for experiment control systems … jeffeson lab v. gyurjyan, d. abbott, g....
TRANSCRIPT
AGENT BASED FRAMEWORK FOR EXPERIMENT CONTROL SYSTEMS
…JEFFESON LAB
V. GYURJYAN, D. ABBOTT, G. HEYES, E. JASTRZEMBSKI, C. TIMMER, E. WOLIN
AFECS
Outline
SOA and intelligent agent technologies cMsg – A Publish/Subscribe inter-process communication
channel ECS framework design criteria COOL - Control oriented ontology language Current implementations
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
SOA
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Style of building reliable systems that deliver functionality as services
Loose coupling between interacting services
Service
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Atomic unit of an SOA. Encapsulates logic, data, or process. Autonomous Location Transparency It is defined by the messages it can accept and the
responses it can give. Messages can be one-way, synchronous or asynchronous.
They can be integrated to provide higher-level services It can be completely self-contained, or it may depend on the
availability of other services or other resources.
Service interaction
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
ServiceRegistry
ServiceProvider
ServiceConsumer
Dis
cove
r Advertise
Interact
Loose Coupling
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Flexibility Scalability Replaceability Fault tolerance
ServiceRegistry
ServiceProvider
Consumer
ServiceProvider
ServiceProvider
Ad
vertise
Data storage
Discove
r
1
2
3
Services are stateless
SO vs. OO
Thursday, April 20, 2023
Vardan Gyurjyan. Jefferson Lab
OO advocates tight coupling, i.e. users have static knowledge of the object.
SOA promotes the design of the system in which it is not necessary that requests and responses are handled by the same set of communicating entities.
Service has an internal thread of control.
SayHelloWorld
“Hello World”
OO SO
Object Service
SayHelloWorld
“Sorry I am busy”
Agent is a service
Thursday, April 20, 2023 Vardan Gyurjyan. Jefferson Lab
creative
adaptive
mobilesocial
persistent
Goal-oriented
Agent
Agent Internal and External Environments
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
External Environment:user, other agents,
applications, information sources,their relationships,
platforms, servers, networks, etc.
Balance
Internal Environment:architecture, goals, abilities, sensors,
effectors, profile, knowledge, etc.
Agent
What does it mean?
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Intelligent Agent is an entity that is able to keep continuous balance between its internal and external environments (it has at least one goal) in such a way that in the case of imbalance agent can:
change external environment to be in balance with the internal one (creative)
change internal environment to be in balance with the external one (adaptive)
find out and move to another place within the external environment where balance occurs without any changes (mobile)
closely communicate with one or more other agents to be able to create a community, which internal environment will be able to be in balance with the external one (social)
What is Publish/Subscribe Messaging
Asynchronous, distributed, location transparency Distinct from client/server
Publisher: publish or send messages to “subjects” “launch-and-forget” mode many publishers can publish to the same subject
Subscriber: subscribe to subjects and supply callbacks “subscribe-and-forget” mode many subscribers can subscribe to the same subject
A process can be both a publisher and subscriber a process can even receive messages it produces!
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
publisher publish
subscriber
subscriber
subscriber
subscribecMsg system
subscribe
subscribe
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
publisherpublish
subject “x”
subscriber
subscriber
subscriber
subscribecMsg system
subscribe
subscribe
subscribe
subject “x”
publishersu
bject “x”
publisher
subject “x”
subject
“x”
subject “x”
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
PublishSubscribe
PublishSubscribe
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
cMsgServe
r
cMsg based P2P
Point 1 Point 2
cMsg – status
A complete publish/subscribe messaging system Very simple API C/C++, Java, C# (in progress)
Many Unix flavors, VxWorks, windows (in progress)
Has some synchronous capabilities Highly customizable and extendable
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
#include <cMsg.hxx>
// connect to system via Universal Domain Locator cMsg c(UDL, “myName”, “My description”); c.connect();
// create and fill message cMsgMessage msg; msg.setSubject(“mySubject”); msg.setType(“myType”); msg.setText(“This is my text”);
// send message c.send(msg);
To send a cMsg message
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
#include <cMsg.hxx>
// connect to cMsg system cMsg c(UDL, “myName”, “My description”); c.connect();
// subscribe to subject/type combination and start receiving c.subscribe(“mySubject”, “myType”, new myCallback(), NULL); c.start(); // do something else…
To receive a cMsg message
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
class myCallback : public cMsgCallback {
void callback(cMsgMessage *msg, void* userArg) { cout << “Message subject is: " << msg->getSubject() << endl; }
};
Where callback is:
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Project Goal
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Develop a framework for building control systems open architecture hierarchical network distributed
Provide a set of tools to deploy: test and control systems alarm systems control visualization systems, etc.
ECS Requirements
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Control components of the experiment.
Full description of the experiment components.
Fault tolerance and recovery.
Create and deploy finite state machines.
Design Philosophy of AFECS
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Pure Java.Collaborating autonomous agents.Each agent represents a hardware or software
component.Messages between agents invoke actions. Agents behave as finite state machines.Agents communicate with physical
components through standard protocols.
AFECS Agent Categories
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Normative agents
administrative agent Crate and manage all other agents Environment administration
Supervisor agents
Control groups of Component agents Component agents
Represent hardware or software components of the real world control system.
N
S
A
Component Agent
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Agents mimic the state of the real (physical) component, they can invoke actions which change the physical component state.
HV power supply Target system
A A
Gas system
A AFECS (control) world.
Real world.
IPC IPC IPC
Inter-Process Communication Channels
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Agents communicate with their associated physical components using range of communication protocols including:
Tcl-DP (legacy protocol) cMsg P2P EPICS channel access protocol SNMP (simple network management protocol) JDBC (for database clients) OS shell interface DIM (in progress)
Supervisor Agent
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Supervisor agents have discrete states and they respond to messages from other agents (supervisor or component).
HV crate 1 HV crate 2
A A
HV crate 3
AAgents representing Individual power supplies
DC HV crates
SDC HV controlsupervisor agent
Agents Groupings
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Physical (AFECS container) A java virtual machine (JVM) is an agent container.
Container is a process. Agent is a set of threads in the process.
Logical (AFECS domain)Agents are grouped into virtual clusters or domains according to their functions. Agents in eachdomain may be visible to other domains.
S
A A A A
S
S
N S A
Domain
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Reduces complexity of large control systems.
Encourages modularity and encapsulation.(only a few agents and their behaviors are visible outside of the domain limits)
Promotes control system hierarchical structure.
Can be redesigned and tested independently, without affecting the rest of the control system.(as long as the behavior of the visible agents remains the same)
AFECS Platform Distribution
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Agents are physically distributed at the configuration time at runtime
S
A A A A
S
SN
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
CODA ROC
CODA EMU
EPICS IOC 1
EPICS CAG
Trigger soft
Trigger hard
Online ANA
A
A
A
A
A
A
A
S
S
S
S
S
NR NA NC
Physical Components Normative Agents
Supervisor agent
Grand supervisor
Front-End
cMsg
IPC
AFECS Platform
IPC
GUI/userIPC
WEB
IPC
Hierarchy of domains
Physical Component Integration
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
ComponentFred
NC
NA
NR
AgentFred
Description of the control
Administrative domain and container AFECS platform
DESIGNING A CONTROL SYSTEM REQUIRES PRECISE DESCRIPTIONS OF PHYSICAL COMPONENTS AND THEIR SOFTWARE ABSTRACTIONS.
COOL - Control oriented ontology language
Control Oriented Ontology Language
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Defines an agent model of the experiment.
Describes functionalities of physical components (state machines)
Describes the semantics of control.
Developed using RDFS.
Is intuitive and human readable.
Can be generated using GUI.
What is an Ontology?
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
An ontology is a specification of a conceptualization. – Tom Gruber
An ontology is a way of representing a knowledge, meaning that knowledge is formalized in a symbolic form, that is, to find a symbolic expression that can be interpreted. – Klein and Methlie
No really what is an Ontology?
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
An ontology specifies a description of the
Terminology and concepts Properties explicitly defining the terms, concepts Relations among concepts Rules distinguishing concepts, refining definitions
and relations (constraints, restrictions, regular expressions) relevant to a particular domain or area of interest.
Philosophy of Knowledge
Thursday, April 20, 2023 Vardan Gyurjyan. Jefferson Lab
Knowledge we have
Knowledge we know we don't know
Knowledge we are not aware we don't know
Formalized Knowledge
Subject Ontology
Domain Ontology Process Ontology Interface Ontology
Taxonomic Knowledge
RelationalKnowledge
AssertionalKnowledge
Thursday, April 20, 2023 Vardan Gyurjyan. Jefferson Lab
Knowledge
Subject specific ontology
Basic ontology
D2
D4
D5
D6D7
D8
D9
D1
Domain Ontology
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
A novel and poem are books.A book is a document.
document
book
novel poem
Domain Ontology
Taxonomic Knowledge
Process Ontology
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
A document author is a woman.
document woman
Process Ontology
Relational Knowledge
author
Interface Ontology
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
document woman
Process Ontology
author
woman string
Process Ontology
name
document string
Process Ontology
author
RDF: Resource Description Framework
RDF is best suited to formalize triple structure of the knowledge base.
Thursday, April 20, 2023 Vardan Gyurjyan. Jefferson Lab
Tag Value
XML RDF
Resource Property ValueSubject Predicate Object
Example
<cool:hasComponent rdf:resource="http://COOLHOME/Sms/test#FSMS1"/> <cool:hasComponent rdf:resource="http://COOLHOME/Slc/test#FSLC1"/>
<cool:hasRule rdf:resource= "http://COOLHOME/Rules/test#RULE1"/> <cool:hasRule rdf:resource= "http://COOLHOME/Rules/test#RULE2"/> <cool:hasRule rdf:resource= "http://COOLHOME/Rules/test#RULE3"/>
<cool:hasSlcOption rdf:resource="http://COOLHOME/Options/test#OPTION"/>
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Example States
<!-- Fake supervisor 1 states --> <rdf:Description rdf:about="http://COOLHOME/States/test#OK"> <cool:hasStateName>FSMS1_Ok</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Sms/test#FSMS1"/> <cool:hasSeverity>1</cool:hasSeverity> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/States/test#WARNING"> <cool:hasStateName>FSMS1_Warning</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Sms/test#FSMS1"/> <cool:hasSeverity>5</cool:hasSeverity> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/States/test#ERROR"> <cool:hasStateName>FSMS1_Error</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Sms/test#FSMS1"/> <cool:hasSeverity>10</cool:hasSeverity> </rdf:Description>
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Example States
<!--FSLC1 component states--> <rdf:Description rdf:about="http://COOLHOME/States/test#OFF"> <cool:hasStateName>off</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Slc/test#FSLC1"/> <cool:achevedThrough rdf:resource="http://COOLHOME/Processes/test#PROCESS1"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/States/test#ON"> <cool:hasStateName>on</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Slc/test#FSLC1"/> <cool:achevedThrough rdf:resource="http://COOLHOME/Processes/test#PROCESS2"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/States/test#STANDBY"> <cool:hasStateName>standby</cool:hasStateName> <cool:isFor rdf:resource="http://COOLHOME/Slc/test#FSLC1"/> <cool:achevedThrough rdf:resource="http://COOLHOME/Processes/test#PROCESS3"/> </rdf:Description>
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Example Rules
<rdf:Description rdf:about="http://COOLHOME/Rules/test#RULE1"> <cool:if rdf:resource="http://COOLHOME/States/test#ON"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/test#OK"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/Rules/test#RULE2"> <cool:if rdf:resource="http://COOLHOME/States/test#STANDBY"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/test#WARNING"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/Rules/test#RULE3"> <cool:if rdf:resource="http://COOLHOME/States/test#OFF"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/test#ERROR"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/Rules/test#CoFcRule1"> <cool:if rdf:resource="http://COOLHOME/States/test#ERROR"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/coda_states#CoDownloaded"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/Rules/test#CoFcRule2"> <cool:if rdf:resource="http://COOLHOME/States/test#WARNING"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/coda_states#CoPrestarted"/> </rdf:Description>
<rdf:Description rdf:about="http://COOLHOME/Rules/test#CoFcRule3"> <cool:if rdf:resource="http://COOLHOME/States/test#OK"/> <cool:thenMoveTo rdf:resource="http://COOLHOME/States/coda_states#CoActive"/> </rdf:Description>
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
AFECS COOL Specific Tools
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
GUI using COOL to build configuration files describing control system.
db2cool: converts current CODA config database to COOL config files.
sml2cool: translates state manager language config files to COOL config files.
One other COOL Example
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
<rdf:RDF'xmlns:cool='http://coda.jlab.org/COOL/cool#'>
<cool:Control rdf:ID="R1ExternalProcess"> <cool:hasComponent rdf:resource="#ROC1"/> <cool:hasComponent rdf:resource="#RC"/> <cool:hasOption rdf:resource="#OPTION"/></cool:Control><cool:Option rdf:ID="OPTION"> <cool:hasCoda2Component>false</cool:hasCoda2Component> <cool:hasDataFile>/tmp/test.dat</cool:hasDataFile></cool:Option><cool:Component rdf:ID="ROC1"> <cool:hasIpc>cMsg</cool:hasIpc> <cool:hasType>ROC</cool:hasType> <cool:hasName>Roc1</cool:hasName> <cool:hasPriority>44</cool:hasPriority> <cool:hasExternalProcess rdf:resource="#PROC1"/></cool:Component><cool:Component rdf:ID="RC"> <cool:hasIpc>cMsg</cool:hasIpc> <cool:hasType>RCS</cool:hasType> <cool:hasName>R1ExternalProcess</cool:hasName> <cool:hasPriority>77</cool:hasPriority></cool:Component><cool:Process rdf:ID="PROC1"> <cool:hasCommandIpc>shell</cool:hasCommandIpc> <cool:isPartOfState>predownload</cool:isPartOfState> <cool:hasCommandName>emacs</cool:hasCommandName></cool:Process></rdf:RDF>
AFECS Implementations
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
New run control for the JLAB data acquisition system.(V. Gyurjyan, et al. “Jefferson Lab Data Acquisition Run Control System”, Proceeding of the CHEP conference. CERN-2005-002, Volume 1, page 151.)
CLAS experiment web based monitoring system. http://clasweb.jlab.org/clasonline/rc/hallB/e-cr.htm
Conclusions
Thursday, April 20, 2023Vardan Gyurjyan. Jefferson Lab
Java based framework for designing and implementing hierarchical, distributed control systems with intelligent agents.
Encourages abstraction, encapsulation, and modularity. Provides a special ontology language (COOL) to describe
hierarchical control structure, control logic, and state machines.
Has been successfully used to develop run control system for the JLAB data acquisition system, and CLAS experiment web based monitoring system.