Transcript Java

Java Based Run Control for CMS Small
DAQ Systems
M. Bellato (INFN – Padova)
L. Berti (INFN – Legnaro)
D. Ceccato (INFN – Legnaro)
M. Gulmini (INFN – Legnaro)
G. Maron (INFN - Legnaro)
N. Toniolo (INFN – Legnaro)
G. Vedovato (INFN – Legnaro)
S. Ventura (INFN – Padova)
X.Q. Yang (INFN – Legnaro)
Abstract #305
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
CMS small DAQ systems
CMS small DAQs use the CMS DAQ model
(RU, EB, BU, RCN) with components scaled down
(performances and/or size) according to the needs.
Hardware and software components may differ on each
small DAQ, so that PLATFORM and OPERATING SYSTEM
independence are an important requirement for a Run
Control System.
Level 1
Trigger
Detector Frontend
RU RU
Event
Manager
Event Builder
BU BU
Computing Services
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
Readout
Units
Controls
Builder
Units
CHEP2000
February 2000
Java Run Control System (JRCS)
Objective:
Provide an easy to customize Run Control framework
for CMS small DAQs (and for small DAQs in general).
Java Run Control System achieves PLATFORM (SPARC, Pentium,
PowerPC) and OPERATING SYSTEM (Solaris, Linux, vxWorks)
independence using extensively CORBA and Java.
Web based techniques have been used to provide a Web
Graphical User Interface.
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
CORBA and JAVA
• CORBA
(Common Object Request Broker Architecture):
• distributed object framework proposed by the Object Management Group
(OMG), that allows transparent invocation of object methods on a network.
• supports several programming languages, including Java and C++.
• Evaluated CORBA implementations:
– Orbix (C++ and Java)
– Visibroker (C++ and Java)
– TAO (C++)
– JDK 1.2 (Java)
• JAVA
• provides platform and operating systems independence executing code on a
Java Virtual Machine (JVM).
• Java Virtual Machines are freely available for almost all platforms.
• Java is a really powerful OO programming language; embedded
multithreading, high level communication protocols support (CORBA, RMI,
sockets, ...), native C/C++ interface (JNI), and Web support (applets,
swing classes) are only some features.
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
JRCS Overview
CORBA
Name
Server
Root Component
Manager
GUI
Configuration
Manager
Component
Manager
DAQ Component
Manager
DAQ Component
Manager
CORBA
Communication
Backbone
Information
Manager
DAQ
Component
DAQ
Component
Job
Manager
CORBA
TCP, IPC, pthreads...
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Component Manager (I)
CHSM
User Interface
•Theoretically rigorous language
system used for implementing
Root Manager
Component
Manager
DAQ Component
Manager
Experiment
Control
Event Builder
Event Filter
Managers
DAQ Component
Manager
ReadOut
FilterUnit
Managers
DAQ Component
ReadOut
FilterUnit
Tasks
DAQ Component
Concurrent, Hierarchical, finite
State Machine (Harel’s state
chart)
•Outputs C++ code
•Developed and written by Paul
J. Lucas and Fabio Riccati
•Run control system for Chorus
has been written with CHSM by
Fabio Riccati
•ATLAS Run control system is
based on CHSM
• Component Managers are organized as a tree, where the leaves are directly connected
to the DAQ Component to control.
The user interacts with the system using a GUI that sends commands to the Root
Manager.
• Component Managers are based on the Harel’s State Charts (CHSM package). The
Finite State Machines are the same for all the Component Managers.
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Component Manager software layers
C++
CHSM
C++
C++ / Java
Interface
Java
State Transition Implementation
(User code)
State Transition Interface
Component
Finite State Machine
Communication
Finite State Machine
Server / Client
Java Native Interface
Server / Client Implementation
CORBA
• Two Finite State Machines have
been implemented.
• A ‘Communication FSM’ manages
the communications between
Component Managers.
• A ‘Component FSM’ manages the
DAQ Component behaviour; the
actions associated to a state
transition have to be customized
depending on the DAQ Component
to control, overriding one C++
class methods (State Transition
Implementation).
Java Virtual Machine
Component Manager software layers
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
State Transition Implementation
State Transition Interface
class CmpTaskBase {
public:
...
virtual bool enterAction() {}
virtual bool exitAction() {}
virtual void configAction() {}
virtual void abortAction() {}
virtual void startAction() {}
virtual void stopAction() {}
virtual void pauseAction() {}
virtual void resumeAction() {}
virtual void resetAction() {}
...
};
(User code)
#include "tcp_server.h"
#include "tcp_client.h"
#include "CmpTaskBase.h“
class CmpTaskImpl : public CHSM_set, public
CmpTaskBase {
public:
CmpTaskImpl(CHSM_SET_ARGS):
CHSM_set(CHSM_SET_INIT), CmpTaskBase() {}
bool enterAction() {...}
bool exitAction() {...}
void configAction(){sendCmdToTask(CTF_CONFIG);}
void abortAction() {sendCmdToTask(CTF_ABORT);}
void startAction(){sendCmdToTask(CTF_START);}
void stopAction(){sendCmdToTask(CTF_STOP);}
void resetAction(){sendCmdToTask(CTF_RESET);}
...
private:
void
sendCmdToTask(int cmd) {...};
...
};
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Auxiliary services
• Configuration Manager:
 Component managers’ tree structure
 Component Managers configuration
 DAQ component setup and configuration
Actually on flat files; integration with a DBMS planned
• Job Manager:
 Launches, kills and monitors JRCS servers and DAQ components
• Information Manager:
 Handles status information of the several components
 Manages Log and Error Messages
 Message dispatcher; error, log and status messages are sent to
the subscribed clients (for instance a GUI); messages can be
synchronous (consequence of a control command) or
asynchronous (for instance the crash of a DAQ component)
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
User Interface (I)
Web based Graphical User Interface
Several approaches have been investigated
• Servlet approach
(at the very beginning):
 All the functionalities are embedded in a Web Server; problematic
• Applet approach:
 a CORBA applet has been developed; it manages all the CORBA client
code providing a nice API to the GUI developer
 Graphical part can be made using Java swing classes; many integrated
development tools are available.
Applet approach
Applet GUI
(swing)
APPLET
( Link )
Java Based Run Control for CMS Small DAQ Systems
CORBA
Michele Gulmini
JRCS
CHEP2000
February 2000
User Interface (II)
Web based Graphical User Interface
•
Dynamic HTML approach:
 The communication ‘CORBA applet’ is used
 Graphical part is done using HTML and Javascript
 A Javascript wrapper providing an API to the JRCS has been
implemented
 The Java/Javascript interface is provided by LiveConnect, a javascript
interpreter provided with modern browsers
 The graphical development is quite difficult, no very good development
tools found
HTML ( Static GUI )
Dynamic HTML
approach
JAVASCRIPT
( Dynamic GUI )
LiveConnect
APPLET
( Link )
Java Based Run Control for CMS Small DAQ Systems
CORBA
Michele Gulmini
JRCS
CHEP2000
February 2000
User Interface (III)
Other approaches are suitable:
•
GUI as CORBA application (Java, C++)
Java application
•
Character user interface (command scripts)
 JAVASCRIPT!!! (see next slide)
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Command Sequencer
• Using Javascript the final user can write sequences of control commands
function sendCommand(cmd) {
document.JSWrapper.sendCommand(cmd, Params);
}
function wait(sec) {
document.JSWrapper.wait(sec);
}
function userScript() {
sendCommand (BOOT,””);
sendCommand (CONFIG,””);
sendCommand (START,”FileOutput=DATA&Run=5”);
wait (600);
sendCommand (STOP,””);
sendCommand (RESET,””);
sendCommand (SHUTDOWN,””);
}
HTML/JavaScript/Swing
(User Code)
JavaScript Library
Netscape/IE/Rhino
Javascript Interpreter
Java - CORBA
Netscape/IE/JRE JVM
UI software layers
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
GUI
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Conclusions
• Java is a really powerful programming language: main troubles with JNI
• Integration with CORBA makes the system really platform and OS independent
• JRCS is suitable to control DAQs with up to few tens of components due to
overheads introduced by CORBA.
• Web based techniques are suitable to implement GUIs; by our experience the
applet approach is actually to prefer to the dynamic HTML approach.
• JRCS was tested the first time on a real environment on July ’99 for the CMS
muon chamber testbeam DAQ (see talk B315)
• Future:
• Work is still in progress...
• JRCS will be integrated with other DAQs:
• CMS muon chamber DAQ in Legnaro
• CMS muon chamber testbeam DAQ ( CERN – July 2000)
• CMS RPC (INFN-Bari) ??
• Other experiments in Legnaro (PRISMA,...)
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Java Based Run Control for CMS Small
DAQ Systems
M. Bellato (INFN – Padova)
L. Berti (INFN – Legnaro)
D. Ceccato (INFN – Legnaro)
M. Gulmini (INFN – Legnaro)
G. Maron (INFN - Legnaro)
N. Toniolo (INFN – Legnaro)
G. Vedovato (INFN – Legnaro)
S. Ventura (INFN – Padova)
X.Q. Yang (INFN – Legnaro)
Abstract #305
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000
Error Detection and Recovery
•
Error detection and recovery procedures have been implemented
• The Information Manager is the core of the ‘Error
Detection System’ since it handles the status information of
the several components;
• Every server can be started and killed independently to the
others. Each server checks periodically its CORBA
connections; when a connection problem is detected an
automatic reconnection procedure starts;
• Error recovery actions can be done by the GUI
• DAQ dependent automatic error recovery procedures have
to be implemented according to the needs (the ‘command
sequencer’ feature helps!!);
Java Based Run Control for CMS Small DAQ Systems
Michele Gulmini
CHEP2000
February 2000