thank you very much for the immediate reply.. i want to use this real time energy value in my tcl code. is there a way to access this variable at a specified time by binding this value to any variable.
--- On Thu, 25/3/10, darkblue winnie <darkblue.win...@gmail.com> wrote: > From: darkblue winnie <darkblue.win...@gmail.com> > Subject: Re: energy of mobile node > To: "deepika jayakodi" <deep_...@yahoo.co.in> > Cc: ns-users@isi.edu > Date: Thursday, 25 March, 2010, 1:44 PM > I don't know what you exactly mean... > Energy is a dynamic value. It decreases throughout the > simulation process. > > If you just want to know the energy value, you can find it > in the trace file after the simulation... Almost every line > of packet log contains the energy details at that time. > > > > In my code, I would like to get the real time energy value > during runtime. > I use the following code to get the pointer to the > EnergyModel and then call its energy() function to get the > real time energy during runtime. > > > Tcl& tcl = Tcl::instance(); > //exec tcl command to get netif_ > sprintf(tcl.buffer(), "$node_(%d) set > netif_(0)", node_id); > tcl.eval(); > //lookup and find the network interface > > netif_ = (WirelessPhy *) > TclObject::lookup(tcl.result()); > if (netif_ == 0) { > fprintf(stderr, "Agent: lookup netif_ > failed.\n"); > } else { > energy_model = (EnergyModel *) > (netif_->node()->energy_model()); > > cout << "energy: " << > energy_model->energy() << endl; > > } > > > On Thu, Mar 25, 2010 at 3:33 AM, > deepika jayakodi <deep_...@yahoo.co.in> > wrote: > > > > > hii am implementing a project using ns2 and > require some help. i want to extract the energy value of > each node in my tcl script. i have used the enrgy model but > am not able to find how to access energy value of a node. > > > > thanks in advance.. Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! http://downloads.yahoo.com/in/internetexplorer/