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 |
|
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...
|
|
void | IsInitialized (bool val) |
|
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() [1/2]
SoftwarePLL::~SoftwarePLL |
( |
| ) |
|
|
inline |
◆ SoftwarePLL() [1/4]
SoftwarePLL::SoftwarePLL |
( |
| ) |
|
|
inlineprivate |
◆ SoftwarePLL() [2/4]
◆ ~SoftwarePLL() [2/2]
SoftwarePLL::~SoftwarePLL |
( |
| ) |
|
◆ SoftwarePLL() [3/4]
SoftwarePLL::SoftwarePLL |
( |
int |
fifo_length = 7 | ) |
|
|
inlineprivate |
◆ SoftwarePLL() [4/4]
◆ AllowedTimeDeviation() [1/4]
double SoftwarePLL::AllowedTimeDeviation |
( |
| ) |
const |
|
inline |
◆ AllowedTimeDeviation() [2/4]
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.
◆ AllowedTimeDeviation() [3/4]
void SoftwarePLL::AllowedTimeDeviation |
( |
double |
val | ) |
|
|
inline |
◆ AllowedTimeDeviation() [4/4]
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.
◆ extraPolateRelativeTimeStamp()
double SoftwarePLL::extraPolateRelativeTimeStamp |
( |
uint32_t |
tick | ) |
|
◆ ExtraPolateRelativeTimeStamp()
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.
◆ ExtrapolationDivergenceCounter() [1/4]
uint32_t SoftwarePLL::ExtrapolationDivergenceCounter |
( |
| ) |
const |
|
inline |
◆ ExtrapolationDivergenceCounter() [2/4]
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.
◆ ExtrapolationDivergenceCounter() [3/4]
void SoftwarePLL::ExtrapolationDivergenceCounter |
( |
uint32_t |
val | ) |
|
|
inline |
◆ ExtrapolationDivergenceCounter() [4/4]
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.
◆ findDiffInFifo()
int SoftwarePLL::findDiffInFifo |
( |
double |
diff, |
|
|
double |
tol |
|
) |
| |
◆ FirstTick() [1/4]
uint64_t SoftwarePLL::FirstTick |
( |
| ) |
const |
|
inline |
◆ FirstTick() [2/4]
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.
◆ FirstTick() [3/4]
void SoftwarePLL::FirstTick |
( |
uint64_t |
val | ) |
|
|
inline |
◆ FirstTick() [4/4]
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.
◆ FirstTimeStamp() [1/4]
double SoftwarePLL::FirstTimeStamp |
( |
| ) |
const |
|
inline |
◆ FirstTimeStamp() [2/4]
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.
◆ FirstTimeStamp() [3/4]
void SoftwarePLL::FirstTimeStamp |
( |
double |
val | ) |
|
|
inline |
◆ FirstTimeStamp() [4/4]
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.
◆ getCorrectedTimeStamp()
bool SoftwarePLL::getCorrectedTimeStamp |
( |
uint32_t & |
sec, |
|
|
uint32_t & |
nanoSec, |
|
|
uint32_t |
tick |
|
) |
| |
◆ GetCorrectedTimeStamp()
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.
◆ getDemoFileData()
bool SoftwarePLL::getDemoFileData |
( |
std::string |
fileName, |
|
|
std::vector< uint32_t > & |
tickVec, |
|
|
std::vector< uint32_t > & |
secVec, |
|
|
std::vector< uint32_t > & |
nanoSecVec |
|
) |
| |
◆ instance()
◆ Instance()
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.
◆ InterpolationSlope() [1/4]
double SoftwarePLL::InterpolationSlope |
( |
| ) |
const |
|
inline |
◆ InterpolationSlope() [2/4]
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.
◆ InterpolationSlope() [3/4]
void SoftwarePLL::InterpolationSlope |
( |
double |
val | ) |
|
|
inline |
◆ InterpolationSlope() [4/4]
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.
◆ IsInitialized() [1/4]
bool SoftwarePLL::IsInitialized |
( |
| ) |
const |
|
inline |
◆ IsInitialized() [2/4]
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.
◆ IsInitialized() [3/4]
void SoftwarePLL::IsInitialized |
( |
bool |
val | ) |
|
|
inline |
◆ IsInitialized() [4/4]
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.
◆ nearSameTimeStamp()
bool SoftwarePLL::nearSameTimeStamp |
( |
double |
relTimeStamp1, |
|
|
double |
relTimeStamp2 |
|
) |
| |
|
private |
◆ NearSameTimeStamp()
bool SoftwarePLL::NearSameTimeStamp |
( |
double |
relTimeStamp1, |
|
|
double |
relTimeStamp2 |
|
) |
| |
|
private |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ pushIntoFifo()
bool SoftwarePLL::pushIntoFifo |
( |
double |
curTimeStamp, |
|
|
uint32_t |
curtick |
|
) |
| |
◆ PushIntoFifo()
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.
◆ testbed()
void SoftwarePLL::testbed |
( |
| ) |
|
|
static |
◆ updateInterpolationSlope()
bool SoftwarePLL::updateInterpolationSlope |
( |
| ) |
|
|
private |
◆ UpdateInterpolationSlope()
bool SoftwarePLL::UpdateInterpolationSlope |
( |
| ) |
|
|
private |
◆ UpdatePLL()
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.
◆ updatePLL()
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.
◆ _instances
std::map< std::string, SoftwarePLL * > SoftwarePLL::_instances |
|
staticprivate |
◆ allowedTimeDeviation
double SoftwarePLL::allowedTimeDeviation |
|
private |
◆ AllowedTimeDeviation_
double SoftwarePLL::AllowedTimeDeviation_ |
|
private |
◆ clockFifo
◆ ClockFifo_
std::vector<double> SoftwarePLL::ClockFifo_ |
|
private |
◆ dClockDiffFeedBack
double SoftwarePLL::dClockDiffFeedBack |
|
private |
◆ dTAvgFeedback
double SoftwarePLL::dTAvgFeedback |
|
private |
◆ extrapolationDivergenceCounter
uint32_t SoftwarePLL::extrapolationDivergenceCounter |
|
private |
◆ ExtrapolationDivergenceCounter_
uint32_t SoftwarePLL::ExtrapolationDivergenceCounter_ |
|
private |
◆ fifoSize
const int SoftwarePLL::fifoSize = 7 |
|
static |
◆ FifoSize_
const int SoftwarePLL::FifoSize_ |
|
private |
◆ firstTick
uint64_t SoftwarePLL::firstTick |
|
private |
◆ FirstTick_
uint64_t SoftwarePLL::FirstTick_ |
|
private |
◆ firstTimeStamp
double SoftwarePLL::firstTimeStamp |
|
private |
◆ FirstTimeStamp_
double SoftwarePLL::FirstTimeStamp_ |
|
private |
◆ interpolationSlope
double SoftwarePLL::interpolationSlope |
|
private |
◆ InterpolationSlope_
double SoftwarePLL::InterpolationSlope_ |
|
private |
◆ isInitialized
bool SoftwarePLL::isInitialized |
|
private |
◆ IsInitialized_
bool SoftwarePLL::IsInitialized_ |
|
private |
◆ lastcurtick
uint32_t SoftwarePLL::lastcurtick = 0 |
|
private |
◆ Lastcurtick_
uint32_t SoftwarePLL::Lastcurtick_ = 0 |
|
private |
◆ lastValidTick
uint32_t SoftwarePLL::lastValidTick |
|
private |
◆ lastValidTimeStamp
double SoftwarePLL::lastValidTimeStamp |
|
private |
◆ MaxAllowedTimeDeviation
const double SoftwarePLL::MaxAllowedTimeDeviation = 0.1 |
|
staticprivate |
◆ MaxAllowedTimeDeviation_
const double SoftwarePLL::MaxAllowedTimeDeviation_ = 0.1 |
|
staticprivate |
◆ MaxExtrapolationCounter
const uint32_t SoftwarePLL::MaxExtrapolationCounter = 20 |
|
staticprivate |
◆ MaxExtrapolationCounter_
const uint32_t SoftwarePLL::MaxExtrapolationCounter_ = 20 |
|
staticprivate |
◆ mostRecentNanoSec
uint32_t SoftwarePLL::mostRecentNanoSec |
|
private |
◆ mostRecentSec
uint32_t SoftwarePLL::mostRecentSec |
|
private |
◆ mostRecentTimeStamp
double SoftwarePLL::mostRecentTimeStamp |
|
private |
◆ numberValInFifo
int SoftwarePLL::numberValInFifo |
|
private |
◆ NumberValInFifo_
int SoftwarePLL::NumberValInFifo_ |
|
private |
◆ packeds_droped
int SoftwarePLL::packeds_droped = 0 |
◆ tickFifo
uint32_t SoftwarePLL::tickFifo[fifoSize] |
|
private |
◆ TickFifo_
std::vector<uint32_t> SoftwarePLL::TickFifo_ |
|
private |
The documentation for this class was generated from the following files: