Search This Blog

Loading...

Few more AWK Scripts for NS2

Labels: , ,

Reactions: 

In my previous blog  AWK Script for NS2, the AWK Script for average end-to-end delay is not available. Also the AWK Script given for throughput is not generic and may not work for old wireless formats sometimes.

The following AWK Script is the generic AWK Script for throughput which can be used on old wireless trace format.

AWK Script for throughput:

genthroughput.awk

The following AWK Script measures average end-to-end delay. It can be used with old wireless trace format.

AWK Script for delay:
e2edelay.awk

If there are any problems encountered in downloading the above files, please visit the following link
http://www.mediafire.com/?z1c2cxdt1a31d

[Latest Update]: You can also check our latest Automated Post Processing (APP) Tool which works based on AWK Scripts and automatically plots graphs.

Here is the link to APP Tool's blog post:

http://mohittahiliani.blogspot.in/2014/10/automated-post-processing-app-tool-for.html

Hope it helps.

Regards,
Mohit P. Tahiliani

Related Blogs: 
1. AWK Script for NS2 supporting New Trace Format
2. AWK Scripts for NS2 
3. AWK Scripts for Normalized Routing Load / Overhead 
4. Xgraph and AWK Scripts in NS-2

Comments (278)

«Oldest   ‹Older   1 – 200 of 278   Newer›   Newest»

thnks a lot for sharing awk scripts...works perfect...do u have awk script for finding out control overhead??

Hi..I am working on energy efficiency in sensor networks. I am new to the ns simulation. Can you please help me with the awk scripts. My id is sanjaychellappan@gmail.com

How to run the awk scripts? , I am using UBUNTU operating system. i have trace files generated by ns 2.34.

Keep the trace file and the AWK file in same folder. Go to that folder via terminal and give the following command:

awk -f awkfilename tracefilename

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi,
I'm using your avg-throughput.awk files on my old wireless format trace file and got this error.....

"awk: avg-throughput.awk:478: (FILENAME=test.tr FNR=2) fatal: division by zero attempted"

can u help me working on this?

Regards.
WIbisana Jaka Sembada

Hi,

Am using Ns version 2.34 and did some wireless simulations.I need now to plot out of these resulted trace files the average end to end delay, total throughput and other parameters to compare between different routing protocols. I have no knowledge of awk, so do these files helps me and do they support the format of files am working on??

can anyone help please ??

Reham

@Wibi - You can try "genthroughput.awk" which is provided on this blog. It will work on old trace files.

@Reham - Yes these AWK files will be helpful to you in analyzing your trace files. There are two types of trace files for wireless simulations: old trace format and new trace format. AWK scripts for both formats are available on this blog. Command to run these awk files on trace files is:

awk -f filename.awk filename.tr

Hope it helps.

Regards,
Mohit P. Tahiliani

Thanks Mohit for your reply..

Actually when am trying to run one of the wireless awk files I got the following error:

command : awk -f delay.awk trace1.tr

error:

awk: delay.awk:1: BEGIN {
' in expression1: ^ invalid char '

Would you please help me in this error Mohit..

Reham

Hi,

this is the format of the trace file generated:

s 2.556838879 _0_ AGT --- 0 cbr 512 [0 0 0 0] ------- [0:0 1:0 32 0] [0] 0 3
r 2.556838879 _0_ RTR --- 0 cbr 512 [0 0 0 0] ------- [0:0 1:0 32 0] [0] 0 3
s 2.556838879 _0_ RTR --- 0 AODV 48 [0 0 0 0] ------- [0:255 -1:255 30 0] [0x2 1 1 [1 0] [0 4]] (REQUEST)

So am i using the write awk scripts, is it old or new format.. add to that, am simulating routing protocols.

Anyhow,still get the error showed before while running these scripts.

Thank you..

Hi Mohit,

In ur e2edelay script, i could not understand few things.
1) end_time[$6] = -1; why you have assigned the value of -1 for the dropped packets.
2)In the end section of your script, the value for count and number of elements in delay array will be different, as you are increment count only in the received packets but you are assigning the value for dropped packets as well in delay array, which inturn will return in the mismatch for your next for loop and next for loop on count will not take into account many packets which are successfully delivered. and thus the final value for n_to_n_delay will go wrong.

Please correct me if i am wrong.

@Reham - Yes you are using the right AWK Script. Your trace file format is an old trace format.

The error that you are getting is because few development packages are not installed. You need to install those packages so as to support AWK scripts.

@Ankur - The AWK script named e2edelay.awk is designed to provide average end-to-end delay, number of dropped packets and packet delivery ratio. The value "-1" is assigned to "end_time" for the dropped packets because that "end_time" is not required to count the number of dropped packets. It is just required to calculate average end-to-end delay. Moreover, to count the number of dropped packets, a variable named "droppedPackets" is used. The variable "count" is used only for the purpose of calculating average end-to-end delay and not for calculating the number of dropped packets.

Hope it helps.

Regards,
Mohit P. Tahiliani

"The value "-1" is assigned to "end_time" for the dropped packets because that "end_time" is not required to count the number of dropped packets. It is just required to calculate average end-to-end delay."

I think we dont consider the dropped packets to calculate the average end-to-end delay as the packets which are dropped actually never reached to destination.


"The variable "count" is used only for the purpose of calculating average end-to-end delay and not for calculating the number of dropped packets."

I know the variable count is used to calculate the the average end-to-end delay, but still if you will print the value of count and value of delay array, you will find both are different.
What i think that the for loop should be changed to
for(i=0; i<=seqno; i++) {

if(end_time[i] > 0) {

n_to_n_delay = end_time[i] - start_time[i];

sum=sum+n_to_n_delay;

count++

}
}

Correct me if i am wrong.

Can have your personal mail id, as i need your help in 1 of my tcl file. my id is dream.ankur@gmail.com

thanks,
ankur

HI mohit,

Thanks for your reply, but what packages I need to install ??

Appreciate your help.

Hi,

I've solved the problem regarding errors am getting while running my awk scripts, anyone getting same error should make sure that the awk script file saved with right format, like unix format in case running under linux or unix machines..

Thanks mohit for help ..

Hi Mohit,

Please can you provide me with the awk script to calculate Energy consumption?

Thank you so much.

@Reham: Thanks for sharing your solution with us. I really appreciate it.

@Adaobi: I have one AWK script for energy consumption but I am not sure how much useful it will be to you. Send an email to me. I will send you the AWK script.

Hi Mohit,

Thanks a lot for your reply. I dont know your e-mail address, but you can please send the awk script to my mail.
okoliadaobi@gmail.com

how to run this AWK script to calculate throughput???? i m new in this line

hi i tried using avg_throughput.awk script but i am getting the error
awk: avg_throughput.awk:4:
'in expressionhput.awk:4: ^invalid char'

I just read that if we save the awk file in linux format the error could be removed...but am not getting how to make it in linux format...please help

Hi Mohit,

Please can you kindly tell me the code I can use in my tcl file to give an arrangement for my nodes(sensor network), so that when i run the nam, the nodes will be arranged on their own like maybe in a vertical or horizontal form, etc.

Thanks.

P.S. I am also still awaiting the awk script to calculate energy consumption you said you would send me. My e-mail address is okoliadaobi@gmail.com.

regards,

Adaobi.

hi Mohit

this is padmaraj..am also badly in need of awk file to find the energy consumption of nodes...pls send it to padmu1990@gmail.com as soon as possible....
Thanks in advance..

Hello everybody
i just want to calculate energy consumption for aodv dsdv dsr and tora,
as of now i just find in ns/tcl/ex/wireless-newnode-energy.tcl.
as it is running and give trace file shows how much each node consumped energy during simulation.
plz send me awk scripts for calculation of toal energy consumped in simulation.
thanks

Hello,
I want to change the no. of nodes in the wrls-aodv.tcl script.
What are the other necessary changes in the tcl file? pl. reply.
Thanking You,
- Nilesh

i am new to ns2. i am able to find many awk scripts for wireless. but i want to calculate delay,throughput and bandwidth for wired networks using multicast routing.Pl help... its slightly urgent.

@Raadhika: Some AWK Scripts for Wired Networks to calculate delay, jitter and packet loss rate are available on the following link:

http://140.116.72.80/~smallko/ns2/tool_en.htm

However, you need to modify them somewhat to meet your requirements of multicast routing.

Hope it helps.

Regards,
Mohit P. Tahiliani

hi...
i m using leach protocol as routing protocol for energy consumption in WSN..can u help me regarding awk to generate it for energy consumption?
thnax in advance!!

i am unable to download awk script for packet delivery ratio.the problem is was directed to esnips.com even i signed in also i was unable find ur awk scripts so please can u mail me..........on sujsachin@gmail.com
please as soon as possible i hv project review

@Sujan - you can download the same script from the following link as well.

http://mohit.ueuo.com/AWK_Scripts.html

Hope it helps.

Regards,
Mohit P. Tahiliani

hi all and thanks every body spetialy Mohit P. Tahiliani
i need awk script to get the energy of network. please help me

hi mohit, i am doing on energy consumption in aodv and dsr routing. would you please send me the awk script for energy consumption trace files.
this is my id
mahdi312002@gmail.com

thanks in advance

Actually when am trying to run one of the wireless awk files I got the following error:

command : awk -f genthroughput.awk trace1.tr

error:

awk: genthroughput.awk:1: BEGIN {
' in expression1: ^ invalid char '

pls send it to daisymamatha@gmail.com as soon as possible

@Hon - AWK file is not saved correctly in Unix format. Save the file as "genthroughput.awk". Please refer to comment # 15 of this blog or visit the following link:

http://www.grymoire.com/Unix/Awk.html#uh-2
OR
http://objectmix.com/awk/377951-awk-tutorial-confusion.html

Hope it helps.

Regards,
Mohit P. Tahiliani

Dear Mohit,
Thanks for sharing your code and ideas. I was executing your genthroughput.awk file. But I got the output as

Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

Please help me what went wrong.

Thanks

Sonam

@Sonam - I guess this is because you are generating packets which have size smaller than 512.

In genthroughput.awk you will find two "if" loops. In those loops you can see I have given a condition pkt_size > 512. You need to change this if you are generating packets of size smaller than 512. E.g.: if your packets are of size 250 then replace 512 by a value which is smaller than 250.

Hope it helps.

Regards,
Mohit P. Tahiliani

Dear Mohit,
Thanks a lot. I look forward to getting more help from you in future.
I wish you happy new year, 2011
Regards,

Sonam

Hi Mohit,

the awk file to calculate throughput is for overall, is there any code that calculate throughput at each time for that i can use it to plot time vs throughput..if no can u give me an idea how should i extend from the throughput code above. thank you in advance

regards,
kevin

Hello Mohit, does the throuhput.awk file work for wired networks aswell and I would also like to know if u have tried any sample code for DCCP on ns2.35?
Thank You.

@Kevin - To get the value of throughput at each instance of time, modify the above given script as per the instructions given on the following link:

http://mohittahiliani.blogspot.com/2010/08/xgraph-and-awk-scripts-in-ns-2_06.html

Hope it helps.

Regards,
Mohit P. Tahiliani

@Aminu - No this throughput script will not work for wired networks since it is designed for wireless trace format (old). I have not tried sample script for DCCP in ns-2.35.

Regards,
Mohit P. Tahiliani

Hello, I can't download your scripts from esnips.Could you send them to me on e-mail. maciejnowak20@gmail.com Especcialy end2enddelay. I would be very gratefull. Or If you can tell me how can I download them,because after registration at esnips is still not possible.

hello.i can't download too.please mail me them,if possible.i need these scripts very much.
my mail address: rosoneri6504@yahoo.com
thanks alot

Hi Mohit,

I have a correction in your e2edelay.awk. In the following case, when you are calculating the end-to-end delay, you are summing up only 'count' number of packets but the summation should be for 'seqno' (all the packets). Some packets will have delay[i] as '-1' these will not be counted because you are using the if condition (which is correct).

for(i=0; i0) {
n_to_n_delay = n_to_n_delay + delay[i];
}
}

@Maciej and Hamed - You can download genthroughput.awk from the following link:

http://www.megaupload.com/?d=EJ81TPN1

and e2edelay from the following link:

http://www.megaupload.com/?d=MBB88FX7

Hope it helps.

Regards,
Mohit P. Tahiliani

hi muhit
thanks about your awk scripts.but they works on only tcp.do you have any script working on udp? or please tell me how to change the code for this? i am using cbr.
and also, i need to get average energy consumption.have any awk file for this?
i need these files very emergency.
thanks alot.

@Hamed - In AWK script, wherever you find "tcp" replace it by "cbr". As of now I have not uploaded AWK script for calculating energy consumption. I hope to do it soon.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit
i need to get energy consumption in my trace files.
Can u send awk for analysis
my email address: kg_love52@hotmail.com
thanks alot

hi mohit, Can u plz help me to make changes to routing table structure...Actually i want to add list of nexthops(multiple) to routing table..
Regards
payal

@Payal - You are working on which routing protocol? To store multiple nexthops in your routing table please refer to the routing table formed by AOMDV (available in ns-allinone-2.34.tar.gz).

Hope it helps.

Regards,
Mohit P. Tahiliani

hi mohit, can u please help me by finding the suitable AWK file for energy consuption. two lines of trace file are as following:
r 13.964549759 _7_ RTR --- 1929 cbr 512 [0 0 0 0] [energy 992.219098 ei 7.778 es 0.000 et 0.003 er 0.000] ------- [7:2 9:0 32 0] [7] 0 2
s 14.187043023 _1_ AGT --- 2011 cbr 512 [0 0 0 0] [energy 997.382025 ei 2.615 es 0.000 et 0.003 er 0.000] ------- [1:0 2:0 32 0] [10] 0 3

please help me by this email: mahdi312002@gmail.com

hi mohit...
i would like to analyse the trace file on packet loss,throughput and delay in wimax? did ur awk file work for it? or we need diff awk file to analyse the trace file? how do i go on it bro? pls help me.

my email: kstar_my@hotmail.com

really appreciate your help.tq..

hello sir....
I run ur throughput script bt its work with terminal and i also run within TCL script...
bt nw i want that when my throughput goes below some level i want to change some parameters...how can i do it?

@Karunan - I have not tried using these AWK scripts for WiMAX and I am not aware of trace format for WiMAX simulations. However, the logic used in AWK scripts will remain same and hence you can modify these AWK scripts to support your requirements based on the trace format of WiMAX simulations.

