Thursday, 16 January 2014

VANET Installation in Linux

Dowloads


VanetMobiSim 1.1 binaries (234 kB) [download(includes portions of CanuMobiSim 2001-2003, © Universität Stuttgart, Germany)
VanetMobiSim 1.1 sources file (1483 kB) [download]
————————————————————————————————————————————————–
Requirements

VanetMobiSim binaries require the presence of a Java Run Time Environment version 1.5 and higher. If the user downloaded the source files, VanetMobiSim requires the presence of a Java SDK version 1.5 or higer as well as Apache Ant.
We make the user aware that most of the linux and windows systems come with a pre-installed JVM. However, VanetMobiSim will likely not work if the JVM is not the Sun JVM. Check your version with this command:
java -version
Download the latest Sun JVM and Apache Ant.
———————————————————————————————————————————————-
Installation

VanetMobiSim is ready to run and plateform independant. The user can simply download the VanetMobiSim java binaries. No further processing is required.
In order to comply with the copyright of CanuMobiSim framework, we cannot diffuse the full source code of VanetMobiSim, which includes portions of CanuMobiSim.
However, the copyright allows us to diffuse the source code and extensions brought to CanuMobiSim by VanetMobiSim. Therefore, in order to obtain the full source code of the VanetMobiSim simulator, we let the user patch CanuMobiSim source code with VanetMobiSim source code and finally compile the project.
The procedure is totally automatic and uses the power of Apache Ant.
    • Download the source code of VanetMobiSim and expand it in a base directory of your choice. You should get the following subdirectories and files:jar/
      build.xml
      VanetMobiSim-src.jar
      VanetMobiSim-samples.jar
      mypackages.lst
      READ_ME
    • Download the source code of CanuMobiSim Expand it in the same directory. You should get a subdirectoy named “src/”. At this time, your current directory should contains:jar/
      src/
      build.xml
      VanetMobiSim-src.jar
      VanetMobiSim-samples.jar
      mypackages.lst
      READ_ME
    • Open a terminal and go to your directory. Be sure that you have a working and well configured version of Apache Ant and that the build.xml file is in the base directory you will launch ant.
      Type:”ant patch”The program will patch the src/ directory with VanetMobiSim source files.
    • Finally, in order to build the simulator and create the javadocs
      Type:”ant all”Warnings generated by javadoc are not important. They are created because we do not distribute the source code of the geotransform java library (It may be found here: GeoTransform)The binary .jar file of VanetMobiSim will be place in the jar/ subdirectory.
  • You can now use VanetMobiSim according to the user manual.

Tuesday, 7 January 2014

Packet delivery ratio calculation in ns2 using awk

Packet delivery ratio calculation in ns2 using awk

Solution

BEGIN {

        sendLine = 0;

        recvLine = 0;

        fowardLine = 0;

}



$0 ~/^s.* AGT/ {

        sendLine ++ ;

}



$0 ~/^r.* AGT/ {

        recvLine ++ ;

}



$0 ~/^f.* RTR/ {

        fowardLine ++ ;

}


$0 ~/^D.* cbr/ {

        dropLine ++ ;

}

END {

        printf "PacketDelivery Ratio:%.4f \n",(recvLine/sendLine);
}

How to Count RERR,RREP,RREQ and hello packets  in ns2 from trace file?





Solution

use the awk scrpt like below,

    BEGIN {
   
            rreq = 0;
   
           rrep = 0;
   
            hello = 0;
             rerr =0;
   
    }
   
   
   
    $0 ~/^s.*(REQUEST)/ {
   
            rreq ++ ;
   
    }
   
   
   
    $0 ~/^s.*(REPLY)/ {
   
            rrep ++ ;
   
    }
   
   
   
    $0 ~/^s.*(HELLO)/ {
   
            hello ++ ;
   
    }
   
   
    $0 ~/^s.*(ERROR)/ {
   
            rerr++ ;
   
    }
   
    END {
   
            printf "Request Count:%d \n",rreq;
        printf "Reply Count:%d \n",rrep;
        printf "Hello Count:%d \n",hello;
        printf "Rerr Count:%d \n",rerr;
   
   
    }
    }

Execute the code by typing: **awk -f "file.awk" "tracefile"**
 

How to find neighbor list in ns2

 

Solution:



# neighbor node calculation

    set nbr [open Neighbor w]

    puts $nbr "\t\t\t\t\tNeighbor Detail"

    puts $nbr "\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

    puts $nbr "\tNode\t\tNb node\t\tNode-Xpos\tNode-Ypos\tNb-Xpos\t\tNb-Ypos\t\tDistance(d)"

    puts $nbr "\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

    close $nbr

    proc distance { n1 n2 nd1 nd2} {

      global c n bnd src dst j0 j1

      set a 0

      set nbr [open Neighbor a]

      set x1 [expr int([$n1 set X_])]

      set y1 [expr int([$n1 set Y_])]

     set x2 [expr int([$n2 set X_])]

      set y2 [expr int([$n2 set Y_])]

      set d [expr int(sqrt(pow(($x2-$x1),2)+pow(($y2-$y1),2)))]

      if {$d<300} {

        if {$nd2!=$nd1} {

          puts $nbr "\t$nd1\t\t$nd2\t\t$x1\t\t$y1\t\t$x2\t\t$y2\t\t$d"

        }
        }



      close $nbr
    }



    U can use above function to print neighbor node's of all nodes in ns2.
 call the function"distance" to print neighbor list
    for example,

    for {set i 0} {$i <$val(nn)} {incr i} {
          for {set j 0} {$j <$val(nn)} {incr j} {
   
            $ns at 10.002 "distance $n($i) $n($j) $i $j"
          }
        }

    here val(nn) denotes number of nodes.