StepClockServo

Package: inet.clock.servo

compound module StepClockServo

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 also: inet.clock.base.ClockServoBase, inet.clock.contract.IClockServo, inet.clock.contract.IClock

StepClockServo

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

Gptp

compound module

Implements the generalized Precision Time Protocol (gPTP) as defined in the IEEE 802.1AS-2020 standard.

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,:ref:2 <neddoc-msg-inet-iclock>))

resetOscillator

bool

true

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);
        bool resetOscillator = default(true);
}

File: src/inet/clock/servo/StepClockServo.ned