@Vish - In that case you need to make modifications in C++ code so as to calculate the throughput and compare it with your pre-determined threshold.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit,
Im using NS-2.34 on Ubuntu 9.04, i want to measure performance metrics of adhoc routing protocols and to compare between them. (e.g average end-to-end delay, normalized routing load, pdf for AODV,DSR DSDV.
Can u help me how to plot graphs for these metrics..
Thanks in advance..
Please help by this: demairakli@gmail.com

hello mohith sir.......i couldn't get the output when i am executing the pdf awk script........form the link
http://mohit.ueuo.com/AWK_Scripts.html
pls help me to fing the pdf...

Dear Mohith Sir,
I am prasuna working on ns2 for my project and I have to find the energy consumed by nodes. I want the awk script for energy consumption and the command to find energy.
My e-mail id is prasunasanugommula99@gmail.com

@Tweetygals - What is the error you are getting? Make sure the AWK file is correctly saved in Unix format.

@Prasuna - I have uploaded a sample AWK Script for Energy Consumption on the following link:

http://www.megaupload.com/?f=0211SAG1

However, it is designed for a specific purpose (it calculates energy consumption of node number 4 in the network). You MUST modify the script according to your scenario.

Hope it helps.

Regards,
Mohit P. Tahiliani

hello mohit, even i am in a urjent need to find the awk file for energy consumption... my email id is rohitrkg.gupta@gmail.com

Hi I am working on energy consumption on Wireless sensor network and I wish that you have a awk script for calculating energy consumption

i will be glad if you will help me out

my email is stan.ansy@gmail.com

Hi,

I tried running simple tcl script (ns-simple.tcl)on http://perform.wpi.edu/NS/simple_ns.html

After running it i tried to figure out the Throughput using your "genthroughput.awk" but it gives

Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

The CBR packet size is> 512 i.e 1000.

I can't figure out where the problem lies.

Any help in this regard will be highly appreciated.

Thanks

@Rohit and Stanley - I have uploaded a sample AWK Script for Energy Consumption on the following link:

http://www.megaupload.com/?f=0211SAG1

However, it is designed for a specific purpose (it calculates energy consumption of node number 4 in the network). You MUST modify the script according to your scenario.

@Here I am - The script which you are using is for Wired network whereas the AWK file throughput i.e. genthroughput.awk is designed for Wireless networks (Old trace format). Wired and Wireless trace formats are different.

Some AWK Scripts for Wired Networks to calculate delay, jitter and packet loss rate are available on the following link:

http://140.116.72.80/~smallko/ns2/tool_en.htm

Hope it helps.

Regards,
Mohit P. Tahiliani

thanks mohit for ur reply,
i also faced problem by modifying the scripts, i guess it has something to do with the format can u xplain it to me. i mean i modified one of the awk script according to my script and saved it using name.awk but it gave an error saying syntax error in awk...........and also can u also post about the control overhead
.

also the e2e delay script is designed to print other parameters as well but it print only the delay. can u explain please......

sir if u can please mail me the awk files for energy since i am unable to download from mega upload...
Regards
santosh

@Rohit - Appropriate AWK file for those parameters is pdf.awk available on the following link:

http://mohittahiliani.blogspot.com/2009/12/awk-script-for-ns2.html

@Santosh - Try downloading from the following link:

http://www.esnips.com/web/mohittahiliani-ns2

Hope it helps.

Regards,
Mohit P. Tahiliani

@Mohit: Thanks a lot for the reply. I just realised on looking at the link that the scenario is wired network.
On looking at a TCL script how can we determine whether the network is for Wired or Wireless N/W.
-Vivek

Dear Mohith sir,
we maneesha nd nasreen working with ns2.34. we r getting the following error while running wireless_newnode energy.tcl
couldn't read file "../mobility/scene/cbr-50-10-4-512": no such file or directory
while executing
"source.orig ../mobility/scene/cbr-50-10-4-512"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $opt(cp)"
invoked from within
"if { $opt(cp) == "" } {
puts "*** NOTE: no connection pattern specified."
set opt(cp) "none"
} else {
puts "Loading connection pattern..."
..."
(file "energynew.tcl" line 172)

we have renamed it as energynew.tcl
please reply us soon as we r in urgent need to submit our project

sir ,
we have energy.tcl script and after we run it energy.xgr is created but it contains no data.
please reply
-maneesha and nasreen

shilpa:hello sir,how to put different initial energy levels to different nodes...............

@Vivek - TCL scripts for Wired network are completely different than those for Wireless Networks. There is no configuration of links (simplex/duplex) in Wireless networks. Moreover, wireless networks require several parameters like Antenna type, Radio Propagation model, etc to be configured.

@Maneesha - You are getting error because file named "cbr-50-10-4-512" is not available in the given folder "../mobility/scene/". Either generate a filename with name "cbr-50-10-4-512" and place it in that folder or change the path where you have saved "cbr-50-10-4-512" (or any other scenario file).

@Shilpa - It can be done as shown below:

$ns node-config -initialEnergy 10
set node_(0) [$ns node]
...

$ns node-config -initialEnergy 30
set node_(1) [$ns node]
...

Here, Node 0 will be configured with 10 units of energy whereas Node 1 will be configured with 30 units of energy.

Similarly you can assign different units of energy for other nodes as well. If you want to configure such that a group of nodes have similar amount of initial energy, that can be done using a "for" loop instead of manually doing it for every node in the network.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit,

thanks for your help. IN THIS POST (http://mohittahiliani.blogspot.com/2009/12/awk-script-for-ns2.html) i came across the same problem what maneesha encountered.
I tried making a empty file named cbr-50-10-8 but it again says " it cannot read the file "cbr-50-10-8". Do we need to put something in the file ( as in traffic characteristics )?

Will be glad to get some feedback.

Hi Maneesha: http://hpds.ee.ncku.edu.tw/~smallko/ns2/adhoc_routing.htm

You can follow this link to go ahead with your simulations.
Thanks

@Vivek - That file should not be empty. It must contain the configuration of UDP connections - as you mentioned - traffic characteristics.

Hope it helps.

Regards,
Mohit P. Tahiliani

Dear Mohit
The awk file e2edelay gives abnormally large number of generated packets,small pdf etc for DSR.whereas give the correct result for dsdv and aodv.

we have to change this file for DSR?
is pdf= received/send or generated /send ?
plz help me
sachin

Dear Mohit

Why the pdf given by e2edelay and by pdf.awk is diffenrt. which file we should use. e2edelay gives abnormally large value for dsr ahereas pdf.awk gives the resonable value?

plz help

Sachin

@Sachin - I would recommend you to use pdf.awk to calculate packet delivery ratio. In e2edelay.awk I have commented the lines that are used to calculate packet delivery ratio because they were designed for calculating not only packet delivery ratio, but other parameters also that we needed for our work.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit,

For scene and traffic generation we usually go to "setdest" and "cbrgen".
This is how i made my cbr-50-10-4-512 file.
Now the thing is the setdest creates a Random Waypoint model. Is there anyway to make it " freeway " model or with certain Geometry which is sufficient to make it look like a highway scenario ( for Vehicular Ad Hoc networks)?

Thanks

-Vivek

I am planning add some value to the reserved bit field in the RREQ and RREP packets in AODV.Could you please tell me how it can be accomplished.

@Vivek - To generate mobility for VANETs I would recommend you to use SUMO and MOVE tools. Using them you can configure the number of vehicles, traffic signal points, junctions, pause time and several other parameters and generate a TCL script which can be used on any version of NS-2.

@Sena - You need to create a new variable in aodv_packet.h file (available in ns-2/aodv directory) that corresponds to the bit you want to utilize (e.g.: see ecn and eln bits in tcp packet).

Hope it helps.

Regards,
Mohit P. Tahiliani

hi sir,
i need tcl scripts for resilience and i am working on energy consumption among nodes so i need some scripts for it.can u mail to id-
nsame17@gmail.com

shilpa: thanku sir....one more thing......
s 0.500158000 _3_ MAC --- 0 AODV 100 [0 ffffffff 3 800] [energy 0.100000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [3:255 -1:255 30 0] [0x2 1 1 [0 0][3 4]] (REQUEST)
N -t 0.500148 -n 2 -e 0.1000
N -t 0.500148 -n 2 -e 0.1000
N -t 0.500148 -n 2 -e 0.1000
r 0.500158000 _2_ MAC --- 0 AODV 36 [0 ffffffff 3 800] [energy 0.100000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [3:255 -1:255 30 0] [0x2 1 1 [0 0][3 4]] (REQUEST)
sir is this a new file format?pls mention what each field stands for? and pls tel which are the awk scripts to follow to find throughput and ene-to-end delay for these type of file formats.......

@Shilpa - It is an old trace format and hence all the scripts provided in this post can be used. For more details on every field, visit the following link:

http://www.cs.binghamton.edu/~kliu/

Hope it helps.

Regards,
Mohit P. Tahiliani

thank u sir.........
sir suppose if we get no. of packets sent =1000,dropped=some figure and received=some figure...how can v believe that the obtained result is right r wrong?.whether it depends on the traffic that we put?.i have calculated the traffic applied on particular node as below....packet interval is 0.1sec,simulation time is 200 sec hence total traffic is 2000 packets on a particular node.is this right?

also sir i m simulating different scenarios for 802.11,smac and zigbee....getting througput of 802.11 around 35% and not getting throughput for smac,what may be the problem with smac?and w.r.t 802.11 is this throughput feasible?

hello sir i m new to ns-2 and i m interested in it.suppose sir if we calculate some parameters using distance b/w 2 nodes say for eg 10m,whether nam shows 10m b/w those 2 nodes?r we should only specify throuh co-ordinates?

@Shilpa - Yes it depends mainly on the traffic that you have configured. Not all the nodes will send packets. Only the nodes which are configured with UDP/CBR (in your scenario) will generate packets. Other will only forward those packets.

The throughput values which you are getting also depend on the bandwidth provided by you. Hence you should verify that. Regarding SMAC, are you getting any error while executing the TCL script?

@Veer - You need to configure that distance in TCL script, which will be visible later when you execute TCL script and view in NAM. I recommend you to go through "Marc Greis Tutorial" which is one of the best tutorial for beginners.

Hope it helps.

Regards,
Mohit P. Tahiliani

no sir i m not getting any error while executing tcl script of smac.........
also sir if i have 4 nodes in which i have put traffic on only 2 nodes...i.e...packet interval is 0.1,simn time is 200sec,then total traffic is 2000packets on each of the two nodes....after simulation getting no.of packets sent as 7000.....not getting exactly how to verify simulated result with applied traffic(theoretical)....pls clear this doubtttttt........

@Shilpa - You might be counting routing packets also by mistake. Make sure you calculate only data packets. Data packets are originated at application layer (AGT in trace file) whereas routing packets are originated at routing layer (RTR in trace file).

Hope it helps.

Regards,
Mohit P. Tahiliani

hello sir,
We met at ISTAR v v nagar, Gujarat

I have one doubt:how can i get power of rts packet in MAC 802_11.cc??

thanks
Ashish Nimavat

sir, I wanted to find the packet delivery ratio, so what i did was count the number of sent packets from source, and all the received packets at destination, all DATA packets only.. but the ratio is coming out to be greater than 1, which means im going wrong somewhere.

Also sir, i wanted to know how does one vary the threshold energy for a node to die, by default it is 0 J, ie till the node energy reaches 0J it keeps sending n receiving.

From what i found and did, changes in wireless-phy.cc and energy-model.cc, i was able to achieve something, but if its correct or not, i have no way of knowing.

@Ashish - Do you mean power consumed in transmitting RTS packet?

@Maverick - Make sure you do not calculate the data packets received by the intermediate nodes. Only the data packets received by the destination must be counted i.e. only the event "r" with layer "AGT" must be counted.

Regarding changing the default threshold energy for a node to die - the procedure that you have followed is correct.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hello Mohit,

Actually I want to implement Dijkstra algo in AODV Path computation .
I am very new in Ns2 . Can you please guide me how I can Do that !

Regards
Shariq

sir i have a doubt like how to set same duty cycles for smac n zigbee for comparision purpose since smac's dutycycle starts from 1 and dat of zigbee's from 0.01..pls do clarify dis doubt....

hello sir
thanks for reply
Actually i want to implement conservative CTS reply. for that a node only replies a CTS packet for a RTS request when the receiving power of that RTS packet is larger than a certain threshold.
So i want to know power of RTS packet when it is received.
thanks
Ashish

@Shariq - Dijkstra is already implemented in NS-2. See the following link:

http://www-rp.lip6.fr/ns-doc/ns226-doc/html/dijkstra_8cc-source.htm

@Shillu - Sorry I dont have much idea about that since I have not worked on it! :) You may get some help from the following link (It discusses implementation of zigbee in NS-2):

http://www-ee.ccny.cuny.edu/zheng/pub/Pages/wpan-ns2-faq.htm

@Ashish - Answer to Question #4 on the following link may be helpful:

http://www.cpe.ku.ac.th/~aphirak/myweb/wpress/wp-content/uploads/2009/09/ns2-FAQ.txt

Hope it helps.

Regards,
Mohit P. Tahiliani

Thanks Mohit ,

Thank you for you link !

Actually I want to implement this dijkstra algo in the AODV Rout Discovery process .
Can you guide me how I can use dijkstra algo in AODV in Rout discovery.

Another thing can you give me an idea about the implementation of Dijkstar algo in ns2 so that I can able to change or update the code !!


Regards
Shariq

hi mohit,
I am working on selfish nodes on mobile ad hoc networks . Could u plz give some information that how to simulate selfish nodes on ad hoc networks.
if u have plz send me on this id.. komal4939@gmail.com
its urgent plz reply me as soon as possible

@Shariq - Sorry, I have not worked with that so cant help much :) One thing might help - see the dependency graph on the link that I gave you. Find out the major functions of dijkstra.cc. Next find out functions which call these functions of dijkstra.cc. That will atleast tell you which existing agents in NS2 are using Dijkstra.

@Komal - I have not worked on that :) but following link may be of some help:

http://elmurod.net/?p=196

Hope it helps.

Regards,
Mohit P. Tahiliani

hi , I am getting an error like segmentation fault during evaluating the trace file using awk script, what is the solution to avoid such type of error while calculating EndToEnd Delay and PDR.

hello mohit,

i am simulating a aodv protocol with 100 nodes ,
i want to generate xgraphs using the tracefile for the average end-to-end delay,can you please suggest me someinputs in this regard

regards
ronit

hello sir if i run the wpan demo tcl scripts in ns2.31 version,in the trace file generated der are no AGT and RTR packets......but all d cbr packets are associated with 4th field as "MAC" layer (old wireless trace format)....pls tell how it is functioning......n how to calculate throughput......

@Bhushan - Which AWK Scripts you are using? Check the command you are using to run AWK scripts on the following link:

http://mohittahiliani.blogspot.com/2010/08/xgraph-and-awk-scripts-in-ns-2_06.html

@Ronit - You can get some idea from the following link:

http://mohittahiliani.blogspot.com/2010/08/xgraph-and-awk-scripts-in-ns-2_06.html

@Shillu - To know about the functioning of WPAN in NS-2, go in the following directory - ns-allinone-2.31/ns-2.31/wpan.

A .pdf file is available wherein all the functions are explained in detail.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit,

I am trying to run e2edaly.awk script ,but it always give Average End-to-End Delay = nan ms
as output. I am trying to run with 25 nodes AODV protocol.

Could you please explain why this error??? Its very urgency to finish my project.

ThankYou
Sandhya

@Sandhya - e2edelay.awk is designed to work with TCP. If you have configured UDP in your TCL Script then you need to replace "tcp" in e2edelay.awk by "cbr".

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit,

Thank you for your reply. I have tried using cbr ..but it still gives the same output.

Please help...

@Sandhya - In "if" loop I have assumed packet size greater than 512 bytes. If you have set packet size less than 512 then you need to change that i.e. reduce it. e.g. if you have set packet size as 256, then put 200 in AWK Script.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi ,

I have set packet size of 512 bytes and type "cbr". I could not understand the problem...

@Sandhya - Set the packetSize_ 1000 in your TCL script and then run AWK script.

Hope it helps.

Regards,
Mohit P. Tahiliani

hey can u tell me reagrding the Multicast protocols..i am not able to make Multicast groups and senders in the tcl script.can u tell me the procedure for taht.

thankx

Hi Mohit,
Do you have any TCL script written for mobility scenario for wireless nodes with certain geometry pattern i.e moving in straight manner with exponential distribution.

Thanks
Vivek

Hi
Below is my tracefile while is i think the old format tracefile
s 1.239631838 _3_ MAC --- 12 cbr 2078 [13a 5 3 800] ------- [0:2 5:0 28 5] [12] 2 0
r 1.250000000 _0_ RTR --- 50 cbr 2000 [0 0 0 0] ------- [0:2 5:0 32 0] [50] 0 0
s 1.250000000 _0_ RTR --- 50 cbr 2020 [0 0 0 0] ------- [0:2 5:0 30 2] [50] 0 0
r 1.256256583 _5_ MAC --- 12 cbr 2020 [13a 5 3 800] ------- [0:2 5:0 28 5] [12] 3 0

i am using genthroughput.awk for throughput
Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

throughput is zero although Packet Size is 1000
so please tell me whats the problem?

@Tanvir - Install ns-allinone-2.35 package since it includes a popular multicast routing protocol called PUMA. A Sample TCL Script is also provided in ns-allinone-2.35/ns-2.35/tcl/ex directory.

@Vivek - TCL Script for mobility scenario is available on the following link. Moreover it also explains how you can generate traffic files as well as mobility scenario files.

http://hpds.ee.ncku.edu.tw/~smallko/ns2/adhoc_routing.htm

@Umair - Yes your trace file format is an old trace format. Check once from your trace file whether data packets are received successfully at Application layer at the receiver or not since the lines in your trace file show sending and receiving only at Network and MAC layer.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hello Mr Mohit
you answered @Tanvir about make a multicast group that a Sample TCL Script is also provided in ns-allinone-2.35/ns-2.35/tcl/ex directory.but I didn't find it may you tell what is its exact name because really I need to know how to create a multicast group over NS2.
Thanks in advance.

@Nour - The filename is "puma.tcl"

Hope it helps.

Regards,
Mohit P. Tahiliani

Thank you so much Mr Mohit

Dear Mohit ,

I want to calculate the number of loss packet in a trace file .
I have a script gawk , it needs some modification to be run ( parametr )
.This is the gawk script :
****
BEGIN {

start_time = 0;

count = 0;

}

{

action = $1;

time = $2;

node_id = $3;

layer = $4;

flags = $5;

seqno = $6;

type = $7;

size = $8;

a = $9;

b = $10;

c = $11;

d = $12;

energy = $14;

for(seqno = 0; seqno < 68; seqno++) {

if(node_id = "_4_" && action == "D" && layer == "IFQ" && type == "cbr") {

count++;

start_time = time;

printf("%f\t%d\n",start_time,count);

}

}

}

END {

}
******
this is the out put of trace file for droped packet :
****
d -t 10.021045480 -Hs 1 -Hd 4194305 -Ni 1 -Nx 60.00 -Ny 50.00 -Nz 1.50 -Ne -1.000000 -Nl MAC -Nw CID -Ma 0 -Md 0 -Ms 8 -Mt 0 -Is 0.1 -Id 4194305.1 -It cbr -Il 256 -If 0 -Ii 1 -Iv 30 -Pn cbr -Pi 0 -Pf 0 -Po 0
****

Please can you tell me what I will change to make the gawk run .
Thanks in advance !

Hi Mohit,

I have a wireshark trace file and i need to analyze the packet loss using awk script. Should i use the awk script provided by you or do i need to make changes? Also should the awk script be copied into a notepad file and name with a .awk extension?

Thanks in advance :-)

