OMNeT++ Simulation Library  5.6.1
cRealTimeScheduler Class Reference

#include <cscheduler.h>

Description

Real-time scheduler class.

When installed as scheduler using the scheduler-class omnetpp.ini entry, it will synchronize simulation execution to real (wall clock) time.

Operation: a "base time" is determined when startRun() is called. Later on, the scheduler object calls usleep() from takeNextEvent() to synchronize the simulation time to real time, that is, to wait until the current time minus base time becomes equal to the simulation time. Should the simulation lag behind real time, this scheduler will try to catch up by omitting sleep calls altogether.

Scaling is supported via the realtimescheduler-scaling omnetpp.ini entry. For example, if it is set to 2.0, the simulation will try to execute twice as fast as real time.

Inheritance diagram for cRealTimeScheduler:
cScheduler cObject cISimulationLifecycleListener

Public Member Functions

 cRealTimeScheduler ()
 
virtual ~cRealTimeScheduler ()
 
virtual std::string str () const override
 
virtual void executionResumed () override
 
virtual cEventguessNextEvent () override
 
virtual cEventtakeNextEvent () override
 
virtual void putBackEvent (cEvent *event) override
 
- Public Member Functions inherited from cScheduler
 cScheduler ()
 
virtual ~cScheduler ()
 
virtual void setSimulation (cSimulation *_sim)
 
cSimulationgetSimulation () const
 
virtual void endRun ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
virtual const char * getName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
const cObjectgetThisPtr () const
 
virtual _OPPDEPRECATED std::string info () const
 
virtual _OPPDEPRECATED std::string detailedInfo () const
 
virtual cObjectdup () const
 
virtual void parsimPack (cCommBuffer *buffer) const
 
virtual void parsimUnpack (cCommBuffer *buffer)
 
virtual cObjectgetOwner () const
 
virtual bool isOwnedObject () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 
- Public Member Functions inherited from cISimulationLifecycleListener
virtual ~cISimulationLifecycleListener ()
 
virtual void listenerAdded ()
 
virtual void listenerRemoved ()
 

Protected Member Functions

virtual void startRun () override
 
- Protected Member Functions inherited from cScheduler
virtual void lifecycleEvent (SimulationLifecycleEventType eventType, cObject *details) override
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Additional Inherited Members

- Static Public Member Functions inherited from cISimulationLifecycleListener
static const char * getSimulationLifecycleEventName (SimulationLifecycleEventType eventType)
 

Constructor & Destructor Documentation

◆ cRealTimeScheduler()

Constructor.

◆ ~cRealTimeScheduler()

virtual ~cRealTimeScheduler ( )
virtual

Destructor.

Member Function Documentation

◆ startRun()

virtual void startRun ( )
overrideprotectedvirtual

Called at the beginning of a simulation run.

Reimplemented from cScheduler.

◆ str()

virtual std::string str ( ) const
overridevirtual

Returns a description that depends on the parametrization of this class.

Reimplemented from cScheduler.

◆ executionResumed()

virtual void executionResumed ( )
overridevirtual

Recalculates "base time" from current wall clock time.

Reimplemented from cScheduler.

◆ guessNextEvent()

virtual cEvent* guessNextEvent ( )
overridevirtual

Returns the first event in the Future Event Set.

Implements cScheduler.

◆ takeNextEvent()

virtual cEvent* takeNextEvent ( )
overridevirtual

Scheduler function – it comes from cScheduler interface. This function synchronizes to real time: before returning the first event from the FES, it waits (using usleep()) until the real time reaches the time of that simulation event.

Implements cScheduler.

◆ putBackEvent()

virtual void putBackEvent ( cEvent event)
overridevirtual

Puts back the event into the Future Event Set.

Implements cScheduler.


The documentation for this class was generated from the following file: