DriftingOscillatorBase

Package: inet.clock.base

DriftingOscillatorBase

simple module

C++ definition

Base module for oscillators whose effective tick rate may drift relative to a nominal tick length. This module provides the mapping used by clocks without generating one event per tick.

Summary


  • Defines a computation origin o (o ≤ now) and a nominal tick length L.
  • Actual tick spacing may differ from L due to drift/compensation; the current tick length is managed internally and may change over time.
  • Mapping operations follow ~IOscillator semantics: N(Δt): number of ticks in (0, Δt] from the origin, I(n) : minimal Δt ≥ 0 such that N(Δt) ≥ n.
  • When rate-related state changes, the origin and phase are updated so that the first tick not earlier than the change time remains consistent (no double or missed ticks).

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Known subclasses

Name Type Description
ConstantDriftOscillator simple module

Oscillator with constant fractional frequency offset (drift).

RandomDriftOscillator simple module

Oscillator with time-varying drift driven by a bounded random walk.

Extends

Name Type Description
OscillatorBase simple module

Base module for oscillators.

Parameters

Name Type Default value Description
displayStringTextFormat string "%c (%n + %d)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

emitNumTicksSignal bool false

Enables emitting a signal at each oscillator tick, can be useful for validating the behavior of the more efficient implementation without events

oscillatorTickEventSchedulingPriority int 0

Specifies the scheduling priority of the tick event

nominalTickLength double

Specifies the elapsed time between oscillator ticks

tickOffset double 0s

Shifts ticks to the past, must be in the range of [0, current tick length)

Properties

Name Value Description
class DriftingOscillatorBase
display i=block/tunnel

Signals

Name Type Unit Description
postOscillatorStateChanged
preOscillatorStateChanged

Statistics

Name Title Source Record Unit Interpolation Mode Description
numTicksChanged number of ticks vector sample-hold
driftRateChanged Oscillator drift rate vector ppm sample-hold

Source code

//
// Base module for oscillators whose effective tick rate may drift relative to a
// nominal tick length. This module provides the mapping used by clocks without
// generating one event per tick.
//
// Summary
// -------
// - Defines a computation origin o (o ≤ now) and a nominal tick length L.
// - Actual tick spacing may differ from L due to drift/compensation; the
//   current tick length is managed internally and may change over time.
// - Mapping operations follow ~IOscillator semantics:
//     N(Δt): number of ticks in (0, Δt] from the origin,
//     I(n) : minimal Δt ≥ 0 such that N(Δt) ≥ n.
// - When rate-related state changes, the origin and phase are updated so that
//   the first tick not earlier than the change time remains consistent (no
//   double or missed ticks).
//
simple DriftingOscillatorBase extends OscillatorBase
{
    parameters:
        displayStringTextFormat = default("%c (%n + %d)"); // Determines the text that is written on top of the submodule
        double nominalTickLength @unit(s); // Specifies the elapsed time between oscillator ticks
        double tickOffset @unit(s) = default(0s); // Shifts ticks to the past, must be in the range of [0, current tick length)
        @signal[preOscillatorStateChanged];
        @signal[postOscillatorStateChanged];
        @class(DriftingOscillatorBase);
}

File: src/inet/clock/base/DriftingOscillatorBase.ned