In file stdtest.h:

class stdtest : public diagtest

Object for implementing a standard test

Inheritance:


Public Methods

explicit stdtest (const string& name)
Default constructor.
virtual bool begin (std::ostringstream& errmsg)
Startup method.
virtual bool end (std::ostringstream& errmsg)
Cleanup method.
virtual bool setup (std::ostringstream& errmsg, tainsec_t starttime, syncpointer& sync)
Setup method.

Protected Classes

class stimulus
simulus object type
typedef std::vector <AWG_Component> awglist
list of awg signals
typedef std::vector <float> pointlist
list of awg points
string name
channel name of excitation
bool isReadback
is read back?
string readback
channel name of readback
AWG_WaveType waveform
excitation waveform type
double freq
frequency
double ampl
amplitude
double offs
offset
double phas
phase
double ratio
square wave ratio
double frange
frequency range
double arange
amplitude range
pointlist points
list of points for arbitrary waveform
gdsChnInfo_t excInfo
channel info for exciation channel
gdsChnInfo_t readbackInfo
channel info for readback
awglist signals
excitation signal list
bool duplicate
true if readback channel is a duplicate
rtddChannel::partitionlist partitions
partition list
bool useActiveTime
use active time for preprocessing
stimulus ()
Default constructor.
bool calcSignal (tainsec_t t0, tainsec_t duration)
Generates signal list.
bool calcSineSignal (tainsec_t t0, tainsec_t duration, tainsec_t ramp)
Generates sine signal.
enum stimulustype
type for selecting stimulus channels
stimNone
ignore stimulus channels
stimReadback
include stimulus channels which have a valid readback
stimAll
include all stimulus channels
class measurementchannel
measurement channel object type
string name
channel name of excitation
gdsChnInfo_t info
channel info for exciation channel
bool duplicate
true if channel is a duplicate
rtddChannel::partitionlist partitions
partition list
bool useActiveTime
use active time for preprocessing
measurementchannel ()
Default constructor.
class interval
interval class
typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval
timeinterval ival
time interval
bool good
if false, this interval was not rejected by the analysis
interval (tainsec_t t, tainsec_t dt)
Constructor.
tainsec_t t0 () const
Interval start.
tainsec_t dt () const
Interval duration.
struct callbackarg
argument for synchronization callbacks
typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval
timeinterval ival
time interval
int measPoint
measurement point
int measPeriod
measurement period

Protected Fields

friend class chnrec
friend
typedef std::vector <stimulus> stimuluslist
stimuli type
typedef std::set <AWG_WaveType> waveformset
allowed stimulus waveform type
const static waveformset sinewaveOnly
sine wave only
const static waveformset periodicOnly
periodic waveforms only
const static waveformset noiseOnly
noise waveforms only
const static waveformset allWaveforms
all waveforms
typedef std::vector <measurementchannel> measlist
measurement channels type
typedef std::vector <interval> intervallist
list of intervals
typedef testsync <stdtest, callbackarg> stdtestsync
synchronization object for standard test
friend class testsync stdtestcallbackarg
friend
const diagTest* test
test access class for storage object
string testType
test type
bool doAnalysis
true is analysis should be done; set false during pause
tainsec_t T0
start time: t = 0
int averageType
average type
int averages
number of averages
int avrgsize
size of average buffer, i.e. number of measurement points
int avrgnum
number of analyzed measurement periods
double timeGrid
time grid of test; used for determining the start time
stimuluslist stimuli
exciatations
measlist meas
measurement channels
intervallist intervals
measurement intervals
std::deque <syncpointer> syncqueue
queue of synchronization points
int dataerrors
number of data errors

Protected Methods

typedef bool(stdtest::*channelAnalysis) (int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
Memeber function prototype for channal analysis callback
virtual bool readParam (std::ostringstream& errmsg)
Read parameter method.
virtual bool readMeasParam (std::ostringstream& errmsg, int maxIndex = 100)
Read measurement parameter method.
virtual bool readStimuliParam (std::ostringstream& errmsg, bool needReadback = false, waveformset allowedWaveforms = allWaveforms, int maxIndex = 100)
Read stimuli parameter method.
virtual bool subscribeChannels (std::ostringstream& errmsg)
Subscribe channels method.
void samplingFrequencies (double fMax, double& fSampleMin, double& fSampleMax)
Sampling frequency range.
virtual double calcTimeGrid (double fMax, tainsec_t* t0 = 0)
Calculate time grid method.
virtual bool calcTimes (std::ostringstream& errmsg, tainsec_t& t0)
Calculate measurement time method.
virtual bool addMeasPartitions (const interval& ival, int pIndex, double fSample, tainsec_t pt = 0, double fZoom = 0, double fZoomSample = 0, tainsec_t tZoom = 0)
Add measurement partitions method.
virtual bool addSyncPoint (const interval& ival, int measPeriod, int measPoint = 0)
Add synchronization point method.
virtual bool newMeasPoint (int i, int measPoint = 0)
new measurement point method.
virtual bool calcMeasurements (std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Add measurements method.
virtual bool delMeasurements (std::ostringstream& errmsg)
Delete measurements method.
virtual bool addMeasurements (std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Add measurements method.
virtual bool startMeasurements (std::ostringstream& errmsg)
Start measurements method.
virtual bool stopMeasurements (int firstIndex = -1)
Stop measurements method.
bool prepareNextPoint (const callbackarg& id)
Prepare method.
virtual bool getNextSyncPoint (const callbackarg& id, syncpointer& sync)
next sync method.
virtual bool syncAction (const callbackarg& id, syncpointer& sync, bool& notify)
Sync action method.
virtual bool syncAbort (const callbackarg& id)
Sync abort method.
virtual bool syncPause (const callbackarg& id, syncpointer& sync)
Sync pause method.
virtual bool syncResume (const callbackarg& id, syncpointer& sync)
Sync abort method.
virtual bool callChannelAnalysis (const callbackarg& id, int measnum, channelAnalysis method, int firstres = 0, stimulustype inclStim = stimReadback, bool async = true, bool skipDuplicates = true)
Channel analyis method.
virtual bool analyze (const callbackarg& id, int measnum, bool& notify)
Analysis method.

Inherited from diagtest:

Public Methods

static double measurementTime(double duration, double cycles, double f, bool roundup = true)
static double adjustForSampling(double t, double dt)
static tainsec_t fineAdjustForSampling(tainsec_t t, double dt)
virtual diagtest* self() const
virtual string name() const
virtual bool init(diagStorage& Storage, const cmdnotify& Notify, rtddManager& RTDDMgr, excitationManager& EnvExc, excitationManager& TestExc, int KeepTraces, bool rtMode = true)
virtual void setStep(int Step, int resindex)
virtual int getResultNumber()
virtual bool readEnvironment()

Protected Fields

mutable recursivemutex mux
string myname
cmdnotify notify
diagStorage* storage
rtddManager* rtddMgr
excitationManager* testExc
bool RTmode
int step
int rindex
int rnumber
int keepTraces

Inherited from testenvironment:

Public Classes

class environment
int num
array index of Env[]
bool active
active flag
string channel
channel name
string waveform
string describing waveform
std::vector <float> points
points of arbitrary waveform
double wait
settling time
environment()
Default constructor
environment(const environment& env)
Copy constructor

Public Fields

typedef std::vector <environment> environmentlist

Public Methods

virtual void setEnvironmentExcitationManager( excitationManager* excmgr)
virtual bool subscribeEnvironment(std::ostringstream& errmsg)
virtual double waitEnvironment() const
virtual bool startEnvrionment(tainsec_t starttime = 0, tainsec_t timeout = -1)
virtual bool stopEnvrionment(tainsec_t timeout = -1)
virtual bool clearEnvrionment(tainsec_t timeout = -1)

Protected Fields

mutable recursivemutex envmux
excitationManager* envexc
environmentlist envlist

Documentation

Standard test template This object implements a abstract standard test. For a straight forward test it should be sufficient to overwrite calcTime, calcMeasurement, readParam and the sync functions.

explicit stdtest(const string& name)
Constructs a standard test object.
Returns:
void

virtual bool begin(std::ostringstream& errmsg)
Begin of test. This function reads parameters and subscribes channels to the excitation and rtdd managers, respectively. (Neither excitations nor rtdd channels are not turned on, however.)
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool end(std::ostringstream& errmsg)
End of test. This function cleans up a test measurement by unsubscribing both excitation and rtdd channels.
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool setup(std::ostringstream& errmsg, tainsec_t starttime, syncpointer& sync)
Sets up the test. This function will activate the excitation and start the data flow from the rtdd interface - after calculating measurement times and setting up the excitations signals and the measurement partitions. This function also returns the first synchronization point.
Returns:
true if successful
Parameters:
errmsg - error message stream
starttime - start time of test
sync - synchronization point

friend class chnrec
friend

class stimulus
simulus object type

typedef std::vector <AWG_Component> awglist
list of awg signals

typedef std::vector <float> pointlist
list of awg points

string name
channel name of excitation

bool isReadback
is read back?

string readback
channel name of readback

AWG_WaveType waveform
excitation waveform type

double freq
frequency

double ampl
amplitude

double offs
offset

double phas
phase

double ratio
square wave ratio

double frange
frequency range

double arange
amplitude range

pointlist points
list of points for arbitrary waveform

gdsChnInfo_t excInfo
channel info for exciation channel

gdsChnInfo_t readbackInfo
channel info for readback

awglist signals
excitation signal list

bool duplicate
true if readback channel is a duplicate

rtddChannel::partitionlist partitions
partition list

bool useActiveTime
use active time for preprocessing

stimulus()
Constructs a stimulus object.
Returns:
void

bool calcSignal(tainsec_t t0, tainsec_t duration)
Generates the signal list which is desribed by the stimulus object.
Returns:
true if successful
Parameters:
t0 - start time of excitation
duration - duration of excitation

bool calcSineSignal(tainsec_t t0, tainsec_t duration, tainsec_t ramp)
Generates a sine wave signal which desribed by the stimulus object and which ramps up smoothly. This function will generate an amplitude ramp up for the first sine signal generated. Subsequent sine waves are set, so that the ramp smooyhly (both frequnecy and amplitude) from the the previous one.
Returns:
true if successful
Parameters:
t0 - start time of excitation
duration - duration of excitation
ramp - duration of ramp

typedef std::vector <stimulus> stimuluslist
stimuli type

typedef std::set <AWG_WaveType> waveformset
allowed stimulus waveform type

const static waveformset sinewaveOnly
sine wave only

const static waveformset periodicOnly
periodic waveforms only

const static waveformset noiseOnly
noise waveforms only

const static waveformset allWaveforms
all waveforms

enum stimulustype
type for selecting stimulus channels

stimNone
ignore stimulus channels

stimReadback
include stimulus channels which have a valid readback

stimAll
include all stimulus channels

class measurementchannel
measurement channel object type

string name
channel name of excitation

gdsChnInfo_t info
channel info for exciation channel

bool duplicate
true if channel is a duplicate

rtddChannel::partitionlist partitions
partition list

bool useActiveTime
use active time for preprocessing

measurementchannel()
Constructs a measurement object.
Returns:
void

typedef std::vector <measurementchannel> measlist
measurement channels type

class interval
interval class

typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval

timeinterval ival
time interval

bool good
if false, this interval was not rejected by the analysis

interval(tainsec_t t, tainsec_t dt)
Constructs an interval object.
Returns:
void

tainsec_t t0() const
Returns the interval start time.
Returns:
start time

tainsec_t dt() const
Returns the interval duration.
Returns:
duration

typedef std::vector <interval> intervallist
list of intervals

struct callbackarg
argument for synchronization callbacks

typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval

timeinterval ival
time interval

int measPoint
measurement point

int measPeriod
measurement period

typedef bool (stdtest::*channelAnalysis)(int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
Memeber function prototype for channal analysis callback
Returns:
true if successful
Parameters:
resultnum - number of result record
measnum - measurement number
chnname - channel name (including array indices)
stim - true if stimulus readback channel

typedef testsync <stdtest, callbackarg> stdtestsync
synchronization object for standard test

friend class testsync stdtest callbackarg
friend

const diagTest* test
test access class for storage object

string testType
test type

bool doAnalysis
true is analysis should be done; set false during pause

tainsec_t T0
start time: t = 0

int averageType
average type

int averages
number of averages

int avrgsize
size of average buffer, i.e. number of measurement points

int avrgnum
number of analyzed measurement periods

double timeGrid
time grid of test; used for determining the start time

stimuluslist stimuli
exciatations

measlist meas
measurement channels

intervallist intervals
measurement intervals

std::deque <syncpointer> syncqueue
queue of synchronization points

int dataerrors
number of data errors

virtual bool readParam(std::ostringstream& errmsg)
Read parameters. This function checks the storage, rttd and excitation manager pointer and reads the parameters (test type, averages, averageType) from the storage object. This funciton should be called by descendents. It also sets the test access class. Descendents should overwrite this function to read their own parameters.
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool readMeasParam(std::ostringstream& errmsg, int maxIndex = 100)
Read measurement channel parameters. This funciton reads the parameters describing the measurement channel(s). This function is not automatically called, but rather has to be invoked by descendents. If the maximum index is larger than 1, array indices are used to read in the measurement channels. At least one measurement channel must be specified for the routine to return successful.
Returns:
true if successful
Parameters:
errmsg - error message stream
maxIndex - maximum array index of parameters

virtual bool readStimuliParam(std::ostringstream& errmsg, bool needReadback = false, waveformset allowedWaveforms = allWaveforms, int maxIndex = 100)
Read stimuli channel parameters. This funciton reads the parameters describing the excitation channel(s). This function is not automatically called, but rather has to be invoked by descendents. If the maximum index is larger than 1, array indices are used to read in the measurement channels. The routine may return succesful without reading any stimulus channel.
Returns:
true if successful
Parameters:
errmsg - error message stream
needReadback - if true a readback channel must be set
maxIndex - maximum array index of parameters

virtual bool subscribeChannels(std::ostringstream& errmsg)
Subscribes channels. This function subscribes excitation channels to the excitation manager and measurement channels to the rtdd manager. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
errmsg - error message stream

void samplingFrequencies(double fMax, double& fSampleMin, double& fSampleMax)
Returns the lowest and highest sampling frequencies. Given the highest frequency of interest calculates the required (highest) sampling frequency. It then checks measurement and stimulus readback channels and determines the lowest sampling frequency available (the lowest sampling frequency is always smaller than the highest one.) The sampling rates are always a power of two.
Returns:
rounded GPS time or <0 on error
Parameters:
fMax - highest frequency of interest
fSampleMin - lowest sampling frequency (return)
fSampleMax - highest sampling frequency (return)

virtual double calcTimeGrid(double fMax, tainsec_t* t0 = 0)
Calcluate the time grid. This function calculates the maximum sampling period of all stimulus readbacks and measurement channels. Additionally, the function will adjust the time grid, so that it is not much smaller than the specified maximum frequency. The returned time grid is always a power of 2. Optionally, this function can fine adjust the start time.
Returns:
time grid
Parameters:
fMax - maximum frequency of interest
t0 - pointer to start time (ignored if 0)

virtual bool calcTimes(std::ostringstream& errmsg, tainsec_t& t0)
Calcluates the measurement time. This function calculates start time and duration of each measuremenmt period. This function must be overwritten by descendents. It can fine adjust the start time t0 if necessary.
Returns:
true if successful
Parameters:
errmsg - error message stream
t0 - start time

virtual bool addMeasPartitions(const interval& ival, int pIndex, double fSample, tainsec_t pt = 0, double fZoom = 0, double fZoomSample = 0, tainsec_t tZoom = 0)
Adds new measurement partitions. This function adds measurement partitions to the both stimuli readback and measurement channels. Decimation factors are derived from the requested sampling frequency and the channel data rate. If fZoomSample is zero, it is ignored. Measurement partitions are added to the partition list of the channel structures.
Returns:
true if successful
Parameters:
ival - measurement interval
pIndex - partition index
fSample - requested sampling rate (before optional zoom)
pt - precursor time
fZoom - heterodyne frequency
fZoomSample - requested sampling frequency after zoom
tZoom - start time (t = 0) for modulation signal

virtual bool addSyncPoint(const interval& ival, int measPeriod, int measPoint = 0)
Adds a new synchronization point. The synchronization point is automatically added to the synchronization queue.
Returns:
true if successful
Parameters:
ival - measurement interval
measPeriod - index of measurement period
measPoint - index of measurement point

virtual bool newMeasPoint(int i, int measPoint = 0)
Generates a new measurement point. By default just returns false. If overwritten by descendents, this function must add exaclty one new interval, one synchronization point and one new measurement partition for every stimulus and measurement channel.
Returns:
true if successful
Parameters:
i - measurement point index
measPoint - measurement index

virtual bool calcMeasurements(std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Calculates measurement parameters. This function determines excitation signals, partitions for the rtdd and synchronization points. This function must be overwritten by descendents.
Returns:
true if successful
Parameters:
errmsg - error message stream
t0 - start time
measPoint - measurement point number

virtual bool delMeasurements(std::ostringstream& errmsg)
Deletes measurements. This function deletes excitation signals, data partitions and synchronization points. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool addMeasurements(std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Adds measurements. This function calls calcTimes and calcMeasurements. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
errmsg - error message stream
t0 - start time
measPoint - measurement point number

virtual bool startMeasurements(std::ostringstream& errmsg)
Starts the measurement. This function switches the excitation signals on and initiates the data flow from the rtdd interface. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool stopMeasurements(int firstIndex = -1)
Stops the measurements. This function resets rtdd channels and optionally deletes data in the storage object beginning with firstIndex. If firstIndex is negative, no data objects are deleted. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
firstIndex - first data index to delete

bool prepareNextPoint(const callbackarg& id)
Prepares the nex measurement point. This function will delete the outdated measurement points and prepare a new measurement point by calling newMeasPoint. New partitions are added from the end of the partition lists in stimuli and meas to the rtdd, if newMeasPoint returns successful.
Returns:
true if successful
Parameters:
id - callback argument of current sync point

virtual bool getNextSyncPoint(const callbackarg& id, syncpointer& sync)
Gets the next synchronization point. If no synchronization points are left returns a 0 pointer. Usually, there is no need to overwrite this function.
Returns:
true if successful
Parameters:
id - callback argument of current sync point
sync - pointer to next synchronization point (return)

virtual bool syncAction(const callbackarg& id, syncpointer& sync, bool& notify)
Callback of synchronization point. This function is called after each measurement step. It calls the analysis method and returns the next synchronization point. This function can be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
sync - next synchronization point, or 0 if finished
notify - if true upon return sends a notfication message

virtual bool syncAbort(const callbackarg& id)
Callback for aborting the test. This function is called when the user aborts the test. It stops the measurement. This function can be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event

virtual bool syncPause(const callbackarg& id, syncpointer& sync)
Callback for pausing the test. This function is called when the user pauses the test. It disables the analysis and sets the avera type to running. This function can be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
sync - next synchronization point, or 0 if continue

virtual bool syncResume(const callbackarg& id, syncpointer& sync)
Callback for resuming the test. This function is called when the user resumes the test. It disables the analysis and sets the avera type to running. This function can be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
sync - next synchronization point, or 0 if continue

virtual bool callChannelAnalysis(const callbackarg& id, int measnum, channelAnalysis method, int firstres = 0, stimulustype inclStim = stimReadback, bool async = true, bool skipDuplicates = true)
Calls the specified method for every measuerement channel, and if needed for all or some stimulus channels. Returns if true if all channel analysis calls were successful. This function can be called from the analyze method to automatically loop over all channels. If mt is true, the channel analysis methods are called by multiple threads. However, the function only returns when all analysis threads have finished.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
measnum - measurement number
method - channel analysis function
firstres - number of first result record to use
inclStim - describes which stimulus are included
async - it true the channel methods are multi-threaded
skipDuplicates - skip duplicated channel channel names

virtual bool analyze(const callbackarg& id, int measnum, bool& notify)
Analysis routine which performs the analysis. This function must be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
measnum - measurement number
notify - if true upon return sends a notfication message


Direct child classes:
timeseries
sweptsine
sineresponse
ffttest
Author:
Written November 1998 by Daniel Sigg
Version:
0.1
See Also:
Diagnostics test manual for used algorithms

alphabetic index hierarchy of classes


Please send questions and comments to sigg_d@ligo-wa.caltech.edu


generated by doc++