@Hajjaji - Your trace format is new trace format. But the Script which you have pasted is designed to work with old trace format. Hence this Script will not work on your trace file. You need to change this script to work with new trace format. Moreover, is seqno < 68 required? If not, you may change it as well. Also when you give a condition layer == "IFQ" it means you are calculating packet drops only due to congestion. If you wish to calculate packet drops in general, you may remove that condition.

@Mayuresh - You need not use AWK Scripts for Wireshark trace files because wireshark has builtin functions to plot graphs. You may refer a Wireshark tutorial to know how to use those builtin functions to plot graphs.

Hope it helps.

Regards,
Mohit P. Tahiliani

Oh no I need it as a part of my project, i have to dump out the wireshark trace file using tcpdump and then use awk script to analyze packet loss, throughput, delay etc. Could u plz help me with the codes and how to run it? The trace file is basically call traffic captured through Skype.

Thanks in advance :)

Hey how can I install inspect visualizer in ns2 2.34 in ubuntu ?and why is it better than nam anyway ?

Hi Dear,
I would like to know hot to measure the life time of nodes using awk script. if you have it, please upload it.
Yours sincerely
Zaw maung

@Mayuresh - I have not come across such code, but if I get it, I will pass on the link to you.

@Umair - You can get some help here:

http://toilers.mines.edu/Public/Code/inspectinstall.html

