Search This Blog

Few more AWK Scripts for NS2

Labels: , ,

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. APP contains a set of 20 AWK Scripts which, if required, can be used outside APP also.

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 (293)

«Oldest   ‹Older   201 – 293 of 293   Newer›   Newest»

Hi mohit,
i have the tcl script for wormhole attack in AODV protocol, but i have some difficulty for wormhole attack in DSR protocol. If u have a TCL script for wormhole attack in DSR then give me pls.
thanx ..

Hi sir;
thanks for ur help in advance; I am new in ns2 and I want to know how I can calculate the number of routes used to transmit traffic between source and destination.

Thank you

Hi sir;
thanks for ur help in advance; I am new in ns2 and I want to know how I can calculate the number of routes used to transmit traffic between source and destination.

Thank you

Hi sir;
I am new in ns2, plz can you explain for me why you put in your script genthroughput.awk :
1. startTime = 400
2. && pkt_size >= 512
3. # Rip off the header

hdr_size = pkt_size % 512

pkt_size -= hdr_size
In my trace file, I have pkt_size=0 for event=="s" and level=="AGT" for ftp traffic
Thanks in advance

Hi sir;
I need to count the number of used routes to transmit traffic between source and destination. Can u help me sir my email is : rachaji@gmail.com
thanks sir;

Hi Mohit need your to plot xgraph. I am getting an error if i run xgraph.
i am trying to calculate end to end delay, it gives an error which can be seen below:

Error in file `n2ndelay.xgr' at line 3:
Unknown line type
Problems found with input data.

hi mohit, need an help in plotting an xgraph.

When i run the xgraph command i often get this error which is given below:

Error in file `n2ndelay.xgr' at line 3:
Unknown line type
Problems found with input data.

Please help me in rectifying it.

Hi Mohit ,


can we implement 6LowPAN over 802.15.4 in ns-2 ? can you suggest any simulation tool for this implementation ?

Hi Mohit .

can we implement 6LowPAN in ns-2 over 802.15.4? if no.. then can you suggest me any appropriate tool to simulate it ?

hi can u help me wth sctp script?

sir,please help me


i m working on dccp for manets.......
i m not able to create a topology by giving dccp instead of tcp......
i m using ns-2.34.......please help me what should i do.......
my work is for my dissertation....


the error that is generated is


num_nodes is set 3
Configuring Nodes
INITIALIZE THE LIST xListHead
dccp1 variable created
dccp1 class set OK
Connection - 1 Establised
Connection - 2 Established
Printing the window size Completed
Everything is done
*** stack smashing detected ***: ns terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0xb9a0a0]
/lib/i386-linux-gnu/libc.so.6(+0xe704a)[0xb9a04a]
ns(_ZN8CMUTrace10nam_formatEP6Packeti+0xbcf)[0x82bc1d9]
ns(_ZN8CMUTrace6formatEP6PacketPKc+0x6b)[0x82bc24f]
ns(_ZN8CMUTrace4recvEP6PacketP7Handler+0x71)[0x82bc587]
ns(_ZN5Agent4sendEP6PacketP7Handler+0x2c)[0x81d4ebe]
ns(_ZN9DCCPAgent6outputEb+0x732)[0x8236dee]
ns(_ZN9DCCPAgent7sendmsgEiPKc+0x1a3)[0x8239e95]
ns(_ZN5Agent7commandEiPKPKc+0x30b)[0x81ded1b]
ns(_ZN9DCCPAgent7commandEiPKPKc+0xad)[0x82391a1]
ns(_ZN16DCCPTCPlikeAgent7commandEiPKPKc+0x1f)[0x823f74d]
ns(_ZN8TclClass12dispatch_cmdEPvP10Tcl_InterpiPPKc+0x32)[0x83d1396]
ns[0x83d4f83]
ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
ns(TclEvalObjvInternal+0x373)[0x83db713]
ns[0x8407aba]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns[0x8407dd3]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns(TclObjInterpProc+0x2a7)[0x8435dc7]
ns(TclProcInterpProc+0x80)[0x8436280]
ns[0x83d5153]
ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
ns(TclEvalObjvInternal+0x373)[0x83db713]
ns[0x8407aba]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns(TclObjInterpProc+0x2a7)[0x8435dc7]
ns(TclProcInterpProc+0x80)[0x8436280]
ns[0x83d4f83]
ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
ns(TclEvalObjvInternal+0x373)[0x83db713]
ns(Tcl_EvalEx+0x4fc)[0x83dc3ac]
ns(Tcl_Eval+0x3c)[0x83dc64c]
ns(Tcl_GlobalEval+0x36)[0x83dc6e6]
ns(_ZN3Tcl4evalEPc+0x1b)[0x83d09a3]
ns(_ZN9AtHandler6handleEP5Event+0x24)[0x81c4e1a]
ns(_ZN9Scheduler8dispatchEP5Eventd+0x94)[0x81c4dd0]
ns(_ZN9Scheduler3runEv+0x2c)[0x81c4d04]
ns(_ZN9Scheduler7commandEiPKPKc+0x6b)[0x81c4eb1]
ns(_ZN8TclClass12dispatch_cmdEPvP10Tcl_InterpiPPKc+0x32)[0x83d1396]
ns[0x83d4f83]
ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
ns(TclEvalObjvInternal+0x373)[0x83db713]
ns[0x8407aba]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns[0x8407dd3]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns(TclObjInterpProc+0x2a7)[0x8435dc7]
ns(TclProcInterpProc+0x80)[0x8436280]
ns[0x83d5153]
ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
ns(TclEvalObjvInternal+0x373)[0x83db713]
ns[0x8407aba]
ns(TclCompEvalObj+0xdd)[0x840bd4d]
ns(TclObjInterpProc+0x2a7)[0x8435dc7]
ns(TclProcInterpProc+0x80)[0x8436280]
ns[0x83d4f83]

