INET Framework for OMNeT++/OMNEST
inet::RandomDriftOscillator Class Reference

#include <RandomDriftOscillator.h>

Inheritance diagram for inet::RandomDriftOscillator:
inet::DriftingOscillatorBase inet::OscillatorBase inet::IScriptable inet::IOscillator inet::StringFormat::IDirectiveResolver

Protected Member Functions

virtual ~RandomDriftOscillator ()
 
virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *message) override
 
- Protected Member Functions inherited from inet::DriftingOscillatorBase
virtual void processCommand (const cXMLElement &node) override
 Called by ScenarioManager whenever a script command needs to be carried out by the module. More...
 
double invertDriftRate (double driftRate) const
 
int64_t increaseWithDriftRate (int64_t value) const
 
int64_t increaseWithDriftRate (int64_t value, double driftRate) const
 
int64_t decreaseWithDriftRate (int64_t value) const
 
int64_t decreaseWithDriftRate (int64_t value, double inverseDriftRate) const
 
- Protected Member Functions inherited from inet::OscillatorBase
virtual int numInitStages () const override
 
virtual void updateDisplayString () const
 

Protected Attributes

cMessage * changeTimer = nullptr
 
cPar * driftRateParameter = nullptr
 
cPar * driftRateChangeParameter = nullptr
 
cPar * changeIntervalParameter = nullptr
 
double driftRateChangeTotal = 0
 
double driftRateChangeLowerLimit = NaN
 
double driftRateChangeUpperLimit = NaN
 
- Protected Attributes inherited from inet::DriftingOscillatorBase
simtime_t nominalTickLength
 
double driftRate = NaN
 
double inverseDriftRate = NaN
 
simtime_t origin
 
simtime_t nextTickFromOrigin
 
- Protected Attributes inherited from inet::OscillatorBase
const char * displayStringTextFormat = nullptr
 

Additional Inherited Members

- Public Member Functions inherited from inet::DriftingOscillatorBase
virtual simtime_t getComputationOrigin () const override
 Returns the oscillator computation origin from which the ticks are measured. More...
 
virtual simtime_t getNominalTickLength () const override
 Returns the nominal time interval between subsequent ticks. More...
 
virtual simtime_t getCurrentTickLength () const
 
virtual void setDriftRate (double driftRate)
 
virtual void setTickOffset (simtime_t tickOffset)
 
virtual int64_t computeTicksForInterval (simtime_t timeInterval) const override
 Returns the number of ticks in the specified time interval measured from the oscillator computation origin. More...
 
virtual simtime_t computeIntervalForTicks (int64_t numTicks) const override
 Returns the smallest simulation time interval for the specified number of ticks measured from the oscillator computation origin. More...
 
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::IOscillator
virtual ~IOscillator ()
 
- Public Member Functions inherited from inet::IScriptable
virtual ~IScriptable ()
 
- Static Public Attributes inherited from inet::OscillatorBase
static simsignal_t driftRateChangedSignal = cComponent::registerSignal("driftRateChanged")
 
- Static Public Attributes inherited from inet::IOscillator
static simsignal_t preOscillatorStateChangedSignal = cComponent::registerSignal("preOscillatorStateChanged")
 
static simsignal_t postOscillatorStateChangedSignal = cComponent::registerSignal("postOscillatorStateChanged")
 

Constructor & Destructor Documentation

◆ ~RandomDriftOscillator()

virtual inet::RandomDriftOscillator::~RandomDriftOscillator ( )
inlineprotectedvirtual
27 { cancelAndDelete(changeTimer); }

Member Function Documentation

◆ handleMessage()

void inet::RandomDriftOscillator::handleMessage ( cMessage *  message)
overrideprotectedvirtual
32 {
33  if (message == changeTimer) {
34  driftRateChangeTotal += driftRateChangeParameter->doubleValue() / 1E+6;
37  auto driftRate = driftRateParameter->doubleValue() / 1E+6;
39  scheduleAfter(changeIntervalParameter->doubleValue(), changeTimer);
40  }
41  else
42  throw cRuntimeError("Unknown message");
43 }

◆ initialize()

void inet::RandomDriftOscillator::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::DriftingOscillatorBase.

15 {
16  if (stage == INITSTAGE_LOCAL) {
17  driftRateParameter = &par("driftRate");
18  driftRateChangeParameter = &par("driftRateChange");
19  changeIntervalParameter = &par("changeInterval");
20  driftRate = driftRateParameter->doubleValue() / 1E+6;
21  }
23  if (stage == INITSTAGE_LOCAL) {
24  changeTimer = new cMessage("ChangeTimer");
25  driftRateChangeLowerLimit = par("driftRateChangeLowerLimit").doubleValue() / 1E+6;
26  driftRateChangeUpperLimit = par("driftRateChangeUpperLimit").doubleValue() / 1E+6;
27  scheduleAfter(changeIntervalParameter->doubleValue(), changeTimer);
28  }
29 }

Member Data Documentation

◆ changeIntervalParameter

cPar* inet::RandomDriftOscillator::changeIntervalParameter = nullptr
protected

Referenced by handleMessage(), and initialize().

◆ changeTimer

cMessage* inet::RandomDriftOscillator::changeTimer = nullptr
protected

Referenced by handleMessage(), and initialize().

◆ driftRateChangeLowerLimit

double inet::RandomDriftOscillator::driftRateChangeLowerLimit = NaN
protected

Referenced by handleMessage(), and initialize().

◆ driftRateChangeParameter

cPar* inet::RandomDriftOscillator::driftRateChangeParameter = nullptr
protected

Referenced by handleMessage(), and initialize().

◆ driftRateChangeTotal

double inet::RandomDriftOscillator::driftRateChangeTotal = 0
protected

Referenced by handleMessage().

◆ driftRateChangeUpperLimit

double inet::RandomDriftOscillator::driftRateChangeUpperLimit = NaN
protected

Referenced by handleMessage(), and initialize().

◆ driftRateParameter

cPar* inet::RandomDriftOscillator::driftRateParameter = nullptr
protected

Referenced by handleMessage(), and initialize().


The documentation for this class was generated from the following files:
inet::RandomDriftOscillator::driftRateChangeLowerLimit
double driftRateChangeLowerLimit
Definition: RandomDriftOscillator.h:23
inet::sctp::min
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SctpAssociation.h:261
inet::RandomDriftOscillator::changeTimer
cMessage * changeTimer
Definition: RandomDriftOscillator.h:18
inet::DriftingOscillatorBase::initialize
virtual void initialize(int stage) override
Definition: DriftingOscillatorBase.cc:12
inet::RandomDriftOscillator::driftRateChangeParameter
cPar * driftRateChangeParameter
Definition: RandomDriftOscillator.h:20
inet::RandomDriftOscillator::driftRateParameter
cPar * driftRateParameter
Definition: RandomDriftOscillator.h:19
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::RandomDriftOscillator::driftRateChangeTotal
double driftRateChangeTotal
Definition: RandomDriftOscillator.h:22
inet::sctp::max
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
inet::RandomDriftOscillator::driftRateChangeUpperLimit
double driftRateChangeUpperLimit
Definition: RandomDriftOscillator.h:24
inet::DriftingOscillatorBase::setDriftRate
virtual void setDriftRate(double driftRate)
Definition: DriftingOscillatorBase.cc:36
inet::DriftingOscillatorBase::driftRate
double driftRate
Definition: DriftingOscillatorBase.h:21
inet::RandomDriftOscillator::changeIntervalParameter
cPar * changeIntervalParameter
Definition: RandomDriftOscillator.h:21