nidas  v1.2-1520
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
nidas::dynld::raf::SyncInfo Class Reference

Parameters needed for each sample to assemble and write a sync record. More...

#include <SyncRecordSource.h>

Public Member Functions

 SyncInfo (dsm_sample_id_t i, float r, SyncRecordSource *srs)
 Constructor. More...
 
 SyncInfo (const SyncInfo &)
 Copy constructor. More...
 
SyncInfooperator= (const SyncInfo &)
 Assignment. More...
 
void addVariable (const Variable *var)
 
void advanceRecord (int last)
 
int getSlotIndex () const
 
bool incrementSlot ()
 
bool decrementSlot ()
 
bool checkNonIntRateIncrement ()
 
void computeSlotIndex (const Sample *samp)
 
int getRecordIndex () const
 
void incrementRecord ()
 
void decrementRecord ()
 

Public Attributes

dsm_sample_id_t id
 
float rate
 Sampling rate of the sample. More...
 
int nSlots
 Smallest integer not less than rate, computed as ceil(rate). More...
 
int dtUsec
 Number of microseconds per sample, 1000000/rate, rounded to an integer. More...
 
std::vector< size_t > varLengths
 Number of values for each variable in the sample. More...
 
size_t sampleLength
 Number of data values in one second: nSlots times the sum of the varLengths for the variables in the sample plus one for the time offset. More...
 
size_t sampleSRIndex
 Index of this sample in the sync record array of doubles. More...
 
std::list< const Variable * > variables
 Variables in the sample. More...
 
std::vector< size_t > varSRIndex
 Indices of the each variable in the sync record array of doubles. More...
 
unsigned int discarded
 
bool overWritten
 
unsigned int noverWritten
 
unsigned int nskips
 
unsigned int skipped
 
unsigned int total
 
int minDiffInit
 See the comment below about minDiff. More...
 
int minDiff
 The minimum difference between the sample time tags and their corresponding slot times is computed over the second. More...
 
int skipMod
 skipMod provides a way to insert NaNs in sync records with non-integral rates. More...
 
int skipModCount
 Sample counter used for non-integral rates. More...
 
unsigned int nEarlySamp
 How many successive samples have been earlier than their slot time by more than TDIFF_CHECK_USEC. More...
 
unsigned int nLateSamp
 How many successive samples have been later than their slot time by more than TDIFF_CHECK_USEC. More...
 
unsigned int outOfSlotMax
 Once nEarlySamp or nLateSamp exceed this value, adjust the slot index. More...
 

Static Public Attributes

static unsigned int ncopy
 
static unsigned int nassign
 
static const int TDIFF_CHECK_USEC = 2 * USECS_PER_MSEC
 If sample time tag differs from the slot time by this much or more then increment nEarlySamp or nLateSamp. More...
 

Private Attributes

int islot
 Index of next slot for the sample in the current sync record. More...
 
int irec
 Index of current sync record for this sample. More...
 
SyncRecordSource_srs
 

Detailed Description

Parameters needed for each sample to assemble and write a sync record.

Constructor & Destructor Documentation

SyncInfo::SyncInfo ( dsm_sample_id_t  i,
float  r,
SyncRecordSource srs 
)

Constructor.

Note there is not a default, no-arg constuctor.

SyncInfo::SyncInfo ( const SyncInfo other)

Copy constructor.

References ncopy.

Member Function Documentation

void SyncInfo::addVariable ( const Variable var)
void SyncInfo::advanceRecord ( int  last)
bool SyncInfo::checkNonIntRateIncrement ( )
void SyncInfo::computeSlotIndex ( const Sample samp)
void nidas::dynld::raf::SyncInfo::decrementRecord ( )
inline
bool SyncInfo::decrementSlot ( )
int nidas::dynld::raf::SyncInfo::getRecordIndex ( ) const
inline
int nidas::dynld::raf::SyncInfo::getSlotIndex ( ) const
inline
void nidas::dynld::raf::SyncInfo::incrementRecord ( )
inline
bool SyncInfo::incrementSlot ( )
SyncInfo & SyncInfo::operator= ( const SyncInfo other)

Member Data Documentation

SyncRecordSource* nidas::dynld::raf::SyncInfo::_srs
private
unsigned int nidas::dynld::raf::SyncInfo::discarded
int nidas::dynld::raf::SyncInfo::dtUsec

Number of microseconds per sample, 1000000/rate, rounded to an integer.

Referenced by checkNonIntRateIncrement(), nidas::dynld::raf::SyncRecordSource::checkTime(), nidas::dynld::raf::SyncRecordSource::computeSlotIndex(), and operator=().

dsm_sample_id_t nidas::dynld::raf::SyncInfo::id

Referenced by operator=().

int nidas::dynld::raf::SyncInfo::irec
private

Index of current sync record for this sample.

Referenced by advanceRecord(), and operator=().

int nidas::dynld::raf::SyncInfo::islot
private

Index of next slot for the sample in the current sync record.

Referenced by advanceRecord(), checkNonIntRateIncrement(), computeSlotIndex(), decrementSlot(), incrementSlot(), and operator=().

int nidas::dynld::raf::SyncInfo::minDiff

The minimum difference between the sample time tags and their corresponding slot times is computed over the second.

This value is written into the sync record as the time offset for the samples within that second.

Referenced by checkNonIntRateIncrement(), nidas::dynld::raf::SyncRecordSource::checkTime(), operator=(), nidas::dynld::raf::SyncRecordSource::receive(), and nidas::dynld::raf::SyncRecordSource::slog().

int nidas::dynld::raf::SyncInfo::minDiffInit

See the comment below about minDiff.

The minimum difference will never be more than minDiffInit. For integral sample rates it is simply minDiffInit = dtUsec For non-integral rates it can be either minDiffInit = dtUsec or minDiffInit = (nSlots * dtUsec) % USECS_PER_SEC The first value results in output sample tags that are closer to the original samples with cleaner delta-Ts between non-nan values, but last slot time in a sync record may be in the next second. We now believe this isn't an issue with nimbus, so we'll go with minDiffInit = dtUsec.

Referenced by nidas::dynld::raf::SyncRecordSource::checkTime(), and operator=().

unsigned int SyncInfo::nassign
static

Referenced by operator=().

unsigned int nidas::dynld::raf::SyncInfo::ncopy
static

Referenced by SyncInfo().

unsigned int nidas::dynld::raf::SyncInfo::nEarlySamp

How many successive samples have been earlier than their slot time by more than TDIFF_CHECK_USEC.

Referenced by nidas::dynld::raf::SyncRecordSource::checkTime(), computeSlotIndex(), and operator=().

unsigned int nidas::dynld::raf::SyncInfo::nLateSamp

How many successive samples have been later than their slot time by more than TDIFF_CHECK_USEC.

Referenced by nidas::dynld::raf::SyncRecordSource::checkTime(), computeSlotIndex(), decrementSlot(), and operator=().

unsigned int nidas::dynld::raf::SyncInfo::noverWritten
unsigned int nidas::dynld::raf::SyncInfo::nskips
int nidas::dynld::raf::SyncInfo::nSlots

Smallest integer not less than rate, computed as ceil(rate).

The number of slots for the sample in the sync record. For example, 13 for a sample rate of 12.5.

Referenced by addVariable(), checkNonIntRateIncrement(), nidas::dynld::raf::SyncRecordSource::checkTime(), decrementSlot(), incrementSlot(), operator=(), nidas::dynld::raf::SyncRecordSource::receive(), and nidas::dynld::raf::SyncRecordSource::slog().

unsigned int nidas::dynld::raf::SyncInfo::outOfSlotMax

Once nEarlySamp or nLateSamp exceed this value, adjust the slot index.

Referenced by nidas::dynld::raf::SyncRecordSource::checkTime(), and operator=().

bool nidas::dynld::raf::SyncInfo::overWritten
float nidas::dynld::raf::SyncInfo::rate
size_t nidas::dynld::raf::SyncInfo::sampleLength

Number of data values in one second: nSlots times the sum of the varLengths for the variables in the sample plus one for the time offset.

Referenced by addVariable(), nidas::dynld::raf::SyncRecordSource::init(), and operator=().

size_t nidas::dynld::raf::SyncInfo::sampleSRIndex

Index of this sample in the sync record array of doubles.

The first value for the sample is the time offset within the second, followed by the data values for each variable.

Referenced by nidas::dynld::raf::SyncRecordSource::init(), operator=(), and nidas::dynld::raf::SyncRecordSource::receive().

int nidas::dynld::raf::SyncInfo::skipMod

skipMod provides a way to insert NaNs in sync records with non-integral rates.

In incrementCount(), if the next slot to be written is the last in the record and the modulus (sampCount % skipMod) is non-zero, then the last slot in the record is skipped, leaving a NaN.

skipMod is initialized to (int)(1.0 / (1 - (nSlots-rate))) Here are the values for some expected rates, including non-integral ARINC rates.

rate skipMod (skipModCount % skipMod) ! = 0 integral 1 never true, no skips 12.5 2 skip slot every other second 6.25 4 skip slot in 3 out of 4 seconds 3.125 8 skip slot in 7 out of 8 1.5625 1 never true (algorithm breaks down)

Referenced by checkNonIntRateIncrement(), operator=(), and nidas::dynld::raf::SyncRecordSource::slog().

int nidas::dynld::raf::SyncInfo::skipModCount
unsigned int nidas::dynld::raf::SyncInfo::skipped
const int nidas::dynld::raf::SyncInfo::TDIFF_CHECK_USEC = 2 * USECS_PER_MSEC
static

If sample time tag differs from the slot time by this much or more then increment nEarlySamp or nLateSamp.

Referenced by nidas::dynld::raf::SyncRecordSource::checkTime().

unsigned int nidas::dynld::raf::SyncInfo::total
std::list<const Variable*> nidas::dynld::raf::SyncInfo::variables
std::vector<size_t> nidas::dynld::raf::SyncInfo::varLengths

Number of values for each variable in the sample.

Referenced by addVariable(), operator=(), and nidas::dynld::raf::SyncRecordSource::receive().

std::vector<size_t> nidas::dynld::raf::SyncInfo::varSRIndex

Indices of the each variable in the sync record array of doubles.

Referenced by addVariable(), nidas::dynld::raf::SyncRecordSource::init(), operator=(), and nidas::dynld::raf::SyncRecordSource::receive().


The documentation for this class was generated from the following files: