Struct hifitime::ClockNoise [−][src]
pub struct ClockNoise { /* fields omitted */ }
Expand description
ClockNoise adds true clock drift to a given Duration measurement. For example, if a vehicle is
measuring the time of flight of a signal with high precision oscillator, the engineering
specifications will include the oscillator stability. This specification bounds the preciseness
of time span calculations. On very short time spans, i.e. less than a few minutes, clock drift
is usually negligible. However, in several high fidelity systems the clock drift may lead to
a significant error (e.g. several kilometers in two-way radar ranging). This module allows high
fidelity simulation systems to test the resilience of algorithms with oscillator stability.
The constructors here are specified in parts per million: for a parts per billion specification
simply multiply the value by 1e-3
.
NOTE: Clock stability is not linear. If a clock is rated at stable within 15 ppm per
fifteen minute interval this does not correspond to 1 ppm per minute.
Example
use hifitime::ClockNoise;
// The IRIS clock is 1 part per billion over one second
let nasa_iris = ClockNoise::with_ppm_over_1sec(1e-3);
let ddoor = 8.0 * 60.0;
let noisy = nasa_iris.noise_up(ddoor);
assert!(
(noisy - ddoor).abs() < 1e-3,
"Expected a zero deviation for IRIS"
);
Implementations
Creates a new ClockNoise generator from the stability characteristics in absolute parts per million The ppm value is assumed to be the 7-sigma deviation.
Creates a new ClockNoise generator from the stability characteristics in parts per million over one second.
Creates a new ClockNoise generator from the stability characteristics in parts per million over one minute (i.e. 60 seconds).
Creates a new ClockNoise generator from the stability characteristics in parts per million over fifteen minutes (i.e. 900 seconds).
From an input set of seconds, returns a random walk number of seconds corresponding to the value plus/minus a drift This is the most accurate method to generate a noisy signal, but it’s extremely slow.