Skip to content

ntpstats.simio

Exchange with network simulators: OMNeT++/INET and ns-3 (#29).

Import
  • OMNeT++ output vectors (.vec, result file format versions 2 and 3): every vector becomes a series. INET clocks record timeChanged:vector, the clock's time at each change; ntpstats turns it into time error relative to simulation time (TE = clock time − simulation time) and the usual offset reference − local = −TE. Other vectors (pdelay, gmRateRatio, your own) are selected with vectors and kept as raw values. .vec files are auto-detected by every command.
  • ns-3 results: packet captures from PcapHelper are read like any other capture (NTP and PTP), and two-column text from FileHelper or GnuplotHelper (time, value) is read as CSV (-f csv).
Export
  • :func:write_omnetpp_vec writes series as an OMNeT++ vector file, to be plotted next to simulation results in the OMNeT++ IDE or opp_scavetool.
  • :func:write_columns writes time value text for ns-3 programs and gnuplot.
  • :func:inet_oscillator maps a fitted power-law noise model to INET's RandomDriftOscillator: the drift rate does a random walk with an increment drawn from uniform(-a, a) ppm every changeInterval T. A random walk of frequency with step variance σ² per T has S_y(f) = σ²/(2π² T f²), so h₋₂ = σ²/(2π² T) and a = √3 · σ = √(6π² h₋₂ T). Only the random-walk FM part and the frequency offset carry over; the other noise types and the linear drift are reported, with what they contribute to ADEV at 1 s and 1000 s, so the loss is visible.

read_omnetpp_vec(lines, name='omnetpp', vectors=None, modules=None)

Series from an OMNeT++ .vec file.

By default every clock vector (timeChanged) becomes the time error of that clock relative to simulation time. vectors (a glob on the vector name, e.g. "pdelay*") and modules (a glob on the module path) select other vectors, kept as raw values in the offset column.

parse_omnetpp(lines, name='omnetpp')

Parser entry (-f omnetpp-vec): the clock vectors; else series written by ntpstats; else every vector.

write_omnetpp_vec(series, run='ntpstats', te=False, epoch=None)

An OMNeT++ vector file (version 3, ETV) with one vector per series and per extra column.

Time is seconds from epoch (default: the first sample), as simulation time. te=True writes the time error (−offset) instead of the offset.

write_columns(series, column='offset', epoch=None)

time value text (one sample per line, seconds), as ns-3's FileHelper and gnuplot use.

inet_oscillator(h, freq_offset=0.0, drift=0.0, change_interval=1.0, module='**.clock.oscillator', tau0=1.0)

INET RandomDriftOscillator settings that reproduce random-walk FM h[-2] and a frequency offset.

tau0 is the sample interval the h were fitted at (the ADEV of what is lost is reported at tau0 and 1000 s). Returns {"ini": text, "a_ppm": ..., "lost": [...]}.

random_drift_phase(n, tau0, a_ppm, change_interval, initial_ppm=0.0, rng=None)

Phase (s) of INET's RandomDriftOscillator semantics, sampled every tau0 (for checking the mapping).