my code is

set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) CMUPriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 50
set val(nn) 3
set val(rp) AODV
set val(x) 500
set val(y) 400
set val(stop) 150







#-------Event scheduler object creation--------#

set ns [new Simulator]
#creating trace file and nam file
set tracefd [open 1.tr w]
set windowVsTime2 [open 1a.tr w]
set namtrace [open 1.nam w]
puts "Created Files"

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

set chan_1_ [new $val(chan)]
puts "Configuring Nodes"
# configure the nodes
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel $chan_1_ \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON

for {set i 0} {$i < $val(nn) } { incr i } {
set node_($i) [$ns node]
}

# Provide initial location of mobilenodes
$node_(0) set X_ 5.0
$node_(0) set Y_ 5.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 490.0
$node_(1) set Y_ 285.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 150.0
$node_(2) set Y_ 240.0
$node_(2) set Z_ 0.0

# Generation of movements
$ns at 10.0 "$node_(0) setdest 250.0 250.0 3.0"
$ns at 15.0 "$node_(1) setdest 45.0 285.0 5.0"
$ns at 19.0 "$node_(2) setdest 480.0 300.0 5.0"

# Set a TCP connection between node_(0) and node_(1)
set dccp1 [new Agent/DCCP/TCPlike]
puts "dccp1 variable created"
$dccp1 set class_ 2
puts "dccp1 class set OK"

set dccpsink1 [new Agent/DCCP/TCPlike]
$ns attach-agent $node_(0) $dccp1
$ns attach-agent $node_(1) $dccpsink1
$ns connect $dccp1 $dccpsink1
set ftp [new Application/FTP]
$ftp attach-agent $dccp1
$ns at 10.0 "$ftp start"
puts "Connection - 1 Establised"

#Setup a CBR over UDP connection
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $dccp1
#$cbr set type_ CBR
#$cbr set packet_size_ 1000
#$cbr set random_ false
$ns at 10.0 "$cbr0 start"

set dccp [new Agent/DCCP/TCPlike]
$dccp1 set class_ 2
set dccpsink [new Agent/DCCP/TCPlike]
$ns attach-agent $node_(1) $dccp
$ns attach-agent $node_(2) $dccpsink
$ns connect $dccp $dccpsink
#set ftp [new Application/FTP]
#$ftp attach-agent $dccp1
#$ns at 10.0 "$ftp start"


#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $dccp
#$cbr set type_ CBR
#$cbr set packet_size_ 1000
#$cbr set rate_ 1mb
#$cbr set random_ false
$ns at 10.0 "$cbr1 start"

$ns at 9.0 "$dccpsink1 listen"
$ns at 9.0 "$dccpsink listen"
puts "Connection - 2 Established"




# Printing the window size

proc plotWindow {tcpSource file} {
global ns
set time 0.01
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file "$now $cwnd"
$ns at [expr $now+$time] "plotWindow $tcpSource $file" }
$ns at 10.0 "plotWindow $dccp1 $windowVsTime2"

puts "Printing the window size Completed"

# Define node initial position in nam
for {set i 0} {$i < $val(nn)} { incr i } {
# 30 defines the node size for nam
$ns initial_node_pos $node_($i) 150
}

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$node_($i) reset";
}

# ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at 150.01 "puts \"end simulation\" ; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam 1.nam &
}

puts "Everything is done"
$ns run

Hello Mohit
I am currently working on WMN, I used the AWK script for throughput/delay and its working fine for the entire network, is it possible to modify the script such that one will get throughput for an individual node or can one calculate throughput for just one node

