Set delay in simulator time?

53 views
Skip to first unread message

Ashar Tariq

unread,
Apr 29, 2021, 7:39:44 AM4/29/21
to ns-3-...@googlegroups.com
Hi,

Is there a way to set delay in simulator time?
Like for example, if I want to hold the simulator time for 10 secs, is there any built-in  function to achieve this delay?

***simulator delay, not the coding delay***

Regards

pdbarnes

unread,
Apr 29, 2021, 6:39:12 PM4/29/21
to ns-3-users
With respect to what?  You want to hold the simulator at a given simulation time, 5s, say, with respect to?  Wall clock time?

If you need to maintain synchrony with wall clock, use the RealTimeSimulatorImpl

If you just need to freeze the simulator arbitrarily, you could create a new Object with a method to do just that, by using Posix realtime timers.  This could be as simple as calling sleep or nanosleep, or as complicated as the implementation of WallClockSynchronizer

Ashar Tariq

unread,
Apr 30, 2021, 12:18:46 AM4/30/21
to ns-3-...@googlegroups.com
Thankyou for your response.
I am actually trying to implement something like a 'retransmission time out'. So when the packet is lost, I want the simulator to delay the transmission of the next packet for a certain period of time (say 10 secs).

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/d055372f-7f12-4fe3-84ae-b9b9ecc1a241n%40googlegroups.com.

pdbarnes

unread,
Apr 30, 2021, 3:22:18 PM4/30/21
to ns-3-users
Ahh, so you mean a delay in simulation time.  For a simple RTO take a look at Timer .  You would cache the packet, then re-enqueue it when the Timer expires.

If you want to block sending of any packets it's a little more involved.  Depending on the NetDevice type you might be able to set it busy (blocking other enqueued packets from sending) for the desired time.

Ashar Tariq

unread,
Apr 30, 2021, 8:20:11 PM4/30/21
to ns-3-...@googlegroups.com
Thanks, I will look into the Timer class. 
Appreciate your help.

Reply all
Reply to author
Forward
0 new messages