ConstantDriftOscillator

Package: inet.clock.oscillator

ConstantDriftOscillator

simple module

C++ definition

Oscillator with constant fractional frequency offset (drift).

Summary


Produces a strictly periodic tick sequence whose rate is a constant factor faster or slower than the nominal tick length. No per-tick events are scheduled; mappings follow ~IOscillator semantics via the base.

Semantics


  • Let L be the nominal tick length and r be driftRate in ppm.
  • Effective factor d = 1 + r·1e−6.
  • Current tick length: L_current = L / d. * r > 0 → faster oscillator (shorter ticks) * r = 0 → nominal rate * r < 0 → slower oscillator (longer ticks)

Inheritance diagram

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

Extends

Name Type Description
DriftingOscillatorBase simple module

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.

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)

driftRate double 0ppm

Constant fractional frequency offset

Properties

Name Value Description
class ConstantDriftOscillator
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

//
// Oscillator with constant fractional frequency offset (drift).
//
// Summary
// -------
// Produces a strictly periodic tick sequence whose rate is a constant factor
// faster or slower than the nominal tick length. No per-tick events are
// scheduled; mappings follow ~IOscillator semantics via the base.
//
// Semantics
// ---------
// - Let L be the nominal tick length and r be `driftRate` in ppm.
// - Effective factor d = 1 + r·1e−6.
// - Current tick length: L_current = L / d.
//   * r > 0  → faster oscillator (shorter ticks)
//   * r = 0  → nominal rate
//   * r < 0  → slower oscillator (longer ticks)
//
//
simple ConstantDriftOscillator extends DriftingOscillatorBase like IOscillator
{
    parameters:
        double driftRate @unit(ppm) = default(0ppm); // Constant fractional frequency offset
        @class(ConstantDriftOscillator);
}
File: src/inet/clock/oscillator/ConstantDriftOscillator.ned