SettableClock

Package: inet.clock.model

SettableClock

compound module

This module represents a settable (step-able) clock with adjustable oscillator compensation.

Extends ~OscillatorBasedClock with the ability to step the clock time to an explicitly provided value (forward or backward) and to apply a new oscillator-compensation factor. Stepping the clock introduces a discontinuity in the clock-time mapping. Overdue events (whose target time becomes < now after the step) can be handled in three ways:

  • execute : run overdue events immediately (in order)
  • skip : drop/cancel overdue events
  • error : terminate simulation and report an error

The clock time can be set from C++ or by a clock servo module or by a time synchronization protocol or using a <set-clock module="..." time="..."/> command in a ScenarioManager script.

<b>See also:</b> ~IClockServo, ~ScenarioManager

oscillator : like IOscillator

ConstantDriftOscillator: Oscillator with constant fractional frequency offset (drift).

IOscillator: Interface for oscillator models.

Source:
oscillator: <default("ConstantDriftOscillator")> like IOscillator if typename != "" {
    @display("p=100,100");
    emitNumTicksSignal = default(!parent.useFutureEventSet); // needed when not using FES
} underlyingClock : like IClock

OscillatorBasedClock: Oscillator-driven clock.

IClock: Interface for clock models.

Source:
underlyingClock: <default("OscillatorBasedClock")> like IClock if typename != "" {
    parameters:
        oscillator.typename = "";
        oscillatorModule = default("^.oscillator");
        useFutureEventSet = default(parent.useFutureEventSet);
        @display("p=100,200");
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

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

Extends

Name Type Description
OscillatorBasedClock compound module

Oscillator-driven clock.

Parameters

Name Type Default value Description
displayStringTextFormat string "%t (%c)"

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

referenceClock string ""

Full path of the reference clock

clockTimeChangeEventSchedulingPriority int 0

Specifies the scheduling priority of the clock time changed event

emitClockTimeInterval double 0s

A non-zero value means the clock time will be emitted periodically

oscillatorModule string ".oscillator"
initialClockTime double 0s

Clock time at the simulation time when the module is initialized

roundingMode string "up"

When scheduling to a clock time or with a clock delay this clock uses rounding with respect to the nominal tick length

useFutureEventSet bool true

true: schedule in FES; false: internal list (requires oscillator signals)

clockGranularity double 0s

Scheduling grid G; 0s ⇒ use oscillator nominal tick length

initialOscillatorCompensation double 0ppm
defaultOverdueClockEventHandlingMode string "execute"

Properties

Name Value Description
class SettableClock
display i=block/timer

Signals

Name Type Unit Description
oscillatorCompensationChanged double

Statistics

Name Title Source Record Unit Interpolation Mode Description
oscillatorCompensationChanged oscillator compensation vector ppm sample-hold

Source code

//
// This module represents a settable (step-able) clock with adjustable oscillator compensation.
//
// Extends ~OscillatorBasedClock with the ability to step the clock time to an explicitly provided value (forward or
// backward) and to apply a new oscillator-compensation factor. Stepping the clock introduces a discontinuity in the
// clock-time mapping. Overdue events (whose target time becomes < now after the step) can be handled in three ways:
//  - execute : run overdue events immediately (in order)
//  - skip    : drop/cancel overdue events
//  - error   : terminate simulation and report an error
//
// The clock time can be set from C++ or by a clock servo module or by a time synchronization protocol or using a
// <set-clock module="..." time="..."/> command in a `ScenarioManager` script.
//
// @see ~IClockServo, ~ScenarioManager
//
module SettableClock extends OscillatorBasedClock
{
    parameters:
        double initialOscillatorCompensation @unit(ppm) = default(0ppm);
        string defaultOverdueClockEventHandlingMode @enum("execute","skip","error") = default("execute");
        @class(SettableClock);
        @signal[oscillatorCompensationChanged](type=double);
        @statistic[oscillatorCompensationChanged](title="oscillator compensation"; record=vector; interpolationmode=sample-hold; unit=ppm);
    submodules:
        underlyingClock: <default("OscillatorBasedClock")> like IClock if typename != "" {
            parameters:
                oscillator.typename = "";
                oscillatorModule = default("^.oscillator");
                useFutureEventSet = default(parent.useFutureEventSet);
                @display("p=100,200");
        }
}

File: src/inet/clock/model/SettableClock.ned