Rhic Monitor System Description




Server Overview


The RHIC monitor system consists of a server application, the RHIC CDEV database and its servers,
and the Objectivity database. The purpose of the system is to retrieve the RHIC monitored machine
parameters, make them available to PHENIX applications, and to archive them for latter access.

RHIC machine parameters are stored in the RHIC CDEV database. The PHENIX rhic monitor server
runs on phoncs0.  This server retrieves the monitored data from the CDEV server where it caches the
data locally and stores it in the PHENIX Objectivity database.  The PHENIX server provides access
functions so that applications can read the data directly from the server.  Additional functions are
available to recall the data from the Objectivity database.

Running the RHIC monitor server

The RHIC monitor server executes on phoncs0.phenix.bnl.gov.  The name of the server is rhicserver.
This server can be started from the phoncs account by executing the setuponcs command followed by
the command rhicserver &.  This starts a server listed in the output of the psit command as server
"phoncs/RhicMonitor".  An example of the output is printed below.  The PID value will be different.

 phoncs0> psit
[29917: New Connection (phoncs0.phenix.bnl.gov,IT_daemon,*,phoncs,pid=4430,optimised) ]
Active servers at node phoncs0.phenix.bnl.gov are :
Name            Marker  Code    Comms   Port    Launch  PerClient?      OS-pid
------------------------------------------------------------------------------
phoncs/RhicMonitor*     cdr     tcp     2623    manual  ---             18454
 

Server Data Update

The PHENIX rhic server reads data from the CDEV database server both synchronously on demand,
and asynchronously.  The retrieved data is stored locally in the rhic monitor server.  A client application
which reads the monitored data from the PHENIX server  will be returned the data from the last update.

Data which is updated asynchronously from the RHIC CDEV server is done so through a callback mechanism.
With this update mechanism  the CDEV database server  updates the PHENIX  rhic monitor server when a
change in value of a monitored parameter in the CDEV database.  Currently, the bunchcurrent and beam current
parmeters are updated with this mechanism. All of the other RHIC parameters are updated synchronously.
 

Server Data Update Rates


The data that is updated synchronously  reads data  from the RHIC CDEV database every 30 seconds.
The bunch current and beam current data is currently being updated by the CDEV database every 4 seconds.

The rhic server archives the monitored data to the Objectivity database every 10  minutes.  The data is also
currently being stored in an ascii file.
 

Data Exchange to RHIC from PHENIX

PHENIX measured parameters which are of interest to the RHIC facility can be sent to the CDEV
database server.  Currently the main magnet status and current is being sent to RHIC.  The main
magnet status and run values are being read every 2 minutes.  If a value changes then RHIC is
updated with this data.
 

Server Access Functions

User applications can access the monitored RHIC parmeters through CORBA function calls to the PHENIX
rhic server.   Each of the CDEV object types is mapped in the phenix server to a corresponding CORBA
complianet object.  The each CORBA object has an accessor function called getData which will return all of
the data which is contained by that object.  The description of the CORBA objects is described in the IDL files
for each object.  The IDL files are accessable with the following links.  The structures that are returned by the
CORBA calls are defined in the IDL file rhicStructs.idl.
 
 
CDEV Object  IDL description
ringSpec  RhicRingSpec IDL
irSpec  irSpec IDL
DvmControl  DvmControl IDL
WcmControl  WcmControl IDL
SisScaler  SisScaler IDL
Polarimeter  Polarimeter IDL
rhicStructs  rhicStructs IDL

 
 

Client Helper Classes and Sample Application


In order to simplify client application access to the RHIC server and its parameters a number of helper
classes have been written.  These helper classes provide functions to connect to the rhic server, to
retreive the data from it, and to display the returned data.  The helper classes hide from the user all
CORBA specific information.  A description of the helper classes and sample code can be found  here
 
 

Data Structures

The RHIC machine information is stored in the CDEV database in separate objects.  Each object
contains a number of attributes, each of which  contains a RHIC machine parameter.