Thank you for this Mohit :)
I want to know how I can retrieve the packets loss and signal signal strength from a file .tr ?

Thank you
S.K

sir, how to save the output of a awk file into another file?

hi mohit sir,

please guide..
i want to estimate the network lifetime in an aodv network and compare them for varying number of wireless nodes and the varying values of initial energy. how can i do that? also the results are to be plotted using Xgraph ..

Dear Sir,
when i use trace file for new trace and got like -29.Can you help me look what did I do wrong?IS it ok if I'd like to send my related file to you?
My e-mail is teddyparry@gmail.com

Pare

Hello Mohit Sir,
I am gokul n i am doing my final year B.tech project on csma protocol with power backoff. In my project i have to compare the already existing the temporal backoff which mac 802.11 protocol uses for contention resolution and the new csma protocol with spatial(power) backoff. Firstly, I want to know which file to select to execute the temporal backoff in mac 802.11 protocol. Secondly, I want to know whether there is already a code in ns-2 to implement csma protocol with power backoff. Please help me I'm new to ns-2 and I need you help badly.

Regards,
Gokul

Hi Sir,
I am using ns2 and I'm trying to execute a script.awk for the protocol AODV in order to calcul the throughput,energy and end to end delay.is there any script.awk for these parameters and for the protocol AODV because the trace file is not like the other.
thx a lot :)

Hello Mohit Sir,i am Darmin from Malaysia.
I am doing analysis on QoS of video transmission over WiMAX. I am using ns2.31 and nist patch for wimax. I am using evalvid tools "http://140.116.164.80/~smallko/ns2/myevalvid2.htm" by smallko for the video analysis. I dont know how to write a tcl script to run the video analysis over WiMAX. Could you help me sir. thanks

Sir..
I am working on energy efficiency in wireless sensor networks. Can you please help me with the awk scripts. My id is nathankarthik123@gmail.com

Hi mohit

i am trying to find out link utilization between two nodes, in wirless , both r static nodes , whereas 0 is receving 2 is sending and it back off is resetting , i want to see how much impact it is putting on link

need help

BEGIN {
recvdSize = 0
startTime = 400
stopTime = 0
}

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

# Store start time
if (level == "AGT" && event == "s" && node_source == 2) {
if (time < startTime) {
startTime = time
}
}

# Update total received packets' size and store packets arrival time
if (level == "AGT" && event == "r" && node_des == 0 ) {
if (time > stopTime) {
stopTime = time
}
# Rip off the header
hdr_size = pkt_size % 512
pkt_size -= hdr_size
# Store received packet's size
recvdSize += pkt_size
}
}

END {
printf("Average Throughput[kbps] = %.2f\t\t StartTime=%.2f\tStopTime=%.2f\n",(recvdSize/(stopTime-startTime))*(8/1000),startTime,stopTime)
}

Dear sir,

Please Send me the AWK script to find out energy level of each node at each instance of time.

dhavalkvaria@gmail.com

Thanks in Advance.

I working on wireless network , Now I want calculate energy efficiency for sleep nodes in protocols like SMAC kindly help me. mahaveerjj@rediffmail.com

@Meenakshi - Number of packet sent between two nodes can be counted by using $1, $3, $4 and $7 information available in the trace file. Modify the available AWK scripts accordingly.

@Naishita - For old trace format, only the column numbers differ. The rest of the logic of an AWK script remains the same. So change the column numbers appropriately.

@Suga - It is not recommended to create a sensor node with 802.11. Instead you can check out the sample TCL Scripts provided for 802.15.4 in NS-2 package in the following directory:
ns-allinone-2.xx/ns-2.xx/tcl/ex/wpan

@Alain - There are many factors that affect the throughput, e.g. Switch off RTS/CTS and you will see a drastic increase in the network throughput. Moreover, achieving 100% throughput in wireless networks is still an open research problem!

@Spyware - You need to modify the existing AWK Scripts based on the instructions given on the following link:

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

@Honey - trace2stats available from the following link will be useful to you:

http://perso.citi.insa-lyon.fr/mfiore/research.html

@Zara (Virgo) - The default output is in bytes/second and hence we convert it to Kbps. NS-2.33-AOMDV-Multiple-Interface patch seems to work fine. Please ensure you have followed the steps correctly.

@Theking - energy.awk provided on the following link may be useful to you. However, make sure you modify it according to your requirements.

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

@Lotus - FEC is by default implemented in the ns-2 package. You can also find some details related to same on the following link:

http://ns-2.blogspot.in/2007/05/hacks-adding-forward-error-correction.html

Hope it helps.

Regards,
Mohit P. Tahiliani

@Amol - Sorry, havent worked with that. Will post the details if found.

