ConstantDriftOscillator¶
Package: inet.clock.oscillator
simple module ConstantDriftOscillator
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
driftRatein 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)
Usage diagram¶
Inheritance diagram¶
Used in compound modules¶
Name |
Type |
Description |
|---|---|---|
compound module |
Oscillator-driven clock. |
Extends¶
Name |
Type |
Description |
|---|---|---|
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 |
|---|---|---|---|
driftRateChanged |
double |
||
numTicksChanged |
unsigned long |
||
postOscillatorStateChanged |
|||
preOscillatorStateChanged |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
driftRateChanged |
Oscillator drift rate |
vector |
ppm |
sample-hold |
||
numTicksChanged |
number of ticks |
vector |
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);
}