Integrating NS3 with semi-Realtime Applications

79 views
Skip to first unread message

Alessandro Amato

unread,
May 9, 2024, 5:14:26 PM5/9/24
to ns-3-users
Hi everyone,

I'm new to NS3 and I'm trying to connect it with an external physics simulator for drone movement in a reinforcement learning setup. The external simulator runs in real time, which works well with NS3's real-time mode. However, training in real-time isn't practical. I'm wondering if it's possible to speed up NS3 by a factor of N like we can with the external simulator.

For instance, if we speed up the simulator by a factor of 10 (meaning 0.1s in real-time equals 1 sec in the simulator), and then we are sending a packet from node 1 to node 2, in real time it takes 8ms. But with the 1s = 0.1s constraint, it would take 0.8ms.

Would that be possible?

Thanks,
Alessandro

Tommaso Pecorella

unread,
May 11, 2024, 5:41:26 AM5/11/24
to ns-3-users
Thought question (to answer).

Technically if you do NOT use the real-time scheduler your simulation will go as fast as possible, but I guess this is not what you want as the simulation might go too fast, and the events will not be spaced correctly.
So, let's go to the facts.

Fact: the functionality to "speed up" a real-time simulation isn't available.
Fact: it is possible to implement it.

The real-time simulation is due to the RealtimeSimulatorImpl class. This class synchronizes itself with the real-time clock thanks to a Synchronizer class, which is further implemented in WallClockSynchronizer.

The easiest thing (in my opinion) is to modify WallClockSynchronizer so that it can use a "multiplier", like you said. Shouldn't be dramatic, and it would be a nice feature (if you do it, please submit a patch).

Another way is to have a completely different Synchronizer taking the clock from an external source (e.g., an RPC), so that the speedup (or slowdown) is dependent on "something else" - possibly your other tool.
Reply all
Reply to author
Forward
0 new messages