Daniel Sigg, May 2001
The purpose of the Monitor Data API is to provide a look at monitors running in the background. A background monitor typically doesn't display any graphics because it runs without an open terminal. However, it might still be useful to look at some of the monitor results in form of a plot. To facilitate this the Monitor Data API can be used to export data such as time traces or power spectra. The user then connects to the monitor through a network interface and requests a data dump of an exported object. This can be done interactively with the DMT Viewer which lets the user select monitors and monitor data objects through a graphical user interface and which displays the data in a graphics pad.
Most of the data transport is done by a lower level software layer and all a user has to do is to setup the exportable data objects. In some situations--like when it doesn't seem to work--it might be helpful understand hoe the plumbing works.
During initialization the background monitor announces its name to the name server. The name server is the central service which keeps track of what is available. Typically, one would run one name server per site. On the DMT machines at the two sites this is done automatically at boot time, but off-site it may be necessary to start a name server by hand; just type:
NameServerWhen a client program such as the DMT Viewer wants to display result data it first connects to the name server and makes a request for the list of monitors currently running and exporting data. For each selected monitor it will then request a list of exported data objects directly from the monitor. Finally, after the user has selected one or more data objects the data itself is downloaded from the monitor. It is important that the DMT Viewer knows the network address of the name server. In the control room this is already setup for the corresponding site, but elsewhere it might be necessary to set the associated environment variable prior of launching the DMT Viewer. To connect to the DMT at LHO type:
setenv DMTNAMESERVER sand.ligo-wa.caltech.eduor for the corresponding server at LLO type:
setenv DMTNAMESERVER delaronde.ligo-la.caltech.eduNow start the DMT Viewer by
dmtviewer
The easiest way to prepare a monitor for exporting data is to use the monitor framework. This has the advantage that the monitor server class is already setup and all what is left to the user is to subscribe the exportable objects. Here is a code fragment which gets a channel once a second, calculates the power spectrum and exports it:
#include <string>From the above code fragment we can see that the following steps are necessary to export data from a monitor:
#include <iostream>
#include "TSeries.hh"
#include "FSeries.hh"
#include "FSpectrum.hh"
#include "DatEnv.hh"
#include "MonServer.hh" // Include Monitor Data APIclass MyMonitor : public DatEnv, MonServer {
// inherit from DatEnv and MonServer
public:
MyMonitor (int argc, const char* argv[]);
virtual ~MyMonitor() {}
virtual void ProcessData();
virtual void Attention() {
// This call serves data, if a request is pending
MonServer::Attention(); }
...
private:
TSeries* fData; // Input data
FSpectrum fSpectrum; // Data object to be exported
};EXECDAT (SpectrumMonitor); // DMT Framework
// Constructs the monitor, initializes the monitor server and subscribes
// the data objects
MyMonitor::MyMonitor (int argc, const char* argv[])
: DatEnv (argc, argv), MonServer ("MyMonitor"), fData (0) {
// Monitor name used by the name server
getDacc().addChannel ("H0:PEM-LVEA_SEISX", 1, &fData);
// subscribe the data object
serveData ("H0:PEM-LVEA_SEISX", &fSpectrum);
...
}// Get some data and compute the power spectrum
void MyMonitor::ProcessData() {
// Calculate the power spectrum
FSeries* fft = new FSeries (*fData);
fSpectrum = FSpectrum (*fft);
delete fft;
...
}
...
The following classes are currently supported by the Monitor Data API:
The following classes will soon be supported by the Monitor Data API:
Get a working example form here.
Exercise:
The DMT Viewer shares substantial part of its code with the Diagnostics Test Tool (DTT). The main difference is that instead of the test setup tab a monitor and data object selection tab has been inserted. The plotting capabilities as well as the save/restore, import/export and calibrations are identical. The monitor and data selection tab looks as follows: