class SoftwarePLL implements synchronisation between ticks and timestamp. See https://github.com/michael1309/SoftwarePLL/blob/master/README.md for details.
More...
#include <softwarePLL.h>
|
double | AllowedTimeDeviation () const |
|
void | AllowedTimeDeviation (double val) |
|
double | extraPolateRelativeTimeStamp (uint32_t tick) |
|
uint32_t | ExtrapolationDivergenceCounter () const |
|
void | ExtrapolationDivergenceCounter (uint32_t val) |
|
int | findDiffInFifo (double diff, double tol) |
|
uint64_t | FirstTick () const |
|
void | FirstTick (uint64_t val) |
|
double | FirstTimeStamp () const |
|
void | FirstTimeStamp (double val) |
|
bool | getCorrectedTimeStamp (uint32_t &sec, uint32_t &nanoSec, uint32_t tick) |
|
bool | GetCorrectedTimeStamp (uint32_t &sec, uint32_t &nanoSec, uint32_t tick) |
| Computes the timestamp of a measurement from sensor ticks. More...
|
|
bool | getDemoFileData (std::string fileName, std::vector< uint32_t > &tickVec, std::vector< uint32_t > &secVec, std::vector< uint32_t > &nanoSecVec) |
|
double | InterpolationSlope () const |
|
void | InterpolationSlope (double val) |
|
bool | IsInitialized () const |
|
void | IsInitialized (bool val) |
|
bool | IsInitialized () const |
| Returns the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inconsistent or not enough samples in the fifo buffer) More...
|
|
bool | pushIntoFifo (double curTimeStamp, uint32_t curtick) |
|
bool | UpdatePLL (uint32_t sec, uint32_t nanoSec, uint32_t curtick) |
| Updates PLL internale State should be called only with network send timestamps. More...
|
|
bool | updatePLL (uint32_t sec, uint32_t nanoSec, uint32_t curtick) |
| Updates PLL internale State should be called only with network send timestamps. More...
|
|
| ~SoftwarePLL () |
|
| ~SoftwarePLL () |
| Destructor of class SoftwarePLL. More...
|
|
|
double | AllowedTimeDeviation () const |
| Returns the max. allowed time difference between estimated and measured timestamp time in seconds. More...
|
|
void | AllowedTimeDeviation (double val) |
| Set the max. allowed time difference between estimated and measured receive timestamp in seconds. More...
|
|
double | ExtraPolateRelativeTimeStamp (uint32_t tick) |
| Extrapolates and returns the measurement timestamp in seconds relative to FirstTimeStamp. The timestamp of a measurement in seconds can be estimated from sensor ticks by ExtraPolateRelativeTimeStamp(tick) + FirstTimeStamp(). More...
|
|
uint32_t | ExtrapolationDivergenceCounter () const |
| Returns the counter of extrapolated divergences (number of times the estimated and measured receive timestamp differed more than AllowedTimeDeviation. More...
|
|
void | ExtrapolationDivergenceCounter (uint32_t val) |
| Sets the counter of extrapolated divergences (number of times the estimated and measured receive timestamp differed more than AllowedTimeDeviation. More...
|
|
uint64_t | FirstTick () const |
| Returns the first sensor tick in the fifo buffer. More...
|
|
void | FirstTick (uint64_t val) |
| Sets the first sensor tick in the fifo buffer. More...
|
|
double | FirstTimeStamp () const |
| Returns the first timestamp in the fifo buffer in seconds. More...
|
|
void | FirstTimeStamp (double val) |
| Sets the first timestamp in the fifo buffer in seconds. More...
|
|
double | InterpolationSlope () const |
| Returns the interpolated slope (gradient of the regression line) More...
|
|
void | InterpolationSlope (double val) |
| Sets the interpolated slope (gradient of the regression line) More...
|
|
void | IsInitialized (bool val) |
| Sets the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inconsistent or not enough samples in the fifo buffer) More...
|
|
bool | PushIntoFifo (double curTimeStamp, uint32_t curtick) |
| Pushes measurement timestamp and sensor ticks to the fifo, updates tick fifo and clock (timestamp) fifo. More...
|
|
class SoftwarePLL implements synchronisation between ticks and timestamp. See https://github.com/michael1309/SoftwarePLL/blob/master/README.md for details.
Definition at line 20 of file softwarePLL.h.
SoftwarePLL::~SoftwarePLL |
( |
| ) |
|
|
inline |
SoftwarePLL::SoftwarePLL |
( |
| ) |
|
|
inlineprivate |
SoftwarePLL::~SoftwarePLL |
( |
| ) |
|
SoftwarePLL::SoftwarePLL |
( |
int |
fifo_length = 7 | ) |
|
|
inlineprivate |
double SoftwarePLL::AllowedTimeDeviation |
( |
| ) |
const |
|
inline |
void SoftwarePLL::AllowedTimeDeviation |
( |
double |
val | ) |
|
|
inline |
double SoftwarePLL::AllowedTimeDeviation |
( |
| ) |
const |
|
inlineprotected |
Returns the max. allowed time difference between estimated and measured timestamp time in seconds.
- Returns
- allowed time difference between estimated and measured timestamp
Definition at line 125 of file SoftwarePLL.h.
void SoftwarePLL::AllowedTimeDeviation |
( |
double |
val | ) |
|
|
inlineprotected |
Set the max. allowed time difference between estimated and measured receive timestamp in seconds.
- Parameters
-
[in] | val | allowed time difference between estimated and measured timestamp |
Definition at line 132 of file SoftwarePLL.h.
double SoftwarePLL::extraPolateRelativeTimeStamp |
( |
uint32_t |
tick | ) |
|
double SoftwarePLL::ExtraPolateRelativeTimeStamp |
( |
uint32_t |
tick | ) |
|
|
protected |
Extrapolates and returns the measurement timestamp in seconds relative to FirstTimeStamp. The timestamp of a measurement in seconds can be estimated from sensor ticks by ExtraPolateRelativeTimeStamp(tick) + FirstTimeStamp().
- Parameters
-
- Returns
- measurement timestamp in seconds relative to FirstTimeStamp
Definition at line 72 of file SoftwarePLL.cpp.
uint32_t SoftwarePLL::ExtrapolationDivergenceCounter |
( |
| ) |
const |
|
inline |
void SoftwarePLL::ExtrapolationDivergenceCounter |
( |
uint32_t |
val | ) |
|
|
inline |
uint32_t SoftwarePLL::ExtrapolationDivergenceCounter |
( |
| ) |
const |
|
inlineprotected |
Returns the counter of extrapolated divergences (number of times the estimated and measured receive timestamp differed more than AllowedTimeDeviation.
- Returns
- counter of extrapolated divergences
Definition at line 139 of file SoftwarePLL.h.
void SoftwarePLL::ExtrapolationDivergenceCounter |
( |
uint32_t |
val | ) |
|
|
inlineprotected |
Sets the counter of extrapolated divergences (number of times the estimated and measured receive timestamp differed more than AllowedTimeDeviation.
- Parameters
-
[in] | val | counter of extrapolated divergences |
Definition at line 146 of file SoftwarePLL.h.
int SoftwarePLL::findDiffInFifo |
( |
double |
diff, |
|
|
double |
tol |
|
) |
| |
uint64_t SoftwarePLL::FirstTick |
( |
| ) |
const |
|
inline |
void SoftwarePLL::FirstTick |
( |
uint64_t |
val | ) |
|
|
inline |
uint64_t SoftwarePLL::FirstTick |
( |
| ) |
const |
|
inlineprotected |
Returns the first sensor tick in the fifo buffer.
- Returns
- first sensor tick
Definition at line 83 of file SoftwarePLL.h.
void SoftwarePLL::FirstTick |
( |
uint64_t |
val | ) |
|
|
inlineprotected |
Sets the first sensor tick in the fifo buffer.
- Parameters
-
Definition at line 90 of file SoftwarePLL.h.
double SoftwarePLL::FirstTimeStamp |
( |
| ) |
const |
|
inline |
void SoftwarePLL::FirstTimeStamp |
( |
double |
val | ) |
|
|
inline |
double SoftwarePLL::FirstTimeStamp |
( |
| ) |
const |
|
inlineprotected |
Returns the first timestamp in the fifo buffer in seconds.
- Returns
- first timestamp
Definition at line 97 of file SoftwarePLL.h.
void SoftwarePLL::FirstTimeStamp |
( |
double |
val | ) |
|
|
inlineprotected |
Sets the first timestamp in the fifo buffer in seconds.
- Parameters
-
Definition at line 104 of file SoftwarePLL.h.
bool SoftwarePLL::getCorrectedTimeStamp |
( |
uint32_t & |
sec, |
|
|
uint32_t & |
nanoSec, |
|
|
uint32_t |
tick |
|
) |
| |
bool SoftwarePLL::GetCorrectedTimeStamp |
( |
uint32_t & |
sec, |
|
|
uint32_t & |
nanoSec, |
|
|
uint32_t |
tick |
|
) |
| |
Computes the timestamp of a measurement from sensor ticks.
- Parameters
-
[out] | sec | Estimated system Timetamp (seconds) |
[out] | nanoSec | Estimated system Timetamp (nanoseconds) |
[in] | tick | sensor ticks |
- Returns
- true if timestamp is computed, false otherwise (SoftwarePLL not initialized)
Definition at line 138 of file SoftwarePLL.cpp.
bool SoftwarePLL::getDemoFileData |
( |
std::string |
fileName, |
|
|
std::vector< uint32_t > & |
tickVec, |
|
|
std::vector< uint32_t > & |
secVec, |
|
|
std::vector< uint32_t > & |
nanoSecVec |
|
) |
| |
SoftwarePLL & SoftwarePLL::Instance |
( |
const std::string & |
id = "" , |
|
|
int |
fifo_length = 7 |
|
) |
| |
|
static |
Creates an instance of SoftwarePLL or returns an existing one, given its id.
- Parameters
-
id | identifier of the instance, f.e. "Sensor1", "TIM571". |
fifo_length | length of fifo (buffer size, i.e. number of ticks in fifo). Applied only for new instances of SoftwarePLL, existing instance will keep their buffer size. |
- Returns
- instance of a SoftwarePLL
Definition at line 28 of file SoftwarePLL.cpp.
double SoftwarePLL::InterpolationSlope |
( |
| ) |
const |
|
inline |
void SoftwarePLL::InterpolationSlope |
( |
double |
val | ) |
|
|
inline |
double SoftwarePLL::InterpolationSlope |
( |
| ) |
const |
|
inlineprotected |
Returns the interpolated slope (gradient of the regression line)
- Returns
- interpolated slope
Definition at line 111 of file SoftwarePLL.h.
void SoftwarePLL::InterpolationSlope |
( |
double |
val | ) |
|
|
inlineprotected |
Sets the interpolated slope (gradient of the regression line)
- Parameters
-
[in] | val | interpolated slope |
Definition at line 118 of file SoftwarePLL.h.
bool SoftwarePLL::IsInitialized |
( |
| ) |
const |
|
inline |
void SoftwarePLL::IsInitialized |
( |
bool |
val | ) |
|
|
inline |
bool SoftwarePLL::IsInitialized |
( |
| ) |
const |
|
inline |
Returns the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inconsistent or not enough samples in the fifo buffer)
- Returns
- initialization status
Definition at line 67 of file SoftwarePLL.h.
void SoftwarePLL::IsInitialized |
( |
bool |
val | ) |
|
|
inlineprotected |
Sets the initialization status, i.e. true, if SoftwarePLL is initialized, or false otherwise (inconsistent or not enough samples in the fifo buffer)
- Parameters
-
[in] | val | initialization status |
Definition at line 76 of file SoftwarePLL.h.
bool SoftwarePLL::nearSameTimeStamp |
( |
double |
relTimeStamp1, |
|
|
double |
relTimeStamp2 |
|
) |
| |
|
private |
bool SoftwarePLL::NearSameTimeStamp |
( |
double |
relTimeStamp1, |
|
|
double |
relTimeStamp2 |
|
) |
| |
|
private |
bool SoftwarePLL::pushIntoFifo |
( |
double |
curTimeStamp, |
|
|
uint32_t |
curtick |
|
) |
| |
bool SoftwarePLL::PushIntoFifo |
( |
double |
curTimeStamp, |
|
|
uint32_t |
curtick |
|
) |
| |
|
protected |
Pushes measurement timestamp and sensor ticks to the fifo, updates tick fifo and clock (timestamp) fifo.
- Parameters
-
curTimeStamp | measurement timestamp in seconds (receive time) |
curtick | sensor ticks |
- Returns
- always true
Definition at line 51 of file SoftwarePLL.cpp.
void SoftwarePLL::testbed |
( |
| ) |
|
|
static |
bool SoftwarePLL::updateInterpolationSlope |
( |
| ) |
|
|
private |
bool SoftwarePLL::UpdateInterpolationSlope |
( |
| ) |
|
|
private |
bool SoftwarePLL::UpdatePLL |
( |
uint32_t |
sec, |
|
|
uint32_t |
nanoSec, |
|
|
uint32_t |
curtick |
|
) |
| |
Updates PLL internale State should be called only with network send timestamps.
- Parameters
-
[in] | sec | System Timetamp from received network packed |
[in] | nanoSec | System Timestamp from received network packed |
[in] | curtick | sensor ticks |
- Returns
- PLL is in valid state (true)
Definition at line 81 of file SoftwarePLL.cpp.
bool SoftwarePLL::updatePLL |
( |
uint32_t |
sec, |
|
|
uint32_t |
nanoSec, |
|
|
uint32_t |
curtick |
|
) |
| |
Updates PLL internale State should be called only with network send timestamps.
- Parameters
-
sec | System Timetamp from received network packed |
nsec | System Timestamp from received network packed |
curtick | micro Seconds since scanner start from SOPAS Datagram |
- Returns
- PLL is in valid state (true)
Definition at line 125 of file softwarePLL.cpp.
std::map< std::string, SoftwarePLL * > SoftwarePLL::_instances |
|
staticprivate |
double SoftwarePLL::allowedTimeDeviation |
|
private |
double SoftwarePLL::AllowedTimeDeviation_ |
|
private |
std::vector<double> SoftwarePLL::ClockFifo_ |
|
private |
double SoftwarePLL::dClockDiffFeedBack |
|
private |
double SoftwarePLL::dTAvgFeedback |
|
private |
uint32_t SoftwarePLL::extrapolationDivergenceCounter |
|
private |
uint32_t SoftwarePLL::ExtrapolationDivergenceCounter_ |
|
private |
const int SoftwarePLL::fifoSize = 7 |
|
static |
const int SoftwarePLL::FifoSize_ |
|
private |
uint64_t SoftwarePLL::firstTick |
|
private |
uint64_t SoftwarePLL::FirstTick_ |
|
private |
double SoftwarePLL::firstTimeStamp |
|
private |
double SoftwarePLL::FirstTimeStamp_ |
|
private |
double SoftwarePLL::interpolationSlope |
|
private |
double SoftwarePLL::InterpolationSlope_ |
|
private |
bool SoftwarePLL::isInitialized |
|
private |
bool SoftwarePLL::IsInitialized_ |
|
private |
uint32_t SoftwarePLL::lastcurtick = 0 |
|
private |
uint32_t SoftwarePLL::Lastcurtick_ = 0 |
|
private |
uint32_t SoftwarePLL::lastValidTick |
|
private |
double SoftwarePLL::lastValidTimeStamp |
|
private |
const double SoftwarePLL::MaxAllowedTimeDeviation = 0.1 |
|
staticprivate |
const double SoftwarePLL::MaxAllowedTimeDeviation_ = 0.1 |
|
staticprivate |
const uint32_t SoftwarePLL::MaxExtrapolationCounter = 20 |
|
staticprivate |
const uint32_t SoftwarePLL::MaxExtrapolationCounter_ = 20 |
|
staticprivate |
uint32_t SoftwarePLL::mostRecentNanoSec |
|
private |
uint32_t SoftwarePLL::mostRecentSec |
|
private |
double SoftwarePLL::mostRecentTimeStamp |
|
private |
int SoftwarePLL::numberValInFifo |
|
private |
int SoftwarePLL::NumberValInFifo_ |
|
private |
int SoftwarePLL::packeds_droped = 0 |
uint32_t SoftwarePLL::tickFifo[fifoSize] |
|
private |
std::vector<uint32_t> SoftwarePLL::TickFifo_ |
|
private |
The documentation for this class was generated from the following files: