DMT: Trend API
Quick Start Guide

Daniel Sigg, May 2001


  1. Overview
  2. How does it work
  3. What do I have to do
  4. Using the pTrend macro
  5. Example
  6. Data Viewer


Overview

The purpose of the Trend API is to provide the means to store a set of performance measures once a seoncd and/or once a minute. Since trend data is stored separately, it is avialable for quick lookup over long time periods. Minute trend is available on disk at either Observatory since the installtion of the DAQ system, whereas second trend is typically kept online for a couple of weeks. The preferred method of looking at trend data is the data viewer.



How does it work

There are basically two sources of trend data: (i) the DAQ system which automatically caluclates the mean, the standard deviation/rms, the minimum, the maximum and the number of points of all acquired channels; (ii) the DMT which computes performance measures such as band-limited rms values and power line harmonics.

The most convenient way to look at trend data is the data viewer. Data viewer is part of the LIGO tools distributions. Currently, data viewer requires a network data server (NDS) to obtaine data. Trend data is archived on tape and is available from the archive using the LIGO Archive Server (LARS). One can also look at trend from the ROOT command line using the pTrend macro.

Future plans for the Trend API include:

  • Computing the minute trend from the second trend automatically.
  • Adding support for the Monitor Data API, i.e., trends get automtaically exported.
  • Preload the trend data from previously written trend files, so that the exported trend data is not reset to zero after a restart of the monitor.

  • Trend data is the best way to establish a long term baseline.



    What do I have to do

    Here is a code fragment which gets a channel once a second, calculates a band-limited rms value and writes it to a trend file:

    #include <string>
    #include <math.h>
    #include "TSeries.hh"
    #include "FSeries.hh"
    #include "FSpectrum.hh"
    #include "DatEnv.hh"
    #include "Trend.hh"  // Include Monitor Data API

    class MyMonitor : public DatEnv {
       public:
          MyMonitor (int argc, const char* argv[]);
          virtual ~MyMonitor() {}
          virtual void ProcessData();
          TSeries*     fData;      // Input data
          Trend        fHistory;   // Trend class
          ...
    };

    EXECDAT (MyMonitor);   // DMT Framework

    // Constructs the monitor, initializes the monitor server and subscribes
    // the data objects
    MyMonitor::MyMonitor (int argc, const char* argv[])
    : DatEnv (argc, argv), fData (0) {
       getDacc().addChannel ("H0:PEM-LVEA_SEISX", 1, &fData);
       // setup trend writing
       fHistory.setName ("myMonitor"); // Set filename of trend
       fHistory.setType (Trend::kSecond); // Set trend type (sec or min)
       fHistory.setFrameLen (60);      // Set frame length
       fHistory.addChannel ("H0:PEM-LVEA_SEISX_RMS_10_30");
                                       // Add trend channel(s)
       ...
    }

    // Get some data and load the history buffer
    void MyMonitor::ProcessData() {
       // Calculate the rms value
       FSeries* fft = new FSeries (*fData);
       float rms = sqrt (fft->Power (kLowF, kHighF));
       delete fft;
       // Add the rms value to the trend
       fHistory.trendData ("H0:PEM-LVEA_SEISX_RMS_10_30",
                           fData->getStartTime(), rms);
       ...
    }
    ...

    From the above code fragement we can see that the following steps are necessary to add support for trend files to a monitor:
  • Inlcude the Trend API,
  • Declare a trend object,
  • Setup the trend object by specifying the filename extension, the trend type and the frame length,
  • Add the names of the trend channels to the trend object,
  • Compute the trend values, and
  • Add the new data point(s) to the trend object.

  • Any monitor which watches the performance of the detector should write its results in form of trends.



    Using the pTrend macro

    On can use the pTrend macro to look at the trend written by the above example; from the ROOT command line type:

    pTrend ("H0:PEM-LVEA_SEISX_RMS_10_30", "H-675369430.T.myMonitor", 0, 120);
    The first argument is the name of the trend channel, the second argument represents the full name of the trend file, the third argument represents the start time (zero for the beginning of the file), and the last argument represents the length of the data stretch in seconds.



    Example

    Get a working example form here.

    Exercise:

  • In the above example make the name of the trend file configurable from the command line.
  • Modify the above example to allow choosing the band limit from the command line.
  • Modify the above example to include a multiple number of bands.

  • Look at the produced trend files with the pTrend macro.



    Data Viewer

    Get the instructions from here.