0

I want initialize a 5-second counter and send a message. If a response message is received before the end of 5 seconds, the timer is interrupted and action is taken. However if the timer ends and no message is received another action will be taken.

I thought of setting a constant "timer = 5" and decrementing it in a "For" loop with an "IF", but the time spent will not be recorded as simulation time.

How to make this implementation to reflect simulation time?

campos
  • 153
  • 2
  • 12

1 Answers1

0

As you correctly point out, each event in OMNeT++ is assumed to take zero time. If you want an event to cause something to take place some seconds into the future, you will need to have this event schedule another one using, e.g., the OMNeT++ built-in scheduleAt or the Veins 5a2 convenience methods of the TimerManager class (see VeinsInetSampleApplication for an example).