LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 09-14-2017, 11:25 PM   #1
khanhcn
LQ Newbie
 
Registered: Sep 2017
Posts: 8

Rep: Reputation: Disabled
How to find Residual Energy of the nodes in ns2


Hi all,

I am writing a tcl script for WSN in NS-2. In my script, I want to summary residual energy of each nodes in trace file .tr

I have googled some sites, but i does not works. I have seen also some thread in this forum but answer is not clear.

http://slogix.in/how-to-find-residua...e-nodes-in-ns2

https://ns2research.wordpress.com/20...rgy-of-a-node/

I followed second link, declare in aodv.h and add code into aodv.cc

Code:
double OLSR::get_energy(nsaddr_t addr)
Code:
double OLSR::get_energy(nsaddr_t addr) 
{
Node* thisnode = Node::get_node_by_address(addr);
double energy ;
energy = thisnode->energy_model()->energy();
return energy;
}
In tcl scrip, I also declare EnergyModel. However, I don't know how to call this function in tcl script

Code:
$ns node-config   -energyModel "EnergyModel" \
                   -initialEnergy 3.4 \
                   -txPower 0.33 \
                   -rxPower 0.1 \
                   -idlePower 0.05 \
                   -sleepPower 0.03 \
set energy [new Agent/AODV] ???

Thanks,
Khanh CN
 
Old 09-15-2017, 07:21 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,354
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
Closed as duplicate, please use https://www.linuxquestions.org/quest...s2-4175613838/
 
1 members found this post helpful.
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
To find Residual Energy of nodes in OLSR protocol-NS-2.35 shelja.fet@mriu.edu.in Linux - Newbie 3 07-21-2016 07:43 AM
How to find residual a residual energy of a node in wireless network in ns2 pon Linux - Newbie 0 08-31-2014 10:44 AM
LEACH on ns2. Anyone know how to obtain residual network energy? linuxUser123linux Linux - Software 1 07-13-2013 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration