Skip to main content

PPS Timestamping

The pps_ts hook sets the timestamps of samples based on a PPS signal/edge within the sample.

A common use-case is the accurate time-tagging of sample data acquired via an Analog to Digital Converter (ADC). Some ADC solutions are interfaced via non real-time interfaces like Ethernet or USB like for example the ones supported by the uldaq node-type. In these cases timestamping the measured signal with the current system time of the host system will be subject to an inaccuracy caused by the communication delay between the host system and the ADC.

The pps_ts hook solves this issue by using a pulse-per-second (PPS) signal which is sampled by the same ADC as the other signals. A cheap solution for generating PPS signals are of-the-shelf GPS receiver modules.

The hook detects the PPS signal and re-timestamps the samples based on this signal.

Timestamping via sampled PPS signal.
Timestamping via sampled PPS signal.

Implementation​

The source code of the hook is available here: https://github.com/VILLASframework/node/blob/master/lib/hooks/pps_ts.cpp

Configuration​

mode
string
Default: "simple"
Enum: "simple" "horizon"

The synchronization mode. The horizon mode is currently no recommended to use as it is not fully tested.

threshold
number
Default: 1.5

The signal level threshold of the PPS signal which is used to detect an edge.

expected_smp_rate
required
integer

The expected sampling rate of the input signal. Only important for a faster initialization.

horizon_estimation
integer
Default: 10
horizon_compensation
integer
Default: 10
signal
string

The name of a signal to which this hook should be applied

enabled
boolean
Default: true

An optional field which can be used to disable a hook.

priority
integer
Default: 99

The priority of this hook which determines the order in which hooks are executed. Hooks with a lwoer priority are executed before ones with a higher priority.

If no priority is configured, hooks are executed in the order they are configured in the configuration file.

{
  • "mode": "simple",
  • "threshold": 1.5,
  • "expected_smp_rate": 0,
  • "horizon_estimation": 10,
  • "horizon_compensation": 10,
  • "signal": "busA.V",
  • "enabled": true,
  • "priority": 99
}

Example​

node/etc/examples/hooks/pps_ts.conf
@include "hook-nodes.conf"

paths = (
{
in = "signal_node"
out = "file_node"

hooks = (
{
type = "pps_ts"

signal = "pps"

mode = "simple" # Oneof: simple, horizon
threshold = 0.5
expected_smp_rate = 5e3
horizon_estimation = 10
horizon_compensation = 10
}
)
}
)