class VoltWriter : public VoltBase

Handles the output for calculations on power line monitor channels

Inheritance:


Public Methods

VoltWriter(const char* filename, const char* HTMLfile, int average = 1, int ival = 1, bool harmonics = true, int trend = notrend, MonServer* monserver = 0)
Constructor
VoltWriter(const char* filename, int average=1, int ival = 1, bool harmonics = true, int trend = notrend, MonServer* monserver = 0)
Constructor
virtual ~VoltWriter()
Destructor
void writeIndex()
Writes the trend file index
static char* makeName(char* s, const char* name, const char* ext)
Make a conforming channel name
void addSlot(VoltWatcher& VWatch)
Add a VoltWatcher to a slot
void setTimeArray(const int id, const unsigned long GPSsecs)
Change the time in one slot
void setData(const int id, const int column, const float data)
NOT THE SAME AS THE ORIGINAL METHOD IN VOLTBASE
void setSlotStatus(const int id, bool status)
Change a slot's status to GOOD or BAD
void makeHeaders()
Make data files with headers
void VoltWriter::printHeader()
Print headers on the screen
void print2File(const int id)
Update a data file
void print2Screen(const int id) const
Print data to screen
void print2Web()
Update the webpage
void reset()
Set all slots' timers to zero

Protected Fields

bool slotStatus[maxChannels]
The GOOD/BAD status of each slot
char channelNames[maxChannels][80]
Name of each slot's channel
char fileNames[maxChannels][80]
Name of each slot's data file
char webname[200]
Location of web page
bool useharmonics
Include harmonics in output?
int usetrend
Use trend instead of ASCII files
Trend trend
Trender
std::ofstream opd
Output stream for data files
std::fstream web
Output stream for the webpage
MonServer* mserv
monitor server
float hist[maxChannels][4][maxHistory]
History arrays (rms, frequency, crest value, THD)
int histlen[maxChannels]
History array length
Time histStart[maxChannels]
History array start time
const float interval
Number of seconds per point
TSeries histTS[maxChannels][4]
History for monitor server (rms, frequency, crest value, THD)
const int avgFactor
Number of VoltWatcher buffers over which to average calculations
int timer[maxChannels]
Number of partial calculations added so far to each slot in the database

Protected Methods

void makeFilenames(const char* filename)
Makes a filename for each slot
void addHistPoint(int id)
add a history point

Inherited from VoltBase:

Protected Fields

deftrend float database[maxChannels][4 + maxHarmonics*2]

Documentation

VoltWriter handles the results of several VoltWatchers - its major functions are to save the results from each channel to a file and to periodically post all of the results to a webpage, summary.html.

Source code: VoltWriter.hh and VoltWriter.cc

VoltWriter(const char* filename, const char* HTMLfile, int average = 1, int ival = 1, bool harmonics = true, int trend = notrend, MonServer* monserver = 0)
Constructor. Entire database is set to zero. All timers are set to zero. All slots are set to BAD.
Parameters:
filename - Base filename for all files
HTMLfile - Path and filename of the summary web page
avg - Number of VoltWatcher buffers over which to average results

VoltWriter(const char* filename, int average=1, int ival = 1, bool harmonics = true, int trend = notrend, MonServer* monserver = 0)
Constructor. Entire database is set to zero. All timers are set to zero. All slots are set to BAD. Default web page is used.
Parameters:
filename - Base filename for all files
avg - Number of VoltWatcher buffers over which to average results

virtual ~VoltWriter()
Destructor

void writeIndex()
Writes the trend file index

static char* makeName(char* s, const char* name, const char* ext)
Make a channel name for trend and online viewing. A conforming channel name uses MLTV as the system name.
Returns:
pointer to return string
Parameters:
s - String to copy to (must be long enough)
name - Original channel name
ext - Channel name extension

void addSlot(VoltWatcher& VWatch)
If the slot is free and the VoltWatcher passed has no errors, the VoltWatcher will write its results to the slot in the database matching its ID number.
Parameters:
VWatch - VoltWatcher to add

void setTimeArray(const int id, const unsigned long GPSsecs)
Sets the time in the specified slot to a new value, but only when the internal timer is maxed or zero
Parameters:
id - Slot to change
GPSsecs - New time (in GPS seconds)

void setData(const int id, const int column, const float data)
A value is divided by <b>avgFactor</b> and ADDED to the database item. The item is set to zero first if the internal timer is at the beginning.
Parameters:
id - Slot number to add to
column - Column number to add to
data - Value to add

void setSlotStatus(const int id, bool status)
Change a slot's status to GOOD or BAD
Parameters:
id - Slot number
status - GOOD or BAD

void makeHeaders()
Create a data file for each GOOD VoltWatcher and put fancy headers at the top of each one.

void VoltWriter::printHeader()
Print fancy column headers on the screen to go with <b>print2Screen ()</b>

void print2File(const int id)
Add all the data from one slot in the database to the last line of that slot's data file, but only if the slot's timer is maxed
Parameters:
id - Slot number

void print2Screen(const int id) const
Print a slot's first few values in the database to the screen, but only if the slot's timer is maxed
Parameters:
id - Slot number

void print2Web()
Print the entire database to a webpage (summary.html), but only if the timers for ALL slots are maxed

void reset()
Set all slots' timers to zero

void makeFilenames(const char* filename)
Makes a filename for each slot. Filename's base is the string passed to the function, and its extension is the slot number.
Parameters:
filename - Base for filenames

bool slotStatus[maxChannels]
The GOOD/BAD status of each slot. Status is GOOD if the slot is in use by a VoltWatcher with no errors. Status is BAD if the slot is not in use or if its VoltWatcher has an error.

char channelNames[maxChannels][80]
Name of each slot's channel

char fileNames[maxChannels][80]
Name of each slot's data file

char webname[200]
Location of web page

bool useharmonics
Include harmonics in output?

int usetrend
Use trend instead of ASCII files

Trend trend
Trender

std::ofstream opd
Output stream for data files

std::fstream web
Output stream for the webpage

MonServer* mserv
monitor server

float hist[maxChannels][4][maxHistory]
History arrays (rms, frequency, crest value, THD)

int histlen[maxChannels]
History array length

Time histStart[maxChannels]
History array start time

const float interval
Number of seconds per point

void addHistPoint(int id)
add a history point

TSeries histTS[maxChannels][4]
History for monitor server (rms, frequency, crest value, THD)

const int avgFactor
Number of VoltWatcher buffers over which to average calculations

int timer[maxChannels]
Number of partial calculations added so far to each slot in the database. Using <b>setTimeArray ()</b> increments the timer. The timer resets when it equals <b>avgFactor</b>.


This class has no child classes.
Author:
Charlie Shapiro

alphabetic index hierarchy of classes


generated by doc++