@Haji - The number of routes between a source and destination can be found out by printing the routing table of the routing protocol being used.

startTime is initialized to 400 so that the first time when if (time < startTime) is executed - it turns out to be true and simulation start time can be captured. It is required for calculating throughput.

pkt_size > 512 is because in my TCL Script I have set data packet size as 500 bytes. Modify it accordingly based on what packet size you give in the TCL script.

The header is removed because the it is not useful for the application.

@VishwanathMS - The xgraph file must not contain any additional data apart from the two columns which form X and Y axis of the graph. Read the following blog:

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

@Phocus Array - 802.15.4 is available in the default package of ns-2. Find the sample TCL Scripts in the following directory:

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

@Shaveta- The sample TCL script is available in the following directory:

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

@Mintu Singh - Better to use the TCL Script provided on the following link while working with MANETs:

140.116.164.80/~smallko/ns2/adhoc_routing.htm

@Nombuso - Throughput can be calculated for the entire network or for a particular link. For both, the logic remains the same. Only the fields in the trace file must be appropriately used.

@Mils - "D" in the first column of the trace file indicates a packet loss. Received signal strength cannot be calculated from the trace file. It must be printed from the C++ file.

@Tushar - Give the following command:

awk -f filename.awk filename.tr > filename.txt

@Niteshagrawal - energy.awk available on the following link may be useful to you. However, make necessary modifications as per your requirements.

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

@Pare - Didnt get your question? Can you make it more clear please!

@Gokul - All files related to 802.11 are available in the
ns-allinone-2.xx/ns-2.xx/mac directory.

The syntax of executing all 802.11 types can be obtained from

ns-allinone-2.xx/ns-2.xx/tcl/lib/ns-default.tcl

The default values are set in this file.

@Realiste1988 - AWK Scripts provided in this blog will work fine for AODV.

@Darmin - Sorry, havent worked with that. Will post relevant details if found.

@Passion of the Christ - energy.awk available on the following link may be useful but modify it according to your requirements.

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

@Khoso - Link utilization is nothing but the throughput. To calculate that for two nodes, modify the if condition to include sending and receiving node numbers, "s" and "r" as $1, "AGT" and "RTR" as layers and packet type = cbr OR tcp whichever you have used in the TCL Script.

@Dhaval - Create an AWK Script based on the guidelines given on the following link:

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

@Mahaveerjj - energy.awk available on the following link may be useful but modify it according to your requirements.

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

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi, I'm new to ns2, i'm using your throughtput_newtrace, may i know what are these parameters for
recvdSize = 0
startTime = 400
stopTime = 0

and why the starttime is set to 400?

I want to calculate the throughtput for the whole 802.11 network that i setup, is it correct to use this awk script?

this is my email address justme7345@gmail.com

Can you please drop me a email. I've got a ns2 question that i would like to ask but afraid its to long to type it out here.

Thank you.

Looking forward to your reply.

@Jan - The justification for setting starttime = 400 is given in my previous comment (just above your comment).

Yes it is alright to use this AWK Script for 802.11 networks.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi,

I use the throughput_newtrace to calculate the throughput but i realize it only works for FTP traffic. I am simulating CBR traffic.

How can i modified the awk script to calculate CBR traffic.
And can it calculate both, as i want to calculate the throughtput of the network that sends both type of traffic.

Please reply ASAP, urgent.

Thank you so much.
justme7345@gmail.com

@Jan - throughput_newtrace works well with both FTP as well as CBR because there is no such condition mentioned in the script that differentiates both type of traffic. May be you are not getting result because of different packet size used in the TCL Script. Replace 512 in throughput_newtrace by the packet size which you have used in the TCL Script.

Hope it helps.

Regards,
Mohit P. Tahiliani

plz tell me how to calculate throughput of tcp hybla and various flavors in heterogeneous enviornment?

@Nir - genthroughput.awk available in this blog can be used to calculate throughput for all flavors of TCP.

Hope it helps.

Regards,
Mohit P. Tahiliani

Hi sir,
i have the following awk code and trace file for wired cum wireless networks.
while am executing tcl script many packets are dropped but my awk output shows no of dropped pkt as zero. can u correct my awk script to calculate delay as well as no of dropped packets.
________________________________________________
awk code for end-to end delay
_________________________________________________
BEGIN {

seqno = -1;

droppedPackets = 0;



count_tcp = 0;

drop_tcp = 0;

n_to_n_delay_tcp = 0;

avg_n_to_n_delay_tcp = 0;


}

#end-to-end delay

{

#packet delivery ratio

if(($4 == "AGT") && ($1 == "s") && (seqno < $6)) {

seqno = $6;


}





if(($1 == "s") && ($4 == "AGT") && ($7 == "tcp" )) {

start_time_tcp[$6] = $2;
traffic_type[$6] = "tcp";

} else if(($3 == "1") && ($1 == "r") && ($4 == "0") && ($5 == "tcp")){

end_time_tcp[$12] = $2;



} else if(($1 == "D") || ($1 == "d") && ($4 == "IFQ") || ($7 == "tcp")) {

end_time_tcp[$6] = -1;


}




}



END {



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

if(traffic_type[i] == "tcp")

{

if(end_time_tcp[i] > 0) {

delay_tcp[i] = end_time_tcp[i] - start_time_tcp[i];

count_tcp++;
n_to_n_delay_tcp = n_to_n_delay_tcp + delay_tcp[i];


}


else
{
drop_tcp++;
}


}



}


print "total number of packet generated = " seqno+1;

print "total number of tcp packets = " count_tcp;

print " total delay =" n_to_n_delay_tcp " ""seconds";

avg_n_to_n_delay_tcp = n_to_n_delay_tcp/seqno+1;

print "avg delay = " avg_n_to_n_delay_tcp " ""seconds"

print "Number of Dropped Packets = " drop_tcp ;






}



--------------------------------------------------------
trace file
---------------------------------------------------------

+ 10 0 4 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
- 10 0 4 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
+ 10 1 4 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
- 10 1 4 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
+ 10 2 4 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7
- 10 2 4 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7
+ 10 3 4 tcp 40 ------- 2 0.3.0.0 1.0.4.0 0 8
- 10 3 4 tcp 40 ------- 2 0.3.0.0 1.0.4.0 0 8
+ 10 4 5 tcp 40 ------- 0 0.4.0.0 1.0.1.1 0 9
- 10 4 5 tcp 40 ------- 0 0.4.0.0 1.0.1.1 0 9
r 10.006003 1 4 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
+ 10.006003 4 5 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
- 10.006003 4 5 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
r 10.008003 0 4 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
+ 10.008003 4 5 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
- 10.008003 4 5 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
r 10.010003 2 4 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7
+ 10.010003 4 5 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7
- 10.010003 4 5 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7
r 10.012004 3 4 tcp 40 ------- 2 0.3.0.0 1.0.4.0 0 8
+ 10.012004 4 5 tcp 40 ------- 2 0.3.0.0 1.0.4.0 0 8
- 10.012004 4 5 tcp 40 ------- 2 0.3.0.0 1.0.4.0 0 8
r 10.014004 4 5 tcp 40 ------- 0 0.4.0.0 1.0.1.1 0 9
r 10.018057718 _6_ AGT --- 9 tcp 40 [13a 1 0 800] ------- [8192:0 4194305:1 30 4194305] [0 0] 1 0
s 10.018057718 _6_ AGT --- 10 ack 40 [0 0 0 0] ------- [4194305:1 8192:0 32 0] [0 0] 0 0
r 10.020007 4 5 tcp 40 ------- 3 0.1.0.0 1.0.2.0 0 6
+ 10.020063 5 4 ack 60 ------- 0 1.0.1.1 0.4.0.0 0 10
- 10.020063 5 4 ack 60 ------- 0 1.0.1.1 0.4.0.0 0 10
r 10.022007 4 5 tcp 40 ------- 2 0.0.0.0 1.0.1.0 0 5
r 10.024007 4 5 tcp 40 ------- 4 0.2.0.0 1.0.3.0 0 7

@Shiny John - This AWK Script is not correct because it is designed with respect to old trace format which is different than the one used in wired networks.

You need to design a new AWK Script for such a scenario.

Hope it helps.

Regards,
Mohit P. Tahiliani

hi all ..
I have the task of simulating the energy in the battery to wirelles sensor network using NS-2 ..
I do not know his awk script
please help me ..
thank you ..

I'm sorry my english is very bad

hi this is raj and i want a script of energy consumption ,routing protocol used aodv and how can i draw xgraph between two parameter.
my gmail id is titfortat.raj@gmail.com
so if you have script so please send me on my email address

@Bambang - You can find the sample TCL script for energy consumption in the default package of ns-2 in the following directory:

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

Name of the TCL Script is: wireless-newnode-energy.tcl

AWK Script for the same can be downloaded from the following link:

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

Name of the AWK Script is "energy.awk" (Note: You will have to modify it for your use).

@Paritosh - Same answer applies to you as well !!!

Hope it helps.

Regards,
Mohit P. Tahiliani

My trace fiel was old format as below;
But still showing error .


>>awk -f e2edelay.awk wireless1.tr
awk: e2edelay.awk:91: (FILENAME=wireless1.tr FNR=256361) fatal: division by zero attempted



s 2.556838879 _0_ AGT --- 0 cbr 100 [0 0 0 0] ------- [0:0 50:0 32 0] [0] 0 0
r 2.556838879 _0_ RTR --- 0 cbr 100 [0 0 0 0] ------- [0:0 50:0 32 0] [0] 0 0
s 2.556838879 _0_ RTR --- 0 AODV 48 [0 0 0 0] ------- [0:255 -1:255 30 0] [0x2 1 1 [50 0] [0 4]] (REQUEST)
r 2.557826970 _13_ RTR --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [50 0] [0 4]] (REQUEST)
r

can someone point out why? Thanks in advance...

Mohit i want to calculate throuput,delay and load for ZRP protocol but your file is not working. i got throuput 0.00 so tell me how to calculate this three thing

it's urgent please help me

hello mohit i want to calculate throughput for ZRP protocol but the file given by you is not giving me output

i got throuput=0 starttime=400 like that

tell me what to do it's urgent please help me

Hi sir,

How can i calculate the residual energy of the nodes and also the network lifetime....
Pls help me sir... i require tis immediately....
Thanx in advance....

sir i am doing adaptive data dissemination in vanet. In that i want to show bandwidth utilization of each channel in dsrc. is this possible in ns-2.
If suppose channel capacity is full i want to divert the packets to other channel depending upon no. of packets. can i integrate this with sumo

my energy calculation programe is not working for trace files using ns2.34
can you please guide me
actually i tried to call the awk script using java
i need it urgently



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.
my trace file is in ns2.34 format
so please send me the AWK script to my email address that is pbacharyaa@gmail.com

Hello Mr. Mohit,
Sir, I'm currently doing my M.E project in NS 2.35 and I have a few queries:
(1) Can u state me few advantages of NS 2.35 over other existing versions and another popular Simulator OPNET?

Thankyou in advance
Regards,
Post Graduate Scholar
Ambili Girrish

hey mohit sir.. thanks for such a helpful blog and the tools u provide.
i want to know that is it possible in ns2 to send a real time date like we can say a string or an english or character and then it get modified because of blackhole and that black hole is prevented using hash chain method

pls reply asap
i need ur help..

hey mohit sir.. thanks for such a helpful blog and the tools u provide.
i want to know that is it possible in ns2 to send a real time date like we can say a string or an english or character and then it get modified because of blackhole and that black hole is prevented using hash chain method

pls reply asap
i need ur help..

hiii Mohit.....can i get awk scripts for old trace file format for wired network....???????

hi Mohit Sir,

can i get awk script for old trace file format for wired network....

SIR I M NEW TO NS2.
i m getting an error whil executing throughput.awk
BEGIN as a invalid command

Hi Mohit, this is Swamy here.
How to calculate the average lifetime of a sensor node in wsn. Is there any relationship between energy consumption and lifetime of a node.
Please if you have awk scripts to calculate average lifetime of a node please send to
swmy.veerabhadra@gmail.com

Thanks,
Swamy

Hello everybody
i want to calculate energy consumption for aodv dsdv dsr and tora,
so i need the awk for the energy consumption in ns2 simulator
please
thanks

Hello mohit sir..
I wanted the AWK script for energy consumption by nodes in wireless network.
I am getting Page not found error while downloading it. please tell me how can i get it.
i am badly in need of it.

Hi i simulated a script tcl for wireless network . and i want an awk script to have the graph of packet sending rate and loss rate . I have seen in your script but they schow me only the number of packets sent and dropped but i need the rate . Pleaase help me .

Hello,

i want to calculate the pdr of puma.tcl
while using the provided pdr.awk i m getting weird result, i.e nb of s < nb of r

cbr s:633 r:5628, r/s Ratio:8.8910, f:6525

how can i fix it ?

thank you

Hello Mohit
I want to write awk for my trace file but the format of trace file is different and is like this can you help me to calculate E-2-E delay, packet reception ratio, consumed energy? tnx

M 103.20000 233 (71.07, 120.78, 59.49), (95.89, 200.10), 1.82
M 103.20000 234 (232.61, 84.83, 353.75), (271.25, 52.16), 2.49
M 103.20000 235 (312.73, 346.13, 252.57), (345.59, 388.12), 0.28
M 103.20000 236 (161.05, 424.74, 61.95), (212.46, 485.95), 1.92

Hello sir,
I am doing my master's project in ns-2.my project is to analysis and comparison of aodv,dsr and dsdv over different mobility models. Could you plz provide me tcl and awk scripts for the same as mentioned above.

Thanks.

hi
I used energy consumption awk script but in trace file energy column is not apear.
please help me!

hi sir,this is Nirmala B R pursuing Mtech.I am interested to my final year project in wireless sensor networks area, last sem i have gone through various LEACH protocols so I wanted to do project using ns2 in the same area.Can you plz suggest me what kind of project I can do? plz guide me sir..my mail id is nirmala.nimmu4@gmail.com thank you sir,waiting for ur reply

