NS2 Awk Scripts

HI all,
           Awk Programming is very easy to learn and simple to apply. Awk in NS-2  takes the trace file for analysis.
  • Handles complex task such as Calculation, database Handling, Report Creation
  • Each Filed is separated using Space(or Tab)
  • Record is separated using New-line character.
  • $1,$2,$3,$4 are used to access column.
  • $awk '{print $1 $2 "---> Rs." $3 * $4}' invent.tr  , here "invent.tr" be simple trace file act as input to awk to analyse . Quotes are used for printing purpose.
  • To print Entire record "$0"  -> $awk '{print $0}' invent.tr
  • Invent.tr consist of     values separated by space     like 10 20 30 40  . 
  • Here $1 =10 , $2 =20 .........
AWK in NS2
   
          Awk programming can be used to analyse the metrics of any network connection
  •    Throughput
  •     PDF (Packet Delivery ratio)
  •     Jitter
  •    end-to-end Delay
  •     NRL (Network routing Load)
The general form of an AWK program is shown below:
BEGIN {<initialization>}
<pattern1> {<actions>}
<pattern2> {<actions>}
.
.
.
END {<final actions>}
 Execution Command  in NS2 
  •  >> awk -f  filename.awk tracefilename.tr

 Awk Script Downloads for NS2 


  • Packet Delivery Ratio:          Click Here
  • Normalized Routing Load and More AWK files   can be found Here :     Click Here

202 comments:

  1. Hi ,
    i can't download the awk scripts .I want trace graphes : throuput ...
    pleaaase can you help me.
    Thank's.

    ReplyDelete
  2. hi
    i need awk script for dropped packets and for delay

    ReplyDelete
    Replies
    1. hi Hareem, Please use below link to Download ENd-2-End Delay

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

      Regarding Dropped packets !! its same as to calculate received packets and send packets .in the Pdf awk script replace the letter "f" or "s" or "r" with "d"
      f->forward packets
      r->received packets
      s->send
      d->drop packets

      Delete
    2. Hello,
      What do you mean by in the Pdf awk script replace the letter "f" or "s" or "r" with "d" ?? Should i replace each and every f,r & s with "d" ?
      Can you please explain me how that works? Will it show me the number of packets dropped in the simulation/ad-hoc simulation?
      A quick reply will be highly appreciated my friend :)
      Thanks :)

      Delete
  3. Hello, I am getting e2e delay for DSDV more than aodv but being proactive its delay should be less. Please tell what can be a mistake in awk script. Please reply. I need it urgently.

    ReplyDelete
  4. Hello sir,
    Your blog is very helpful for beginners.
    I am trying to use e2edelay.awk for ZRP but it is giving dropped packets 0. All other values are within range for other protocols but for why not for ZRP??

    ReplyDelete
    Replies
    1. $ns use-newtrace ...> remove this line in ur TCL file or commnent it with #


      if you are using new trace file then check the awk scrip whether its new trace file one or old trace file awk.

      Delete
    2. hey aditi have u implemented zrp? can u help me in implementing zrp.....pls? reply asap

      Delete
  5. Its for new trace format sir.
    # DROPPED PACKETS
    if (( $1 == "d" ) && ( $35 == "cbr" ) && ( $3 > 0 ))
    {
    droppedPackets=droppedPackets+1;
    }

    N ZRP trace is
    d -t 92.380779825 -Hs 28 -Hd 0 -Ni 28 -Nx 188.43 -Ny 519.74 -Nz 0.00 -Ne -1.000000 -Nl IFQ -Nw --- -Ma 0 -Md 0 -Ms 1c -Mt 800 -Is 28.255 -Id 0.255 -It ZRP -Il 564 -If 0 -Ii 63059 -Iv 5 -Zsrc 28 -Zdst 29 -Ztyp IERP_DATA -Zseq 688 -Zqid 0 -Zlbc 0

    ReplyDelete
    Replies
    1. Please use the code of end-2-end delay for old trace format i posted ....

      Delete
    2. Using above script also its giving dropped packet 0 for ZRP.

      GeneratedPackets = 7902
      ReceivedPackets = 2925
      Packet Delivery Ratio = 37.0159
      Total Dropped Packets = 0
      Average End-to-End Delay = 64.4466 ms

      Please help sir. Is it possible ZRP packet drop is 0 because pdf is coming less than AODV then how cud packet drop 0.

      Delete
    3. could u tell me the code to find packet drops at each node for aodv implemented wireless simulation using awk scripts??? pls help...its urgent

      Delete
  6. Ohk sir.....Thnx a lot.

    ReplyDelete
  7. hw to generate xgraph from a awk script?

    ReplyDelete
    Replies
    1. once you got the results , note it down wat u want to keep in the xgraph i.e. group size vs packet delievery ration for example. once u got all the results ,,please check the article on xgraph

      Delete
  8. Hi yuvraj
    How to change sifs & CW values ?
    Thx for this blog

    ReplyDelete
    Replies
    1. Its comes under MAC protocol which specified in the TCL file..if you want to edit the file ,,,you need to see the mac 802.11 file and there you need to change the default values to your values.

      Delete
    2. thanks for reply.
      i have used
      Mac/802_11 set SlotTime_ 0.000010
      Mac/802_11 set SIFS_ 0.000020
      Mac/802_11 set CWMax_ 1023
      in my tcl script & viaried SIFS values to check throughput.
      But in ns directory:
      ns-allinone-2.35-RC7/ns-2.35/mac
      how can i vary sifs value in mac-802_11.cc or .h file.
      Also how to differentiate between 802.11 a/b/g in ns directory.

      Delete
  9. Hello sir,
    Thanx alot for starting this blog
    Sir I have installed DYMOUM patch in ns 2.34. It is running successfully.
    But one column in trace format is showing undefined in palce of DYMOUM thats why routing packets and NRL is zero. Please help sir what is wrong.

    s 45.800282856 _38_ RTR --- 3606 undefined 24 [0 0 0 0] ------- [38:255 -1:255 1 0] [ HELLO 0 0 4 ]

    ReplyDelete
  10. Its due to patching problems ....please re-check the steps u followed to edit some of the files. if i can't any solution they use undefined in the position of routing protocol in awk script and check whether u r getting accurate results .

    ReplyDelete
  11. Thx sir,your codes are super....
    But in my code,I modified location of node & it start working fine..
    Sir I want to implement pcf over dcf in manet, for Qos guarantees in real time data transmission over manet.
    What changes in my tcl should I do to send video or voice packets?
    & how to create & allocate multiple parallel channels for best effort & high priority data?

    ReplyDelete
    Replies
    1. for that i think you need to use VOIP protocol. please check it once about VOIP protocol

      Delete
    2. Your replies are highly encouraging!
      But i am not getting any clue of how to generate video traffic through CBR application, & its relation with our tcl code.
      Also what should be written in tcl code for creating two channels,one separate each for text data & other for video data over manet.
      Thanks for your guidance sir!

      Delete
    3. http://www.sce.carleton.ca/~amatrawy/mpeg4/

      The above link will give the details to generate the Video Traffic

      Delete
  12. thanks for reply.
    i have used
    Mac/802_11 set SlotTime_ 0.000010
    Mac/802_11 set SIFS_ 0.000020
    Mac/802_11 set CWMax_ 1023
    in my tcl script & viaried SIFS values to check throughput.
    But in ns directory:
    ns-allinone-2.35-RC7/ns-2.35/mac
    how can i vary sifs value in mac-802_11.cc or .h file.
    Also how to differentiate between 802.11 a/b/g in ns directory.

    ReplyDelete
    Replies
    1. Hello sir,
      this effort of yours is great!
      I have a query regarding setdest::
      can we directly add pause time in tcl without recompiling,
      if yes what will be the syntax &
      If not then how can we set different pause time for different nodes in wireless topology.
      Thanks in advance sir!

      Delete
    2. @puneet: you can set the default value in the function below, here the code is like the values u r passing from TCL get set...if you want the value to be fixed , you can simply give the value instead of &SIFSTime


      PHY_MIB::PHY_MIB(Mac802_11 *parent)
      {
      /*
      * Bind the phy mib objects. Note that these will be bound
      * to Mac/802_11 variables
      */

      parent->bind("CWMin_", &CWMin);
      parent->bind("CWMax_", &CWMax);
      PHY_MIB::PHY_MIB(Mac802_11 *parent)
      {
      /*
      * Bind the phy mib objects. Note that these will be bound
      * to Mac/802_11 variables
      */

      parent->bind("CWMin_", &CWMin);
      parent->bind("CWMax_", &CWMax);
      parent->bind("SlotTime_", &SlotTime);
      parent->bind("SIFS_", &SIFSTime);

      Delete
    3. @suyash: Ns-2 used to create scenario files

      2. Creating node-movements for wireless scenarios.

      The node-movement generator is available under ~ns/indep-utils/cmu-scen-gen/setdest directory and consists of setdest{.cc,.h} and Makefile. CMU's version of setdest used system dependent /dev/random and made calls to library functions initstate() for generating random numbers. That was replaced with a more portable random number generator (class RNG) available in ns. In order to compile the revised setdest.cc do the following:
      1. Go to ns directory and run "configure" (you probably have done that already while building ns). This creates a makefile for setdest.
      2.Go to indep-utils/cmu-scen-gen/setdest. Run "make" , which first creates a stand-alone object file for ~ns/rng.cc (the stand-alone version doesnot use Tclcl libs) and then creates the executable setdest.
      3. Run setdest with arguments as shown below:

      ./setdest [-n num_of_nodes] [-p pausetime] [-s maxspeed] [-t simtime] \
      [-x maxx] [-y maxy] > [outdir/movement-file]

      Lets say we want to create a node-movement scenario consisting of 20 nodes moving with maximum speed of 10.0m/s with an average pause between movement being 2s. We want the simulation to stop after 200s and the topology boundary is defined as 500 X 500. So our command line will look like:

      ./setdest -n 20 -p 2.0 -s 10.0 -t 200 -x 500 -y 500 > scen-20-test

      The output is written to stdout by default. We redirect the output to file scen-20-test. The file begins with the initial position of the nodes and goes on to define the node movements.

      $ns_ at 2.000000000000 "$node_(0) setdest 90.441179033457 44.896095544010
      1.373556960010"

      This line from scen-20-test defines that node_(0) at time 2.0s starts to move toward destination (90.44, 44.89) at a speed of 1.37m/s. These command lines can be used to change direction and speed of movement of mobilenodes.

      Directives for GOD are present as well in node-movement file. The General Operations Director (GOD) object is used to store global information about the state of the environment, network, or nodes that an omniscent observer would have, but that should not be made known to any participant in the simulation.

      Currently, the god object is used only to store an array of the shortest number of hops required to reach from one node to an other. The god object does not calculate this on the fly during simulation runs, since it can be quite time consuming. The information is loaded into the god object from the movement pattern file where lines of the form

      $ns_ at 899.642 "$god_ set-dist 23 46 2"

      are used to load the god object with the knowledge that the shortest path between node 23 and node 46 changed to 2 hops at time 899.642.

      The setdest program generates node-movement files using the random waypoint algorithm. These files already include the lines to load the god object with the appropriate information at the appropriate time.

      Delete
    4. In .cc file,I tried replacing "&SIFSTime" with values.
      But I got the same values of throughput,delay,pdr.

      Delete
    5. Recompile the ns2 by entering
      1)./configure
      2)make
      3) make install

      Delete
  13. Thanks Yuvraj sir!
    But can,t we directly use for pause time:
    setdest .
    because on reconfiguring like:
    ./setdest -n 50 -p 200 -s uniform -m 0.0 -M 50.0 -t 900.0 -x 1000 -y 1000 >scen-50
    I got a file scen-50.
    How to use this now?
    As I try to use set val(cp) "scen-50" but has no effect on performance.
    Please guide me with your knowledge.....

    ReplyDelete
  14. By directly means:
    Can we directly include pause time in tcl script:
    $ns at " $n() setdest "
    Is their any provision for adding field in it for individual nodes?

    ReplyDelete
    Replies
    1. $ns_ at 0.75 "$n2 setdest 379.0 349.0 20.0" ---> you can specify speed in the tcl file . Pause time is common for the entire simulator environment setup. thats why it declared only once in scenario file generation.

      Delete
    2. Thanks Sir
      But on re configuring we get a text file.
      I named that file scen-50.
      How to use this file now in tcl?
      As I try to use
      set val(cp) "scen-50";
      & secondly
      set val(sc) "scen-50";
      both commands reflected no effect on performance.

      Delete
    3. puts "Loading scenarios-05-25 file..."
      source "scenarios/scen-50"



      create one scenarios folder and keep scen-50 file in that folder and use above commands in ur tcl file

      Delete
    4. So if i have to vary pause time from 10 to 100 in steps of 10,
      i have to recompile using ./setdest command & create 10 different text files.
      Then keep them in a folder 'scenario'.
      That folder has to be kept in the same folder which also has the tcl file.
      Tcl files will now include
      puts "Loading scenario file..."
      source "scenario/"
      Please verify above steps.

      Delete
  15. Thanks for replying !
    I tried replacing &SIFSTime with values.
    But I got the same values of throughput,delay,pdr.
    Where as throughput should have been maximum for 8 microsecond.
    What should I do?
    Also what can be done for removing hidden terminal problem using ns 2.35?

    ReplyDelete
  16. Brahmansh Tiwari17 April 2013 at 11:51

    Hello Sir
    First of all I thank you for helping us out.
    I have generated scenario for 30 adhoc nodes,
    Now I want to detect hidden terminal problem if any in the scenario & please suggest me the modification I need to carry out in my 50adhoc.tcl for removal of the hidden terminal problem.

    ReplyDelete
  17. Possible Solutions To avoid Hidden Terminal Problem
    -------------------------------------------------------
    1) Increase the Transmission power in ut tcl file. set Rx_ "value" increase this power value.
    2) Move the nodes in ur environment setup. moving nodes can sense the carriers easily there by reduce the problem
    3) Use Omni Directional Antenna instead of Directional in ur tcl fine under antenna set up.

    ReplyDelete
    Replies
    1. Brahmansh Tiwari18 April 2013 at 07:52

      Thank you sir for helping out!
      Without recompiling the kernel
      if I carry out the changes told by you in various tcl only,
      & get different results for each tcl.
      Will that be enough to be considered as research work?
      Can I publish a paper or in other case submit masters thesis with those results?

      Delete
    2. Increase the group size like 5,10,20,30,40,50 nodes and check the PDF,JITTER,NRL,Throughput,Delay using awk scripts. once u got results draw the graph for group size vs PDF,Jitter,NRL.....

      Delete
    3. Brahmansh Tiwari18 April 2013 at 12:08

      awk running with throughput=0 for some topology.
      wonder where lies the problem?
      And is it legal to use your awk scripts for my thesis work?
      I have read some IEEE papers having almost the same work which you told me.
      But how can that be a research then?
      Its just redoing of with varying parameters.
      Anyways thx for taking your time for beginners like me!

      Delete
  18. Sir I am reading this :
    http://140.116.164.80/~jhlin5/ns2/ns2.htm
    & link maentioned by you
    http://www.sce.carleton.ca/~amatrawy/mpeg4/
    Thanks for your kind help!

    ReplyDelete
  19. Brahmansh Tiwari20 April 2013 at 05:29

    Thank you very much sir!
    One more question:
    About hidden terminal problem type I;
    If we created a topology of 500x500 of 100 nodes then most of the nodes will be in carrier sensing & transmitting range of each other.
    Then the problem is bound to occur I suppose?
    Am I right?

    ReplyDelete
  20. Sir, i am doing a project on wireless sensor network, in my project i need show energy graph. i hv no idea about awk script of energy consumption...throughput n all i can do..plz help me in energy awk script...thank you

    ReplyDelete
    Replies
    1. Beegala Yuvaraj29 April 2013 at 01:41

      For enabling energy , please check my post on energy module in NS-2. once u enable the energy model in NS-2 , the energy will be shown in joules in trace file. intially u hav to set the energy in joules in TCL file.
      For graph , run the scenario for 200 sec. change the group size like 10,20,30,40,50 and check the final energy after stoping the simulation . thus u can draw a graph between energy consumption and group size

      Delete
  21. Hello sir,we are implementing a project for intrusion detection in MANETs.We need to extract 4 parameters namely packet loss,packet sent,packet received and energy consumption from trace files.Please can you help us out with awk script for extracting these parameters?

    ReplyDelete
  22. Hello sir,i am implementing a project called Intrusion Detection in MANETs.We need to analyse 4 parameters namely:packet sent(PS),packet received(PR),packet loss(PL),energy consumption(EC).Sir please can you help us out with the awk script needed to extract those parameters?

    ReplyDelete
  23. Hello,we are doing a project intrusion detection in MANETs using AODV protocol,we have carried out simulation.We need to extract 4 parameters :Packet loss,packet sent,packet received and energy consumption from trace files.Can you help us out with awk file?

    ReplyDelete
  24. Hello,we are doing a project intrusion detection in MANETs using AODV protocol,we have carried out simulation.We need to extract 4 parameters :Packet loss,packet sent,packet received and energy consumption from trace files.Can you help us out with awk file?

    ReplyDelete
    Replies
    1. Beegala Yuvaraj4 May 2013 at 11:21

      Hi Abhishek, you can download the awk scripts for each parameter.in PDF awk script ,you can get all packet loss,packet sent,packet received,energy consump in tht only. please see my post on awk script usuage.

      Delete
    2. Sorry sir i did not find it.Can you please send that link

      Delete
    3. http://www.mediafire.com/?lb8ihh6n2v5vwim

      Delete
    4. hi Abhishek and Beegalayuvraj Sir, i am also working on intrusion detection system in MANETs based on DSR routing protocol . my topic is EAACK - A Secure Intrusion Detection system " IEEE 2013. I am new to NS-2 , learnt some basics and went through NS-2 Manual , but i am confused from where to start and end. i have strong desire to learn this and do my project on my own , i need some basic guideline regarding this.... PlZ PLZ help me.

      Delete
  25. can you plz provide the awk for calculating energy consumption

    ReplyDelete
    Replies
    1. http://www.mediafire.com/?lb8ihh6n2v5vwim

      Delete
    2. Thank you sir for the reply...but i tried using this awk file.it is not showing any output..Can u plz tell me where am i going wrong..or do i need to change something in this.

      Delete
    3. Beegala Yuvaraj7 May 2013 at 00:19

      Check out the trace file foramt u r using . there are two types 1) new trace file which contains many columns in the trace file around (34) . 2) old trace file foramt around 10 . in awk if they are using in between $20 to $30 like this .it means its awk script for new trace file format. you can disable it by commenting $ns_ new trace line in ur tcl file.

      Delete
    4. Sir it is using old trace file format,still it is not working.

      s 14.544278800 _6_ AGT --- 1 cbr 28 [0 0 0 0] ------- [6:0 5:1 32 0] [0] 0 1
      r 15.953406826 _5_ AGT --- 1 cbr 28 [220 5 6 800] ------- [6:0 5:1 32 5] [0] 1 1

      this is the type of trace file it is using. Can u help.

      Delete
    5. Beegala Yuvaraj10 May 2013 at 02:04

      hi rahul, change it new trace file format. do u see any energy related trace in this old trace format ? no . enable the new trace file format in ur TCL file and apply awk . it will definitely work. check the command it will look like this ...... $ns_ newtrace.....add new trace format command in TCL

      Delete
  26. Please can you help me writting .sh scripts to simulate ad hoc routing protocoles ?

    ReplyDelete
    Replies
    1. Beegala Yuvaraj7 May 2013 at 00:32

      Better to simulate with TCL file instead << .sh file >> . thoguh u write .sh file , you should call the TCL file only. TCL file will produce trace file from which results can be analyzed.

      TCL ->TRACE FILE-> apply AWK scripts-> Results ->apply Xgraph -> graph as conclusion

      Delete
  27. sir how can we install zigbee protocol in ns2 kindly tell me about that .

    ReplyDelete
    Replies
    1. Beegala Yuvaraj10 May 2013 at 01:50

      http://en.pudn.com/downloads157/sourcecode/others/detail700528_en.html

      Download the protocol here and follow steps given in that .

      Delete
  28. How to remove division by zero attempted error in ns2? I am getting this error when i ma trying to run awk script for the olsr protocol. Hoping for a reply soon.

    ReplyDelete
    Replies
    1. Beegala Yuvaraj10 May 2013 at 03:25

      Check out the trace file foramt u r using . there are two types 1) new trace file which contains many columns in the trace file around (34) . 2) old trace file foramt around 10 . in awk if they are using in between $20 to $30 like this .it means its awk script for new trace file format. you can disable it by commenting $ns_ new trace line in ur tcl file.

      Delete
  29. sir I have tried both old and new format but awk script for enery does not work belo I have past old format but I have also try new one but it is not working there is no result kindly tell me the solution thanx .

    s 0.100000000 _0_ AGT --- 0 tcp 40 [0 0 0 0] [energy 10.000000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [0:0 2:0 32 0] [0 0] 0 0
    r 0.100000000 _0_ RTR --- 0 tcp 40 [0 0 0 0] [energy 10.000000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [0:0 2:0 32 0] [0 0] 0 0
    s 0.100000000 _0_ RTR --- 0 AODV 48 [0 0 0 0] [energy 10.000000 ei 0.000 es 0.000 et 0.000 er 0.000] ------- [0:255 -1:255 30 0] [0x2 1 1 [2 0] [0 4]] (REQUEST)
    N -t 0.100115 -n 1 -e 9.899365
    N -t 0.100115 -n 6 -e 9.899365
    N -t 0.100115 -n 18 -e 9.899365
    N -t 0.100115 -n 14 -e 9.899365
    N -t 0.100115 -n 15 -e 9.899365
    N -t 0.100115 -n 12 -e 9.899365
    N -t 0.100115 -n 9 -e 9.899365
    N -t 0.100115 -n 13 -e 9.899365
    N -t 0.100115 -n 8 -e 9.899365
    N -t 0.100115 -n 17 -e 9.899365
    N -t 0.100115 -n 16 -e 9.899365
    N -t 0.100115 -n 7 -e 9.899365
    N -t 0.100115 -n 11 -e 9.899365
    N -t 0.100115 -n 20 -e 9.899365
    N -t 0.100115 -n 22 -e 9.899365

    ReplyDelete
  30. awk: ne2edelay.awk:91: (FILENAME=mdart.trc FNR=528564) fatal: division by zero attempted
    error is shown if i try to run awk file for e2edelay

    ReplyDelete
    Replies
    1. i am working on ns2.35... wireles sensor networks..jitter and e2edelay file is not working,,,also kind help me to check the node enrgy.. as my work is on enrgy efficiency

      Delete
    2. Beegala Yuvaraj19 May 2013 at 11:04

      Please check ur trace file format and awk file u r using. the awk script is miss matching with ur trace file...use old trace file and try to execute. it will work 100 %

      Delete
    3. may i mail u d whole code? nd d queries i need to ask?

      Delete
  31. Hi, Great site and very useful.
    I need an awk file for showing out of sequence packets arriving at a node. Have you got one or, if not, can you point me to where I might find one. Any help greatly appreciated,
    John.

    ReplyDelete
  32. That's for ns2.35,
    Thanks,
    John

    ReplyDelete
    Replies
    1. Beegala Yuvaraj19 May 2013 at 11:07

      HI john , take Packet delivery node awk script and apply on ur trace file. check if its working or not. if its working , you just need to calculate for individual nodes. if u see the trace file . it will display the node number. in the condition , plz give the $(column num)==node number and calulate . increase the node numbers and calculate.

      Delete
  33. jeena here
    this is my code


    #-------------------------------------------------------------------------------
    # ------------------------------------------------------------------------------
    #remove-all-packet-headers ;# removes all except common
    #add-packet-header ;# needed headers
    Mac/802_11 set CWMin_ 31
    Mac/802_11 set CWMax_ 1023
    Mac/802_11 set SlotTime_ 0.000020 ;# 20us
    Mac/802_11 set SIFS_ 0.000010 ;# 10us
    Mac/802_11 set PreambleLength_ 144 ;# 144 bit
    Mac/802_11 set ShortPreambleLength_ 72 ;# 72 bit
    Mac/802_11 set PreambleDataRate_ 1.0e6 ;# 1Mbps
    Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
    Mac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps
    Mac/802_11 set ShortPLCPDataRate_ 2.0e6 ;# 2Mbps
    Mac/802_11 set RTSThreshold_ 3000 ;# bytes
    Mac/802_11 set ShortRetryLimit_ 7 ;# retransmissions
    Mac/802_11 set LongRetryLimit_ 4 ;# retransmissions
    Mac/802_11 set newchipset_ false ;# use new chipset, allowing a more recent packet to be correctly received in place of the first sensed packet
    Mac/802_11 set dataRate_ 11Mb ;# 802.11 data transmission rate
    Mac/802_11 set basicRate_ 1Mb ;# 802.11 basic transmission rate
    Mac/802_11 set aarf_ false ;# 802.11 Auto Rate Fallback

    ReplyDelete
  34. jeena..

    #------------------------------------------------------------------------------
    # Defining options
    # ------------------------------------------------------------------------------
    set val(chan) Channel/WirelessChannel ;# channel type
    set val(ant) Antenna/OmniAntenna ;# antenna type
    set val(propagation) Shado ;# propagation model
    set val(netif) Phy/WirelessPhy ;# network interface type
    set val(ll) LL ;# link layer type
    set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
    set val(ifqlen) 50 ;# max packet in ifq
    set val(mac) Mac/802_11 ;# MAC type
    set val(rp) MDART;# routing protocol
    set val(n) 100.0 ;# node number
    set val(density) 4096 ;# node density [node/km^2] i.e. 4096
    set val(end) 200.0 ;# simulation time [s]
    set val(mobility) Static ;# mobility model
    set val(minSpeed) 0.5 ;# movement minimum speed [m/s]
    set val(maxSpeed) 1.5 ;# movement maximum speed [m/s]
    set val(minPause) 0.1 ;# movement minimum pause time [s]
    set val(maxPause) 0.5 ;# movement maximum pause time [s]
    set val(movementStart) 100.0 ;# movement start time [s]
    set val(traffic) Node-UDP ;# data pattern
    set val(dataStart) 100.0 ;# data start time [s]
    set val(dataStop) [expr $val(end) - 60.0] ;# data stop time [s]
    set val(seed) 1 ;# general pseudo-random sequence generator
    set val(macFailed) true ;# ATR protocol: ns2 MAC failed callback
    set val(etxMetric) true ;# ATR protocol: ETX route metric
    set val(throughput) 5.0 ;# CBR rate (<= 5.4Mb/s)
    set val(flow) 100 ;# number of concurrent data flow for FLOW-**P data pattern
    set val(nodes) $val(n) ;# number of concurrent transmitting nodes for NODE-**P data pattern
    set opt(energymodel) EnergyModel ;
    set opt(initialenergy) 100;

    ReplyDelete
    Replies
    1. # ------------------------------------------------------------------------------
      # Topology definition
      # ------------------------------------------------------------------------------
      #
      set val(dim) [expr $val(n) / $val(density)]
      set val(x) [expr [expr sqrt($val(dim))] * 1000]
      set val(y) [expr [expr sqrt($val(dim))] * 1000]



      # ------------------------------------------------------------------------------
      # Pseudo-random sequence generator
      # ------------------------------------------------------------------------------

      # General pseudo-random sequence generator
      set genSeed [new RNG]
      $genSeed seed $val(seed)
      set randomSeed [new RandomVariable/Uniform]
      $randomSeed use-rng $genSeed
      $randomSeed set min_ 1.0
      $randomSeed set max_ 100.0

      # Mobility model: x node position [m]
      set genNodeX [new RNG]
      $genNodeX seed [expr [$randomSeed value]]
      set randomNodeX [new RandomVariable/Uniform]
      $randomNodeX use-rng $genNodeX
      $randomNodeX set min_ 1.0
      $randomNodeX set max_ [expr $val(x) - 1.0]

      # Mobility model: y node position [m]
      set posNodeY [new RNG]
      $posNodeY seed [expr [$randomSeed value]]
      set randomNodeY [new RandomVariable/Uniform]
      $randomNodeY use-rng $posNodeY
      $randomNodeY set min_ 1.0
      $randomNodeY set max_ [expr $val(y) - 1.0]

      # Mobility model: node speed [m/s]
      set genNodeSpeed [new RNG]
      $genNodeSpeed seed [expr [$randomSeed value]]
      set randomNodeSpeed [new RandomVariable/Uniform]
      $randomNodeSpeed use-rng $genNodeSpeed
      $randomNodeSpeed set min_ $val(minSpeed)
      $randomNodeSpeed set max_ $val(maxSpeed)

      # Mobility model: node movement pause [s]
      set genNodePause [new RNG]
      $genNodePause seed [expr [$randomSeed value]]
      set randomNodePause [new RandomVariable/Uniform]
      $randomNodePause use-rng $genNodePause
      $randomNodePause set min_ $val(minPause)
      $randomNodePause set max_ $val(maxPause)

      # Data pattern: node
      set genNode [new RNG]
      $genNode seed [expr [$randomSeed value]]
      set randomNode [new RandomVariable/Uniform]
      $randomNode use-rng $genNode
      $randomNode set min_ 0
      $randomNode set max_ [expr $val(n) - 1]

      # Data pattern "Random": flow start time [s]
      set genStartData [new RNG]
      $genStartData seed [expr [$randomSeed value]]
      set randomStartData [new RandomVariable/Uniform]
      $randomStartData use-rng $genStartData
      $randomStartData set min_ $val(dataStart)
      $randomStartData set max_ $val(dataStop)

      # Data pattern "Full: flow start time [s]
      set genStartDataFull [new RNG]
      $genStartDataFull seed [expr [$randomSeed value]]
      set randomStartDataFull [new RandomVariable/Uniform]
      $randomStartDataFull use-rng $genStartDataFull
      $randomStartDataFull set min_ 0
      $randomStartDataFull set max_ [expr ($val(n) * ($val(n) - 1)) - 1]

      # Data pattern: flow end time [s]
      set genEndData [new RNG]
      $genEndData seed [expr [$randomSeed value]]
      set randomEndData [new RandomVariable/Uniform]
      $randomEndData use-rng $genEndData
      $randomEndData set min_ 0.0
      $randomEndData set max_ [expr $val(end) - $val(dataStart) - 20]

      Delete
  35. # ------------------------------------------------------------------------------
    # General definition
    # ------------------------------------------------------------------------------
    ;#Instantiate the simulator
    set ns [new Simulator]
    ;#Define topology
    set topo [new Topography]
    $topo load_flatgrid $val(x) $val(y)
    ;#Create channel
    set chan [new $val(chan)]
    $prop topography $topo
    ;#Create God
    create-god $val(n)
    ;#Global node setting
    $ns node-config -sensorNode ON -adhocRouting $val(rp) \
    -llType $val(ll) \
    -macType $val(mac) \
    -ifqType $val(ifq) \
    -ifqLen $val(ifqlen) \
    -antType $val(ant) \
    -propInstance $prop \
    -phyType $val(netif) \
    -channel $chan \
    -topoInstance $topo \
    -agentTrace ON \
    -routerTrace ON \
    -macTrace OFF \
    -movementTrace OFF \
    -energyModel $opt(energymodel) \
    -rxPower 0.3 \
    -txPower 0.6 \
    -initialEnergy $opt(initialenergy)

    ReplyDelete
    Replies
    1. # ------------------------------------------------------------------------------
      # Trace file definition
      # ------------------------------------------------------------------------------

      #New format for wireless traces
      #$ns use-newtrace

      #Create trace object for ns, nam, monitor and Inspect
      set nsTrc [open mdart.trc w]
      $ns trace-all $nsTrc
      set namTrc [open nam.trc w]
      $ns namtrace-all-wireless $namTrc $val(x) $val(y)
      set scenarioTrc [open scenario.trc w]

      proc fileTrace {} {
      global ns nsTrc namTrc
      global ns nsTrc scenarioTrc
      $ns flush-trace
      close $nsTrc
      close $scenarioTrc
      close $namTrc

      }

      Delete
    2. # ------------------------------------------------------------------------------
      # Nodes definition
      # ------------------------------------------------------------------------------
      ;# Create the specified number of nodes [$val(n)] and "attach" them to the channel.
      for {set i 0} {$i < $val(n) } {incr i} {
      set node($i) [$ns node]
      $node($i) random-motion 1 ;# disable random motion 0
      }



      # ------------------------------------------------------------------------------
      # Nodes mobility
      # ------------------------------------------------------------------------------
      #parameters for trace Inspect
      puts $scenarioTrc "# nodes: $val(n), max time: $val(end)"
      puts $scenarioTrc "# nominal range: 250"

      if {$val(mobility) == "Static"} {
      for {set i 0} {$i < $val(n)} {incr i} {
      set X [expr [$randomNodeX value] ]
      $node($i) set X_ $X
      set Y [expr [$randomNodeY value] ]
      $node($i) set Y_ $Y
      $node($i) set Z_ 0.0
      $ns initial_node_pos $node($i) 20
      puts $scenarioTrc "\$node_($i) set X_ $X"
      puts $scenarioTrc "\$node_($i) set Y_ $Y"
      puts $scenarioTrc "\$node_($i) set Z_ 0.0"
      }
      }



      # ------------------------------------------------------------------------------
      # Data load
      # ------------------------------------------------------------------------------
      if {$val(traffic) == "Node-UDP"} {
      for {set i 0} {$i < $val(nodes)} {incr i} {
      set udp($i) [new Agent/UDP]
      $ns attach-agent $node($i) $udp($i)
      set dest [expr round([$randomNode value])]
      while {$dest == $i} {
      set dest [expr round([$randomNode value])]
      }
      set monitor($dest) [new Agent/LossMonitor]
      $ns attach-agent $node($dest) $monitor($dest)
      $ns connect $udp($i) $monitor($dest)
      set cbr($i) [new Application/Traffic/CBR]
      $cbr($i) attach-agent $udp($i)
      $cbr($i) set packetSize_ 1000
      $cbr($i) set random_ false
      $cbr($i) set rate_ [expr $val(throughput) / [expr $val(n) * sqrt($val(n))]]Mb
      # $cbr($i) set rate_ [expr $val(throughput)]Mb
      $ns at [expr $val(dataStart) + [$randomSeed value]] "$cbr($i) start"
      $ns at $val(dataStop) "$cbr($i) stop"
      # $ns at [expr [$randomStartData value]] "$cbr($i) start"
      # set endData [expr [$randomStartData value] + [$randomEndData value]]
      # if {$endData > $val(dataStop)} {
      # set endData $val(dataStop)
      # }
      # $ns at $endData "$cbr($i) stop"
      }
      }



      # ------------------------------------------------------------------------------
      # Tracing
      # ------------------------------------------------------------------------------

      # printing simulation time
      proc timeTrace { tracePause} {
      global ns
      set now [$ns now]
      $ns at [expr $now + $tracePause] "timeTrace $tracePause"
      puts "$now simulation seconds"
      }

      $ns at 10.0 "timeTrace 10.0"

      #$ns at 500 "[$node(0) agent 255] storeInfo id1 tex#t1"
      #$ns at 500 "[$node(0) agent 255] storeInfo id2 text2"

      #$ns at 520 "[$node(0) agent 255] requestInfo id1"

      # ------------------------------------------------------------------------------
      # Starting & ending
      # ------------------------------------------------------------------------------
      for {set i 0} {$i < $val(n) } {incr i} {
      $ns at $val(end) "$node($i) reset";
      }

      $ns at $val(end) "fileTrace"
      $ns at $val(end) "$ns halt"

      $ns run

      Delete
  36. hi dis is jeena,,,d awk files for e2edelay and jitter are not working for dis code...kindly help me as soon as possible...plz plz pl zpl zplz any one help me

    ReplyDelete
    Replies
    1. HI jeena, r u getting trace file for the above TCL script. plz let me knw if u got trace file .so that i can help u with awk scripts

      Delete
    2. yes i m getin d trace file. pdf nd throughut r workin properly. jitter awk file runs but jus gives heading of jittr 1 jittr 2 jittr3 jittr4 rest whole file is blank

      Delete
    3. e2edelay show fatal division by zero error,,,kindly help me by tomorw evng please! i hav to sumbit my work on monday

      also i need to check the residual enrgy of d nodes aftr simulation process...kindly tel me how to do dat as wel thank u so much for ur help

      Delete
    4. in trace file defition, previously there was no # in front of use new trace format, so i got d answers for pdf nd thruput..i had put dis # aftr reading ur blog stil i cudnt get d answers

      Delete
    5. Beegala Yuvaraj26 May 2013 at 22:50

      http://mailman.isi.edu/pipermail/ns-users/2007-August/060804.html

      You can find useful results here

      Delete
    6. Beegala Yuvaraj26 May 2013 at 22:55

      For Jitter
      -----------------------
      #New format for wireless traces
      $ns use-newtrace ---->keep this line instead #$ns use-newtrace

      For End2end Delay
      ----------------------------------
      #old format for wireless traces
      #$ns use-newtrace ---->keep this line instead $ns use-newtrace

      100% it will work.

      Delete
  37. i want to implement zrp m using ns2.35 can anyone help me regarding this....one more problem is there while executing dsr getting segmentation fault even for 5 nodes....how can i handle this

    ReplyDelete
    Replies
    1. Beegala Yuvaraj26 May 2013 at 22:58

      Dsr does not work properly in Ns-2 . I tried it many times. If it not working try this ..


      https://github.com/erimatnor/dsr-uu

      Delete
    2. no it isnt workin

      Delete
  38. hye,
    my awk jiiter script show blank result like that on terminal
    # flow flowType src dst time jitter1 jitter2 jitter3 jitter4
    plz tell me what changes i have done in my tcl script to find results?

    ReplyDelete
    Replies
    1. Beegala Yuvaraj26 May 2013 at 22:55

      For Jitter
      -----------------------
      #New format for wireless traces
      $ns use-newtrace ---->keep this line instead #$ns use-newtrace

      For End2end Delay
      ----------------------------------
      #old format for wireless traces
      #$ns use-newtrace ---->keep this line instead $ns use-newtrace

      100% it will work.

      Delete
    2. thanks a lot sir.but cann't download the average jitter file for wireless. i have average jitter file for wired network.

      Delete
    3. sir. $ns use-newtrace line is placed in tracefile adhoc.tcl, how can i findout jitter value plz tell me whole procedure sir i cann't understand.

      Delete
    4. Beegala Yuvaraj31 May 2013 at 02:23

      better i will make it as a post....please check for my latest post

      Delete
    5. sir m doing all the things which u tell me earlier, but again result is same .i m adding $ns use-newtrace .and new trace file generated but result again # flow flowType src dst time jitter1 jitter2 jitter3 jitter4. plz help me for doing my project in which jitter is most important.

      Delete
  39. hello sir,pls help me .i want to calculate end to end delay at every instant by the using of awk script.but i have only for avg delay.plz can u give a link for downloading,or suggest me how modify for at instant....plzzzzzzzz
    thnk you

    ReplyDelete
    Replies
    1. Beegala Yuvaraj28 May 2013 at 23:21


      Delay at each instant or node
      ----------------------------------------------------
      Add this code at the end of ur script in END { } section
      for(i=0; i<=seqno; i++) {
      print "Delay at each node+i :" dealy[i] ;

      Delete
  40. hai friend,
    how can i include the attacker in protocol.I want to find out the sybil,selected forward attacks.i m a beginner. pls give a idea yar

    ReplyDelete
  41. Priyanka: can u tell me which protocol , u want to add attacker. Please see my post on black hole attack . Similarly u can add attacker for ur s

    ReplyDelete
    Replies
    1. thanks for ur reply yuvraj..but how can i detect the attackers?

      Delete
    2. the protocol is AODV yuvraj..

      Delete
    3. Beegala Yuvaraj10 June 2013 at 22:25

      you have to add the attacker . check my post "BLACK HOLE attack". once u added then its easy to detect the attackers using ur TCL code. you need to modify ur c++ files in ns-2 for adding attacker

      Delete
    4. hi yuvraj,thanks for this reply.Can u pls tell, how to detect the attackers from tcl file?

      Delete
  42. hello :)

    this is a part of the tracefile which i m not able to analyze :(

    s 0.000401693 0 0.00 0.00 -99 0 0 AGT --- 0 DSRCApp 11 [0 0 0 0] ------- [0:0 -1:0 32 0]
    s 0.003588245 11 10.00 10.00 -99 0 0 AGT --- 1 DSRCApp 11 [0 0 0 0] ------- [11:0 -1:0 32 0]
    s 0.004169000 0 0.00 0.00 -99 0 0 MAC --- 0 DSRCApp 39 [0 ffffffff 0 0] ------- [0:0 -1:0 32 0]
    s 0.004169000 0 0.00 0.00 -99 0 0 PHY --- 0 DSRCApp 39 ------- [0:0 -1:0 32 0]
    D 0.004321017 5 0.00 5.00 -99 0 0 PHY DND 0 DSRCApp 39 ------- [0:0 -1:0 32 0]
    D 0.004321033 10 0.00 10.00 -99 0 0 PHY DND 0 DSRCApp 39 ------- [0:0 -1:0 32 0]

    1-can u help me analyze it so we write a pdr.awk for it
    2-i downloaded urs but i guess i should modify it to work on my tracefile

    please help

    ReplyDelete
    Replies
    1. Beegala Yuvaraj12 June 2013 at 00:08

      Hi , the trace file u got was old trace file format. check the awk file, whether u can see something like $14 ,$20 ...if its like this then add $ns new-trace to ur tcl file and run.

      Please see my latest post :
      http://byuvraj.blogspot.in/2013/05/awk-script-not-running-for-ns-2.html

      Delete
  43. in the trace file of the vanet , they are the following layer : AGT-MAC-PHY
    to calculate the pdf, i m concerned with the AGT layer only, right ?

    so if i run ur awk :
    $0 ~/^s.* AGT/ {sendLine ++ ; }
    $0 ~/^r.* AGT/ {recvLine ++ ;}

    i get:
    cbr s:1001 r:15188, r/s Ratio:15.1728, f:0

    s > r ==> totally wrong, right ?

    where do u think is my problem?

    thank you so much
    you r helping me too much :)

    ReplyDelete
    Replies
    1. Beegala Yuvaraj12 June 2013 at 23:16

      correct you should concern with AGT because its the APPlication layer which means the peer node will receive the packet successfully. MAC,PHY are middle layers were the format differs.

      You should replace cbr with DSRCApp in your awk file.

      Delete
  44. one more thing, on the net the format of the trace is :

    s 76.000000000 _98_ AGT --- 1812 cbr 32 [0 0 0 0] ------- [98:0 0:0 32 0]

    where 98 is the node ID.

    while in mine, it is :

    s 0.000067388 0 0.00 0.00 -99 0 0 AGT --- 0 DSRCApp 100 [0 0 0 0] ------- [0:0 -1:0 32 0]

    what is this 0 0.00 0.00 -99 0 0 instead of _x_ ?

    i m thinking of not caluclating the nb of received based on AGT but based on this weird nb also. what is ur opinion?

    here is a part of my trace file:

    s 0.000067388 0 0.00 0.00 -99 0 0 AGT --- 0 DSRCApp 100 [0 0 0 0] ------- [0:0 -1:0 32 0]
    s 0.002840405 2 20.00 0.00 -99 0 0 AGT --- 1 DSRCApp 100 [0 0 0 0] ------- [2:0 -1:0 32 0]
    s 0.004039000 2 20.00 0.00 -99 0 0 MAC --- 1 DSRCApp 128 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    s 0.004039000 2 20.00 0.00 -99 0 0 PHY --- 1 DSRCApp 128 ------- [2:0 -1:0 32 0]
    r 0.004255017 7 20.00 5.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255033 1 10.00 0.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255033 12 20.00 10.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255033 3 30.00 0.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255037 6 10.00 5.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255037 8 30.00 5.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255047 11 10.00 10.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255047 13 30.00 10.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255050 17 20.00 15.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255060 16 10.00 15.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255060 18 30.00 15.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255067 0 0.00 0.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255067 4 40.00 0.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255069 5 0.00 5.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255069 9 40.00 5.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]
    r 0.004255075 10 0.00 10.00 -99 0 0 MAC --- 1 DSRCApp 100 [0 ffffffff 2 0] ------- [2:0 -1:0 32 0]

    Thank you

    ReplyDelete
    Replies
    1. Please ping me in fb . its better to chat .so that i can solve ur prob. here its became crowdy

      Delete
    2. thank you dear, you r too good to be true :)

      Delete
  45. Hi sir!
    I am unable to get awk for e-e delay in new trace format.
    Can you provide me the link to download.
    I am actually tangled in between the two format.
    Thanks in advance!

    ReplyDelete
    Replies
    1. Beegala Yuvaraj13 June 2013 at 23:19

      Please read this post
      http://byuvraj.blogspot.in/2013/05/awk-script-not-running-for-ns-2.html

      Delete
  46. hi yuvraj,
    how to detect the attackers from tcl file

    ReplyDelete
  47. hi
    i want to calculate average remaining energy of the network after every 15 sec during 500 sec simulation, using awk script. i can calculate the remaining network energy by taking the average of all nodes final energy at the end of simulation. i'll be grateful if you can guide how to do that.
    regards,
    najma

    ReplyDelete
    Replies
    1. Beegala Yuvaraj21 June 2013 at 06:38

      Hope u enabled the energy in ur tcl fle. give ur energy as 1000 joules or how much u want . please look in to trace file and check the column of send time and coulmn and energy coulmn . use both in ur awk script and calculate the time .

      Delete
  48. what is the significance of jitter1 jitter2 jitter3 jitter4 o/p after running awk?
    thanks alot

    ReplyDelete
  49. sir...i am in need of generating graph between packet delivery ratio and node speed for AODV...please publish the ns2 tcl code

    ReplyDelete
    Replies
    1. Beegala Yuvaraj28 June 2013 at 06:10

      use my aodv tcl code in aodv downloads post

      Delete
  50. hi. sir

    i am facing problem in generate xgraph from .tr file, problem is like this

    Error in file `voip.tr' at line 610:
    Unknown line type
    Problems found with input data.

    formate of .tr file is like this


    + 1 0 1 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    - 1 0 1 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    r 1.01224 0 1 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    + 1.01224 1 3 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    - 1.01224 1 3 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    r 1.02448 1 3 sctp 56 -------I 0 0.0 3.0 1 -1 2 65535 65535
    + 1.02448 3 1 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    - 1.02448 3 1 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    r 1.03672 3 1 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    + 1.03672 1 0 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    - 1.03672 1 0 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    r 1.04896 1 0 sctp 56 -------I 0 3.0 0.0 1 -1 3 65535 65535
    + 1.04896 0 1 sctp 36 -------I 0 0.0 3.0 1 -1 4 65535 65535
    - 1.04896 0 1 sctp 36 -------I 0 0.0 3.0 1 -1 4 65535 65535
    r 1.0604 0 1 sctp 36 -------I 0 0.0 3.0 1 -1 4 65535 65535
    + 1.0604 1 3 sctp 36 -------I 0 0.0 3.0 1 -1 4 65535 65535


    please help me sir.
    it is very important for me.

    ReplyDelete
    Replies
    1. Beegala Yuvaraj28 June 2013 at 06:11

      Please use new trace file format %ns use new-trace

      Delete
    2. thanks for your response.

      but sir.

      how i can generate new trace file format from .tcl script ?

      or

      other way you may know then please inform me ?

      please sir help...

      thanks a lot.

      Delete
  51. hi, please sir can you help me how to modify the axis in xgraph i want to make the throughput in function of number of nodes but i don't understand the blog of xgraph can you please give some examples and thks in advance :)

    ReplyDelete
    Replies
    1. Beegala Yuvaraj9 July 2013 at 00:15

      Xgraph can be generated two ways. one directly from tcl or manually. what i explained was manually. here the data wat ever u collected need to be kept in text file and generate graph using xgraph command. ( cmd----> xgraph file1.txt ) . in this file give the x-axis(nodes) and y-axis(throughput) data in two columns like
      nodes(x-axis) throughput(y-axis)
      ------- ---------------
      5 300.0
      10 500.0
      15 630

      Delete
  52. Dear Sir,
    I want to find route acquisition delay from old trace file generated for AODV.
    Please help me to resolve it.

    ReplyDelete
  53. Hi,
    i used your e2edelay.awk file to find delay, it was supposed the result to be in the range of 0.5 ms and my results were like 500 ms. i generated the same scenario i found in an article and i wanted to check the values in it. i just wonder if you have any idea where the problem might be??

    ReplyDelete
    Replies
    1. Beegala Yuvaraj9 July 2013 at 00:07

      It depends on other parameters too. check out ur simulation timing, distance between the nodes, antenna model u r using, if the nodes are clubbed together then the delay will be less , check out the trace file format also

      Delete
  54. This comment has been removed by a blog administrator.

    ReplyDelete
  55. Hello sir
    I use CBRP protocol and create trace file. and use awk to calculate dropped packet, but it show
    cbr s:39 r:39, r/s Ratio:1.0000, f:54 , d:0
    count of dropped packet=0
    also in trace file i have
    s 29.031284241 _9_ RTR --- 904 cbr 545 [0 0 0 0] ------- [9:2 11:0 32 17] [0] 0 2
    s 29.031312149 _31_ RTR --- 900 message 45 [0 0 0 0] ------- [31:-1 -1:255 3 0]
    r 29.036906439 _17_ RTR --- 904 cbr 545 [13a 11 9 800] ------- [9:2 11:0 32 17] [0] 1 2
    cbrp 29.036906439 _17_ --- 904 [9 -> 11] [9 |17 11 ]
    f 29.036906439 _17_ RTR --- 904 cbr 545 [13a 11 9 800] ------- [9:2 11:0 31 11] [0] 1 2
    r 29.038145553 _28_ RTR --- 900 message 45 [0 ffffffff 1f 800] ------- [31:-1 -1:255 3 0]
    it's really?

    ReplyDelete
    Replies
    1. Beegala Yuvaraj8 July 2013 at 23:47

      Please increase the simulation time to 200 or 900 and check the result. what you get is correct only.

      Delete
    2. I increase the simulation time to 200,300,400,500,600
      but dropped packet=0 still

      Delete
  56. Hello,
    In the Throughput file, it says the starting time is 400. Does this mean the AWK file will only calculate the throughput starting from time 400 till the end?
    Can't I make the starting time to be 0? What will happen then?

    Please let me know. Thanks :)

    ReplyDelete
    Replies
    1. Beegala Yuvaraj25 July 2013 at 09:38

      No !! Please check your trace file. It starts from 0.0 only . some times it may be 2 or 3 not 400. please check the awk u r using and trace file format (new or old).

      Delete
  57. Hi yuvraj,

    We have assignment on NS2 submit in next week which need manet simulation using DSR & AODV. Sir ask us to use random waypoint mobility and to draw some graphs based on "inter-contact time" and "contact time" of nodes.

    But I'm not sure how to obtain "inter-contact time" and "contact time". Can I get it from NS2 trace file? (If so how can we get it from trace file?)

    Can you kindly help me on this problem?

    Thanks & Regards,
    Chandana

    ReplyDelete
    Replies
    1. Beegala Yuvaraj25 July 2013 at 06:31

      http://nrl.iis.sinica.edu.tw/Download/

      Please look in to it and check whether its help u or not .

      Delete
  58. hi sir,
    i am working on maodv protocol in ns2.35, it is successfully installed and tcl script running fine, on running tcl script i have got trace file of size 458 mb (something) and nam file of size 92 mb, but the problem is that their no graphs are generating like delivery ratio, end2end delay on analyzing it shows data received 0, router dropped 25, data dropped 0.i m using trace graph. so please sir give me solution for that ASAP.
    thank you.

    ReplyDelete
    Replies
    1. Beegala Yuvaraj2 August 2013 at 11:09

      Hi akash , Please check whether u r using maodv tcl script or not . check the multicast adress sum thing like this 0xE00000. check out the sender and receiver nodes properly. once everything clear ,go for checking the simulation environment.
      simulation time,traffic, transport layer protocol (UDP for multicast ).

      Delete
  59. hello sir
    am working with AODV in ns2.34.
    i need to plot THROUGHPUT vs LOAD.
    can i get the awk script for load &is routing load and network load same ..
    kindly reply me ASAP
    thanks&regards

    ReplyDelete
    Replies
    1. Beegala Yuvaraj2 August 2013 at 11:12

      HI ram , yes load is nothing but network routing load . please check for nrl.awk (network routing load). its easy to analyze and get results. once u got results . use Xgraph to plot the graph.

      Delete
    2. thanks for ur reply
      i got the graph using gnuplot. when am trying to plot with xgraph i got a error saying
      PROBLEMS FOUND WITH INPUT DATA.what to do ??
      can u define what is STATIONS can i get awk script ????

      Delete
  60. Sir,
    when using awk script for trace file analysis man says tat particular
    awk is applicable to new trace format or old trace format..
    sir, wat is difference between old and new trace format?
    how to identify which trace format my ns2 is generating? iam using ns-2.27 using cygwin
    how to convert old trace format to new trace format and vice versa?

    please reply sir
    Thanks

    ReplyDelete
  61. Beegala Yuvaraj2 August 2013 at 11:16

    Hi priya,
    $ns new-trace --> if u keep this line in ur tcl file . it will create new trace file format with consists of 30 columns. (x,y,z) positions will be shown. if dont keep any line like or #ns new-trace --> it means old trace format which is very easy to analyze by awk scripts. still if u did not get ping me on fb . i ll chat and answer ur queries

    ReplyDelete
  62. Hi,
    how i can change the the shape and color of nodes in wireless network

    ReplyDelete
  63. I also want the .awk file of energy and hopcount

    ReplyDelete
    Replies
    1. Beegala Yuvaraj3 August 2013 at 01:31

      Nodes with Color
      ------------------
      $n0 color blue
      $n1 color red

      Nodes with shape
      --------------------
      $n0 shape box
      $n1 shape circle

      Delete
    2. This comment has been removed by the author.

      Delete
  64. hiii sir

    i downloaded aodv_50.tcl file ,throughput awk file and tried to calculate throughput
    am getting below error .what to do?
    [root@localhost ns-allinone-2.34]# awk -f gth.awk AODV_50.tr
    Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

    ReplyDelete
    Replies
    1. Beegala Yuvaraj3 August 2013 at 04:57

      Please check the trace file you are using .. Disable the new trace format and check whether u r using awk script for old trace file format or not.
      Comment the new-trace like below in ur tcl
      # $ns new-trace

      Delete
  65. hiii

    am trying to plot graph THROUGHPUT vs LOAD.am using throughput.awk,nrl_ot.awk trying to put into 1 awk script .but am getting NRL=0...as am not to define $7 in old trace format.
    i mean that $1=event,what is $7=??

    ReplyDelete
  66. Hi,
    Nodes with Color
    ------------------
    $n0 color blue
    $n1 color red

    Nodes with shape
    --------------------
    $n0 shape box
    $n1 shape circle

    this command is not working

    ReplyDelete
    Replies
    1. Beegala Yuvaraj4 August 2013 at 23:56

      Here n0,n1 means the node names...please chenge the node names according to ur node creation .

      Delete
  67. sir, not working after changing the name.......

    ReplyDelete
    Replies
    1. Beegala Yuvaraj6 August 2013 at 02:15

      Dont put them in one file. Better do it seperately. please refer here for trace file formats
      http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats

      Delete
    2. thank you so much sir...sir but tell me how i put in separate file and link both of them...

      Delete
  68. channel.cc:SendUp -Calc HighestAnteenaZ_ distCST_
    HighestAnteenaZ_ = 1.5 , distCST_ 550.0

    sir what is the meaning of these lines

    ReplyDelete
    Replies
    1. Beegala Yuvaraj6 August 2013 at 01:38

      highestAntennaZ_ ===> highest antenna position
      distCST_====> maximum receiving distance.

      consider the distance between the sender ans reciever is maximum . in this case , the distance between nodes may vary thus long distance nodes will discard the packets due to low transmission range. Transmission power(P_t)and packet Receving power(P_r) are calculated using propogation models in Ns-2. two way model,random point,shadowing models etc..u can also set the threshold physical layer using
      Phy/WirelessPhy set RXThresh_
      here 550.0 make sense in terms of range the nodes communicate
      More info :
      https://wiki.ti5.tu-harburg.de/wsn/ns2/class_propagation

      Delete
    2. thank you sir...this information is very usefull for me.....

      Delete
    3. how i can understand fully NS2.34 in detail....

      Delete
  69. hiii

    am trying to plot graph THROUGHPUT vs LOAD.am using throughput.awk,nrl_ot.awk trying to put into 1 awk script .but am getting NRL=0...as am not to define $7 in old trace format.
    i mean that $1=event,what is $7=??

    ReplyDelete
  70. hello

    i got error saying PROBLEMS FOUND WITH INPUT DATA when am trying to plot with xgraph.what to do??

    ReplyDelete
    Replies
    1. Beegala Yuvaraj7 August 2013 at 02:18

      Please refer to my post on xgraph to have clear idea to plot the graph.

      Delete
  71. This comment has been removed by a blog administrator.

    ReplyDelete
  72. I created a scenario with a defined number of nodes (=20)
    vehicular network
    some nodes during a interval of time will broadcast a message (500bytes)

    i need to know how many nodes receive the message and not how many packets are received.

    i have no problem in awk or perl

    any clue?
    Thank you

    ReplyDelete
  73. hi
    i am getting this error
    for both new as well as old trace format
    please help me
    GeneratedPackets = 7355
    ReceivedPackets = 7333
    Packet Delivery Ratio = 99.7009%
    Total Dropped Packets = 0
    Average End-to-End Delay = -nan ms

    ReplyDelete
    Replies
    1. Please check your awk script. nan means not a number. may be if u using character to compute. please verify tht awk script u r suing

      Delete
    2. This comment has been removed by the author.

      Delete
  74. Hi! How can I set ns to simulate with 2 nodes. Only 1 node is the source and the other is a receiver node. I need to have the receiver node receive a total of 1350 packets. The length of the simulation time depends on the length of time the 1350 packets have been received. Therefore, I should not be setting the stop time. It depends on the simulation when the ns will stop.

    ReplyDelete
  75. hi
    Can you suggest me measures to minimise e2edelay in aodv protocol?
    i tried by varying rxthresh but didnt worked out well.
    thanks

    ReplyDelete
  76. hiii
    can i get the difference between adhoc mode and client mode in 802.11s mesh networks.

    ReplyDelete
  77. Hi Sir.
    i want to extract nodes computational (not communication) energy consumption in ns.
    how i can do this?

    please help me

    thanx

    ReplyDelete
    Replies
    1. please initialize the energy with some x joules then run the program...

      Delete
  78. Hi Yuvraj,
    Pls give me the CA-AOMDV Patch file for ns2.34

    ReplyDelete
    Replies
    1. HI priya, its just AOMDV protocol and some one modified bit code in it and named it as CA-AOMDV. its not separate protocol.

      Delete
  79. Hello sir,
    I want to plot a graph between end to end delay vs pause time for AODV and DSDV ...

    ReplyDelete
  80. sir I want a awk script for energy analysis of new wireless trace format.
    script provided by you is not working , also it works only for node-id =4 .

    I have to print node id and its reaming energy .
    please help.

    ReplyDelete
  81. sir i want to deploy nodes exponentially.
    how to generate nodes exponentially and display them in nam .

    Thanks

    ReplyDelete
  82. how to find out route discovery frequency in AOMDV protocol. Please help.

    ReplyDelete
  83. how to find out packet drop in EAODV protocol. Please help.my id is mamtaparmar32@gmail.com

    ReplyDelete
  84. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. - 0.099976 2 3 exp 128 ------- 1 0.0 1.1 1 1
      + 0.110976 0 2 exp 128 ------- 1 0.0 1.1 3 3

      please tell me that above trace file format is a new or old?

      Delete
  85. do you any awk script to calculate end to en delay , jitter , throughput in wired network.

    If you have then please tell.

    I really need that.

    ReplyDelete
  86. Thank you :) this is awesome !!!!

    ReplyDelete
  87. Thanks it is great site
    I would ask how I can run PAODV protocol in NS2.35

    ReplyDelete
  88. how can run GPSR in ns2.35

    ReplyDelete
  89. i try to run instantJitter awk script...but it gives no output....why???

    ReplyDelete
  90. how can run GPSR in ns2.34

    ReplyDelete
  91. Hi, Great site and very useful.
    Sir,
    I need an awk script for showing out of routing path stretch between a source and a destination node (i.e., in terms of number of hops). Also, I need to examine each node in the simulation to figure out the ratio between the actual numbers of a node’s neighbors (i.e., neighbors in its transmission range) to those listed in the same node’s neieghbors-list. I’m working on GPSR routing protocol in NS2.
    Have you got one or, if not, can you point me to where I might find one. Any help greatly appreciated,
    Nashmi

    ReplyDelete
  92. Hi, Great site and very useful.
    Sir,
    I need an awk script to figure out the ratio between the actual numbers of a node’s neighbors (i.e., neighbors in its transmission range) to those listed in the same node’s neieghbors-list. I’m working on GPSR routing protocol in NS2.
    Have you got one or, if not, can you point me to where I might find one. Any help greatly appreciated,
    Nashmi

    ReplyDelete
  93. Hi Sir,
    My email is nshmrstrmg@yahoo.com. Kindly, can you send me your email to explain my problem, please.

    Thanks.

    ReplyDelete
  94. hi sir,
    i need awk script for packet loss.

    ReplyDelete
  95. Hello ,
    someone plz help me in ns2.35
    whenever i use command awk-f pdf.awk ns.trc>aomdv.xg then it always show awk-f command not found, plz help anyone

    ReplyDelete
  96. hello,
    someone help me for awk script design possible without having protocol ?actually my protocol is LSGO routing protocol which is combination of Link state routing, Geographic opportunistic routing protocol and i have not source code of this protocol

    ReplyDelete
    Replies
    1. Hi Krima,
      Awk programming to use analyze the metrics of network. if you dont have routing protocol then how u can u calculate throughput,packet loss, end to end delay. U need a routing protocol to send some data between sender and receiver . Once you have a network then you can analyze the data using awk script . input for this is trace file which will be generated after ur execution of TCL script

      Delete
  97. sir can u mail me the code for cluster formation i manet

    ReplyDelete
    Replies
    1. What exactly u want ?? Cluster Formation is abstract concept. wat routing protocol u want to use ? how u want to split the data ?

      Delete