Daniel Sigg, May 2001
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.
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:
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>From the above code fragement we can see that the following steps are necessary to add support for trend files to a monitor:
#include <math.h>
#include "TSeries.hh"
#include "FSeries.hh"
#include "FSpectrum.hh"
#include "DatEnv.hh"
#include "Trend.hh" // Include Monitor Data APIclass 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);
...
}
...
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.
Get a working example form here.
Exercise:
Get the instructions from here.