1313
1414namespace inet {
1515
16+ /* *
17+ * @brief Ideal (uniform) oscillator.
18+ *
19+ * Provides a strictly periodic tick sequence with constant tick length and no
20+ * drift. The computation origin is a simulation time (o ≤ now).
21+ *
22+ * Mathematical semantics
23+ * ----------------------
24+ * - Let L := tickLength > 0 be the nominal tick interval (constant).
25+ * - Tick instants (relative to origin) are τ_i := i·L, i = 1,2,… (the origin
26+ * itself is not counted as a tick).
27+ * - Tick count from origin for interval Δt ≥ 0: N(Δt) = |{ i : 0 < τ_i ≤ Δt }|
28+ * = floor(Δt / L) (tick exactly at Δt is included; a tick at the origin is
29+ * excluded).
30+ * - Minimal interval for n ≥ 0 ticks: I(n) = inf{ Δt ≥ 0 : N(Δt) ≥ n } = n · L
31+ * with I(0) = 0.
32+ *
33+ * This class implements the ~IOscillator mapping without generating per-tick
34+ * events. It is suitable as a reference oscillator for clocks that require a
35+ * simple, drift-free timebase.
36+ */
1637class INET_API IdealOscillator : public OscillatorBase
1738{
1839 protected:
40+ // / Computation origin (o ≤ now); tick counting is measured from here.
1941 simtime_t origin;
42+
43+ // / Constant tick length L > 0 used for both N(Δt) and I(n).
2044 simtime_t tickLength;
2145
2246 protected:
@@ -25,15 +49,20 @@ class INET_API IdealOscillator : public OscillatorBase
2549 virtual void scheduleTickTimer () override ;
2650
2751 public:
52+ /* * @name IOscillator contract */
53+ // /@{
2854 virtual simtime_t getComputationOrigin () const override { return origin; }
55+
2956 virtual simtime_t getNominalTickLength () const override { return tickLength; }
57+
3058 virtual int64_t getNumTicksAtOrigin () const override { return 0 ; }
3159
3260 virtual int64_t computeTicksForInterval (simtime_t timeInterval) const override ;
61+
3362 virtual simtime_t computeIntervalForTicks (int64_t numTicks) const override ;
63+ // /@}
3464};
3565
3666} // namespace inet
3767
3868#endif
39-
0 commit comments