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 recordtimeChanged: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 offsetreference − local = −TE. Other vectors (pdelay,gmRateRatio, your own) are selected withvectorsand kept as raw values..vecfiles are auto-detected by every command. - ns-3 results: packet captures from
PcapHelperare read like any other capture (NTP and PTP), and two-column text fromFileHelperorGnuplotHelper(time, value) is read as CSV (-f csv).
Export
- :func:
write_omnetpp_vecwrites series as an OMNeT++ vector file, to be plotted next to simulation results in the OMNeT++ IDE oropp_scavetool. - :func:
write_columnswritestime valuetext for ns-3 programs and gnuplot. - :func:
inet_oscillatormaps a fitted power-law noise model to INET'sRandomDriftOscillator: the drift rate does a random walk with an increment drawn fromuniform(-a, a)ppm everychangeIntervalT. A random walk of frequency with step variance σ² per T hasS_y(f) = σ²/(2π² T f²), soh₋₂ = σ²/(2π² T)anda = √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).