[Ns-developers] Comment on ns Simulator::Schedule (re-post to ns-developers)

George Riley riley at ece.gatech.edu
Mon Nov 20 13:44:23 PST 2006


Mathieu,
I was looking over the Time API, and found we still disagree on the  
semantics
of scheduling events.  see below:

/**
* \brief create an ns3::Time instance which contains the
*        current simulation time.
*
* This is really a shortcut for the ns3::Simulator::Now method.
* It is typically used as shown below to schedule an event
* which expires in 2 seconds from now:
* \code
* Simulator::Schedule (Now () + Seconds (2.0), &my_function);
* \endcode
*/
class Now : public Time
{
public:
   Now ();
};


I can't understand why the time passed to schedule is absolute time as
opposed to relative time.  The expected use case is that the time  
calculated
is relative to current time (transmission time, speed of light delay,  
time out values
in TCP, etc).  The only absolute time use case is if we want an  
application to
start at some particular time, or the simulation to finish at some  
time.  I think
we need to optimize for the expected case, and say:

Schedule(rxTime, .....) // Schedule packet rx event

and

Schedule(myAppStartTime - Now())

when the abs time is needed.

George

------------------------------------------------------------------------ 
--------------------
Dr. George F. Riley, Assistant Professor
The School of Electrical and Computer Engineering at Georgia Tech
Atlanta, GA  30332-0250
(404)-894-4767
E-Mail: riley at ece.gatech.edu

ECE3090 Web Page: http://users.ece.gatech.edu/~riley/ece3090/
ECE4110 Web Page: http://users.ece.gatech.edu/~riley/ece4110/
CS1372/CS1803 Web Page: http://www-static.cc.gatech.edu/classes/ 
AY2007/cs1372_fall/




More information about the Ns-developers mailing list