[ns] a loop or a start and stop methods

2007-11-08 Thread Nabila khedimi


Hi,
I want to execute a ping agent continuously during the simulation, regarding 
the schedular object in NS, is there any the difference between making a 
infinite loop inside the tcl code or define a start and a stop method inside 
the ping agent code(which is a c++ program)
Thanks for help
Nabila
 
> To: [EMAIL PROTECTED]; ns-users@isi.edu> Subject: RE: [ns] access to TCL 
> instance variables> From: [EMAIL PROTECTED]> Date: Tue, 6 Nov 2007 10:05:46 
> -0800> > > Nabila,> > To print the value, you may do something like> > puts 
> [$myagent set myvar_]> > Cheers,> Teerawat> > On 11/6/2007, "Nabila khedimi" 
> <[EMAIL PROTECTED]> wrote:> > >> >This is what I did, we can set a value to 
> the variable like you did but how to get its value, for printing for example> 
> > > >> To: [EMAIL PROTECTED]; ns-users@ISI.EDU> Subject: Re: [ns] access to 
> TCL instance variables> From: [EMAIL PROTECTED]> Date: Tue, 6 Nov 2007 
> 08:13:30 -0800> > > Hi Nabila,> > First of all, you need to bind your OTcl 
> class Agent/MyAgentOtcl to, for> example, MyAgent. Secondly, suppose you need 
> to access variable my_var_> of class MyAgent. You need to bind this variable 
> to the OTcl domain.> This can be done in the constructor:> > 
> MyAgent:MyAgent()> {> bind("my_var_", &my_var_);> }> > Then you will be able 
> to access varaible my_var_ from the OTcl domain:> > set myagent [new 
> Agent/MyAgentOtcl]> $myagent set my_var_ 10> > Good Luck> Teerawat> > On 
> 11/6/2007, "Nabila khedimi" <[EMAIL PROTECTED]> wrote:> > >> >> >Hi,How do we 
> access instance variables of a c++ class in tcl code I tried thefolowing: set 
> myagent [new Agent/MyAgentOtcl]# Set configurable parameters of 
> MyAgent$myagent set my_var1_otcl 4$myagent set my_var2_otcl 3.14$myagent 
> call-my-priv-funcset intvar 0set intvar [Agent/MyAgentOtcl my_var1_otcl] puts 
> "my_var1_otcl = $intvar" I have had this:my_var1_otcl= my_var1_otclthe name 
> instead of th value, what's the problem, neither set intvar $myagent 
> my_var1_otcl works Thanks for helpnabila> 
> >_> >Windows 
> Live Hotmail and Microsoft Office Outlook – together at last. Get it now.> 
> >http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033>
>  >> >_> >Boo! 
> Scare away worms, viruses and so much more! Try Windows Live OneCare!> 
> >http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
_
Help yourself to FREE treats served up daily at the Messenger Café. Stop by 
today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline


Re: [ns] a loop or a start and stop methods

2007-11-08 Thread Pedro Vale Estrela


You need to schedule a tcl proc which: 
a) does ping "send"  
b) reschedule itself for 1 second later

this is a simple 4 line TCL proc!

you can also do this in c++ only by using a timer object, for the same
purpose. This will require recompilation and c++ debugging.

Pedro Estrela
http://tagus.inesc-id.pt/~pestrela





> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Nabila khedimi
> Sent: quinta-feira, 8 de Novembro de 2007 18:16
> To: ns-users@ISI.EDU
> Subject: [ns] a loop or a start and stop methods
> 
> 
> 
> Hi,
> I want to execute a ping agent continuously during the simulation,
> regarding the schedular object in NS, is there any the difference between
> making a infinite loop inside the tcl code or define a start and a stop
> method inside the ping agent code(which is a c++ program)
> Thanks for help
> Nabila
>