TTEthernet Model for INET Framework
|
Scheduler module. More...
#include <TTEScheduler.h>
Public Member Functions | |
virtual int | numInitStages () const |
Returns the number of initialization stages this module needs. More... | |
virtual uint32_t | getTicks () |
Returns the current number of ticks. More... | |
virtual uint64_t | getTotalTicks () |
Returns the absolute number of ticks. More... | |
virtual uint32_t | getCycles () |
Returns the current number of cycles. More... | |
virtual void | clockCorrection (int32_t ticks) |
Corrects the clock by the number of ticks. More... | |
virtual bool | registerEvent (SchedulerEvent *event) |
Register a new event in the scheduler. More... | |
virtual bool | registerEvent (SchedulerActionTimeEvent *actionTimeEvent, bool forceNextCycle) |
Register a new event in the scheduler. More... | |
virtual void | unregisterEvent (SchedulerEvent *event) |
Unregister an event that was previously registered in the scheduler. More... | |
virtual void | correctEvents () |
Helper function to correct Events after tick length changes. More... | |
virtual void | changeDrift () |
Helper function to change the drift. More... | |
Protected Member Functions | |
virtual void | initialize (int stage) |
Initialization of the module. More... | |
virtual void | handleMessage (cMessage *msg) |
Handles all scheduler messages. More... | |
virtual void | handleParameterChange (const char *parname) |
Indicates a parameter has changed. More... | |
Static Protected Attributes | |
static simsignal_t | currentDrift = SIMSIGNAL_NULL |
Signal that is emitted every time the drift (Difference of configured and actual tick length) changes. More... | |
static simsignal_t | newCycle = SIMSIGNAL_NULL |
Signal that is emitted at the beginning of a new cycle. More... | |
Private Attributes | |
simtime_t | lastCycleStart |
Simulation time when the last cycle started. More... | |
simtime_t | lastNewCycleMessage |
Simulation time when the last newcycle message was seen. More... | |
uint64_t | lastCycleTicks |
Number of ticks since the simulation started when the last cycle started. More... | |
std::list< SchedulerEvent * > | registredEvents |
List of registered SchedulerEvents. More... | |
cMessage * | newCyclemsg |
simtime_t | maxDriftChange |
caches max_drift_change parameter More... | |
simtime_t | maxDrift |
caches max_drift parameter More... | |
simtime_t | currentTick |
caches current_tick parameter More... | |
simtime_t | tick |
caches tick parameter More... | |
uint32_t | cycleTicks |
caches cycle_ticks parameter More... | |
uint32_t | cycles |
Number of cycles since the simulation started. More... | |
Scheduler module.
Implements a scheduler with a dedicated local clock with adjustable precision that may be synchronized by a synchronization module
Definition at line 34 of file TTEScheduler.h.
|
virtual |
Helper function to change the drift.
Can be overwritten to implement special clock drift behavior.
Definition at line 136 of file TTEScheduler.cc.
Referenced by handleMessage().
|
virtual |
Corrects the clock by the number of ticks.
number | of ticks the clock must be corrected |
Definition at line 191 of file TTEScheduler.cc.
Referenced by TTEthernetModel::DummySync::handleMessage().
|
virtual |
Helper function to correct Events after tick length changes.
Definition at line 149 of file TTEScheduler.cc.
Referenced by clockCorrection(), and handleMessage().
|
virtual |
Returns the current number of cycles.
Definition at line 218 of file TTEScheduler.cc.
Referenced by TTEthernetModel::DummySync::handleMessage().
|
virtual |
Returns the current number of ticks.
Definition at line 203 of file TTEScheduler.cc.
Referenced by correctEvents(), TTEthernetModel::TTIncoming::handleMessage(), TTEthernetModel::TTEOutput::isTransmissionAllowed(), and registerEvent().
|
virtual |
Returns the absolute number of ticks.
Definition at line 213 of file TTEScheduler.cc.
Referenced by TTEthernetModel::RCIncoming::handleMessage(), and TTEthernetModel::TTEOutput::setTransparentClock().
|
protectedvirtual |
Handles all scheduler messages.
Registers self-messages for events sends messages to trigger events in remote modules.
msg | the incoming message. |
Definition at line 111 of file TTEScheduler.cc.
|
protectedvirtual |
Indicates a parameter has changed.
parname | Name of the changed parameter or NULL if multiple parameter changed. |
Definition at line 183 of file TTEScheduler.cc.
|
protectedvirtual |
Initialization of the module.
stage | the stages. Module initializes when stage==1 |
Definition at line 32 of file TTEScheduler.cc.
|
virtual |
Returns the number of initialization stages this module needs.
Definition at line 27 of file TTEScheduler.cc.
|
virtual |
Register a new event in the scheduler.
May fail if ActionTimeEvent is out of schedule
event | Pointer to the Event to be scheduled. The scheduler will send the event according to the event type |
Definition at line 48 of file TTEScheduler.cc.
Referenced by TTEthernetModel::RCTrafficSourceApp::handleMessage(), TTEthernetModel::TTTrafficSourceApp::handleMessage(), TTEthernetModel::DummySync::handleMessage(), TTEthernetModel::TTIncoming::handleMessage(), TTEthernetModel::TTBuffer::handleMessage(), TTEthernetModel::TTEAPIApplicationBase::handleMessage(), TTEthernetModel::RCTrafficSourceApp::initialize(), TTEthernetModel::TTTrafficSourceApp::initialize(), TTEthernetModel::DummySync::initialize(), TTEthernetModel::TTBuffer::initialize(), TTEthernetModel::TTEAPIApplicationBase::registerTask(), and TTEthernetModel::RCBuffer::resetBag().
|
virtual |
Register a new event in the scheduler.
May fail if ActionTimeEvent is out of schedule
actionTimeEvent | Pointer to the Event to be scheduled. The scheduler will send the event according to the event type |
forceNextCycle | should the event be forced in the next cycle even if it could be executed in this cycle |
Definition at line 70 of file TTEScheduler.cc.
|
virtual |
Unregister an event that was previously registered in the scheduler.
You must delete the event afterwards manually!
event | Pointer to the Event to be unregistered. The scheduler will not send the event anymore |
Definition at line 103 of file TTEScheduler.cc.
|
staticprotected |
Signal that is emitted every time the drift (Difference of configured and actual tick length) changes.
Definition at line 202 of file TTEScheduler.h.
Referenced by changeDrift(), and initialize().
|
private |
caches current_tick parameter
Definition at line 73 of file TTEScheduler.h.
Referenced by changeDrift(), clockCorrection(), correctEvents(), getTicks(), getTotalTicks(), handleMessage(), handleParameterChange(), and registerEvent().
|
private |
Number of cycles since the simulation started.
Definition at line 86 of file TTEScheduler.h.
Referenced by getCycles(), handleMessage(), and initialize().
|
private |
caches cycle_ticks parameter
Definition at line 81 of file TTEScheduler.h.
Referenced by clockCorrection(), correctEvents(), getTicks(), handleMessage(), handleParameterChange(), and registerEvent().
|
private |
Simulation time when the last cycle started.
Definition at line 40 of file TTEScheduler.h.
Referenced by clockCorrection(), correctEvents(), getTicks(), handleMessage(), initialize(), and registerEvent().
|
private |
Number of ticks since the simulation started when the last cycle started.
Definition at line 50 of file TTEScheduler.h.
Referenced by getTotalTicks(), handleMessage(), and initialize().
|
private |
Simulation time when the last newcycle message was seen.
Definition at line 44 of file TTEScheduler.h.
Referenced by getTotalTicks(), handleMessage(), and initialize().
|
private |
caches max_drift parameter
Definition at line 68 of file TTEScheduler.h.
Referenced by changeDrift(), and handleParameterChange().
|
private |
caches max_drift_change parameter
Definition at line 64 of file TTEScheduler.h.
Referenced by changeDrift(), and handleParameterChange().
|
staticprotected |
Signal that is emitted at the beginning of a new cycle.
Definition at line 207 of file TTEScheduler.h.
Referenced by handleMessage(), and initialize().
|
private |
Definition at line 59 of file TTEScheduler.h.
Referenced by clockCorrection(), and handleMessage().
|
private |
List of registered SchedulerEvents.
Used to reregister after clock tick changes.
Definition at line 57 of file TTEScheduler.h.
Referenced by correctEvents(), handleMessage(), registerEvent(), and unregisterEvent().
|
private |
caches tick parameter
Definition at line 77 of file TTEScheduler.h.
Referenced by changeDrift(), and handleParameterChange().