Hi,
You must have the mnode_ variable really pointing to the mobile node
associated to that agent.
For example for me, I defined a tcl command that I called "node" that
get's the node associates with the agent.
I added the following to the "command( )" method of my agent :
if (argc == 3)
if(strcmp(argv[1], "node") == 0) {
                        mnode_ = (MobileNode*) TclObject::lookup(argv[2]);
                        if(mnode_ == 0)
                                return TCL_ERROR;
mnode_ is declared as MobileNode *  in the .h file of my agent.

Then in my tcl script, after creating nodes and agents, I can do :

for {set i 0} {$i < $opt(nn) } {incr i} {
    set node_($i) [$ns_ node]       ;#nodes creation
}

for {set j 0} {$j < $opt(nn) } {incr j} {
    set clagent_($j) [new Agent/Clustering [$node_($j) node-addr] ]
;#agent creation
    $clagent_($j) node $node_($j)
}

Hope it's clear.
Bye.


On 4/21/06, mohamed yahia <[EMAIL PROTECTED]> wrote:
> Hi Hajer.
>
> please from where to call my function to get node position and node
> speed. i tried to call it from recv() function but it give me strange
> and same result for speed and x-position like this :
>
>
> The node speed is 6.78901e-316
>
> this is my code
> tell me what is wrong plz
>
>
> #include "common/mobilenode.h"
> void
> mytcpTcpAgent::node_speed()
> {
>
> MobileNode * mnode_;
> double speed = mnode_->speed();
> printf("The node speed is %g\n", speed);
> return;
>
> }
>
> kind regards
> Yahia
>
>
>  On Fri, 2006-04-21 at 12:25 +0200, Hajer FERJANI wrote:
> > Hi,
> > Do you mean by mobility the speed of a mobile node?
> > In this case, considering that -m and -M are the options to specify the
> > minimum and maximum speed of nodes (I don't remember well setdest options),
> > then setdest will dynamically assign to mobile nodes speed values ranging
> > from 1 to 6 m/s. If you look to the file generated by setdest, you'll see in
> > it commands like
> > "$node0 setdest X Y V" X and Y being future positions and V the speed of the
> > node.
> > Now, to get this value during simulation, you should have a pointer to
> > the MobileNode
> > instance of you agent (MobileNode * mnode_; ), then you can do :
> > double speed = mnode_->speed();
> >
> > Hope it helps.
> > Bye.
> >
> >
> >
> > On 4/20/06, www triste <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hello everybody
> > > i have a big probleme concerning mobility;i use setdest for generate a
> > > scenario,and i use v2
> > > setdest -v 2 -n 50 -s 1 -m 1 -M 6 -t 50 -P 1 -p 3.0 -x 1000 -y 1000
> > > in this case what is the value of mobility?
> > > please if it is possibile to calculate mobility,help me;thanks a lot
> > >
> > >
> > > ---------------------------------
> > > Faites de Yahoo! votre page d'accueil sur le web pour retrouver
> > > directement vos services préférés : vérifiez vos nouveaux mails, lancez 
> > > vos
> > > recherches et suivez l'actualité en temps réel. Cliquez ici.
> > >
>
>

Reply via email to