Bug 974

Summary: Unexpected behavior when running Python simulations using ns3::RealtimeSimulatorImpl
Product: ns-3 Reporter: alina <aquereilhac>
Component: python bindingsAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ns-bugs
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   

Description alina 2010-08-05 08:37:09 EDT
By default the python binding for Simulator.Run() (See [1]) executes ns3::Simulator::RunOneEvent() inside a loop instead of directly invoking the ns3::Simulator::Run() method. This produces an unexpected behavior when using ns3::RealtimeSimulatorImpl because no time synchronization is done inside the loop.
(See [2] "It is expected that if there are any realtime requirements, the responsibility for synchronizing with real time in an external event loop will be picked up by that loop.")
One possible solution could be to invoke ns3::Simulator::Run() by default, but this will cause signals to be ignored by default also (See [3]). Another solution would be to provide the realtime synchronization inside the loop.

[1] http://code.nsnam.org/ns-3-dev/file/48625d668186/bindings/python/ns3module_helpers.cc line 284
[2] http://code.nsnam.org/ns-3-dev/file/48625d668186/src/simulator/realtime-simulator-impl.cc line 490
[3] http://www.nsnam.org/bugzilla/show_bug.cgi?id=375
Comment 1 Gustavo J. A. M. Carneiro 2010-08-05 12:38:36 EDT
I think we should call Simulator::Run by default for when the scheduler is a real-time one.  It will ignore signals, but at least it runs.  It's complicated to catch signals reliably when threads are involved...
Comment 2 alina 2010-08-09 06:34:00 EDT
That would work.
Comment 3 Gustavo J. A. M. Carneiro 2010-08-09 12:42:34 EDT

*** This bug has been marked as a duplicate of bug 631 ***