Its better than NAM because it clearly shows route formation, active routes, etc which is difficult to observe in NAM.

@Zaw - You can find energy.awk on the following link:

http://www.megaupload.com/?f=0211SAG1

It does not measure the lifetime of a node but measures remaining energy of a node. With minor modifications you can use energy.awk to measure lifetime of a node.

Hope it helps.

Regards,
Mohit P. Tahiliani

thanx for giving reply, but its still not working, the awk script which u have posted on your site, will work at the place of filename.awk to get graph values,
waiting eagerly for ur response

sir i am using mobility in my project. I tried the link which given in the above posts. I used the procedure to run the script, but i am getting errors in that. The errors are

$ ns adhoc.tcl AODV cbr-50-10-2 scene-50-0-20-100-500-500
num_nodes is set 50
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
couldn't read file "scene-50-0-20-100-500-500": no such file or directory
while executing
"source.orig scene-50-0-20-100-500-500"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $val(sc)"
(file "adhoc.tcl" line 73)
i didn't understand the error in this . Please help sir

Hi Mohit...
I downloaded your awk for E2E delay....As I am using cbr traffic...I changed in the awk file and the E2E was calculated....I think that I am right, ok???

Do you have any other awk with another metrics to wireless simulations???

Thanks for the help and congratulations!!!!

Hi Mohit...just another question....I want to evaluate AODV protocol in my simulation using cbr flows...

As I told in the previous post...I changed in the awk file tcp by cbr....So I would need to change AGT with RTR???

I have this doubt...because in the trace has AGT and RTR...If I want to evaluate end to end delay...how to proceed??? Can you give me a fast explain about it??

Thanks for the advance

Best regards

@Reena - AWK Scripts provided on this blog will not plot graphs directly. You need to modify them as explained in my another post called "Xgraph and AWK Scripts in NS-2". Following is the link:

http://mohittahiliani.blogspot.com/2010/08/xgraph-and-awk-scripts-in-ns-2_06.html

@Madhu - The error is because the file which you have specified in the "source" command in TCL is not available. You need to give a proper path where the file is stored. E.g. if you are calling "samplefile" from a TCL script and if it is available in the same folder you can give following command:

source samplefile

but if "samplefile" is not available in the same folder your command must be

source /give path here/samplefile

@Ederval - You do not have to make any changes in e2edelay.awk except the CBR change (which you have already done). There is no need to change AGT to RTR. Few more AWK Scripts are available on the following link:

http://www.megaupload.com/?f=0211SAG1

Hope it helps.

Regards,
Mohit P. Tahiliani

Sir,
I am sivaleela.I learn so many things from your site sir.thank u thank u so much.Can u please upload awk scripts that calculate avg end-to-end delay and packet delivery ratio for new trace format....
Thank you sir.

@Sivaleela - I will try to upload it soon!

Regards,
Mohit P. Tahiliani

thank you so much sir.Do you know about partially overlapping channels? If so can you please me sir.How to get partially overlapping channels in ns2? please suggest me sir.
I am waiting for your valuable reply.

@Sivaleela - The modifications to support partially overlapping channels are contributed in "Miracle" framework. Following link may be useful:

http://www.hindawi.com/journals/wcn/2010/761792/

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi all,
How does ns-2 distinguish between caluculation in power consumed and energy consumed??? Are they similar?

HI...Mohit...Thanks for the answer....ok???

I would like to know if you have or can indicate awk script to calculate number of hops of a packet (source-destination)...

Thanks one more time..and congratulations!!!

Ederval

@JAT - The present Energy Model of NS-2 is a basic and mainly calculates energy consumption (in idle mode, sleep mode, etc). For more details you may look in energy-model.cc available in the following directory:

ns-allinone-2.xx/ns-2.xx/mobile

@Ederval - I dont have such an AWK script. You may use "god" object available in the mobility pattern that you generate to find out the exact number of hops between source and destination. Each time source and destination move far (or near), "god" object updates the hop count.

Hope it helps.

Regards,
Mohit P. Tahiliani

hello Mohit,

im working on localization in wireless sensor networks... i have the trace file. have learned that awk can be used to localize it.. thanks to the blog... but my query is whether awk can communicate with ns2 during its working... say change a variable's status in my tcl script.... thanks in advance


anu...

@Anu - AWK is used only for post processing and it operates on Trace files. It cannot be used to change a variable's status in a TCL Script.

Hope it helps.

Regards,
Mohit P. Tahiliani

thanks Mohit

Hey Mohit , this is Sukrutha here .
i have used the command : awk -f awkfile tracefile


and my trace file is around 50k lines!!!!!!!!!!!!

When i run the above command , i am encountering following error :

program limit exceeded: sprintf buffer size=1020
FILENAME="Simple.tr" FNR=364 NR=364

can u figure out whats wrong n help me out.
Thanks

Good Day Mr Tahiliani!

In using e2edelay.awk on a trace file from a wireless simulation using dsr, I got a segmentation fault on the for loop after END. It's works fine though for both aodv and dsdv....

What could be causing the problem?

Thank you very much! I really appreciate the tools you have provided here for us!

@John - DSR gives segmentation fault if the interface queue in TCL Script is set to

Queue/DropTail/PriQueue

Instead we must use

CMUPriQueue

whenever we are simulating DSR.

I guess there may not be any problem with e2edelay.awk.

Hope this solves the problem!

Regards,
Mohit P. Tahiliani

