AWK scripts (.awk), which are used to extract
the necessary information from trace files (.tr) are also useful to plot graphs
using Xgraph (.xgr) utility of NS-2. However, the AWK scripts that are used to
plot graphs differ from the AWK scripts that just print the values on the
terminal.
I will try to explain the
difference between these two types of AWK scripts with the help of an example. Assume
that we have designed a tcl script named “energy.tcl” which simulates a network
for 100 seconds. We run this tcl script with the following command:
ns energy.tcl
After executing the tcl script we get a trace
file (.tr) and a NAM file (.nam) i.e. “energy.tr” and “energy.nam”. Now we may have two scenarios as explained below:
1. We want the value of residual
(remaining) energy of a node at the end
of the simulation. (Here graph of Time v/s Residual energy is not required).
2. We want the value of residual (remaining) energy of
a node at each instance of time i.e
from beginning of the simulation to the end of the simulation. (Time v/s
Residual energy graph is required to observe the decrease in the total energy
of a node).
For both of the above mentioned
scenarios we need to design two different AWK scripts. However, the main logic
to calculate the residual energy will remain the same. Only the way we print
the values differs.
Let scen1.awk be the awk file for first scenario and scen2.awk be the awk file for second
scenario. scen1.awk should be designed such that when we run it by using the
following command:
awk
-f scen1.awk energy.tr
it should print the residual
(remaining) energy of a node on the terminal.
And scen2.awk should be designed
such that when we run it by using the following command:
awk -f
scen2.awk energy.tr >
energy.xgr
it should print two values in “energy.xgr”: time
and residual (remaining) energy of a node.
If you open “energy.xgr” you will
notice that there are two columns created. In first column, values related to “time”
are printed and in another column values related to “residual energy” are
printed. The values in first column form X-axis of the graph and the values in
second column form Y-axis of the graph (thus you get a graph of Time v/s
Residual Energy). Give the following command to see
the graph:
xgraph energy.xgr
Default background color of the
graph is grey. If you want a graph with background color as white, give the
following command:
xgraph energy.xgr
-bg white
Other options (like changing
background colors, plotting bar graphs, etc) related to Xgraph are available in
the pdf file given below:
Hope it helps.
Regards,
Mohit P. Tahiliani
[Latest Update] You can also check the latest Automated Post Processing (APP) Tool which works based on AWK Scripts and automatically plots the graphs.
Here is the link to APP Tool's blog post:
Related Blogs:
hi sir thanks for your previous helps. from your help i calculated throuhgput and average -end-to end-Delay(latency).but now i want to calculate jitter . iam giving some lines from tracefiles.
s 4.000000000 _0_ AGT --- 0 cbr 1000 [0.00 0 0] [energy 1000.000000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [0:0 3:0 32 0] [0] 0 0
r 4.000000000 _0_ RTR --- 0 cbr 1000 [0.00 0 0] [energy 1000.000000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [0:0 3:0 32 0] [0] 0 0
plz help me in writing awk script for jitter or r u having it plz mail me . my mail id is india3005@gmail.com
Dear Mohit
hello sir
i am working on the adhoc routing protocol ,i used the protocol olsr and MP-OLSR,
i runing your script awk four calculate the end to end delay but i have this error
Average End-to-End Delay = -nan ms
can you give me an example of olsr awk because it is not the same forme!
thanks in advance.
dear Mohit
hello sir
may name is hanane, can you tell me how i Study the impact of network density on the performance of protocols OLSR and MP-OLSR , means in the X axis of graphe i have the number of noeuds and the Y axisof graphe i have the end to end delay for example.
i have the script.tcl ,my problem is how to calculate the end to end delay by contribution number the of the noeuds ????
please sir help me
thanks in advances
sir, i'm working with clustering in DTN... can u send me the coding...
HI
I want to draw curves with NS2.34 under CentOS 6.2 Please there’s someone there can give me the script to realize this task I can not use the xgraph
thanks for your help
sir your blog has been very useful in our project for comparing the performance of routing protocols AODV, DSDV and DSR in MANET's. I needed awk script to calculate end to end delay and packet delivery fraction at every instance of time.i have downloaded end delay and packet delivery fraction from your blog.. can u plz tell me wht changes should i maketo these files.thanking you in advance..waiting for your reply.
@Bhagath Singh - You can get that information from the following link:
http://neo.lcc.uma.es/staff/jamal/vanet/?q=content/vanetmobisim-ns-2-simulator
and the ns-2 code for VDTP is available on the following link:
http://neo.lcc.uma.es/staff/jamal/techwork_eng.html
@Spyware - That site is down now!
@Guna - AODV finds the shortest path based on the number of hops. See the following tutorial to understand the code of AODV in ns-2:
www-npa.lip6.fr/~rehmani/aodv_v2.pdf
Details regarding NEMO in ns-2 are available on the following link:
http://www.arcst.whu.edu.cn/web_kongrs/nemo_sim.htm
@Delali - Patches related to congestion control protocols for WSN are not widely available for ns-2. However, if I come across any such patch, I will post it here. Meanwhile, you can get some help from the Appendix Section of the following Master's thesis:
http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CGoQFjAD&url=http%3A%2F%2F194.42.16.6%2Faction.php%3Fkt_path_info%3Dktcore.actions.document.view%26fDocumentId%3D5444&ei=H1CrT6TCIIHLrQeC3rG_AQ&usg=AFQjCNHLLgh8WW3fgtLFB4kcicLih_CVrg
@Nehal - There are many factors that might affect your simulation results. Ensure that you have designed the topology as described in the paper that you are using, e.g.: what is the transmission range used by the authors, type of propagation model, queue size, etc. Unless you design the similar topology, it is not possible to obtain similar results.
See the following link for setting transmission range:
http://140.116.164.80/~smallko/ns2/range_en.htm
@Ashish - The following tutorial will help:
www-npa.lip6.fr/~rehmani/aodv_v2.pdf
@Pothalaiah - You need to execute AWK script on every trace file one by one. To reduce the time, you may design a shell script to this task.
@Prav - No it is not correct. AWK script to calculate throughput is available on the following link:
http://mohittahiliani.blogspot.in/2010/02/few-more-awk-scripts-for-ns2.html
Hope it helps.
Regards,
Mohit P. Tahiliani
@Suvodeep - After unzipping, you must apply the patch by using "patch" command. After the patch has been successfully applied, you must give ./configure
@Rama - See Section X of Marc Greis tutorial on the following link:
http://www.isi.edu/nsnam/ns/tutorial/
@Kay - All the files have been made available for download from the following link:
http://www.mediafire.com/?z1c2cxdt1a31d
@Keepwalking - Your mechanism seems to be quite similar to LEACH. LEACH patch is available for ns-2.27. You can install that and make the necessary modifications.
@Suga - Sample TCL Scripts are available in the following directory which simulate WSN with 802.11
ns-allinone-2.xx/ns-2.xx/tcl/ex/wpan
@Sharad - AWK script to calculate delay can be downloaded from the following link:
http://www.mediafire.com/?z1c2cxdt1a31d
@Priyanka - First you need to run the AWK script and redirect the output to another file. Later the following command must be executed:
xgraph filename.xgr
@Smita - Unfortunately, the OLSR official site is down!
@Babar - Better to use the "rate_" parameter of CBR rather than "interval_"
For multimedia traffic, you can use a rate of 64Kb and packet size of 200 bytes for interactive voice traffic. 640Kb and a packet size of 840 bytes for video traffic (Ref.: TCP Evaluation tool Manual).
@Mani - Following link explains simulating malicious behavior with AODV. You can use the same procedure to do it for DSR:
http://elmurod.net/index.php/2009/10/24/adding-malicious-node-in-aodv/
@Pare - You can download the AWK scripts from the following link:
http://www.mediafire.com/?z1c2cxdt1a31d
TCL Script for energy is provided in the following directory:
ns-allinone-2.xx/ns-2.xx/tcl/ex
Name: wireless-newnode-energy.tcl
@Adarsha - Patch file is specific to a routing protocol. You can get few from the following link:
http://nsnam.isi.edu/nsnam/index.php/Contributed_Code
Hope it helps.
Regards,
Mohit P. Tahiliani
@Jk - AWK Script provided on this blog cannot be used to plot a graph. It can be used to get the average values.
@Praveen - 1. Use GOD (General Operations Director) object to find the inter node distance.
2. See Marc Greis tutorial Section XI.2
3. Count the number of lines that get printed with COL in trace file. COL represents a packet drop due to collision.
4. Use xgraph, gnuplot or excel as per your requirements.
5. Make changes in mac/mac-802_11.cc file and recompile ns-2
@Katahatiku - Just use "ZRP" instead of any other routing protocol in wireless TCL Script.
@Josna - Use Xgraph, gnuplot or excel to plot it. Graph can be Queue size v/s throughput or Queue size v/s No. of dropped packets.
@Ashish - Modify the "struct" of AODV packet in aodv.cc. Include the field name, its length and an inline function to access it.
@Bhupendra - Read the above blog carefully. I have tried to make it as simple as possible.
@Sushil - Simulating a malicious node with AODV has been explained on the following link:
http://elmurod.net/index.php/2009/10/24/adding-malicious-node-in-aodv/
@Asmi - All scripts have been shifted to the following link long time back:
http://www.mediafire.com/?z1c2cxdt1a31d
@Nithu - See the following link:
http://t-issariyakul.blogspot.in/2009/03/no-slot-error-for-classifiers.html
@Mcbain - genthroughput.awk cannot be used to plot graphs. It can be used only to get average values. Include an extra printf statement in genthroughput.awk within the loop so that it can be used to plot graphs.
@Jiya - Probably the trace file format will be different. Make sure you are using an AWK script corresponding to your trace file format. You can get some help from the following link as well:
http://140.116.164.80/~smallko/ns2/adhoc_routing.htm
@Engineer Ilyas - You can get some help from here:
http://t-issariyakul.blogspot.in/2010/07/segmentation-fault-common-error-in-ns2.html
Hope it helps.
Regards,
Mohit P. Tahiliani
@Meenakshi - There are different ways in which you can calculate jitter. For e.g. avgStats.awk provided on the following link provides 4 different ways in which you can calculate jitter. However, avgstats.awk works only for wired and new-trace format for wireless. The trace which you have posted shows that your trace format is an old one. Include the following line in your TCL Script
$ns use-newtrace
and then re-run it. After that you can use avgstats.awk to get the jitter values. Download trace2stats folder from the following link:
http://perso.citi.insa-lyon.fr/mfiore/data/trace2stats_v05b.tgz
@Hanane - Vary the number of nodes within the same area to study the impact of network density. To calculate the average end-to-end delay, you can use the AWK script provided in this blog. It is independent of the number of nodes. Make sure you use an AWK script with respect to your trace file format.
@Nisha - Get the code from here and follow the README file therein:
http://www.illuvatar.nu/ns-dtn/code/
@Nouran - Install gnuplot. It is a better tool to represent the results.
@Mitali - You need to cut the printf statement which appears in END part of the AWK script and paste it within the body of the AWK Script. Print two values separated by a tab - first one as time and second as the required parameter. Run the following command:
awk -f filename.awk filename.tr > filename.xgr
Later give
xgraph filename.xgr
or else you can also use gnuplot for better representation.
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello Sir,
while i tried to run ZRP the following error appeared
(_o14 cmd line 1)
invoked from within
"_o14 cmd addr"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o14" line 2)
(SplitObject unknown line 2)
invoked from within
"_o14 addr"
("eval" body line 1)
invoked from within
"eval $node addr $args"
("default" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
(procedure "_o3" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns_ node"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $opt(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
, please help me..
Regards
@Mustafa11 - After successfully applying the patch - Go in the following directory:
ns-allinone-2.xx/ns-2.xx/
and give the following command:
make install
Hope it helps.
Regards,
Mohit P. Tahiliani
hi there
am working on mobile wimax , and i want to simulate handover process
does any one have awk script for handover delay or packet drop
or any script related to handover
please any help will do
Sir
I need a awk script to calculate Normalized Mav Load.
Sanjeev
Thank you in advance for the favour and help
hello sir,
when i run zrp.tcl file in ns2.33 it shows the following error:
num_nodes is set 25
can't read "val(adhocRouting)": no such element in array
while executing
"$ns_ node-config -adhocRouting $val(adhocRouting) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(..."
(file "zrp.tcl" line 42)
i don't know how to set typos in node-config part
can u pls help me to sort out this problem...
hello sir, one more problem arises after sorting out the above
num_nodes is set 10
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
ns: Agent/ZRP set radius_: can't read "radius_": no such variable
(Object set line 1)
invoked from within
"Agent/ZRP set radius_"
pls help me to sort out this problem.
Hi
I work on online games with a client server architecture. the work required is to compraisser packets sent by the client which aims to optimize bandwidth.
I use the simulator ns2.34 Linux (CentOS 6.2), please is there someone who can give me the awk script that allows compraisser packages please help me what is urgent and thank you for your help
hi
I want to write an awk script that calculates the total bandwidth between two nodes. I work on wired networks with a simulator NS 2.34.
I use an architecture multianneau and I want to calculate bandwidth between two nodes even ring source and destination then I want to calculate bandwidth, but this time the destination node belongs to another ring.
please is there someone who can help me to write the awk script that calculates the total bandwidth and thank you for your help
hii praveen did u get the awk script for HOW TO ASSIGN RANDOM SPEEDS TO THE NODES ? (A SINGLE NODE MOVING WITH DIFF SPEEDS AT DIFF TIMES) ?
can u share with me
pls mail at wcn802@gmail.com
regards
thak u sir for your reply.sir v r not getting the output for delay n pdf,is there some other way to do that?
can you help me I have an error when I execute the commande xgraph AODV.xgr
Error in file `AODV.xgr' at line 1:
Cannot read second coordinate
and when I open AODV.xgr I have only one colomn
hii, i m using ns-2.35 & working on improving energy efficiency of tora protocol. i have used the awk script provided on this log but it does not generate any vale in .xgr file, the .xgr file generated is blank... Please help me to solve this problem..
Thanks & regards
VMK
@Hamzah - I believe you can take the AWK Scripts provided in this blog and modify them according to your requirement. For measuring the handover delay, you may use the binding update packets which get printed in the trace file.
@Sanjeev - You can download it from the following link:
http://mohittahiliani.blogspot.in/2011/08/awk-scripts-for-normalized-routing.html
@Neha - Make sure the syntax "radius_" is correct. e.g. "_" must be there or not.
@Nouran - I have not come across such a design yet. Will post it here if any information is found.
@Ram - I think you need a TCL Script to do that. AWK script wont be useful for designing a scenario.
@Mitali - What is the error that you get with delay and pdf?
@Hasna - You should have 2 columns in your .xgr file. Did you modify AWK Script so that it prints according to a format required by Xgraph?
@VMK - AWK Scripts provided on this blog will not help you to plot graphs. They can be just used to obtain the values on the terminal. You need to modify them as explained above so that you can plot graphs.
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello sir,
Can you give a sample code to do make a Cluster...I'm searching it for months now.Please can anyone help me by providing some codes.
Thanks in advance!!!
hello sir,
i m working on selective forwarding attack. pls send me some coding regarding this attack
#Create a simulator object
set ns [new Simulator]
#Open the NS data file for excel
set nf [open out.nam w]
set INCREMENT 0.2
set STOP 20
set PacketSize1 1024
set PacketSize3 1024
set LINK_BW 2mb
set LINK_LATENCY 10ms
set QUEUE_SIZE 30
#Define a 'finish' procedure
proc finish {} {
global nf
close $nf
exit 0
}
proc CalculateThroughput {} {
global tcp1 tcp3 ns nf
global INCREMENT
set tcpBW1 [$tcp1 set ack_]
set tcpBW3 [$tcp3 set ack_]
set now [$ns now]
set d [expr $now - 0.1]
set Throughput1 [expr $tcpBW1/$d * 8 * [$tcp1 set packetSize_]/1024]
set Throughput3 [expr $tcpBW3/$d * 8 * [$tcp3 set packetSize_]/1024]
#puts "$now $Throughput1 $Throughput3"
puts $nf "$now $Throughput1 $Throughput3"
$ns at [expr $now + $INCREMENT] "CalculateThroughput"
}
#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n1 $LINK_BW $LINK_LATENCY DropTail
#Set Queue Size of link (n0-n1) to 10
$ns queue-limit $n0 $n1 $QUEUE_SIZE
#Give node position (for NAM)
$ns duplex-link-op $n0 $n1 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n0 $n1 queuePos 0.5
#Setup a TCP connection 1
set tcp1 [new Agent/TCP/Reno]
$tcp1 set packetSize_ $PacketSize1
$ns attach-agent $n0 $tcp1
set sink1 [new Agent/TCPSink]
$ns attach-agent $n1 $sink1
$ns connect $tcp1 $sink1
$tcp1 set fid_ 1
#Setup a TCP connection 3
set tcp3 [new Agent/TCP/Reno]
$tcp3 set packetSize_ $PacketSize3
$ns attach-agent $n0 $tcp3
set sink3 [new Agent/TCPSink]
$ns attach-agent $n1 $sink3
$ns connect $tcp3 $sink3
$tcp3 set fid_ 3
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ftp1 set type_ FTP
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
$ftp3 set type_ FTP
#Schedule events for the CBR and FTP agents
$ns at 0.1 "$ftp1 start"
$ns at 0.1 "$ftp3 start"
$ns at $STOP "$ftp3 stop"
$ns at $STOP "$ftp1 stop"
$ns at $INCREMENT "CalculateThroughput"
#Call the finish procedure
$ns at [expr $STOP + 0.5] "finish"
#Run the simulation
$ns run
im not getting anythng on execution of this tcl script
please do you have a link to an aodv.tcl file that is working?
and can be used to process large traffic files generated using the cmu cbr n scen generator???
thanks for your help
@Vino - Cluster formation for which type of a network?
@Mini Yadav - Sorry, havent worked with that! Will post the details if anything found.
@Param - What is the error that you are getting?
@Abubakar - The following link will help you:
140.116.164.80/~smallko/ns2/adhoc_routing.htm
Hope it helps.
Regards,
Mohit P. Tahiliani
from where i can get the full code essential for running dsr protocol? plesae help me as soon as possible...Thank you...
@Poushali - C++ code of DSR is available in the following directory:
ns-allinone-2.xx/ns-2.xx/dsr
The TCL Syntax for running DSR is
set val(rp) DSR
But make sure you also include this line
set val(ifq) CMUPriQueue
instead of
set val(ifq) Queue/DropTail/PriQueue
Hope it helps.
Regards,
Mohit P. Tahiliani
hello sir.......am doing work on sinkhole attack detection in wsn using LQI MESH TOPOLOGY.......do yo have any idea how to create routing and link cost table in DSDV.....plzzz send me the details fr this........
@Sapna - The following tutorial may be of some use to you because creation of table is similar in almost all protocols, except for the field types:
http://www-npa.lip6.fr/~rehmani/aodv_v2.pdf
Hope it helps.
Regards,
Mohit P. Tahiliani
sir i am a beginner in ns2
i have been assigned the task to calculate average number of packets in the system,average time spent by a packet in the system and average number of packets waiting in the queue while using queuing models and udp with cbr.Please provide me with the desired awk files to do so for a wired network.
hello Mohit
i got divide by zero attempted every time for every trace file with ur awk code please help me
***************
N.Venkatadri
nagala.venkat@gmail.com
hello mohit, i go through the awk scripts provided by u and apply
these scripts for my ns2 trace files but every time i got
"divisioin by zero attempted" for every my trace files
please help me
********
N.venkatadri
can i have the tcl script for comparing any two topologies along with x-graph(star &ring if possible)
Hello Sir,
I need your help in generating TCL script for comparision of two topologies in NS2
@Radhika - I would recommend you to use "TCP Evaluation Suite" for calculating all those parameters. Try installing it and you are almost done because it provides a lot inbuilt facilities for extracting results.
@Venkat - May be you have to make some changes according to your TCL set up. Suppose if you are using UDP instead instead of TCP, please replace
$7 == "tcp"
by
$7 == "tcp" || $7 == "cbr"
and re-run the AWK Script.
Similarly, if your packet size is less than 512 bytes - make those corrections in AWK scripts and re-run. It would work fine! (assuming your trace file is of old format for wireless networks).
@Sajan - Use the TCL Script generator provided on the following link:
http://mohittahiliani.blogspot.in/2009/10/tcl-script-generator.html
Hope it helps.
Regards,
Mohit P. Tahiliani
hi sir,
i am working on associativity based routing protocol and i want to make it scalable so i need the tcl code for this. so please help me
thanks and regards
@Mahesh - To make a routing protocol scalable - you will have to focus more on its Core design. TCL script is just used for designing the required scenario. You can a standard TCL script provided on the following link for your work:
http://140.116.164.80/~smallko/ns2/adhoc_routing.htm
By using the procedure mentioned in the above link - you can generate as many scenarios as you want.
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello, i liked your post very much it gives me an idea for my project. Can you please upload the files used above again coz the links to them are not working. I would really appreciate your help.
-Urmi
@Urmi - I cross checked all the links. They are working fine. Please let me know which link(s) are not working so that I can correct them.
Regards,
Mohit P. Tahiliani
mmm actually i could'nt find links to the above mentioned files ie energy.tc scen1.awk etc plz can u mention the link in the comment.
thnx
-Urmi
and the link given here for the energy consumption is not working..
http://mohit.ueuo.com/AWK_Scripts.html
@Urmi - The above mentioned filenames are just used for explaining the concept. There are no such specific files designed. You can alternatively use "wireless-newnode-energy.tcl" which is provided in the following directory:
ns-allinone-2.xx/ns-2.xx/tcl/ex
You can find almost all AWK Scripts (including the one for energy) on the following link (keep visiting this link for updates):
http://www.mediafire.com/?z1c2cxdt1a31d
NOTE: Modify energy.awk as per your requirement. The script provided on the above link is designed for my scenario.
Hope it helps.
Regards,
Mohit P. Tahiliani
Thnx alot...
There is an example in ns2/ex/pgm. Please can you tell me how can i usse the energy model there. I am able to use it in DSDV, AODV etc but really stuck in this one.
@Urmi - Energy model is mainly required while working with Wireless scenarios. Whereas all the files in ns-2/tcl/ex/pgm correspond to Wired networks. I wonder why you need Energy model in Wired networks as they are not energy constrained.
Hope it helps.
Regards,
Mohit P. Tahiliani
ok actually i wanted to compare two wireless multicast protocols for energy efficiency. One is that i got, PUMA but i could not find any other i think MAODV is one but i am not able to run it. I have proficiency in c but with TCL and awk iam a begginer.Please can you suggest something.
Thnx
-Urmi
@Urmi - Yes, PUMA is available by default in ns-2.35. A script for the same is also provided in ns-2/tcl/ex.
Apart from MAODV - you can also take a look at CPUMA which is designed for MANETs and is based on PUMA. CPUMA's source code for ns-2.33 is available on the following link:
http://sourceforge.net/projects/cpuma/
Regarding MAODV:
MAODV's patch for ns-2.26 is available. Following are some useful links:
http://kunz-pc.sce.carleton.ca/Thesis/maodv-code.zip
http://kunz-pc.sce.carleton.ca/Thesis/maodv-scripts.zip
http://kunz-pc.sce.carleton.ca/Thesis/maodv-ns-2.26.pdf
and step by step installation procedure is explained on the link given below:
http://rahimanuddin.wordpress.com/2010/03/01/maodv-simulation-in-ns-2/
You can also try installing this code on ns-2.35, however, it needs to be done manually and line by line. Sample TCL scripts are also provided on the links above which you can use for your reference once the MAODV patch is applied to your ns-2.
Hope it helps.
Regards,
Mohit P. Tahiliani
I'm using ns2 for my project... I tried to execute xgraph and i got error in that..
awk -f delay.awk out.tr > out.xgr
xgraph out.xgr
Error is,
Error in file 'out.xgr' at line 3: Unknown line type
Problems found with input data
@Jothi Rajan - Did you ensure that delay.awk produces output in the format as desired by xgraph? Generally, the delay.awk should be designed such that it produces the output in two columns. Two columns correspond to X-axis and Y-axis.
Hope it helps.
Regards,
Mohit P. Tahiliani
hai sir,
I'm not cleared... Can u please give me sample program
@Jothi Rajan - I dont have one with me right now. You can download some of the AWK Scripts from the following link and modify them as explained above in my blog:
http://www.mediafire.com/?z1c2cxdt1a31d
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello sir,
Sorry for asking the same doubt again i understood what u have told.....
But while executing the delay program we will get only the delay of the packets na... but you are saying that we need to get in x-axis and y-axis (ie) simulation time vs delay is it right..
my doubt is how we get time while executing awk -f delay.awk > out.xgr ...... Please reply me sir these may be silly questions to you but as a beginner i'm confused with this concept for two days
@Jothi Rajan - Time is indicated in the 2nd column of the trace file. Hence, when you print $2 from your AWK Script - it will print the time.
You need to modify the printf statement in delay.awk. Presently, it is printing only one value i.e. delay. Modify it to print two values i.e. time and delay.
Example: printf("%d\t%d\n", $2, delay);
where, "$2" in the above statement refers to time and "delay" is a variable that keeps track of average end to end delay.
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello sir,
Thank you for your reply.......... My another ques is i found some codings in your blog to find total packet sent , received , dropped and so on....... Is these are to be used for all packet transmission program to find the sent, received, dropped packets? If yes means how we execute it....
My another query is,
I'm getting error while executing throughput awk script as,
Begin {
'in expression:1: ^ invalid char'
please rectify this too
Thnx 4 replying, now as you said i should try CPUMA i downloaded the code but iam using ns-2.35. is there a way to patch it on ns-2.35?? or should i download ns-2.33 but then iam not sure whether PUMA will work on that???
plz guide me through this.
-Urmi
@Jothi Rajan - Your first query is not clear to me. Execution of all AWK Scripts is same as mentioned above in the blog.
Regarding calculation of throughput:
I recommend you to use "genthroughput.awk" provided on the link given below to calculate throughput.
http://mohittahiliani.blogspot.in/2010/02/few-more-awk-scripts-for-ns2.html
Note that "genthroughput.awk" works only for old trace file formats. If you have a new trace file format, use "throughput_newtrace.awk" provided on the link below:
http://mohittahiliani.blogspot.in/2010/03/awk-script-for-ns2-supporting-new-trace.html
@Urmi - PUMA's patch for ns-2.33 is available on the following link:
http://nsnam.isi.edu/nsnam/index.php/Contributed_Code#Multicast
The patch is provided by the same author who has integrated PUMA in ns-2.35
Hope it helps.
Regards,
Mohit P. Tahiliani
Hai sir,
Thank u for ur reply...... Please tell me whether there is a diff between 802.11 MAC and 802.11 MAC DCF (CSMA/CA)........ What is their difference and how they differ in codings.....
Whether MAC DCF is available as inbuilt coding or we need to add some lines codings to the MAC........
Sir I had also tried ur throughput awk script but it getting the same error........
Solve my problems
Hai sir ,
Please answer to this ques too.... I saw total number of sent packet awk script in ur blog in that coding u mentioned node_id as 0 to 6...... Is these are id's of the 6 nodes. If yes means then how i calculate sent packet of about 50 nodes for tcp.........
@Jothi - Yes, 802.11 MAC DCF is available in ns-2 by default. I recommend you to take a look at the ns-2 manual for more details on 802.11 MAC and its different types implemented in ns-2. Section 16.3 gives a brief idea about that. See the following link of ns-2 manual:
http://www.isi.edu/nsnam/ns/doc/node193.html
Regarding throughput calculation:
Please do not use throughput.awk. Use "genthroughput.awk" Get it from the following link:
http://www.mediafire.com/?z1c2cxdt1a31d
If you still get errors, then the problem may be because either you are using a new trace format or the packet size in your simulation is less than 512 bytes. If you are using new trace format then use "throughput_newtrace.awk" provided on the link given above. If your packet size is less than 512 bytes - replace 512 in AWK scripts with your packet size.
For calculating total sent packets of 50 nodes:
Use "pdf.awk". It gives information about total sent, total received, total forwarded, etc. You can download it from the same mediafire link given above.
Hope it helps.
Regards,
Mohit P. Tahiliani
Hello sir,
Thank u very much for ur quite reply......... My another ques is i'm using ns2 in red hat linux through vmware workstation.... Is there any different format for executing xgraph for linux.... Because i had tried executing xgraph as u mentioned in ur blog but i'm still getting the same error as i mentioned u earlier... Please reply for this too
@Jothi Rajan - The command to execute xgraph remains same, irrespective of the operating system used. Try to run "xgtest.xg" which is available in the following directory:
ns-allinone-2.xx/xgraph-x.x/examples
The command to execute is: xgraph xgtest.xg
Check whether you get a graph or not. If not, probably xgraph is not installed properly on your machine.
Hope it helps.
Regards,
Mohit P. Tahiliani
i tried to patch ns-2.35 with CPUMA and then i re installed ns 2.35 but when i run the code it gives the following error
num_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
invalid command name "Agent/CPUMA"
while executing
"Agent/CPUMA create _o17 0"
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Agent/CPUMA [$node node-addr]"
(procedure "_o3" line 2)
(Simulator create-cpuma-agent line 2)
invoked from within
"$self create-cpuma-agent $node"
("CPUMA" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
CPUMA {
set ragent [$self create-cpuma-agent $node]
}
PUMA {
set ragent [$self create-puma-agent $node]
}
DSDV {
set ra..."
(procedure "_o3" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node"
("for" body line 2)
invoked from within
"for {set i 0} { $i < $val(nn) } { incr i } {
set node_($i) [$ns node]
}"
in the tcl file i just replaced PUMA with CPUMA
i.e.
set val(rp) CPUMA
$ns node-config -adhocRouting $val(rp) \
am id oing it wrong?? Plz help. Thnx
-Urmi
Hi Mohit,
I use NS2.34 in Linux from wired network.
I want to calculate the end to end delay and packet loss
with awk scripts to realize graphs please help me if possible
Sir please help me with my last question..m stuck with my project..
-Urmi
@Urmi - I have not worked with CPUMA but I guess the changes that you have done are correct because thats the general syntax of executing any routing protocol. But still I would recommend you to see sample TCL script (if provided in the downloaded code) for the exact syntax of running CPUMA.
Another thing you can try is: Go in ns-allinone-2.xx/ns-2.xx and give the following command:
make install (you need to be in root mode to execute this command)
then try running the TCL script again.
@Nouran - Download the AWK scripts from the following link:
http://perso.citi.insa-lyon.fr/mfiore/data/trace2stats_v05b.tgz
Follow the instructions given in the README file to get results.
Hope it helps.
Regards,
Mohit P. Tahiliani
is there any other multicast routing protocol in ns2 that i can use???
@Urmi - No, as far as I know, PUMA is the only multicast routing protocol for wireless networks available by default in ns-2.
Hope it helps.
Regards,
Mohit P. Tahiliani
To study multicast protocols for energy efficiency, suppose i have k number of nodes now i do simulation with two protocols on the same scenario. Now how do i see which one is a better one?? Do i calculate residual energy of each nodes?? or how do i proceed??
P.S i got the cpuma working thnx alot for your guidance.
hello Mohit P. Tahiliani Sir, I have done my simulation. i have generated dsr50_100 and scen50_100 and traffic files. Now how can i generate results for dynamic source routing from this . Actually i am doing M.tech and i have to submit my thesis on dsr perfermonce i have to generate result for this. i have done experiment but i don't know what results can be shown for dynamic source routing
hello sir, i am doing My m.tech thesis in dynamic source routing protocol performance analysis. Sir i have done simulation experiment in ns2. now i have generated these files from simulations /home/ankit/Desktop/my-experiment/dsr50_100
/home/ankit/Desktop/my-experiment/dsr50_200
/home/ankit/Desktop/my-experiment/dsr50_300
/home/ankit/Desktop/my-experiment/dsr50_400
/home/ankit/Desktop/my-experiment/dsr50_500
/home/ankit/Desktop/my-experiment/scen50_100
/home/ankit/Desktop/my-experiment/scen50_200
/home/ankit/Desktop/my-experiment/scen50_300
/home/ankit/Desktop/my-experiment/scen50_400
/home/ankit/Desktop/my-experiment/scenscen50_500
/home/ankit/Desktop/my-experiment/dsr50_100
/home/ankit/Desktop/my-experiment/dsr50_200
/home/ankit/Desktop/my-experiment/dsr50_300
/home/ankit/Desktop/my-experiment/dsr50_400
/home/ankit/Desktop/my-experiment/dsr50_500
/home/ankit/Desktop/my-experiment/scen50_100
/home/ankit/Desktop/my-experiment/scen50_200
/home/ankit/Desktop/my-experiment/scen50_300
/home/ankit/Desktop/my-experiment/scen50_400
/home/ankit/Desktop/my-experiment/scen50_500
/home/ankit/Desktop/my-experiment/traffic_10_4
/home/ankit/Desktop/my-experiment/traffic_20_4
/home/ankit/Desktop/my-experiment/traffic_30_4
/home/ankit/Desktop/my-experiment/traffic_40_4
/home/ankit/Desktop/my-experiment/traffic_50_4
now i am confused which results i have to shown for final work from these files and which parameters i have to take from these files for final results for dsr thesis. sir please help me
@Urmi - Design a scenario according to your application requirements. First run it with one protocol and take down the results. Then run the same scenario with another protocol and again take down the results. Now compare both the results and conclude.
@Surya - Once you have completed running the simulation - use parameters such throughput, delay, packet loss, routing load, residual energy, etc to analyze the behavior of DSR. AWK scripts of almost all these parameters are available in this blog.
Hope it helps.
Regards,
Mohit P. Tahiliani
I did a simulation using PUMA and i am gettin number of dropped packets as 0. That is a very ideal situation is there any parameter to control it??
Thnx
@Urmi - Try designing a different scenarios. Eg.: vary the speed of the nodes, increase or decrease the density of nodes, vary the number of multicast receivers, etc. It is not that PUMA will behave equally well in all the scenarios.
Hope it helps.
Regards,
Mohit P. Tahiliani
hello sir
i m beginner for NS2.35 can u send me link for manual of tcl scripting
@Pratik - You can find links of most of the ns-2 tutorials on the following link. Start from the first link. Links are arranged in the order of complexity starting from the easiest first.
http://wing.nitk.ac.in/tutorials/
Hope it helps.
Regards,
Mohit P. Tahiliani
Sir,
How to extract a particular trace file data to a data file using awk..
Thanks in advance..
Sir,
I am doing project on 'An Optimal Key Distribution Scheme for Secure
Multicast Group Communication'. here i need to create a group and want to share key among valid members. that key is to be encrypted and decrypted by using the algorithm given in paper.
Plz can u guide me in this project.How all the things can be done.
Thanks ..
sir,
i need packet delivery ratio,latency in perl script sir.
what are the changes i have to male in throughput.pl file.
sir,
I'm doing my final year project in secure on-demand routing protocol using friendship mechanism
so in that i want packet delivery ratio analysis (xgraph) source code for both routing protocols: AODV and DSR
I'm doing my final year project on secure on-demand routing protocol using friendship mechanism
so in that i want packet delivery ration analysis (xgraph) source code for both routing protocols: AODV and DSR
Sir
I am working on project on LR-WPAN-802.15.4 and want to calulate
1.battery energy consumption
2. and Residual life-time of nodes.
Plz help me with relevant AWK scripts.
Good Morning Mohit Sir
How to use VOIP application in ns2.35 for MANET for my master project.
Hi Mohit Sir
I was patching ns2.34 with voip. But it is giving the following error
------------------------------------------------------
patching file voip/voip_source.h
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 6897:
[root@localhost ns-2.34]#
----------------------------------------------------
Please help me. I am doing my masters project.
I am using the patch file from the following link
http://cng1.iet.unipi.it/wiki/index.php/Ns2voip++
Thanks in advance.
hello sir,
I am working on MAC protocols for WSNs in ns2.34 and new to this. I have tried to add a new protocol which i got over the internet. But am getting errors when i use "make" command.
Can i get steps to add a protocol to existing ns2.
Thanks.
Akshay
hi sir,
i want to access the destination sequence numbers of the routes that are discovered during AODV protocol,and store them to manipulate further can u plzz help me with it how and where can i get it?
hi sir this is punith .... i attended the ns-2 workshop in acharya college banglre .... sir please tell me the steps for cloning of AODV protocol
hello
can u provide awk script for calculating energy consumption...
Thanks
Akshay
hi sir,
can u pls help with it....
when working with awk scripts to find out pdf.awk etc, how can we write the output into a file?? like along with printing the output in terminal,i even want to write it in a file?? pls help..
I am Sreekanth Vakati doing my M.Tech in Andhra Pradesh. I am doing a project on MANET routing protocols.I have got some results like Packet delivery Ratio ,Routing Overhead,and Avg End-to-End Delay.I have got these results from Trace file run in the java parsetrace file.In my base paper the author calculated the Node Throughput.I dont have any idea to calculate throughput.Somebody told me that some awk files will be available in the net and run them in terminal,i have downloaded awk file and i don't know how to run it in Linux, if anybody know how to calculate the node throughput kindly give me the reply.
Good work Mohit sir this blog is very nice for a Person doing a project on NS2
One of my friends told me about your blog
its great
I am getting error invalid command name "Agent/GPSR" while executing "Agent/GPSR set bdesync_ 0.5 " file my.tcl line 3.
please suggest solution its urgent as I have to submit my Phd thesis
Vaishali khairnar
email khairnar.vaishali3@gmail.com
Hi Sir,
I use NS2 in linux multicast trafic wired network, I get the following trace file:
+ 0.16 0 1 cbr 300 ------- 0 0.1 -2147483648.0 12 12
- 0.16 0 1 cbr 300 ------- 0 0.1 -2147483648.0 12 12
r 0.1616 0 7 cbr 300 ------- 0 0.1 -2147483648.0 0 0
+ 0.1616 7 0 prune 80 ------- 30 7.0 0.0 -1 13
- 0.1616 7 0 prune 80 ------- 30 7.0 0.0 -1 13
+ 0.165 0 12 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 12 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 9 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 9 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 7 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 7 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 2 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 2 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 1 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 1 cbr 300 ------- 0 0.1 -2147483648.0 13 14
r 0.1666 0 7 cbr 300 ------- 0 0.1 -2147483648.0 1 1
+ 0.1666 7 0 prune 80 ------- 30 7.0 0.0 -1 15
- 0.1666 7 0 prune 80 ------- 30 7.0 0.0 -1 15
+ 0.17 0 12 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 12 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 9 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 9 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 7 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 7 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 2 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 2 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 1 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 1 cbr 300 ------- 0 0.1 -2147483648.0 14 16
r 0.1716 0 7 cbr 300 ------- 0 0.1 -2147483648.0 2 2
+ 0.1716 7 0 prune 80 ------- 30 7.0 0.0 -1 17
- 0.1716 7 0 prune 80 ------- 30 7.0 0.0 -1 17
+ 0.175 0 12 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 12 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 9 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 9 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 7 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 7 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 2 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 2 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 1 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 1 cbr 300 ------- 0 0.1 -2147483648.0 15 18
r 0.1766 0 7 cbr 300 ------- 0 0.1 -2147483648.0 3 3
+ 0.1766 7 0 prune 80 ------- 30 7.0 0.0 -1 19
- 0.1766 7 0 prune 80 ------- 30 7.0 0.0 -1 19
+ 0.18 0 12 cbr 300 ------- 0 0.1 -2147483648.0 16 20
- 0.18 0 12 cbr 300 ------- 0 0.1 -2147483648.0 16 20
+ 0.18 0 9 cbr 300 ------- 0 0.1 -2147483648.0 16 20
Please if you can I want an explanation of the trace file and script awk to calcul end to end delay.
thank you very much.
Hi Sir,
I use NS2 in linux multicast trafic wired network, I get the following trace file:
+ 0.16 0 1 cbr 300 ------- 0 0.1 -2147483648.0 12 12
- 0.16 0 1 cbr 300 ------- 0 0.1 -2147483648.0 12 12
r 0.1616 0 7 cbr 300 ------- 0 0.1 -2147483648.0 0 0
+ 0.1616 7 0 prune 80 ------- 30 7.0 0.0 -1 13
- 0.1616 7 0 prune 80 ------- 30 7.0 0.0 -1 13
+ 0.165 0 12 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 12 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 9 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 9 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 7 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 7 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 2 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 2 cbr 300 ------- 0 0.1 -2147483648.0 13 14
+ 0.165 0 1 cbr 300 ------- 0 0.1 -2147483648.0 13 14
- 0.165 0 1 cbr 300 ------- 0 0.1 -2147483648.0 13 14
r 0.1666 0 7 cbr 300 ------- 0 0.1 -2147483648.0 1 1
+ 0.1666 7 0 prune 80 ------- 30 7.0 0.0 -1 15
- 0.1666 7 0 prune 80 ------- 30 7.0 0.0 -1 15
+ 0.17 0 12 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 12 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 9 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 9 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 7 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 7 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 2 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 2 cbr 300 ------- 0 0.1 -2147483648.0 14 16
+ 0.17 0 1 cbr 300 ------- 0 0.1 -2147483648.0 14 16
- 0.17 0 1 cbr 300 ------- 0 0.1 -2147483648.0 14 16
r 0.1716 0 7 cbr 300 ------- 0 0.1 -2147483648.0 2 2
+ 0.1716 7 0 prune 80 ------- 30 7.0 0.0 -1 17
- 0.1716 7 0 prune 80 ------- 30 7.0 0.0 -1 17
+ 0.175 0 12 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 12 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 9 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 9 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 7 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 7 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 2 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 2 cbr 300 ------- 0 0.1 -2147483648.0 15 18
+ 0.175 0 1 cbr 300 ------- 0 0.1 -2147483648.0 15 18
- 0.175 0 1 cbr 300 ------- 0 0.1 -2147483648.0 15 18
r 0.1766 0 7 cbr 300 ------- 0 0.1 -2147483648.0 3 3
+ 0.1766 7 0 prune 80 ------- 30 7.0 0.0 -1 19
- 0.1766 7 0 prune 80 ------- 30 7.0 0.0 -1 19
+ 0.18 0 12 cbr 300 ------- 0 0.1 -2147483648.0 16 20
- 0.18 0 12 cbr 300 ------- 0 0.1 -2147483648.0 16 20
+ 0.18 0 9 cbr 300 ------- 0 0.1 -2147483648.0 16 20
Please if you can I want an explanation of the trace file and script awk to calcul end to end delay.
thank you very much.
Dear friends, excuse me anyone may help me by sending me awk script to calculate the routing overhead from the trace file of zone routing protocol(ZRP).
Thanks
hi sir,am trying to install xgraph but getting errors.will you please help me regarding this.
and one more thing that if you have a code for the wsn please send it to me on arjunrv0304@gmail.com
i need a energy program for wireless sensor networks and to calaculate energy efficiency
Hi everyone,
As a part of my project, I have made two more entries named Flag 1 and
Flag 2 in the existing neighbor table in aodv. Whenever a node X receive a
request from node Y, Flag 1 corresponding to Y will get set as "1". I want
to calculate the total number of entries in the neighbor table
corresponding to node Y, and the number of 0's set for the flag of Y out of the total number of entries. How can I access/ do this from the existing
neighbor table? Anyone who knows about this please help me. It was really
urgent for my project.
Thanks in advance
Sir, Most of the above links are not working..! From where i can get awk script to calculate the energy efficiency..! Please Help..!
hiii when m runni g xgraph i getting d error
"Parameter LabelFont: can't translate `helvetica-10' into a font (defaulting to `fixed
how to resolve???
should i need to dwnload smthng??i m using redhat linux 5 and ns2.35
dear sir,
can you tell me how to calculate residual energy of the node in ns2 ..how i can write tcl script for that.
Dear Mohit,
I want to know how to calculate reliability i.e. % of number of nodes that received data at the end of simulation in VANET new trace format of ns2.34
Hi sir... i am doing my master degree project now. i cant view graph wen i use this command xgraph out.xgr. i got error as following...
Error in file `out.xgr' at line 1:
Unknown line type
Problems found with input data.
could u plz tell me ,why it is not working?
respected sir ,
my tr file format is
s -t 2.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 23.24 -Ny 97.63 -Nz 0.00 -Ne 10.000000 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.0 -Id 9.0 -It cbr -Il 210 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 1
r -t 2.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 23.24 -Ny 97.63 -Nz 0.00 -Ne 10.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.0 -Id 9.0 -It cbr -Il 210 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 1
but my awk code does not work
awk code is
BEGIN {
droppedAODVPackets=0;
sends=0;
recvs=0;
# highest packet id can be checked in the trace file for an approximate value
highest_packet_id =500000;
sum=0;
AODV_Adv=0;
}
{
action = $1;
time = $2;
node_1 = $3;
node_2 = $4;
src = $5;
# For stand alone ad hoc trace files:
# if ( packet_id > highest_packet_id ) highest_packet_id = packet_id;
# For wired- and cireless trace files.
if ($5 =="cbr") {
packet_id = $12;
} else {
packet_id = $6;
}
#============= CALCULATE DELAY =========================================
# getting start time is not a problem, provided you're not starting
# traffic at 0.0.
# could test for sending node_1_address or flow_id here.
if ( start_time[packet_id] == 0 ) start_time[packet_id] = time;
# only useful for small unicast where packet_id doesn't wrap.
# checking receive means avoiding recording drops
if ( action != "d" ) {
if ( action == "r" ) {
# could test for receiving node_2_address or flow_id here.
end_time[packet_id] = time;
}
} else {
end_time[packet_id] = -1;
}
#============= CALCULATE PACKET DELIVERY FRACTION============================
# $3 = source node id , here I have 4 source nodes and start my analysis after
490 seconds of simulation (when traffic started)
if (( $1 == "s") && ( $7 == "cbr" ) && ( $4
=="AGT" ) && ( ( $3== "_5_" ) || ( $3==
"_6_" ) || ($3=="_7_") || ($3=="_8_")
)&& ($2 > 490.00 ) ) {
sends++;}
# $4 = destination node in wired segment of network. if you simulate ad hoc only
scenario the change $4 to $3 and %5 to $7.
if ( ( $1 == "r") && ( $5 == "cbr" ) && (
$4 == "0" ) && ($2 > 490.00 ) ) {
recvs++;}
pdf = (recvs/sends)*100;
#==================== ADVERTISEMENTS ==================
if ( (($1=="f") || ($1=="s") ) && ($4 ==
"RTR") && ($7 =="AODV" ) && ($2 > 490.00
) ) {
AODV_Adv++;
}
#============= DROPPED AODV PACKETS ========================================
if ( ($1 == "D") && ($7=="cbr") && ($2 >
490.00 ) ){
droppedAODVBytes=droppedAODVBytes+$8 ;
droppedAODVPackets=droppedAODVPackets+1;
}
}
END {
for ( packet_id = 0; packet_id <= highest_packet_id; packet_id++ ) {
start = start_time[packet_id];
end = end_time[packet_id];
packet_duration = end - start;
if ( start < end ) sum= packet_duration+sum;
}
delay=sum/recvs;
printf(" Average e-e delay: \t %f \n", delay);
printf(" normalised routing load \t %f \n ", AODV_Adv/recvs);
printf("No. of packets sent = %d \n", sends);
printf(" No. of packets received = %d \n", recvs);
printf(" Pdf (100%) = %f \n \n", pdf);
printf("No. of dropped data (packets) = %d \n ",droppedAODVPackets);
printf("No. of dropped data (bytes) = %d \n \n ",droppedAODVBytes);
printf("No. of aodv advertisements = %f \n ",AODV_Adv);
}
pl help me
Dear sir, thanks for such a nice blog. I am working on LEACH and need to plots its cluster head graphs .kindly help me.
Thanks
Dear sir.I need help to write the perl/awk script to determine dead nodes (remaining energy is zero).
Please ..
Dear sir.Kindly help me to determine the dead nodes (remaining energy is zero ) using Perl/Awk scripts.
Thanks
sir please provide awk for nodes remaining energy of nodes in a WSN.
my mail is rohinisharmaohlan@gmail.com
Link provided by you is not working
Thanks
sir how to change the colour of the xgraph line while executing the .tr file...
sir,
i have downloaded awk files for pdr, genthorughput and instantjtter from ur page...and i have run the command awk -f genthroughput.awk mytrace.tr >out.xgr
but dat was giving me single values for start time and stop time in case of genthroughput and blank page for instantjitter...
my trace file is..
s 0.030990201 _0_ RTR --- 6 message 32 [0 0 0 0] ------- [0:255 -1:255 32 0]
s 0.031305201 _0_ MAC --- 6 message 90 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032025614 _1_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032025614 _12_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032025614 _16_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032025732 _19_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032025927 _10_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032026033 _2_ MAC --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032050614 _1_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032050614 _12_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032050614 _16_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032050732 _19_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032050927 _10_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
r 0.032051033 _2_ RTR --- 6 message 32 [0 ffffffff 0 800] ------- [0:255 -1:255 32 0]
s 0.092512184 _11_ RTR --- 19 message 32 [0 0 0 0] ------- [11:255 -1:255 32 0]
how can i make graph...and what changes are need to b done in awk file ...i am using cbr traffic...
thanks you in advance ...
i want to show the three routing metrics (packet delivery ratio,overhead, delay) in ns2.35. i have tcl file about aodv and dsr. it is generate the nam file and trace file properly. but i do not run the xgraph. please sir, i want to know that how to run the xgraph and what command will be used for this. i am very much obliged if u help me.
how to calculate bandwidth in ns2 ?? Is there any awk script?
sir i am getting
Parsing error in event.
plz help me to solve this
sir i want the c++ code for routing table so that i can patch that will ns2
hello sir
i am creating xgraph but the graph's y axis values are not clearly visible.for .81 its taking it as 810.0000 * 10^-3.
Also tell can i save this plot somewhere??
please reply
hello sir I am doing project on vertical handoff between UMTS and WLAN so please sir suggest me about tcl code...
Do u require a different awk file to use with xgraph?
Hi Sir,
This is Hemanth. I am working on the comparison of Pattern Mac (P-MAC) and Short preamble Mac (X-MAC). How can i compare both in terms of packet delivery ratio, throughput and end to end delay. Number of nodes I consider is 100. Please help me out.
Thank you.
Respected sir,
I have simulated a wireless scenario with 50 nodes and DSR as routing protocol.I am finding it difficult to analyze my trace file. please help me out with this sir.
i hereby pasting the tracefile format of my results. Please help me to find out respective fields.
r 11.667773961 _36_ MAC --- 1 DSR 32 [0 ffffffff 28 800] [energy 199.999716 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [40:255 41:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 11.667773961 _37_ MAC --- 1 DSR 32 [0 ffffffff 28 800] [energy 199.999716 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [40:255 41:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
verry helpful .thanx
sir i want tcl script for sinkhole attack detection in wireless sensor network
I am doing the project on "Performance comparison of scheduling algorithms in Optical Burst Switched Network".
Can you suggest how to include obs-module in ns2?
hello sir
i want to plot two parameter graph for example scen2.awk of your example.but i didnt get scen2.awk .so please provide that i can study that for my parameters.
@Pinakini - I haven't worked on it and hence would not be able to assist you much on that.
@Anvika - There is no such file called scen2.awk. That name has been used for explanation only. I suggest you to use our APP Tool which helps in plotting graphs.
See this link: http://mohittahiliani.blogspot.in/2014/10/automated-post-processing-app-tool-for.html
Hope it helps.
Regards,
Mohit P. Tahiliani
hello sir
can you give me the awk script to calculating the energy consumption and network life time.
And can you tell me if we want to find packet delivery ratio for 25 nodes in random mobility.
Then we will have to find the pdr 25*25 times for each source and destination.
@Deepmala - You can try using APP Tool for analyzing your trace files.
Here is the link: http://mohittahiliani.blogspot.in/2014/10/automated-post-processing-app-tool-for.html
You can get energy consumption from that tool and PDR also. Network lifetime is not available in it.
Regarding your question on PDR - No! you do not need to do that. You can just find average pdr of the whole network.
Hope it helps.
Regards,
Mohit P. Tahiliani
I have completed your simulator, but I have a question: if I use idsaodv to secure for this attact, how will I can do? Can you give me source file Tcl about idsaodv? tutorial? Please
Thanks so much!
Hello sir,
I have analyzed the tcl files in wpan folder of ns2.35.These are of AODV over802.15.4.The trace file of it do not contain 'AGT'.So it is not providing any output for most of the awk files provided by u.Please provide me some help regarding QOS Analysis of Zigbee(AODV over 802.15.4).
Thanks
@Pham - I do not have a sample TCL file for idsaodv.
@Smriti - That is because those TCLs may not be sending any data from the application layer.
I suggest you to change the AWK script as per your requirement.
Hope it helps.
Regards,
Mohit P. Tahiliani
after obtaining value of parameters from awk file.i want draw graphs then can i use sh graph.sh command? & how?
@Anvika - Have you created a graph.sh file? If so, what does the code in that file do?
Regards,
Mohit P. Tahiliani
Is ns2 source code forclustering in aodv is available on net
Hello sir,
i have tried putting a node to sleep..i want to wake it up by pinging it using other node...give me some idea how to create tat scenario..i used ping commands in tcl script..but didn't work..please help me sir..
thank u
Sir
I would like to plot graph for PDR using xgraph. I am using the new trace format.I take time along x-axis and pdr along y-axis. But I dont know how to set values along x and y axes. could you please help me sir?
hello sir,
i need a energy efficient dsr.tcl file of 600 nodes please share me if you have one. That would be very helpfull. Thank you.
Respected mohit Tahiliani,
I, Sahil(student of ec engineering) pursing my final year project on performance comparison of AODV ,DSDV, DSR and ZRP in MANET. So, while working on ns-2.35 there are plenty of errors I am currently facing with. Firstly, when I try to fetch data from the AODV trace file via awk script which was downloaded from your blog, the script is executed and stores the output in a new file with shows that total throughput or PDR is "-nan"(I don't understand what is mean and so this dont match my expected outcomes). It would be thankful if you help me with this.
Thanking you,
Sahil
Ca anyone tell me how to plot SNR or BER plot in NS2