nidas v1.2.3
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.
 
 SyncInfo (const SyncInfo &)
 Copy constructor.
 
SyncInfooperator= (const SyncInfo &)
 Assignment.
 
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.
 
int nSlots
 Smallest integer not less than rate, computed as ceil(rate).
 
int dtUsec
 Number of microseconds per sample, 1000000/rate, rounded to an integer.
 
std::vector< size_tvarLengths
 Number of values for each variable in the sample.
 
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.
 
size_t sampleSRIndex
 Index of this sample in the sync record array of doubles.
 
std::list< const Variable * > variables
 Variables in the sample.
 
std::vector< size_tvarSRIndex
 Indices of the each variable in the sync record array of doubles.
 
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.
 
int minDiff
 The minimum difference between the sample time tags and their corresponding slot times is computed over the second.
 
int skipMod
 skipMod provides a way to insert NaNs in sync records with non-integral rates.
 
int skipModCount
 Sample counter used for non-integral rates.
 
unsigned int nEarlySamp
 How many successive samples have been earlier than their slot time by more than TDIFF_CHECK_USEC.
 
unsigned int nLateSamp
 How many successive samples have been later than their slot time by more than TDIFF_CHECK_USEC.
 
unsigned int outOfSlotMax
 Once nEarlySamp or nLateSamp exceed this value, adjust the slot index.
 

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.
 

Private Attributes

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

Detailed Description

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

Constructor & Destructor Documentation

◆ SyncInfo() [1/2]

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

Constructor.

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

◆ SyncInfo() [2/2]

SyncInfo::SyncInfo ( const SyncInfo & other)

Copy constructor.

References nidas::core::getSample(), and ncopy.

Member Function Documentation

◆ addVariable()

void SyncInfo::addVariable ( const Variable * var)

◆ advanceRecord()

void SyncInfo::advanceRecord ( int last)

◆ checkNonIntRateIncrement()

bool SyncInfo::checkNonIntRateIncrement ( )

◆ computeSlotIndex()

void SyncInfo::computeSlotIndex ( const Sample * samp)

◆ decrementRecord()

void nidas::dynld::raf::SyncInfo::decrementRecord ( )
inline

References incrementRecord().

◆ decrementSlot()

bool SyncInfo::decrementSlot ( )

◆ getRecordIndex()

int nidas::dynld::raf::SyncInfo::getRecordIndex ( ) const
inline

References irec.

◆ getSlotIndex()

int nidas::dynld::raf::SyncInfo::getSlotIndex ( ) const
inline

References islot.

◆ incrementRecord()

void nidas::dynld::raf::SyncInfo::incrementRecord ( )
inline

◆ incrementSlot()

bool SyncInfo::incrementSlot ( )

◆ operator=()

SyncInfo & SyncInfo::operator= ( const SyncInfo & other)

Member Data Documentation

◆ _srs

SyncRecordSource* nidas::dynld::raf::SyncInfo::_srs
private

◆ discarded

unsigned int nidas::dynld::raf::SyncInfo::discarded

Referenced by operator=().

◆ dtUsec

int nidas::dynld::raf::SyncInfo::dtUsec

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

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

◆ id

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

Referenced by operator=().

◆ irec

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

Index of current sync record for this sample.

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

◆ islot

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(), getSlotIndex(), incrementSlot(), and operator=().

◆ minDiff

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(), and operator=().

◆ minDiffInit

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 operator=().

◆ nassign

unsigned int SyncInfo::nassign
static

Referenced by operator=().

◆ ncopy

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

Referenced by SyncInfo().

◆ nEarlySamp

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 computeSlotIndex(), and operator=().

◆ nLateSamp

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 computeSlotIndex(), decrementSlot(), and operator=().

◆ noverWritten

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

Referenced by operator=().

◆ nskips

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

Referenced by operator=().

◆ nSlots

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(), decrementSlot(), incrementSlot(), and operator=().

◆ outOfSlotMax

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

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

Referenced by operator=().

◆ overWritten

bool nidas::dynld::raf::SyncInfo::overWritten

Referenced by operator=().

◆ rate

float nidas::dynld::raf::SyncInfo::rate

Sampling rate of the sample.

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

◆ sampleLength

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(), and operator=().

◆ sampleSRIndex

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(), and operator=().

◆ skipMod

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(), and operator=().

◆ skipModCount

int nidas::dynld::raf::SyncInfo::skipModCount

Sample counter used for non-integral rates.

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

◆ skipped

unsigned int nidas::dynld::raf::SyncInfo::skipped

Referenced by operator=().

◆ TDIFF_CHECK_USEC

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.

◆ total

unsigned int nidas::dynld::raf::SyncInfo::total

◆ variables

std::list<const Variable*> nidas::dynld::raf::SyncInfo::variables

Variables in the sample.

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

◆ varLengths

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

Number of values for each variable in the sample.

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

◆ varSRIndex

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

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

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


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