1 / 14

NS2 in Ad Hoc Network

NS2 in Ad Hoc Network. 492516207 邱朝螢. Ad Hoc Wireless Simulations in NS2. Topography Routing Protocols AODV DSR DSDV TORA Configure Node Traffic Mobile Node. Configure Node. $ns_ node-config -adhocRouting AODV ;# routing protocol -llType LL ;# link layer type

dezso
Download Presentation

NS2 in Ad Hoc Network

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NS2 in Ad Hoc Network 492516207 邱朝螢

  2. Ad Hoc Wireless Simulations in NS2 • Topography • Routing Protocols • AODV • DSR • DSDV • TORA • Configure Node • Traffic • Mobile Node

  3. Configure Node • $ns_ node-config • -adhocRouting AODV\ ;# routing protocol • -llType LL\ ;# link layer type • -macType Mac/802_11\ ;# MAC type • -ifqType Queue/DropTail/PriQueue\ ;# interface queue type • -ifqLen 100 \ ;# max packet in ifq • -antType Antenna/OmniAntenna\ ;# antenna model • -propType Propagation/TwoRayGround\ ;# radio-propagation model

  4. Configure Node • -phyType Phy/WirelessPhy\;# network interface type • -topoInstance $topo \ • -agentTrace ON \ • -routerTrace ON \ • -macTrace OFF \ • -movementTrace OFF \ • -channel $chan_1_

  5. Topography • # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) • # Create God create-god $val(nn)

  6. Node • Create Node • for {set i 0} {$i < $val(nn)} {incr i} { set node_($i) [$ns_ node]} • Random initial node position • for {set i 0} {$i < $val(nn)} {incr i}{ $node_($i) set X_ [expr { $val(x)*rand() } ] $node_($i) set Y_ [expr { $val(y)*rand() } ] $node_($i) set Z_ 0.0 $node_($i) radius 500}

  7. Node • Initial node size • for {set i 0} {$i < $val(nn)} {incr i} { $ns_ initial_node_pos $node_($i) 50;} • Link • $ns duplex-link $n0 $n2 2Mb 10ms DropTail • $node_($i) radius 500

  8. Simulation of AODV

  9. Traffic • CBR • set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set packet_size_ 512 $cbr set packet_rate_ 4 $cbr set rate_ 2mb $ns_ at 0.01 "$cbr start" $ns_ at $val(stop) "$cbr stop"

  10. Mobile Node • for {set j 0} {$j < $val(mvnodes)} {incr j} { set addx [expr {$val(x)*rand()}] set addy [expr {$val(y)*rand()}] set ranspeed [expr {$val(nodespeed)*rand()}] set temp 0.1 $ns_ at $temp "$node_($j) setdest $addx $addy $ranspeed" }

More Related