In file trend/Trend.hh:

class Trend

Accumulate and write trend data frames.

Inheritance:


Public Classes

enum TrendType
Enumerate trend types

Public Fields

typedef TrendAcc::count_t count_t
Data type for data counts
typedef TrendAcc::math_t math_t
Arithmetic data type
typedef float trend_t
Type of data contained in TSeries

Public Methods

Trend (void)
Default contructor.
Trend (const Trend& x)
Copy constructor
explicit Trend (const char* Name, TrendType type=kSecond, count_t FrameL=0)
Data constructor.
~Trend (void)
Destructor
bool exists (const char* ChName) const
test for channel
TrendChan& find (const char* ChName)
Find a channel entry.
const TrendChan& find (const char* ChName) const
Find a channel entry.
std::string getName (void) const
Trend channel group name.
std::string getFileName (void) const
Trend file name.
bool isEmpty (void) const
Test for non-zero data.
bool isEmpty (const Time& start, const Time& stop) const
Test for non-zero data.
void addChannel (const char* Name)
Add a trend channel.
void clear (void)
Clear the trend.
void close (void)
Close the trend.
std::ostream& dump (std::ostream& os) const
Dump the trend status.
void open (void)
open the trend FrWriter.
void read (const std::string& file)
Read a trend from the sppecified frame file
void trendData (const char* Name, const TSeries& ts)
Add points from a time series to the trend.
void trendData (const char* Name, const Time& t, math_t point)
Trend a single point.
void setAutoUpdate (bool enable)
Set auto-update mode.
void setFile (const char* Name)
Set the trend name.
void setFrameCount (int nFrame)
Set the maximum number of frames in a file.
void setFrameLen (int nSample)
Set the maximum number of samples in a frame.
void setIFO (const char* ifo)
Set IFO name.
void setMonID (const std::string& Name)
Set the channel monitor ID.
void setName (const char* Name)
Set the trend channel group name.
void setSample (Interval time)
Set the sample interval
void setType (TrendType type)
Set the trend type.
void Update (const Time& t=Time(0))
Write trend if time is past.
void writeIndex (const char* file=0) const
Write an NDS index file

Documentation

The Trend class collects LIGO standard trend information and records it in trend frames. Multiple channels may be trended and recorded by a single Trend object. The trend is specified with a sample interval and a number of points per frame. The Trend class averages over all data within the sample interval and produces a frame after the desired number of sample intervals has been accumulated.

The trender can write data frames automatically or only when an Update() command is issued. By default, the updates are made automatically. This option can be reset using setAutoUpdate(false). This option must be set (i.e. no automatic update) if data being added to multi-channel trend may overlap the end of a frame.

The trend file name may be specified explicitly with the setFile() method or may be left to default. The default value for the trend file name is $DMTRENDOUT/<ifo>-<name>_[MT]-<gps>_<sec>.gwf, where <ifo> is the specified IFO name, <name> is the channel group (or monitor) name, [MT] is "M" for minute trends or "T" for second trends, <gps> is the GPS time of the start of the trend and <sec> is the number of seconds of data in the trend frame file.

An channel index file may be written in the format used by the Network Data Server (NDS) by calling writeIndex() after all trend channels have been configured.

The basic steps to using the Trend class are shown below:

  
     ----  Initialization
   
     Trend trend;
     trend.setName("MyTrend");
     trend.setType(Trend::kSecond);
     trend.setIFO("H2");
     trend.setAutoUpdate(false);
     trend.setFrameCount(1);
     trend.addChannel("MyChannelA");
     trend.addChannel("MyChannelB");
     trend.writeIndex();
   
     ----  Adding data
   
     Time t; TSeries ts; Trend::math_t Data;
     ...
     trend.trendData("MyChannelA", t, Data);
     trend.trendData("MyChannelB", ts);
     ...
     trend.Update(ts.getEndTime());
   
     ----  Clean up and go away
   
     trend.write();
     trend.close();
     

typedef TrendAcc::count_t count_t
Data type for data counts

typedef TrendAcc::math_t math_t
Arithmetic data type

typedef float trend_t
Type of data contained in TSeries

enum TrendType
Enumerate trend types

Trend(void)
Construct an empty and unnamed trnder.

Trend(const Trend& x)
Construct an identical copy of an existing trnder.
Parameters:
x - Trender to be copied.

explicit Trend(const char* Name, TrendType type=kSecond, count_t FrameL=0)
Construct and initialize a Trend object. THe