There are currently 6different object types that are being read from the CDEV database. These
are the ringSpec, irSpec, WcmControl, DvmControl, SisScaler, and Polarimeter objects. The names of each
of the objects for each object type that is being read from the CDEV database is described in
table CDEV Object Names .  These are the names which are used by a client application to
gain access to the object in the rhic server which runs on phoncs0.

The names of the attributes, their data types and the number of values of each attribute is described
 in the following tables:
 
 
Object Type Table
ringSpec  ringSpecDescription
irSpec  irSpec Description
DvmControl  DvmControl Description
WcmControl  WcmControl Description
SisScaler  SisScaler Description
Polarimeter  Polarimeter Description

 
 

Data Archival

Data read from the CDEV database is stored in the PHENIX objectivity database and into an ascii
file.
 

Objectivity Data Store Rates:


All data read from the RHIC CDEV database is stored in the Objectivity database.  Currently it is stored
every 10 minutes.
 

Objectivity Data Structures:

The data which is stored in the Objectivity database is placed in a container object called the RhicDataContainer.
A new container is created every day at midnight, and all the data stored in that day is stored in the new
container.

For each CDEV data object there is a corresponding object in which that objects data is stored into the Objectivity database.   Accordingly,  the following table defines the objects that are currently stored in the Objectivity database:
 
 
CDEV Object Objectivity Object
ringSpec RhicRingEntry
irSpec RhicIrEntry
dvmControl DvmControlEntry
wcmControl WcmControlEntry
sisScaler SisScalerEntry
Polarimeter PolarimeterEntry

There is one object of each type for each object that is read from the CDEV database.  Each object is
given an identical name as it is accessed from the CDEV database.  The names of these objects are
in  cdev Object Names .
 
 

Database Access

The data objects can be retrieved by date and by object name.  Thus for a specified day  any named
object can be retieived which was stored on the given day.  There is a helper class which  defines a
number of functions to retrieve data.  Each object type has its own access function.  Each function
specifies as arguements the name of the object , the month, day and year on which the object was
stored, and a data structure in which the data for that object is returned.  The helper class is called
RhicDbScan.  Its access functions are described in the list below.
 

Functions for Database Access

class RhicDbScan

 int searchContainer(char * objectname,char * month, char *date, char *yr);

  int getWcmControlData(char * objectName, char *Mon, char *day, char * yr,wcmControlStruct & data);

  int getRingData(char * objectName, char *Mon, char *day, char * yr,rhicRingStruct & data);

  int getScalerData(char * objectName, char *month, char *day, char * yr,SisScalerStruct & data);

  int getDvmControlData(char * objectName, char *month, char *day, char * yr,DvmControlStruct & data);

  int getIrData(char * objectName, char *month, char *day, char * yr,rhicIrStruct

   int getPolarimeterData( char * objectName, char *month, char *day, char * yr, PolarimeterData & data);

  /**
   * Gets a list of objects that match the name for the specified date
   */
  int getObjectEntryList(char * objectName, char *month, char *day, char * yr, rhicObjectEntryInfo * entrylist);
 
 

Building a Database client application

The Makefiles for building a client application which uses the above functions is archived in the directory:
$ONLINE_MAIN/RhicUtilities

Ascii File Store


A new ascii file is created every day at midnight and the subsequent days data is written to the file.  The file is
located in $ONLINE_LOG.  The files are named rhicdata.MonDayYear.dat.  An example is the
file rhicdata.Oct232001.dat.  The ascii file was originally written until the Objectivity interface was completed.
This operation will be discontinued if it is no longer needed.

Ascii File format

The format of the data in the ascii file is the name of the object from which the data is read followed by the
date, the parameter name and the data.  For example the beam current data for the blue ring which was
read out on Nov 6 is stored as follows:
yi2-wcm3,Tue Nov  6 23:52:07 2001,wcmBeam,16.4228