BU CS 580S - Comparison in NS2: AODV comparing to DSR as Example

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Slide 66Design Routing Protocol Performance Comparison in NS2:AODV comparing to DSR as ExampleYinfei PanSUNY BinghamtonComputer ScienceWhy this topic important?•There are already many projects try to tell us how to use NS-2 easily, while not as that difficult as its official manual says.•However, how to easily use NS-2 to do performance evaluation is still lacking.–Usually, a trace file is larger than 600MB, to analysis this huge file definitely will cost great time.–There are many evaluation methods, but to use them is very time cost and may not exactly what the simple version we want.•This project is to let people who use NS-2 can easily do the work of network post simulation. Thus make the fast use of NS-2 more practical.Overview•Do wireless simulation in NS-2•Reading trace file•How to program the analysis on trace file•Example Part–Brief on AODV & DSR–Simulating them in NS-2–Show the analysis resultsAbout NS-2•Academic project over 10 years old–freely distributed, open source•Large user base –mostly academics•“de facto” standard in networking researchNS-2 could do what for us?•Discrete event network simulator–Physical activities are translated to events–Events are queued and processed in the order of their scheduled occurrences–Time progresses as the events are processed –So, the simulation “time” may not be the real life time you “input”Event Driven SimulationTX Pkt Event @ 1.5secNode 1 ModuleNode 2 ModuleTX Pkt Event @ 1.5secRX Pkt Event @ 1.7secRX Pkt Event @ 1.7secTX Ack Event @ 1.8secEvent QueueIt works like events passing among Nodes which is programmed as modulesEvent @ 2.0secEvent @ 2.0secEvent @ 1.8secNS-2 could do what for us? (cont.)•Modeling Essential Network Components–Traffic models and applications–Transport protocols–Routing and queue–Link layer mechanism•Providing a huge trace file recording all the events line by line in it. So, we can see event driven mechanism is important for post simulation analysisAgent(Src/ Sink)PortDemuxDSRLLI FqMACNetI FRadioPropagationModelChannelARPSimulation ScenarioTcl ScriptC++ Implementation1 2set ns_ [new Simulator] set node_(0) [$ns_ node] set node_(1) [$ns_ node] class MobileNode : public Node {friend class PositionHandler;public: MobileNode();••}What we need in one simulation?•Appearance: the whole topology view of sensor network or mobile network–The position of nodes: (x, y, z) coordinate–The movement parameters•Starting time•To what direction•Speed•Internal work: which nodes are the sources? what are the connections? and using what kind of connection?•Drive the simulation: What about the configuration network components on sensor node? Where to give out the simulation results? How to organize a simulation process?Running simple wireless simulations in NS-2 (do the above in one tcl)•# Create an instance of the simulator, set ns_ [new Simulator]•# Setup trace support by opening file # “trace_bbtr.tr” and call the procedure trace-all set tracefd [open trace_bbtr.tr w]$ns_ trace-all $tracefd•# Create a topology object that keeps track # of all the nodes within boundaryset topo [new Topography]•# The topography is broken up into grids# and the default value of grid resolution is 1. # A diferent value can be passed as a third# parameter to load_flatgrid {}. $topo load_flatgrid $val(x) $val(y)•# Create the object God, "God (General Operations Director) is the object that is used to store global information about the state of the environment, network or nodesset god_ [create-god $val(nn)] •The procedure create-god is defined in $NS2_HOME/tcl/mobility/com.tcl, which allows only a single global instance of the God object to be created during a simulation.•God object is called internally by MAC objects in nodes, so we must create god in every cases.•# Before we can create node, we first needs to configure them. Node configuration API may consist of defining the type of addressing (flat/hierarchical etc), for example, the type of adhoc routing protocol, Link Layer, MAC layer, IfQ etc. $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 [new $val(chan)] \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace OFF# Simulation options# channel typeset val(chan) Channel/WirelessChannel# radio-propagation modelset val(prop) Propagation/TwoRayGround# Antenna typeset val(ant) Antenna/OmniAntenna# Link layer typeset val(ll) LL# Interface queue typeset val(ifq) Queue/DropTail/PriQueue# max packet in ifqset val(ifqlen) 50 # network interface typeset val(netif) Phy/WirelessPhy# MAC typeset val(mac) Mac/802_11# ad-hoc routing protocol set val(rp) DSDV# number of mobilenodesset val(nn) 5•# create nodes:for {set i 0} {$i < $val(nn) } {incr i} { set node_($i) [$ns_ node] # disable random motion $node_($i) random-motion 0}•The random-motion for nodes is disabled here, as we are going to provide node position and movement (speed & direction) directives next.•# give nodes positions to start with, Provide initial (X,Y, for now Z=0) co-ordinates for node_(0) and node_(1). Node0 has a starting position of (5,2) while Node1 starts off at location (390,385). $node_(0) set X_ 5.0$node_(0) set Y_ 2.0$node_(0) set Z_ 0.0$node_(1) set X_ 390.0$node_(1) set Y_ 385.0$node_(1) set Z_ 0.0•At time 50.0s, node 1 starts to move towards the destination (x=25, y=20) at a speed of 15m/s. This API is used to change direction and speed of movement of nodes.$ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0”•# setup traffic flow between the two nodes as follows: TCP connections between node_(0) and node_(1)set tcp [new Agent/TCP]$tcp set class_ 2set sink [new


View Full Document

BU CS 580S - Comparison in NS2: AODV comparing to DSR as Example

Download Comparison in NS2: AODV comparing to DSR as Example
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Comparison in NS2: AODV comparing to DSR as Example and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Comparison in NS2: AODV comparing to DSR as Example 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?