plz do reply sir

Hi
I want an awk file to calculate the dropped packets for each node in ad-hoc wireless network with the old format.
my e-mail: abtsherif@yahoo.com

thank you

hi
can you give me awk file to calculate the energy consumed from each node in ad-hoc networks.

email: abtsherif@yahoo.com

Hi every one ,
Am doing proj on attack detection in wireless networks based on RSS, how can i filter the nodes wiz is highest energy consumption, pls help me soon as possible...

Hello,

Do u have idea why i am getting this output while finding end to end delay ?

sumegha@sumegha-SVF15212SNW:~/Desktop/Highway1$ awk -f e2edelay.awk highway1.tr


Average End-to-End Delay = -nan ms

I want to asking how to implement congestion control in AODV or DSR, could anyone help me? Thank You :)

hloo sir,
I have doubt how to calculate packet send and packet receive in each node through awk scripts.
According through ur code for paket send and packet receive....
BEGIN {

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 = "_5_" && action == "r" && layer == "AGT" && type == "cbr" && size >= 1000) || (node_id = "_6_" && action == "r" && layer == "AGT" && type == "cbr" && size >= 1000)) {

count++;

}

}

}

END {
printf("%d\n",count);
}
this code seqno< 68....
wht this 68 no indicates..???
hope ur valuable reply..................
Thanks and Regrads,
Ann Sunny

hey plz help..when i run run command xgragh throughput.xgr
it display warning :cannot open file 'throughput.xgr'
nothing to plot...
can any1 expalin me how to plot a graph

sir i got error in e2edelay.awk when i generate graph throughput --> delay.... in aodv protocol. i got the value of throughput...but can't get e2edalay value...

Hello sir
when I run script e2edelay with leach.tr
following error occur

awk: e2edelay.awk:91: (FILENAME=leach.tr FNR=376077) fatal: division by zero attempted

please reply

hello sir.. i am doing project in NS2, performence evalution of AODV and DSR routing protocals using TCL and AWK script. To generate throughput and delay graph for the wireless simulation(AODV & DSR).

plz sir could u give me an example and some materials for standard topology bcz i want to see how can i comparison of two protocals (AODV and DSR).

plz sir help me as soon as possible.

My ID is asna.amu@gmail.com

hii mohit

i am calculating residual energy and comparing performance between aodv and aomdv routing protocol. how to patch awk file in these two routing protocol?? please send me reply if anyone having the code ....my mail id - soumyasahoo22@gmail.com

Hello Sir Mohit,

I used your genthroughput.awk on my wireless trace file (old format) but I am getting this:
Average Throughput[kbps] = -0.00 StartTime=7.67 StopTime=0.00
packet size is set to 512. Trae file sample is as follows:
s 7.668618722 _1_ AGT --- 0 cbr 512 [0 0 0 0] ------- [1:0 2:0 32 0] [0] 0 16777215
r 7.668618722 _1_ RTR --- 0 cbr 512 [0 0 0 0] ------- [1:0 2:0 32 0] [0] 0 16777215
s 7.668618722 _1_ RTR --- 0 AODV 48 [0 0 0 0] ------- [1:255 -1:255 30 0] [0x2 1 1 [2 0] [1 4]] (REQUEST)
s 7.668733722 _1_ MAC --- 0 AODV 106 [0 ffffffff 1 800] ------- [1:255 -1:255 30 0] [0x2 1 1 [2 0] [1 4]] (REQUEST)
s 7.718652679 _1_ AGT --- 1 cbr 512 [0 0 0 0] ------- [1:0 2:0 32 0] [1] 0 16777215
r 7.718652679 _1_ RTR --- 1 cbr 512 [0 0 0 0] ------- [1:0 2:0 32 0] [1] 0 16777215
I am not getting the error. Kindly help.

hi sir,
can you plz tell me how to get output for delay,throughput,packet delivery ratio in new trace file format.Because while evaluating these values i got some problem.I think that if i run my program in new trace file format then it will be helpfull.Would u plz help me?

ayan

Hi,
Can I get the awk script for energy consumption

Hello sir,
I am doing my project in ns 2.34, so can you please mail me the awk script for calculating the average residual energy of the nodes in the network. I tried on my own but didn't get correct results, i request you to mail, my mail-id:-
shrutibhavi@gmail.com

hello sir
I m working on ns2.35 ubuntu 12.04
when i try to use awk script for genthroughput, instant jitter, e2e delay using command
awk -f filename.awk ns.trc >aodv.xg
then it always show that
awk: cannot open genthroughput.awk(No such file or directory)
bt it works fine for pdf (pdf and other scripts are in the same folder)
plz help me sir
thanx