gud day to u mohit sir, hope u r fine...
when i used it posted an error which is mentioned just below-
# awk -f e2edelay.awk MyTest.tr
awk: e2edelay.awk:91: (FILENAME=MyTest.tr FNR=25294) fatal: division by zero attempted

can u plz tell me how to no. this fields given below (like for ex- time is $2 ..etc. ) so that i can make changes in awk script to make it work for me because i m little confused.
or if u can provide me the awk script.

this trace is the output of smac with 5 nodes in sensor network if i m not wrong...

s 1.500339577 _0_ AGT --- 2 cbr 512 [0.00 0 0] [energy 998.485984] ------- [0:0 4:0 32 0] [1] 0 0
r 1.500339577 _0_ RTR --- 2 cbr 512 [0.00 0 0] [energy 998.485984] ------- [0:0 4:0 32 0] [1] 0 0
s 1.500339577 _0_ RTR --- 2 cbr 512 [0.00 0 0] [energy 998.485984] ------- [0:0 4:0 32 0] [1] 0 0
D 1.500339577 _0_ IFQ ARP 0 cbr 512 [0.00 0 0] [energy 998.485984] ------- [0:0 4:0 32 0] [0] 0 0
s 1.514016091 _0_ MAC --- 0 ACK 10 [0.00 4 0] [energy 998.485984]
r 1.514016091 _0_ MAC --- 0 ARP 28 [0.01 0 4] [energy 998.474984] ------- [REPLY 4/4 0/0]
N -t 1.514016 -n 3 -e 998.474984
N -t 1.514016 -n 1 -e 998.474984
N -t 1.514016 -n 4 -e 998.474984
N -t 1.514016 -n 2 -e 998.474984

and thanks to u,i have learned allot through this blog and i hope to learn more

@Vijay - Every column is represented in AWK Script by its number e.g. $1 means first column (i.e. event), $2 means second column (i.e. time) and so on. Since you are using an Energy model in your TCL Script, you are getting values related to energy model from $14 onwards. Hence you will have to make modifications in the AWK Script accordingly.

Following link will help you to understand trace file format:

http://www.cs.binghamton.edu/~kliu/research/ns2code/#trace

Hope it helps.

Regards,
Mohit P. Tahiliani

Dear Mohit

Can you please give me the link of control overhead/routing overhead awk script if you have? or give advice where i can get it or what i can do in order to measure the control overhead.

Thanks

@Project Management in IT - You can download it from the following link:

http://mohittahiliani.blogspot.com/2011/08/awk-scripts-for-normalized-routing.html

Hope it helps.

Regards,
Mohit P. Tahiliani

Hello Sir
Please help me how to find out the number of received packets from a TCP agent?
Can u suggest me the awk file?

Regards
Suraj

@Suraj - To get the number of received packets, you can modify genthroughput.awk. There is a variable in genthroughput.awk that counts the number of received packets. Just print that variable using printf and you will get the value.

Hope it helps.

Regards,
Mohit P. Tahiliani

Thanks mohit..
I got the received packets.
Well I need a awk file which can calculate the hop counts in wired sructure.
The code is generated.But m not able to have hop counts.
Please guide me

Regards
Suraj

@Suraj - It would be much easier to print hop count from C++ code of your routing protocol instead of getting it from trace file. Just print the C++ variable related to hop count from C++ file.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi Mohit Ji, this is my aodv trace file format.

M 0.0 nn 50 x 300 y 1500 rp AODV
M 0.0 sc scene-50-100-5-900-300-1500 cp cbr-50-6-4 seed 1.0
M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna
s 2.556838879 _1_ AGT --- 0 cbr 512 [0 0 0 0] ------- [1:0 2:0 32 0] [0] 0 1
r 2.593956241 _2_ AGT --- 0 cbr 532 [13a 2 1 800] ------- [1:0 2:0 30 2] [0] 1 1

is it old or new ? And I need some awk files to evalaute the data for following parameters
1. Packet delivery ratio
2. Average end-to- end delay
3.goodput
4. normalized routing traffic and
5. collision rate

pls help me

Hi mates

My topic is about power saving mechanism in ad hoc wireless network without AP. I am writing to you because I need your help please. I implemented the 802.11 without power saving in NS-2 and I got satisfied results. however, now I need to simulate it with power saving mode which means 'sleep mode and idle mode'. so could you please tell me how to put the nodes in sleep mode or give me any information about it. I am using ns-2.34, I have been stuck for 3 weeks
I will be very very very very very thankful

hi mohit,
i am comparing the performance of AODV and AOMDV bases on PDF but the result that i got the AODV larger then AOMDV i dont know why cna u plz help me for example when hte pause time is 40 and number of the node is 50 and mx speed is 40 i got that AODV = 99.474 and AOMDV = 95,878

and the code that used is her BEGIN {
sends=0;
recvs=0;
routing_packets=0.0;
routing_packets_sent=0.0;
routing_packets=0.0;
droppedBytes=0;
droppedPackets=0;
highest_packet_id =0;
sum=0;
recvnum=0;
tcppktno = 0; tcpbyte = 0;
}

{
time = $3;
packet_id = $41;

# CALCULATE PACKET DELIVERY FRACTION
if (( $1 == "s") && ( $35 == "cbr" ) && ( $19=="AGT" )) { sends++; }
if (( $1 == "s") && ( $35 == "cbr" ) && ( $19=="MAC" )) { tcppktno ++; }

if (( $1 == "r") && ( $35 == "cbr" ) && ( $19=="AGT" )) { recvs++; }

# CALCULATE DELAY
if ( start_time[packet_id] == 0 ) start_time[packet_id] = time;
if (( $1 == "r") && ( $35 == "cbr" ) && ( $19=="AGT" )) { end_time[packet_id] = time; }
else { end_time[packet_id] = -1; }

# CALCULATE TOTAL ROUTING OVERHEAD (change the protocol)
if (($1 == "s" || $1 == "f") && $19 == "RTR" && $35 =="AOMDV") routing_packets++;
if ($1 == "s" && $19 == "RTR" && $35 =="AOMDV") routing_packets_sent++;
if ($1 == "f" && $19 == "RTR" && $35 =="AOMDV") routing_packets_forward++;

# DROPPED PACKETS
if (( $1 == "d" ) && ( $35 == "cbr" ) && ( $3 > 0 ))
{
droppedBytes=droppedBytes+$37;
droppedPackets=droppedPackets+1;
}

#find the number of packets in the simulation
if (packet_id > highest_packet_id)
highest_packet_id = packet_id;
}

END {

for ( i in end_time )
{
start = start_time[i];
end = end_time[i];
packet_duration = end - start;
if ( packet_duration > 0 )
{ sum += packet_duration;
recvnum++;
}
}

delay=sum/recvnum;
PDF = (recvs/sends)*100; #packet delivery ratio[fraction]
RO = routing_packets/sends;
printf("send = %.2f\n",sends);
printf("MACpacketSend = %.2f\n",tcppktno);
printf("recv = %.2f\n",recvs);
printf("Routing Packet Sent = %.2f\n",routing_packets_sent++);
printf("Routing Overhead = %.2f\n",RO);
printf("Packaet Delivery Fraction (%) = %.4f\n",PDF);
printf("Average e-e delay (second)= %.4f\n",delay);
printf("No. of dropped data (packets) = %d\n",droppedPackets);
printf("No. of dropped data (bytes) = %d\n",droppedBytes);
}



plz help me plz

i hope you con help me as soon as possible

i will by thankful

Hello Mohit,

I am using your genthroughput.awk script to calculate throughput from the following trace file.

(excerpts)
+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
r 1.002336 0 2 cbr 210 ------- 0 0.0 3.1 0 0
+ 1.002336 2 3 cbr 210 ------- 0 0.0 3.1 0 0
- 1.002336 2 3 cbr 210 ------- 0 0.0 3.1 0 0
+ 1.00375 0 2 cbr 210 ------- 0 0.0 3.1 1 1
- 1.00375 0 2 cbr 210 ------- 0 0.0 3.1 1 1

when i execute the command on the terminal
chithra@ubuntu:~/ns-allinone-2.29/ns-2.29/tcl/ex$ awk -f genthroughput.awk out.tr
Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

i get throughput as -0.00
Can you please let me know whether am missing something??
your help is highly appreciable..
Thanks in advance

plz sir can you help me with my problem as soon as possible

