Package: inet.clock.model
OscillatorBasedClock
compound moduleModels a clock that uses an oscillator to produce ticks periodically. The oscillator is allowed to drift and produce ticks with different lengths over time. The clock simply counts the number of oscillator ticks. The mapping between clock ticks and clock time uses the nominal tick length.
When scheduling to a clock time or with a clock delay, this clock rounds the argument value using the specified rounding method first.
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.
Used in
| Name | Type | Description |
|---|---|---|
| ClockExample | network | (no description) |
Known subclasses
| Name | Type | Description |
|---|---|---|
| SettableClock | compound module |
Models a clock which can be set to a different clock time. The clock time can be set from C++ or using a <set-clock module="..." time="..."/> command in a ScenarioManager script. |
Extends
| Name | Type | Description |
|---|---|---|
| ClockBase | compound module |
This is a base module for clocks. |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| displayStringTextFormat | string | "%t (%c)" |
determines the text that is written on top of the submodule |
| 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 |
Properties
| Name | Value | Description |
|---|---|---|
| class | OscillatorBasedClock | |
| display | i=block/timer |
Signals
| Name | Type | Unit |
|---|---|---|
| timeChanged | simtime_t |
Statistics
| Name | Title | Source | Record | Unit | Interpolation Mode |
|---|---|---|---|---|---|
| timeChanged | Clock time | vector | linear |
Source code
// // Models a clock that uses an oscillator to produce ticks periodically. The // oscillator is allowed to drift and produce ticks with different lengths over // time. The clock simply counts the number of oscillator ticks. The mapping // between clock ticks and clock time uses the nominal tick length. // // When scheduling to a clock time or with a clock delay, this clock rounds the // argument value using the specified rounding method first. // module OscillatorBasedClock extends ClockBase like IClock { parameters: displayStringTextFormat = default("%t (%c)"); // determines the text that is written on top of the submodule double initialClockTime @unit(s) = default(0s); // clock time at the simulation time when the module is initialized string roundingMode @enum("down","up","closer","none") = default("up"); // when scheduling to a clock time or with a clock delay this clock uses rounding with respect to the nominal tick length @class(OscillatorBasedClock); submodules: oscillator: <default("ConstantDriftOscillator")> like IOscillator { @display("p=100,100"); } }File: src/inet/clock/model/OscillatorBasedClock.ned