plzzzzz sir reply as soon as possible thx

@Angel - This means that genthroughput.awk is not available in the same folder where you are giving the awk command.

@Shruti Bhavi, Surbhi and Ayan Dey - You can try getting the same by using the Automated Post Processing (APP) Tool which we have designed recently. Following is the link: http://mohittahiliani.blogspot.in/2014/10/automated-post-processing-app-tool-for.html

HI sir i am working on cygwin terminal for NS2.how i can run the awk file and plot the xgraph.my mail id:khushbu.patel116@gmail.com

@Khushbu Patel - May be the following blog post may help you:

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

Hope it helps.

Regards,
Mohit P. Tahiliani

hello sir, im trying to find tcl script for HybridMAC protocol that is needed to run in wireless Ad hoc networks environment by using ns2..do u have any idea where i can find suitable script?plz help me...how can i change the script according to my parameters?

hello Mohit i use e2edelay awk but i get output as-
devki@ubuntu:~/Desktop/raushan$ awk -f e2edelay.awk out.tr


Average End-to-End Delay = -nan ms

what is going thsi please help me

Hello Sir

please provide me FSR source code in ns2 and how to draw xgraph for more than one xg files on a single graph to compare the values for different protocol.

please tell me how to do that

Regards

@Richa Goyal - The FSR patch for ns-2 can be downloaded from the following link:

http://fsr-routing.sourceforge.net/

Give the following command to plot multiple ".xg" files using xgraph:

xgraph file_1.xg file_2.xg . . . file_n.xg

Hope it helps.

Regards,
Mohit P. Tahiliani

@Kuljit - I have not worked on HybridMAC and moreover, haven't come across any such code as well. So could not assist you much on this!

@Devaki - Check within the AWK Script whether "if" conditions match your requirements or not. If not, please change them as you need and try again.

Hope it helps.

Regards,
Mohit P. Tahiliani

hi...my project contain comparison of aodv and NCMR protocol(for unicast and multicast network) in terms of four parameters like energr,sdr,packet loss,end to end delay...will u please send me tcl script and c++ code for aodv unicast & multicast which giving parametrs with respective to BER

@Anvika - AODV is just an unicast protocol. Multicast AODV (MAODV) is another variant of AODV which is a multicast protocol.

First you need to patch MAODV in your machine and then carry on with the project. Sample TCL files for AODV are available in the default package of ns-2 and those of MAODV are available in the patch itself.

Hope it helps.

Regards,
Mohit P. Tahiliani

hello Sir!

can any one help me please to implement an algo to prevent from intrusion on tcl using ns2 its a kind of intrusion detecttion system based on energy , so we need to set an amount of energy required if an intrusion demand more , we must claim it and stop the requesting node! tnx in advance !?

waitiing for ur replay sir !

hi mohit when i see trace for puma there are no CBR packets in AGT for receiver only TCP what could be the reaso .please help

After executing the tcl file of my program, the nam file is not displaying. I try to run nam file directly with the command nam output.nam but it shows me the following error:

Cannot connect to existing nam instance. Starting a new one...
*** !!! ***
nam cannot recognize the trace file PREVENTION_BLACK_HOLE.nam
Please make sure that the file is not empty and it is a nam trace

Please help!

Sir, I want to know what is the error in this throughput file

BEGIN {
recvsize=0;
starttime=500;
stoptime=0;
}
{
event=$1;
time=$2;
node_id=$3;
pkt_size=$8;
level=$4;
if(level=="RTR" && event=="s" && pkt_size>=512)
{
if(time=512)
{
if(time>stoptime)
{
stoptime=time;
}
}
hdr_size=pkt_size%512;
pkt_size-=hdr_size;
recvsize+=pkt_size;
}
END {
printf("start time=%.2f",starttime);
printf("stoptime=%2f",stoptime);
printf("average throughput=%.2f",(recvsize/(stoptime-starttime))*(8/1000));
}

when i am trying to run this awk file it is showing BEGIN {
^ invalid char '

Sir, please reply

hi sir,,,,

i am working in ns-aqua-el6 .....

established three file of DBR , VBF , VBVA deployed 60 nodes as shown given below:


https://drive.google.com/open?id=1Zv...ekTasu6ZzgULrm

i want to get parameters results of awk file download from your link ie "top 20 awk"

https://drive.google.com/file/d/0B7S...hMdFNyQU0/view

but many of them are not working.

I want to get parameters files for thease below...


throughput
PDR
E2E delay
residual energy
packet drop

above are not working giving errors please help me to resolve this problem.......

«Oldest ‹Older   201 – 293 of 293   Newer› Newest»