@Rsunil - It is an old trace format. Interpretation is given on the following link:

http://www.cs.binghamton.edu/~kliu/research/ns2code/#trace

and some of the AWK scripts are available on the following link:

http://www.megaupload.com/?f=0211SAG1

@Bowrji - The results depend on the type of topology simulated. It is recommended to use standard topologies for the performance comparison of any two protocols. Modify your topology and analyze again.

@Chithra (Study17) - The trace format which you have posted is of wired network whereas these AWK Scripts are designed only for wireless trace formats. Wired AWK Scripts can be downloaded from the following link:

http://www.reti.polito.it/fiore/trace2stats_v05b.tgz

Hope it helps.

Regards,
Mohit P. Tahiliani

dear

how to put the nodes in sleep mode in ad hoc wireless network without AP.


regards

@Osama - You can find detailed explanation of how to put a node to sleep and vice versa on the following link. However, it is implemented in ns-2 for 802.15.4. But you may take the logic and try to implement it for 802.11

http://www.ee.washington.edu/research/funlab/802_15_4/ns2_changes.pdf

Hope it helps.

Regards,
Mohit P. Tahiliani

Mohit,

Thanks for the clarification. Actually I wanna calculate throughput for wireless scenario only. I am working on HCCA (802.11e) and I am using ns2.29 patch.

Can I use genthroughput.awk script apply for HCCA also?? Kindly let me know.

Thanks,
Chithra

I used the same genthroughput.awk script for HCCA as well which has following trace format (example.trc)

s -t 0.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 50.00 -Ny 40.00 -Nz 0.00 -Ne -1.000000 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.0 -Id 0.0 -It cbr -Il 1 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
r -t 0.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 50.00 -Ny 40.00 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.0 -Id 0.0 -It cbr -Il 1 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
s -t 0.000000000 -Hs 1 -Hd 0 -Ni 1 -Nx 50.00 -Ny 40.00 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.0 -Id 0.0 -It cbr -Il 21 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
s -t 0.000000000 -Hs 2 -Hd -2 -Ni 2 -Nx 58.66 -Ny 55.00 -Nz 0.00 -Ne -1.000000 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 2.0 -Id 0.2 -It cbr -Il 1 -If 0 -Ii 1 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
r -t 0.000000000 -Hs 2 -Hd -2 -Ni 2 -Nx 58.66 -Ny 55.00 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 2.0 -Id 0.2 -It cbr -Il 1 -If 0 -Ii 1 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0

i get the following output at the terminal:
chithra@ubuntu:~/ns-allinone-2.29/ns-2.29/tcl/ex/hcca$ awk -f genthroughput.awk example.trc
Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00


this trace looks way different from the usual wireless trace file. How can I interpret and calculate the throughput n delay? Kindly let me know your suggestion.

Regards,
Chithra

sorry sir can you give me example for using stander Topology because i am new in this pls and my project about performance and comparison of two protocols AODV and AOMDV

and thanks for ur helpe

sir could u give me an example for stander Topology because i want to see how can i comparison of two protocols "AODV and AOMDV"

plz sir help me as soon as possible

Hi Mohit,

How can i put a sensor node in sleep mode or idle mode without enabling beacon or without installing any type of patch

Hi..
After executing throughput.awk script I get error

awk: troughput.awk:46: (FILENAME=aodvtrace.tr FNR=137932) fatal: division by zero attempted

Vaishali
email:- khairnar.vaishali3@gmail.com

@Chithra - Yes you can use the same genthroughput.awk for analysis provided your trace file format is old trace format. The trace file format which you have posted recently is new trace format. AWK Script for throughput for new trace format is available on the following link:

http://mohittahiliani.blogspot.com/2010/03/awk-script-for-ns2-supporting-new-trace.html

@Bowrji - Standard topology design for MANETs is available on the following link:

http://140.116.72.80/~smallko/ns2/adhoc_routing.htm

@Rahul - Without applying any patch you can put a sensor node to sleep by using 802.15.4 which is available in the default allinone package of ns2. Following link will be useful:

http://www.ee.washington.edu/research/funlab/802_15_4/ns2_changes.pdf

@Vaishali - You need to check few things: (1) Make sure your trace file format is wireless old trace format. (2) Use genthroughput.awk available in this post and not throughput.awk provided in "AWK Script for NS-2" post(3) Make sure your packet size in TCL is set to atleast 500. If not, change it accordingly in the AWK Script as well.

Hope it helps.

Regards,
Mohit P. Tahiliani

Mr. Mohit i have downloaded e2edelay.awk for old trace format. great it show me the average delay but when i add more wireless node to transmit UDP/CBR application i got similiar output delay, should it more ms when sum of node increase.
or e2edelay.awk just for measuring TCP delay ?

@Santok - Yes, presently it calculates delay only for TCP connections. Just make following changes to calculate delay for UDP connections:

1. Open e2edelay.awk

2. Search this equation: $7 == "tcp"

3. Replace all such equations by: $7 == "tcp" || $7 == "cbr"

After making these changes e2edelay.awk will work for both TCP and UDP connections.

Hope it helps.

Regards,
Mohit P. Tahiliani

Thank you Mr Mohit, but in my trace file there is no cbr but udp in coloumn 7.
when i run e2edelay.awk i get error fatal:division by zero attempted.
it looks like variabel count has value 0, maybe because no cbr, should i change to udp ?

hi Mr. Mohit i have worked on the Standard topology that you gave it to me but i got this error


"num_nodes is set 50
invalid command name "-llType"

while executing
"-llType $val(ll) \
"

(file "moh.tcl" line 95)
"

pleas can you help me because i dont have time i must finish my work at the end of this month pleas............

Mr. Mohit, how can i use output e2edelay.awk to triger some command in tcl script during simulation.
example
ns_ at 10.0 get value e2edelay for this time
if {$e2edelay > 0.150} {
puts "poor"
}

some like that
please give me clue ?

Thank you sir. I used the awk file for the throughput and its working well. Sir, i would want an awk file for end-to-end delay and packet delivery ratio for ns-2 new trace format..

@Santok - Yes in that case you need to change "cbr" to "udp".

Such tricks are explained in the last link in "Useful Links" Page of this blog.

@Bowrji - I have cross verified that Script and it works fine. Please check for syntax errors wherever you have modified it.

@Amayamoah - pdf.awk provided on the following link works for old as well as new trace formats:

http://www.megaupload.com/?f=0211SAG1

I have not yet designed e2edelay.awk for new trace format. As soon as it is done, I will upload it in the same folder provided on the link above.

Hope it helps.

Regards,
Mohit P. Tahiliani

Thank u, Ur Blog gave us good guidance..

hi sir this is meenakshi my project is smac simulation in wireless sensor networks in ns2 . when iam setting energy parameter like this
set opt(energymodel) EnergyModel ;
-energyModel $opt(energymodel) \
iam getting the error
invalid command name "-energyModel"
while executing
"-energyModel $opt(energymodel) \ "
(file "project.tcl" line 46)

hi sir can i change number of seed in stander topology in ns2 and how

thank u

Dear Mr. Mohit,
I use your genthroughput.awk. It is stated that pkt_size = 512.
If I change my TcL code for generating packetSize_ = 1024000, does it mean I have to change pkt_size = 512000 in genthroughput.awk?
I already changed it, and the result was -0.0.
What do I have to do then? Thank you.

Hi Sir, I am simulating Mobile IP in WiFi. I want to Run Mobile IP on Multichannel. for this purpose i tried ur "NS-2.33-AOMDV-Multiple -Interface.patch" for ns 2.33. but its not working. its giving me error that is
cmu-trace.cc:(.text._ZN9hdr_aomdv6accessEPK6Packet[hdr_aomdv::access(Packet const*)]+0x7): undefined reference to `hdr_aomdv::offset_'
collect2: ld returned 1 exit status
make: *** [ns] Error 1
please help. what should I do.
Reply Soon

Ns make failed!

@Meenakshi - The error is because of a small typo. Use the sample TCL Script provided in the following directory to configure Energy Model in NS-2:

ns-allinone-2.xx/ns-2.xx/tcl/ex

Filename: wireless-newnode-energy.tcl

@Bowrji - Yes you can do that. It is explained in the following link:

http://www.isi.edu/nsnam/ns/tutorial/

See Section XI.1

@Thomhertsiadari - 1024000 is not a realistic value since the underlying Ethernet would frgament it. However if you are still working with it, there is no need to change packet size from 512 to 512000.

@Virgo - The error is because following lines are not added in Makefile.in.

aomdv/aomdv.o aomdv/aomdv_logs.o \
aomdv/aomdv_rtable.o aomdv/aomdv_rqueue.o \

The patch is not adding this lines to Makefile.in

Search for "aodv/aodv_rqueue.o \" in Makefile.in and add above aomdv lines below aodv lines.

Recompile NS-2 once again by following commands:

./configure
make clean
make
make install

Hope it helps.

Regards,
Mohit P. Tahiliani

Can this awk work for video streaming in multicast scenario? I want check delay and throughput for each receiver. Thanks

hi
please mail me the code to perform clustering using ns2

hello sir..........
we r doing project in secure wireless sensor network using ns2...plz help us...for retrieving energy using ns2 in wireless sensor network... and also how to generate dynamic key in wireless sensor nodes?????

Hi Mohit! First of all congratulations for your blog and your web page, they have been very helpful!

I was wondering if you know any way of calculating or showing the power level of the signal received (antenna) in a node from another one or viceversa.

On the other hand, I am studying VANET simulations and it would be great if you knew any web page or document with any code of geocast routing protocols or scenarios... it is quite dificult to find anything : (

Thanks in advance,
Alain

@Andreas - It will work for video streaming but only unicast. You need to modify it for multicast since we have more than 1 receiver in multicast.

@Isvarya - For working with Energy model of NS-2, refer to a sample TCL Script given in the following directory:

ns-allinone-2.xx/ns-2.xx/tcl/ex

NAME: wireless-newnode-energy.tcl

Trace format for such a TCL Script is provided on the following link:

http://www.isi.edu/ilense/software/smac/ns2_energy.html

A sample AWK Script to retrieve remaining energy of a node is provided on the following link:

http://www.mediafire.com/?z1c2cxdt1a31d

NAME: energy.awk (Modify as per your requirement/topology)

Following link deals with Security in Wireless Sensor Networks in NS-2:

http://apachepersonal.miun.se/~qinwan/resources.htm

@Alain - Regarding Received Signal Strength - See the answer given by Daniel Rother on the following link:

http://old.nabble.com/Calculate-Signal-strength-in-ns2-td18536913.html

To generate mobility for VANETs I would recommend you to use SUMO and MOVE tools. Using them you can configure the number of vehicles, traffic signal points, junctions, pause time and several other parameters and generate a TCL script which can be used on any version of NS-2.

Hope it helps.

Regards,
Mohit P. Tahiliani

HI Sir,
I want to calculate control overheads of wireless networks particularly of 802.11b and 802.11s. can u tell me awk code for this
Zara

Hi again
Sir, can u tell me, if I want to generate multimedia traffic on NS 2.33,for this I have configure some thing , or it will run just by adding lines of Tcl code.
I tried by adding RTP/RTCP, but it didnt work.
Can You Guide me
Zara

hii mohit

can u tell me how to get the GNU plot for throughput and delay using trace file

thank u

hello sir,
i want to calculate average delay jitter for wireless networks..
i tried your instantJitter.awk script. but i dint got any output....will u pls provide script for this.
thanku

Hi Mohit

I am using your genthroughput.awk script to get the throughput in wireless scenario in ns-2.34 which is installed in the ubuntu 10.04.

I am using the 1024 cbr packet which is more than 512 which is defined in your awk script then also I am getting the same error as @Here I am.

that is
Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

can you suggest me where i went wrong ?

sir,
while i am running genthoughput.awk
i got error invalid char
i read your previous comments may i know what package should i install.
plz help sir.

@Zara - AWK Script to calculate control overhead is available from the following link:

http://mohittahiliani.blogspot.in/2011/08/awk-scripts-for-normalized-routing.html

To generate multimedia traffic you may try to use the application named RealAudio. The syntax is

Application/Traffic/RealAudio

Default parameters for same are available in ns-default.tcl. ns-default.tcl can be found in ns-allinone-2.xx/ns-2.xx/tcl/lib directory.

@Ram - Follow the procedure given on the link below.

http://mohittahiliani.blogspot.in/2010/08/xgraph-and-awk-scripts-in-ns-2_06.html

Lastly, instead of giving

xgraph filename.xgr

use gnuplot command 'plot' along with its parameters such as line width, etc.

@Naishita - Download the zipped folder that contains AWK Scripts from the following link:

http://www.reti.polito.it/fiore/trace2stats_v05b.tgz

Use avgStats.awk to obtain jitter for wireless networks. However, make sure you use new trace format because avgStats.awk does not work with old trace format.

@Phocus - Make sure your trace file is of old trace format.

@Suga - Verify whether your trace file is corrected generated. Check the packet size you are using in your TCL Script. If it is less than 512 then you need to make changes in AWK Script accordingly.

Hope it helps.

Regards,
Mohit P. Tahiliani

sir i want to calculate no of nodes transmitted from one node to another. if u have any awk script plz mail me . my mail id is india3005@gmail.com

@Naishita: sir Thanks for your reply. But i want to calculate jitter for old trace file format. and will u pls tell me how to calculate throughput at regular intervals like 10s,20s.... i have gone through this link
http://www-sop.inria.fr/members/Eitan.Altman/COURS-NS/n3.pdf
but i dint get the answer. pls help me sir,...

thank u so much sir for your reply.
can u say me what are the steps to create wireless sensor node with 802.11 in ns2.

Hi Mohit!
I am trying to see if definitely I get a throughput of 3MB/s in the simulation I am doing between two mobile nodes using 802.11Ext (802.11p)

I set this values:
#src bitrate: 500*8/0.015=26.666 Kbps= 3.2551MB/s
set cbr0 [attach-CBR-traffic $node_(0) $sink2 500 .015]
set cbr1 [attach-CBR-traffic $node_(1) $sink1 500 .015]

Then I use the awk you provide but i don't get 3MB/s, not even close...
BEGIN {
recvdSize = 0
startTime = 0
stopTime = 0
totalBits=0;
}

{
event = $1
time = $2
node_id = $3
pkt_size = $8
level = $4

# Store start time and total bits sent
if (event == "s" && node_id=="_0_")
{
if (time < startTime) {startTime = time}

if (time > stopTime) {stopTime=time}

totalBits+=8*pkt_size;
}

}

END {

printf("Average Throughput[kbps] = " totalBits/(stopTime-startTime)/1e3);
printf("\n");
}

Have you got any idea of what can be happening?

hey mohhit..
i want to look throughput, delay, jitter, packet drop from the begining till the end of my simulation.(AODV,DSDV,TORA.)
did you have awk file or anything i can use ?
please. . ..

hi mohit sir..
plz say the steps to create wireless sensor node with 802.11 in ns2... plz help me..i need it for my P.G. project

hello sir i am doing project in ns2 to generate throughput and draw garph for that wired simulation.. could you pls help me sir..
if you have code for that could you pls send me to my mail.. my mail id is writee2blossom@gmail.com
thanks in advance..

HI Sir,
I am using ur genthroughput.awk, its finding out result in Kbps.
bcoz you use *8/1000, in the end , why is it so, Is default output is in Mbps. thats why we convert the result in Kbps.

HI Mohit Sir,
I must Appreciate ur work, You are doing an excellent job.
for the last few days I am trying to work on Multiple unterface that is 802.11n. I have installed your NS-2.33-AOMDV-Multiple-Interface Patch, it working with other code, but ur multiple interface code given in folder Multi-Interface TCL Scripts - DSDV_2 is not running, like I tried "im3pmesh.tcl", its giving a long list of error with many procedures number, I tried to post that error , but i Think its too long to paste, I have mailed you many times, But perhaps you are not checking your mail.
Please help me.
Zara

Hello Mohit Sir,
I want an AWK script that calculates total ENERGY CONSUMED in the network. I have tried by my own but could not found the required result.
so please send me the AWK script to my email address that is suchakrajan@gmail.com

Thank you

hi,this is lotus.
I want to know how to add FEC codes to data packets in different time slots in ns-allinone-2.3.4????.plz reply as soon as possible.

«Oldest ‹Older   1 – 200 of 278   Newer› Newest»

Post a Comment

Guest Book...!!!