[Ns-developers] Proposed changes to factor ns-3 simulator module

Gustavo Carneiro gjcarneiro at gmail.com
Sat Jul 19 11:28:15 PDT 2008


2008/7/19 <craigdo at ee.washington.edu>:

>  Hi Gustavo,
>
> I could certainly add a GetRealTime method variant to class Simulator that
> returns the real time since the simulation started in simulator time units.
> That wouldn't be a big deal; similar functions are already written.  This
> sounds like something easily doable.
>
> From a client perspective it would take a little more effort to get to, but
> the realtime synchronizer is a "component" that you could create and call to
> get real time information, including how real time changes with respect
> to simulation time.
>

The "get real time" part is easy, I need no help with that.  But that is not
all that I need.

What I really need and find difficult to implement is "schedule to be called
when approximately 1 second of real time has elapsed".  I mean, I know two
simple ways to accomplish this, but neither is very robust: 1) SIGALARM
(only works in *NIX), 2) use threads (with all the race conditions and
locking overhead inherent to threading).

Anyway, I know that what I ask is probably hard.  I'm just asking in case
you have a better idea already.

Thanks.


>
> Since the simulator itself is a static class we won't be able to
> make multiple implementations coexist with the simulator interface as is.
> You could instantiate the realtime implementation class and talk to it over
> its own public interface which could include real time information, but
> you'd lose all the template magic that is defined in the simulator
> interface.
>
> But to answer your question, there are no plans to have multiple versions
> of the simulator running at the same time.  Right now class Simulator uses
> static methods so there will be one implementation living under these
> methods.  ML argued convincingly for this approach.
>
> -- Craig
>
>  ------------------------------
> *From:* Gustavo Carneiro [mailto:gjcarneiro at gmail.com]
> *Sent:* Saturday, July 19, 2008 3:18 AM
> *To:* craigdo at u.washington.edu
> *Cc:* ns-developers
> *Subject:* Re: [Ns-developers] Proposed changes to factor ns-3 simulator
> module
>
>
>
> 2008/7/19 <craigdo at ee.washington.edu>:
>
>> Hi all,
>>
>> As many of you know, I've been working on a realtime and emulation
>> extension
>> to the ns-3 simulator module.  After some initial discussions it was
>> decided
>> to factor the simulator into an interface and a replaceable
>> implementation;
>> and to check this code into ns-3-dev before the ns-3.2 release.  We're
>> doing
>> this to enable more easily sliding in the realtime, emulation and
>> parallelization work.
>
>
> One thing I was hoping to do some day would be to provide some feedback on
> the console about how the simulated time and real time have evolved.  For
> instance, every real time second, print simulated time and real time.  This
> is a very useful feedback to allow the user to get a feel for how fast
> things are simulating and how much time simulation is likely to take.
>
> So this feedback would need real time scheduling, and I was kind of hoping
> to be able to use your work for that.  But now I see that real time
> scheduling happens on a completely separate simulator, which I think
> precludes me from doing that.
>
> Do you have any comment on this?  Do you think it will ever be possible to
> have both schedulers running at the same time?
>
> Thanks.
>
>
>>
>> I've completed the initial factoring and put the code into a private
>> repository at http://code.nsnam.org/craigdo/ns-3-compsim for your viewing
>> pleasure.
>>
>> The only changes are in src/simulator.  You will find the old
>> SimulatorPriv
>> class removed from simulator.cc; the class declaration renamed to
>> SimulatorImpl and turned into a pure virtual interface in
>> simulator-impl.h;
>> and a default implementation of SimulatorImpl called (perhaps not too
>> surprisingly) DefaultSimulatorImpl in default-simlator-impl.{cc,h} which
>> is
>> just the old SimulatorPriv methods renamed.
>>
>> There is a GlobalValue named "SimulatorImplementationType" that defaults
>> to
>> "ns3::DefaultSimulatorImpl" to control the substitution of the simulator
>> implementation.  When the emulation work is done, you can just set the
>> default value to the name of the realtime simulator (something like
>> "ns3::RealtimeSimulatorImpl") and magically have a realtime ns-3.  Well,
>> that's the theory anyway ...
>>
>> Any comments are welcome.  This version of the simulator passes all waf
>> check and regression tests.  If I don't hear any comments, I plan on
>> checking these changes in late Monday afternoon (US pacific time).
>>
>> Regards,
>>
>> -- Craig
>>
>>
>>
>
>
> --
> Gustavo J. A. M. Carneiro
> INESC Porto, Telecommunications and Multimedia Unit
> "The universe is always one step beyond logic." -- Frank Herbert
>
>


-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list