DMT: Monitor Data API
Quick Start Guide

Daniel Sigg, May 2001


  1. Overview
  2. How does it work
  3. What do I have to do
  4. Supported Data Types
  5. Example
  6. DMT Viewer


Overview

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.



How does it work

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:

NameServer
When 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.edu
or for the corresponding server at LLO type:
setenv DMTNAMESERVER delaronde.ligo-la.caltech.edu
Now start the DMT Viewer by
dmtviewer




What do I have to do

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>
#include <iostream>
#include "TSeries.hh"
#include "FSeries.hh"
#include "FSpectrum.hh"
#include "DatEnv.hh"
#include "MonServer.hh"  // Include Monitor Data API

class 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;
   ...
}
...

From the above code fragment we can see that the following steps are necessary to export data from a monitor:
  • Include the Monitor Server Data API header,
  • Inherit the monitor class from MonServer,
  • Override the Attention method to callback the corresponding method in MonServer,
  • Declare the data objects which will be exported,
  • Specify the monitor name in the MonServer constructor,
  • Subscribe the data objects so the name server knows about them,
  • Fill the exported data objects with meaningful result

  • All background monitors which compute results in form of time or frequency series should export them.



    Supported Data Types

    The following classes are currently supported by the Monitor Data API:

  • TSeries : time series data
  • FSeries : frequency series, transfer function, cross-spectral density, etc.
  • FSpectrum : power spectrum, coherence, etc.

  • It also supports basic types such as long, double and string.

    The following classes will soon be supported by the Monitor Data API:

  • Histrogram : 1 and 2 dimensional histograms
  • Trend : Slow history data (strip chart)
  • Time-frequency plot : time frequency representation

  • Other data types can be easily added since the interface is written transport independent.



    Example

    Get a working example form here.

    Exercise:

  • In the above example make the monitor name configurable from the command line.
  • Modify the above code to include an arbitrary number of channels.
  • Modify the above example to allow choosing the resolution bandwidth, frequency range and window type through a setup file.
  • Add options for DC removal and overlap.

  • Look at the results with the DMT Viewer.



    DMT Viewer

    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: