StepClockServo

Package: inet.clock.servo

StepClockServo

compound module

Step (bang-bang) clock servo.

Summary


Implements ~IClockServo by applying measurements as immediate corrections:

  • Offset is corrected by stepping the clock time (instant jump).
  • Frequency error is corrected by immediately updating the oscillator compensation/rate. This may introduce discontinuities (including backward steps) in the clock time and can affect modules that assume monotonic clock progression.

Semantics


On each adjust call with (timeDifference Δc, rateDifference Δf_ppm):

  • If Δc > 0: local clock is ahead → step the clock backward by Δc.
  • If Δc < 0: local clock is behind → step the clock forward by |Δc|.
  • Apply a new frequency compensation that cancels Δf_ppm immediately (Δf_ppm > 0 means local runs faster; set compensation to slow it by Δf_ppm).

Effects


  • Absolute “at” events scheduled on the clock will shift with the time step.
  • Relative “after” events are insensitive to the offset step but will reflect the new rate going forward.
  • Conversions at the step instant follow IClock(1,2)’s lower/upper-bound conventions.

Parameters


  • clockModule (inherited from ~ClockServoBase): path to the controlled clock.

Notes -----

  • Use only where abrupt corrections are acceptable (e.g., test, cold-start).
  • For smoother behavior, use a slewing/PI/PLL-style servo instead.

<b>See also:</b> ~ClockServoBase, ~IClockServo, ~IClock

Inheritance diagram

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

Extends

Name Type Description
ClockServoBase compound module

Base module for clock servos.

Parameters

Name Type Default value Description
displayStringTextFormat string ""

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

clockModule string

Path to the controlled clock module (IClock(1,2))

Properties

Name Value Description
class StepClockServo
display i=block/control

Source code

//
// Step (bang-bang) clock servo.
//
// Summary
// -------
// Implements ~IClockServo by applying measurements as immediate corrections:
// - Offset is corrected by stepping the clock time (instant jump).
// - Frequency error is corrected by immediately updating the oscillator
//   compensation/rate.
// This may introduce discontinuities (including backward steps) in the clock
// time and can affect modules that assume monotonic clock progression.
//
// Semantics
// ---------
// On each adjust call with (timeDifference Δc, rateDifference Δf_ppm):
// - If Δc > 0: local clock is ahead → step the clock backward by Δc.
// - If Δc < 0: local clock is behind → step the clock forward by |Δc|.
// - Apply a new frequency compensation that cancels Δf_ppm immediately
//   (Δf_ppm > 0 means local runs faster; set compensation to slow it by Δf_ppm).
//
// Effects
// -------
// - Absolute “at” events scheduled on the clock will shift with the time step.
// - Relative “after” events are insensitive to the offset step but will reflect
//   the new rate going forward.
// - Conversions at the step instant follow IClock’s lower/upper-bound conventions.
//
// Parameters
// ----------
// - clockModule (inherited from ~ClockServoBase): path to the controlled clock.
//
// Notes
// -----
// - Use only where abrupt corrections are acceptable (e.g., test, cold-start).
// - For smoother behavior, use a slewing/PI/PLL-style servo instead.
//
// @see ~inet.clock.base.ClockServoBase, ~inet.clock.contract.IClockServo, ~inet.clock.contract.IClock
//
module StepClockServo extends ClockServoBase like IClockServo
{
    parameters:
        @class(StepClockServo);
}
File: src/inet/clock/servo/StepClockServo.ned