~Trend(void)
Destructor

bool exists(const char* ChName) const
Test whether the specified channel has been defined.
Returns:
true if channel is defined.
Parameters:
ChName - Channel name to be tested.

TrendChan& find(const char* ChName)
Find the TrendChan entry for the specified channel.
Returns:
Reference to the TrendChan for the specified channel.
Parameters:
ChName - Name of channel to be located.

const TrendChan& find(const char* ChName) const
Get a constant reference to the TrendChan entry for the specified channel.
Returns:
Reference to the TrendChan for the specified channel.
Parameters:
ChName - Name of channel to be located.

std::string getName(void) const
Return the trend channel group name.
Returns:
String containing the trend name.

std::string getFileName(void) const
Return the trend file name. The file name is either specified explicitly, or written to the data.
Returns:
String containing the trend file name.

bool isEmpty(void) const
Test whether data have been accumulated in any of trend channels.
Returns:
True if non-zero data.

bool isEmpty(const Time& start, const Time& stop) const
Test whether data have been accumulated in any of the trend channels between the specified start and stop times.
Returns:
True if non-zero data.

void addChannel(const char* Name)
A channel is added to the trend channel list. Each trend channel list entry consists of a trend accumulator, and five time series containing accumulated entry count, mean, rms, minimum and maximum.
Parameters:
Name - Name of the new trend channel.

void clear(void)
Clear all data from the trend.

void close(void)
Write out the currently accumulated trend data and close the file.

std::ostream& dump(std::ostream& os) const
Dump the trend status.

void open(void)
Open the trend Frame writer.

void read(const std::string& file)
Read a trend from the sppecified frame file

void trendData(const char* Name, const TSeries& ts)
Add all data points in a time series to the trend. Data for the latest point are left in the running average.
Parameters:
Name - Trend channel name to which the data are added.
ts - Time series containing data to be trended.

void trendData(const char* Name, const Time& t, math_t point)
Add a data point to the specified trend running average. If the time stamp is in a different time bin than the previous, the accumlated average, rms, minimum, maximum and point count are stored in the trend time series and the accumulated values are reset. The new data point is then added to the accumlated average.
Parameters:
Name - Trend channel name to which the data point is added.
t - Time of trended point.
point - The value of the next element of a series.

void setAutoUpdate(bool enable)
Enable or disable auto-update mode. If the trend writer is in auto update mode, a trend frame will be written as soon as a data point later than the current frame is trended. This may cause the trender to choke if further data are received for the current frame.
Parameters:
enable - The trender is placed in auto-update mode if true.

void setFile(const char* Name)
Set the trend file name.
Parameters:
Name - Name for the trend data.

void setFrameCount(int nFrame)
Set the maximum number of trend frames to be written in a single file.
Parameters:
nFrame - Maximum number of frames to be written to a file.

void setFrameLen(int nSample)
Set the maximum number of trend samples to be written in a single frame.
Parameters:
nSample - Maximum number of samples to be written to a frame.

void setIFO(const char* ifo)
Set the interferometer ID. The interferometer ID is used as the first field of the trend frame file name.
Parameters:
ifo - IFO name.

void setMonID(const std::string& Name)
Set the trend channel Locale name. The same monitor ID should appear as the third field of all channel names.
Parameters:
Name - Monitor name to be used in trend channel names.

void setName(const char* Name)
Set the trend channel group name. When the trend is written the name is used as a file extension and as a frame name.
Parameters:
Name - Name for the trend channel group.

void setSample(Interval time)
Set the sample interval for non-standard trends.
Parameters:
Name - Name for the trend data.

void setType(TrendType type)
Set the trend type and assigns an appropriate sample interval.
Parameters:
type - Trend type, either kSecond, kMinute or kNonStandard.

void Update(const Time& t=Time(0))
Determine whether data have passed the current frame. If so, write a frame to the frame file.

void writeIndex(const char* file=0) const
Write an index file for the Network Data Server (NDS). The NDS index file has a list of the channels in the trend frame, organized as text file with one channel name per line. The channel name is followed by a data precision argument. At present the trender writes all data as "32bit_float". If the file name is not specified is specified as a null string, $DMTRENDOUT/channel.cfg is used.
Parameters:
file - Index file name.


This class has no child classes.
Author:
John Zweizig.
Version:
1.3; Modified April 23, 2002.

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++