Tcl script 2
|
|
- Britney Harmon
- 6 years ago
- Views:
Transcription
1 Ns :
2 nam ns 6... ns 6... nam Tcl script ( ) Xgraph ns
3 42... ns MobileIP CUM wired-cum-wireless wired-cum-wireless IP ns ns TCL (Constructor) 76...command( ) rec( ) 81...rec-myroute-pkt( ) send-myroute-pkt( ) 84...reset-myroute-pkt-timer( ) forward-data() ( )
4 90...TCL (makefile)
5 nam ns (Tcl/Tk, otcl, etc) ns.. nam ns.. Unix : UCB ns download page installation problems page ns-users mailing list. ns. nam ns 'ns- ns. allinone/otcl/' installation. 'LD_LIBRARY_PATH'. Unix gurus ns-users mailing list problem page
6 ns 1.2 ns ns <tclscript>. 'ns <tclscript>' ( ) ns Tcl Tcl ns. nam 1.3 'nam <nam-file>' nam. ns nam '<nam-file>'. nam screenshot
7 nam 1-1 ns Tcl Tcl script 2 (node)..
8 . nam (Template) 2.1 Joe. 'example1.tcl' Tcl.. :. Tcl emacs set ns [new Simulator] nam : set nf [open out.nam w] $ns namtrace-all $nf. nf out.nam. nam proc finish {} { (finish). nam global ns nf $ns flush-trace close $nf exec nam out.nam &
9 exit 0 } 5 Object. 'finish' $ns at 5.0 "finish" ns. 'at'. $ns run 'ns example1.tcl' 'nam: empty trace file out.nam'. (... ) 2.2 ).. ( '$ns at 5.0 "finish' '$ns run' set n0 [$ns node]
10 set n1 [$ns node] 'n1' 'n0' '$ns node'.. $ns duplex-link $n0 $n1 1Mb 10ms DropTail n1 n0.. DropTail 'ns example1.tcl' 10 1 Nam ns. n1 n0 n0. n1
11 #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetsize_ 500 $cbr0 set interval_ $cbr0 attach-agent $udp0 n0 UDP 500. UDP CBR.( 200 ). 0/005. n1 ( set null0 [new Agent/Null] $ns attach-agent $n1 $null0 null). $ns connect $udp0 $null0. CBR
12 '$ns at 5.0 "finish" :. $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop" nam (Play). nam 'Step' nam. 3 4.
13 ( ) nam nam.. set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node]. Tcl $ns duplex-link $n0 $n2 1Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail $ns duplex-link $n3 $n2 1Mb 10ms DropTail.. 're-layout'. nam Tcl..
14 $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right nam. nam. 1-3 nam... n1 n0 3.2 CBR UDP. n3 (null) #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0
15 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetsize_ 500 $cbr0 set interval_ $cbr0 attach-agent $udp0 #Create a UDP agent and attach it to node n1 set udp1 [new Agent/UDP] $ns attach-agent $n1 $udp1 # Create a CBR traffic source and attach it to udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetsize_ 500 $cbr1 set interval_ $cbr1 attach-agent $udp1 set null0 [new Agent/Null] $ns attach-agent $n3 $null0. (null) CBR $ns connect $udp0 $null0
16 $ns connect $udp1 $null0 4/5 0/5 CBR. 4/0 1/0 CBR. $ns at 0.5 "$cbr0 start" $ns at 1.0 "$cbr1 start" $ns at 4.0 "$cbr1 stop" $ns at 4.5 "$cbr0 stop" 'ns example2.tcl'. n2 n1 n2 n0 n3 n2 200 :. 500 n2 n1 n2 n0 8/0 n3 n2. 1/6. ( ) nam.. n3 n CBR $udp0 set class_ 1
17 $udp1 set class_ 2 Tcl. $ns color 1 Blue $ns color 2 Red. 2-3 n3 n2. ( ) n3 n2 $ns duplex-link-op $n2 $n3 queuepos 0.5. ns
18 3-3. DropTail. n3 n2 ( ) SFQ. n3 n2. $ns duplex-link-op $n2 $n3 queuepos Tcl 'example3.tcl' Tcl
19 . n0 7.. for {set i 0} {$i < 7} {incr i} { set n($i) [$ns node] }. Tcl.. for {set i 0} {$i < 7} {incr i} { $ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail } ' for '. " % ". 're-layout' nam. 1-4
20 4.2. n(1) n(0) #Create a UDP agent and attach it to node n(0) set udp0 [new Agent/UDP] $ns attach-agent $n(0) $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetsize_ 500 $cbr0 set interval_ $cbr0 attach-agent $udp0 set null0 [new Agent/Null] $ns attach-agent $n(3) $null0 $ns connect $udp0 $null0 $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop" ( ) 2 1.
21 $ns rtmodel-at 1.0 down $n(1) $n(2) $ns rtmodel-at 2.0 up $n(1) $n(2) Tcl $ns rtproto DV nam. 'rtprotodv'
22 3-4 Xgraph 5. 'xgraph', ns-allinone. Xgraph. Tcl. 5.1 :, 1-5
23 set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] $ns duplex-link $n0 $n3 1Mb 100ms DropTail $ns duplex-link $n1 $n3 1Mb 100ms DropTail $ns duplex-link $n2 $n3 1Mb 100ms DropTail $ns duplex-link $n3 $n4 1Mb 100ms DropTail. n2 n1, n0. proc attach-expoo-traffic { node sink size burst idle rate } { #Get an instance of the simulator set ns [Simulator instance] #Create a UDP agent and attach it to the node set source [new Agent/UDP] $ns attach-agent $node $source #Create an Expoo traffic agent and set its configuration parameters set traffic [new Application/Traffic/Exponential] $traffic set packetsize_ $size
24 $traffic set burst_time_ $burst $traffic set idle_time_ $idle $traffic set rate_ $rate # Attach traffic source to the traffic generator $traffic attach-agent $source #Connect the source and the sink $ns connect $source $sink return $traffic }, : 6.(Peak) ( ), Traffic/Expoo. n2 n1, n0.., n4 set sink0 [new Agent/LossMonitor] set sink1 [new Agent/LossMonitor] set sink2 [new Agent/LossMonitor] $ns attach-agent $n4 $sink0 $ns attach-agent $n4 $sink1
25 $ns attach-agent $n4 $sink2 set source0 [attach-expoo-traffic $n0 $sink s 1s 100k] set source1 [attach-expoo-traffic $n1 $sink s 1s 200k] set source2 [attach-expoo-traffic $n2 $sink s 1s 300k] Agent/LossMonitor Tcl, set f0 [open out0.tr w] set f1 [open out1.tr w] set f2 [open out2.tr w] 'finish'.,. proc finish {} { global f0 f1 f2 #Close the output files close $f0 close $f1 close $f2
26 #Call xgraph to display the results exec xgraph out0.tr out1.tr out2.tr -geometry 800x400 & exit 0 }. xgraph. (800*400). proc record {} { global sink0 sink1 sink2 f0 f1 f2 #Get an instance of the simulator set ns [Simulator instance] #Set the time after which the procedure should be called again set time 0.5 #How many bytes have been received by the traffic sinks? set bw0 [$sink0 set bytes_] set bw1 [$sink1 set bytes_] set bw2 [$sink2 set bytes_] #Get the current time set now [$ns now] #Calculate the bandwidth (in MBit/s) and write it to the files puts $f0 "$now [expr $bw0/$time*8/ ]"
27 puts $f1 "$now [expr $bw1/$time*8/ ]" puts $f2 "$now [expr $bw2/$time*8/ ]" #Reset the bytes_ values on the traffic sinks $sink0 set bytes_ 0 $sink1 set bytes_ 0 $sink2 set bytes_ 0 #Re-schedule the procedure } $ns at [expr $now+$time] "record".., 5.3 : $ns at 0.0 "record" $ns at 10.0 "$source0 start" $ns at 10.0 "$source1 start" $ns at 10.0 "$source2 start" $ns at 50.0 "$source0 stop" $ns at 50.0 "$source1 stop" $ns at 50.0 "$source2 stop"
28 $ns at 60.0 "finish" $ns run 5 'record' 'finish' 60. xgraph 2-5 xgraph, gnuplot 'record' ns 6. ns.
29 , node_(1) node_(0) ( )., 500mX500m. TCP.,..,.. Tcl, ns. simple-wireless.tcl Interface Queue (IfQ), like Link Layer (LL)., MAC layer,. ad-hoc,..... val(),. simple-wireless.tcl.
30 # ========================================= ============================= # Define options # ========================================= ============================= set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radiopropagation model set val(ant) Antenna/OmniAntenna ;# Antenna 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(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(rp) DSDV ;# ad-hoc routing protocol set val(nn) 2 ;# number of mobilenodes. trace-all set ns_ [new Simulator] simple.tr.
31 set tracefd [open simple.tr w] $ns_ trace-all $tracefd. set topo [new Topography], 500mX500m ( x=500, y=500). x,y $topo load_flatgrid , load_flatgrid {} : God, create-god $val(nn) God hop God... # $ns_ node-config -addressingtype flat or hierarchical or expanded # -adhocrouting DSDV or DSR or TORA # -lltype LL # -mactype Mac/802_11 # -proptype "Propagation/TwoRayGround"
32 # -ifqtype "Queue/DropTail/PriQueue" # -ifqlen 50 # -phytype "Phy/WirelessPhy" # -anttype "Antenna/OmniAntenna" # -channeltype "Channel/WirelessChannel" # -topoinstance $topo # -energymodel "EnergyModel" # -initialenergy (in Joules) # -rxpower (in W) # -txpower (in W) # -agenttrace ON or OFF # -routertrace ON or OFF # -mactrace ON or OFF # -movementtrace ON or OFF : NULL flat :, AgentTrace flat addressing,. RouterTrace (RouterTrace),AGT (AgentTrace).. MAC MacTrace RTR., (MovementTrace) : API
33 # Configure 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) \ -topoinstance $topo \ -channeltype $val(chan) \ -agenttrace ON \ -routertrace ON \ -mactrace OFF \ -movementtrace OFF : for {set i 0} {$i < $val(nn) } {incr i} { set node_($i) [$ns_ node ] $node_($i) random-motion 0 ;# disable random motion,. ( ) :
34 # Provide initial (X,Y, for now Z=0) co-ordinates for node_(0) and node_(1) $node_(0) set X_ 5.0 $node_(0) set Y_ 2.0 $node_(0) set Z_ 0.0 $node_(1) set X_ $node_(1) set Y_ $node_(1) set Z_ 0.0. (390,385) 1 (5,2) 0 : # # Node_(1) starts to move towards node_(0) # $ns_ at 50.0 "$node_(1) setdest " $ns_ at 10.0 "$node_(0) setdest " # Node_(1) then starts to move away from node_(0) $ns_ at "$node_(1) setdest "
35 1, 50.0s $ns_ at 50.0 "$node_(1) setdest " API. (x=25,y=20) 15. :, # TCP connections between node_(0) and node_(1) set tcp [new Agent/TCP] $tcp set class_ 2 set sink [new Agent/TCPSink] $ns_ attach-agent $node_(0) $tcp $ns_ attach-agent $node_(1) $sink $ns_ connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp $ns_ at 10.0 "$ftp start". Tcp,0 Tcp : # # Tell nodes when the simulation ends # for {set i 0} {$i < $val(nn) } {incr i} { $ns_ at "$node_($i) reset"; }
36 $ns_ at "stop" $ns_ at "puts \"NS EXITING...\" ; $ns_ halt" proc stop {} { global ns_ tracefd close $tracefd } "$ns_ halt", stop{}, : puts "Starting Simulation..." $ns_ run. simple-wireless.tcl. trace-output file simple.tr. DSDV, RouterTrace AgentTrace Tcp Tcp. 0 Tcp Ack,(Agent) Tcp 0 1,. Tcp ,.,
37 6.2 Multihop,,.. scen-3-test. scen-3-test. 670mX670m ns scen-3-test. ~ns/tcl/mobility/scene. "setdest",cmu,, 3 TCP, CBR. cbr-3-test, simple-wireless.tcl LL, MAC, ). wireless1.tcl y x,,(antenna etc, seed, :. set val(chan) set val(prop) set val(netif) set val(mac) set val(ifq) Channel/WirelessChannel Propagation/TwoRayGround Phy/WirelessPhy Mac/802_11 Queue/DropTail/PriQueue
38 set val(ll) set val(ant) set val(x) set val(y) LL Antenna/OmniAntenna 670 ;# X dimension of the topography 670 ;# Y dimension of the topography set val(ifqlen) 50 ;# max packet in ifq set val(seed) 0.0 set val(adhocrouting) DSR set val(nn) 3 ;# how many nodes are simulated set val(cp) set val(sc) "../mobility/scene/cbr-3-test" "../mobility/scene/scen-3-test" set val(stop) ;# simulation time DSR DSDV. 3 (wireless1-out.tr), ns_. : nam. set tracefd [open wireless1-out.tr w] ;# for wireless traces $ns_ trace-all $tracefd set namtrace [open wireless1-out.nam w] ;# for nam tracing $ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
39 ,. val(cp) val(sc) # Define node movement model puts "Loading connection pattern..." source $val(cp) # Define traffic model puts "Loading scenario file..." source $val(sc) :,, scen-3-test $ns_ at "$node_(2) setdest \ " 2, 50,, 3/37 (368.4,170.5) : $god_ set-dist hop god,. hop, 2 1. god.,. setdest ( scen-3-test ) setdest
40 god,..,nam. nam nam. # Define node initial position in nam for {set i 0} {$i < $val(nn)} {incr i} { # 20 defines the node size in nam, must adjust it according to your # scenario size. # The function must be called after mobility model is defined $ns_ initial_node_pos $node_($i) 20 } "ns_ run" CMUTrace. puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocrouting)" puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)" puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"
41 . wireless1.tcl..., ns wireless1.tcl,nam "wireless1-out.tr",cmutrace, wireless1-out.nam. "wireless1-out.nam". nam. movementtrace AgentTrace, RouteTrace, MacTrace ( 1 ) 1, 2 0
42 MobileIP CUM 7 ns wired-cum-wireless 7.1 LAN multi-hop ad-hoc, LAN. wired-. cum-wireless wireless1.tcl. wired-cum-wireless,. wireless2.tcl W(1),W(0),. BS ( ),(3 2,1). 1
43 wired-cum-wireless 1-7 wireless1.tcl.. DSDV Adhoc. CBR, TCP.,. Opt(), Val(). Val() set opt(adhocrouting) DSDV set opt(cp) "" ;# cp file not used set opt(stop) 300 ;# time to stop simulation
44 . Tcp set opt(ftp1-start) set opt(ftp2-start) set num_wired_nodes 2 set num_bs_nodes 1. ns.... adhoc,.,,. ).,., (., "set ns [new Simulator]"
45 $ns_ node-config -addresstype hierarchical AddrParams set domain_num_ 2 ;# number of domains lappend cluster_num 2 1 ;# number of clusters in each ;#domain AddrParams set cluster_num_ $cluster_num lappend eilastlevel ;# number of nodes in each cluster AddrParams set nodes_num_ $eilastlevel ;# for each domain 2.. ( ) 2 "2 1". 1 ( ) ) "1 1 4" 3. 4 ( (. ).,., cum wireless2-out.tr.
46 "WL",. nam.,. nam. "create-god.. $opt(nn)" # create wired nodes set temp { } ;# hierarchical addresses to be used for {set i 0} {$i < $num_wired_nodes} {incr i} { } set W($i) [$ns_ node [lindex $temp $i]]., API,,.. ON..,, BS(0).
47 . adhoc,. :.1,.2.,.3..,. 1 0 : :.1 0..(, )0.(1 )1.(0 )0 ( )0.(0 )0.(0 )0, (0), 1 :. ( )0.(0 )0.(1, ) 1: ( ) :(WL node # 1) 1WL ( ) 1.0.2: 2WL ( )1.0.3 : 3WL
48 0.,. : # configure for base-station node $ns_ node-config -adhocrouting $opt(adhocrouting) \ -lltype $opt(ll) \ -mactype $opt(mac) \ -ifqtype $opt(ifq) \ -ifqlen $opt(ifqlen) \ -anttype $opt(ant) \ -proptype $opt(prop) \ -phytype $opt(netif) \ -channeltype $opt(chan) \ -topoinstance $topo \ -wiredrouting ON \ -agenttrace ON \ -routertrace OFF \ -mactrace OFF #create base-station node set temp { } ;# hier address to be used for ;# wireless domain
49 set BS(0) [ $ns_ node [lindex $temp 0]] $BS(0) random-motion 0 ;# disable random motion #provide some co-ordinates (fixed) to base station node $BS(0) set X_ 1.0 $BS(0) set Y_ 2.0 $BS(0) set Z_ 0.0 # create mobilenodes in the same domain as BS(0) # note the position and movement of mobilenodes is as defined # in $opt(sc) # Note there has been a change of the earlier AddrParams # function 'set-hieraddr' to 'addr2id'. #configure for mobilenodes $ns_ node-config -wiredrouting OFF # now create mobilenodes for {set j 0} {$j < $opt(nn)} {incr j} { set node_($j) [ $ns_ node [lindex $temp \ [expr $j+1]] ] $node_($j) base-station [AddrParams addr2id \ [$BS(0) node-addr]] ;# provide each mobilenode with ;# hier address of its base-station
50 } -(0)-0 ) TCP BS node-(2) w(1) (w(0)),(-node. #create links between wired and BS nodes $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail $ns_ duplex-link $W(1) $BS(0) 5Mb 2ms DropTail $ns_ duplex-link-op $W(0) $W(1) orient down $ns_ duplex-link-op $W(1) $BS(0) orient left-down # setup TCP connections set tcp1 [new Agent/TCP] $tcp1 set class_ 2 set sink1 [new Agent/TCPSink] $ns_ attach-agent $node_(0) $tcp1 $ns_ attach-agent $W(0) $sink1 $ns_ connect $tcp1 $sink1 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1
51 $ns_ at $opt(ftp1-start) "$ftp1 start" set tcp2 [new Agent/TCP] $tcp2 set class_ 2 set sink2 [new Agent/TCPSink] $ns_ attach-agent $W(1) $tcp2 $ns_ attach-agent $node_(2) $sink2 $ns_ connect $tcp2 $sink2 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at $opt(ftp2-start) "$ftp2 start" wireless2-. nam,ns.,out.nam nam wireless2-out.tr. -3- TCL ( WL ). ( W(0) )0 ( 0 ), TCP
52 wired-cum-wireless IP 7.2 wired-cum-wireless..,. W1,W0. ForeignAgent(FA) HomeAgent(HA). FA HA W1 MobileHost(MH) HA MH. MH W0 TCP. IP, FA. FA HA MH.,
53 MobileIP 2-7 wireless2.tcl, wireless3.tcl wireless-mip wireless3.tcl... set opt(nn) 1 ;# just one MH set opt(stop) 250. MH TCP. SC CP set opt(cp) ""
54 set opt(sc) "" : TCP set opt(ftp1-start) num_bs_nodes. HA FA set num_wired_nodes 2 ns.,. FA wireless2.tcl. AddrParams set domain_num_ 3 lappend cluster_num ;# number of domains ;# number of clusters in each domain AddrParams set cluster_num_ $cluster_num
55 lappend eilastlevel ;# number of nodes in each cluster AddrParams set nodes_num_ $eilastlevel ;# of each domain. wireless-mip nam ns set tracefd [open wireless3-out.tr w] set namtrace [open wireless3-out.nam w] $ns_ trace-all $tracefd $ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y) ( 0 ) ( 2 1 ).(0.1.0, 0.0.0),. MH HA FA, , FA MH MH IP MH. FA HA,., IP,Flag.., IP ON # Configure for ForeignAgent and HomeAgent nodes
56 $ns_ node-config -mobileip ON \ -adhocrouting $opt(adhocrouting) \ -lltype $opt(ll) \ -mactype $opt(mac) \ -ifqtype $opt(ifq) \ -ifqlen $opt(ifqlen) \ -anttype $opt(ant) \ -proptype $opt(prop) \ -phytype $opt(netif) \ -channeltype $opt(chan) \ -topoinstance $topo \ -wiredrouting ON \ -agenttrace ON \ -routertrace OFF \ -mactrace OFF # Create HA and FA set HA [$ns_ node 1.0.0] set FA [$ns_ node 2.0.0] $HA random-motion 0
57 $FA random-motion 0 #provide some co-ord (fixed) to these base-station nodes. $HA set X_ $HA set Y_ $HA set Z_ $FA set X_ $FA set Y_ $FA set Z_ (mobilehost) (home-agent) HA.,. # configure for mobilehost $ns_ node-config -wiredrouting OFF
58 # create mobilehost that would be moving between HA and FA. # note address of MH indicates its in the same domain as HA. set MH [$ns_ node 1.0.1] set node_(0) $MH set HAaddress [AddrParams set-hieraddr [$HA node-addr]] [$MH set regagent_] set home_agent_ $HAaddress # movement of the MH $MH set Z_ $MH set Y_ $MH set X_ # MH starts to move towards FA (640, 610) at a speed of 20m/s $ns_ at "$MH setdest " # and goes back to HA (2, 2) at a speed of 20 m/s $ns_ at "$MH setdest " : TCP HA/FA
59 # create links between wired and BaseStation nodes $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail $ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail $ns_ duplex-link $W(1) $FA 5Mb 2ms DropTail $ns_ duplex-link-op $W(0) $W(1) orient down $ns_ duplex-link-op $W(1) $HA orient left-down $ns_ duplex-link-op $W(1) $FA orient right-down # setup TCP connections between a wired node and the MobileHost set tcp1 [new Agent/TCP] $tcp1 set class_ 2 set sink1 [new Agent/TCPSink] $ns_ attach-agent $W(0) $tcp1 $ns_ attach-agent $MH $sink1 $ns_ connect $tcp1 $sink1 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at $opt(ftp1-start) "$ftp1 start"
60 )...( :."warning: Route to base_stn not known: dropping pkt" MH.. "wireless3-out.nam" "wireless3-out.tr" nam. nam TCP. ns ha MH. MH, MH HA FA. MH, FA. MH FA 8 ns CMU...,, CBR TCP, " setdest" CMU..
61 8.1 CBR TCP ~ns/indep-utils/cmu-. cbrgen.tcl scen-gen. cbr TCP, ( CBR TCP ) : ns cbrgen.tcl [-type cbr tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate] CBR/TCP 0.1 seed, 8. : Prompt. 10 CBR 4.0 ns cbrgen.tcl -type cbr -nn 10 -seed 1.0 -mc 8 -rate 4.0 > cbr-10-test CBR. ( ) cbr-10-test : # # 2 connecting to 3 at time # set udp_(0) [new Agent/UDP]
62 $ns_ attach-agent $node_(2) $udp_(0) set null_(0) [new Agent/Null] $ns_ attach-agent $node_(3) $null_(0) set cbr_(0) [new Application/Traffic/CBR] $cbr_(0) set packetsize_ 512 $cbr_(0) set interval_ 0.25 $cbr_(0) set random_ 1 $cbr_(0) set maxpkts_ $cbr_(0) attach-agent $udp_(0) $ns_ connect $udp_(0) $null_(0) $ns_ at "$cbr_(0) start" 10-0 UDP. 3 2 UDP. 8 5 cbr-10-test. TCP "Type" TCP : ns cbrgen.tcl -type tcp -nn 25 -seed 0.0 -mc 8 > tcp-25-test : tcp-25-test #
63 # 5 connecting to 7 at time # set tcp_(1) [$ns_ create-connection TCP $node_(5) TCPSink $node_(7) 0] $tcp_(1) set window_ 32 $tcp_(1) set packetsize_ 512 set ftp_(1) [$tcp_(1) attach-source FTP] $ns_ at "$ftp_(1) start" 8.2 ~ns/indep-utils/cmu-scen-gen/setdest setdest.cc. setdest{.cc,.h} Makefile : ns ) "configure" ns.1. setdest makefile (.,, "make" indep-utils/cmu-scen-gen/setdest.2 stand-alone ). ~ns/rng.cc stand-alone object. setdest ( Tclcl libs :, setdest.3./setdest [-n num_of_nodes] [-p pausetime] [-s maxspeed] [-t simtime] \
64 [-x maxx] [-y maxy] > [outdir/movement-file] 10.0m/s s. 2s. 500*500. :./setdest -n 20 -p 2.0 -s t 200 -x 500 -y 500 > scen-20-test scen-20-test. stdout.. $ns_ at "$node_(0) setdest " 2.0s node_(0) scen-20-test. 1.37m/s (90.44, 44.89). ns 9 ns 9.1 agent. agent ns..
65 , 1-9 agent,., CBR Agent. agent., MAC,IFQ.., ns 1-9
66 9.2 myroute Myroute directory. : 5. ns2 directory header :Myroute.h. ) :Myroute.cc. (. :Myroute-pk.h. header :Myroute-rtable.h. :Myroute-rtable.cc. header : Myroute-ntable.h : Myroute-ntable.cc. ( ) () Agent ns2.. () TCL.. TCL, (agent).
67 .. myroute-.. myroute/pkt.h. ( )Timer () Trace. log. myroute/myroute-pkt.h 9.3.: myroute-pkt.h/myroute # ifndef myroute_pkt_h #define myroute_pkt_h #include <packet.h> define HDR_MYROUTE_PKT(p) hdr_myroute_pkt::access(p) struct hdr_myroute_pkt{ nsaddr_t pkt_src_; u_int16_t pkt_len_; // Node which originated this packet // Packet length (in bytes) u_int8_t pkt_seq_num_; // Packet sequence number inline nsaddr_t& pkt_src() { return pkt_src_;} inline u_int16_t& pkt_len() { return pkt_len_;}
68 inline u_int8_t& pkt_seq_num() { return pkt_seq_num_;} static int offset _; inline static int& offset() { return offset_;} inline static hdr_myroute_pkt* access(const Packet* p) { return (hdr_myroute_pkt*)p->access(offset_ ); } }; #endif. myroute-pkt.h : ns2 : nsaddr-t.. 16:u-int16-t. 8:u-int8-t. config.h header. () packet common/packet.h. hdr-myroute-pkt header ns.
69 header. ( ) access. offset.. offset :. agent 1:int myroute_pkt::offset_; 2:static class MyrouteHeaderClass : public PacketHeaderClass { 3:public: 4:MyrouteHeaderClass() : PacketHeaderClass("PacketHeader/Myroute," 5: sizeof(hdr_myroute_pkt )){ 6:bind_offset(&hdr_myroute_pkt::offset ;_) 7:} 8:} class_rtprotomyroute_hdr; 9.4 myroute/myroute.h. myroute LIVE. : timer myroute/myroute.h 1: # ifndef myroute_h 2: # define myroute_h 3:
70 4: # include " myroute_pkt.h" 5: # include <agent.h> 6: # include <packet.h> 7: # include <trace.h> 8: # include <timer-handler.h> 9: # include <random.h> 10: # include <classifier-port.h> 11: 12: # define CURRENT_TIME Scheduler::instance().clock() 13: # define JITTER (Random::uniform()*5) 14: 15: class Myroute; // forward declaration 16: * 17: / Timers /* 18: 19: class Myroute_PktTimer : public TimerHandler{ 20: public: 21: Myroute_PktTimer(Myroute* agent) : TimerHandler () { 22: agent_ = agent; 23: } 24: protected:
71 25: Myroute* agent_; 26: virtual void expire(event* e); 27: } ; 28: * 29: / Agent*/ 30: 31: class Myroute : public Agent { 32: 33: / * Friends /* 34: friend class Myroute_PktTimer; 35: 36: * Private members*/ 37: nsaddr_t ra_addr_; 38: myroute_state state_; 39: myroute_rtable rtable_; myroute_ntable ntable_; 40: int accessible_var_; 41: u_int8_t seq_num _; 42: 43: protected: 44: 45: PortClassifier* dmux_; // For passing packets up to agents.
72 46: Trace* logtarget_; // For logging. 47: Myroute_PktTimer pkt_timer_; // Timer for sending packets. 48: 49: inline nsaddr_t& ra_addr() { return ra_addr_;} 50: inline myroute_state& state() { return state_;} 51: inline int& accessible_var() { return accessible_var_;} 52: 53: void forward_data(packet*); 54: void recv_myroute_pkt(packet*); 55: void send_myroute_pkt( ); 56: 57: void reset_myroute_pkt_timer( ); 58: 59: public: 60: 61: Myroute(nsaddr_t); 62: int command(int, const char*const*); 63: void recv(packet*, Handler*); 64: 65 : }; 66:
73 67: # endif. header :myroute/myroute-pkt.h. :Common/agent.h. :Common/packet.h. :common/timer-handler.h :Trace/trace.h. ( ) portclassifier : Classifier/classifier-port-h [0-5] myroute_pkttimer.
74 myroute.,, log (46) (trace). trace (agent). myroute rec( ). rec( ),command( ) ). (. UDP TCP. command( ). TCL 9.5. TCL TCL. TCLclass.. myroute/myroute.cc
75 1:static class MyrouteClass : public TclClass { 2:public: 3: MyrouteClass() : TclClass("Agent/Myroute " ) {} 4:TclObject* create(int argc, const char*const* argv } ( 5: assert(argc ==) 5; 6:return (new Myroute((nsaddr_t)Address::instance().str2addr(argv[4]))); 7: } 8:} class_rtprotomyroute; "agent/myroute" 3.. Myroute 4-7 myroute/myroute.cc expire( ) myroute/myroute.cc 1:void 2:Myroute_PktTimer::expire(Event* e ){ 3:agent_->send_myroute_pkt( )
76 4:agent_->reset_myroute_pkt_timer(); 5: } (Constructor) bind. Myroute. bind_bool accessible_var_ myroute/myroute.cc 1:Myroute::Myroute(nsaddr_t id) : Agent(PT_MYROUTE), pkt_timer_(this)} 2: bind_bool("accessible_var_", &accessible_var_); 3: ra_addr_ = id; 4: } command( ) command.. 1:int 2:Myroute::command(int argc, const char*const* argv){ 3: if (argc == 2){ 4: if (strcasecmp(argv[1], "start") == 0){ 5 : pkt_timer_.resched(0.0);
77 6: return TCL_OK; 7 : } 8: else if (strcasecmp(argv[1], "print_rtable") == 0 ){ 9: if (logtarget_!= 0){ 10: sprintf(logtarget_->pt_->buffer(), "P %f _%d_ Routing Table," 11: CURRENT_TIME, 12: ra_addr()); 13: logtarget_->pt_->dump(); 14: rtable_.print(logtarget_); 15 : } 16: else { 17: fprintf(stdout, "%f _%d_ If you want to print this routing table " 18: " you must create a trace file in your tcl script," 19: CURRENT_TIME, 20: ra_addr()); 21 : } 22: return TCL_OK; 23 :} 24 :} 25: else if (argc == 3 } ( 26:// Obtains corresponding dmux to carry packets to upper layers
78 27: if (strcmp(argv[1], "port-dmux") == 0){ 28: dmux_ = (PortClassifier*)TclObject::lookup(argv[2]); 29: if (dmux_ == 0){ 30: fprintf(stderr, "%s: %s lookup of %s failed\n", 31: FILE, 32: argv[1], 33: argv[2], 34: return TCL_ERROR; 35:} 36: return TCL_OK; 37:} 38: // Obtains corresponding tracer 39: else if (strcmp(argv[1], "log-target") == 0 40: strcmp(argv[1], "tracetarget") == 0){ 41: logtarget_ = (Trace*)TclObject::lookup(argv[2]); 42: if (logtarget_ == 0) 43: return TCL_ERROR 44: ; return TCL_OK; 45:} 46:} 47:// Pass the command to the base class
79 48: return Agent::command(argc, argv); 49:} rec( ) rec( ) hde_cmn header. header. common/packet.h : void. ip.h hdr_ip. IP header 2: Myroute::recv(Packet* p, Handler* h){ 3: struct hdr_cmn* ch = HDR_CMN(p); 4: struct hdr_ip* ih = HDR_IP(p); 5: 6: if (ih->saddr() == ra_addr())} 7: // If there exists a loop, must drop the packet 8: if (ch->num_forwards() > 0){ 9: drop(p, DROP_RTR_ROUTE_LOOP); 10: return; 11 : } 12: // else if this is a packet I am originating, must add IP header 13: else if (ch->num_forwards() == 0)
80 14: ch->size() += IP_HDR_LEN; 15:} 16: // If it is a myroute packet, must process it 17: 18: if (ch->ptype() == PT_MYROUTE) 19: recv_myroute_pkt(p); 20: // Otherwise, must forward the packet (unless TTL has reached zero) 21: else { 22: ih->ttl_--;_ 23: if (ih->ttl_ == 0){ 24: drop(p, DROP_RTR_TTL); 25: return; 26 : } 27: forward_data(p ); 28: } 29:}. ) (
81 13-14 IP myroute.(). Recv-myroute- PT_MYROUTE (18-19). pkt( ) (. ) ) forward TTL=0(.. data( ). drop( ).. trace/cmu-trace.h. rec-myroute-pkt( ) LIVE,.. 1:void 2: Myroute::recv_myroute_pkt(Packet* p){ 3: struct hdr_ip* ih = HDR_IP(p); 4: 5: struct hdr_myroute_pkt* ph = HDR_MYROUTE_PKT(p); 6: // All routing messages are sent from and to port RT_PORT, 7: // so we check it.
82 8: assert(ih->sport() == RT_PORT); 9: assert(ih->dport() == RT_PORT ) ; 10: 11 :/*processing of myroute packet...*/ 12: 13 : //release resources 14: Packet: 15:} send-myroute-pkt( ) Myroute/myroute.cc 1: void 2: Myroute::send_myroute_pkt( ){ 3: Packet* p = allocpkt(); 4: struct hdr_cmn* ch = HDR_CMN(p); 5: struct hdr_ip* ih = HDR_IP(p); 6: struct hdr_myroute_pkt* ph = HDR_MYROUTE_PKT(p); 7: 8: ph->pkt_src() = ra_addr(); 9: ph->pkt_len() = 7; 10: ph->pkt_seq_num() = seq_num_++;
83 11: 12: ch->ptype() = PT_MYROUTE; 13: ch->direction() = hdr_cmn::down; 14: ch->size() = IP_HDR_LEN + ph->pkt_len(); 15: ch->error() = 0; 16: ch->next_hop() = IP_BROADCAST; 17: ch->addr_type() = NS_AF_INET; 18: 19: ih->saddr() = ra_addr ;() 20: ih->daddr() =IP_BROADCAST; 21: ih->sport() = RT_PORT; 22: ih->dport() = RT_PORT; 23: ih->ttl() = IP_DEF_TTL; 24: 25: Scheduler::instance().schedule(target_, p,jetter); 26:} allocate( )....(3-6) ip myroute header myroute header
84 . ns header reset-myroute-pkt-timer( ) reset myroute-pkt-timer( ) Myroute/myroute.cc 1: void 2: Myroute::reset_myroute_pkt_timer (){ 3: Pkt_timer_.resched((double)5.0); 4 :} forward-data() myroute forward-data( ). Myroute/myroute.cc 1: void 2: Myroute::forward_data(Packet* p){ 3: struct hdr_cmn* ch = HDR_CMN(p); 4: struct hdr_ip* ih = HDR_IP(p); 5: 6: if (ch->direction() == hdr_cmn::up &&. 7 : ((u_int32_t)ih->daddr()=ip_broadcast ih->daddr()= ra_addr ())){
85 8: dmux_->recv(p, 0.0); 9: return; 10 :} 11: else { 12: ch->direction() = hdr_cmn::down; 13: ch->addr_type() = NS_AF_INET; 14: if ((u_int32_t)ih->daddr() == IP_BROADCAST) 15: ch->next_hop() = IP_BROADCAST; 16: else { 17: nsaddr_t next_hop = rtable_.lookup(ih->daddr()); 18: if (next_hop == IP_BRADCAST; 19: debug("%f:agent %d can not forward a packet destined to %d loss=%d\n," 20: CURRENT_TIME, 21: ra_addr(), 22: ih->daddr()); 23: drop(p, DROP_RTR_NO_ROUTE); 24: return; 25:} 26: else 27: ch->next_hop() = next_hop;
86 28:} 29: Scheduler::instance().schedule(target_, p, 0.0); 30 :} 31 :} 9.8. NS.. packet_t Common/packet.h 1: enum packet_t { 2: PT_TCP, 3:PT_UDP, 4:PT_CBR, packet.h :/* much more packet types */ 6:PT_MYROUTE, 7:PT_NTYPE //This MUST be the LAST one 8: }; : Common/packet.h 1: p_info( ) {
87 2:name_[PT_TCP]="tcp"; 3: name_[pt_udp]="udp"; 4:name_[PT_CBR]="cbr"; 5:/* much more m=names */ 6: name_[pt_myroute]="myroute"; 7:} ( ) (trace).. ( ) CMUTrace format_myroute ( ).. trace/cmu-trace.h trace/cmu-trace.h 1: class CMUTrace :public TRACE { 2: /* definitions */ 3:private: 4: /* */ 5:void format_aodv(packet *p, int offset); 6:void format_myroute(packet *p, int offset); 7:};
88 trace/cmu- trace.cc ). trace/cmu- trace.cc 1: #include <myroute/myroute_pkt.h> 2: 3: /* */ 4: 5: void 6:CMUTrace::format_ip(Packet *p, int offset( 7:{ 8:struct hdr_myroute_pkt*ph= HDR_MYROUTE_PKT(P); 9: 10: if (pt_->tagged()){ 11: sprintf(pt_->buffer() + offset, ( 12: -" Myroute:o %d -myroute:sp %d myroute:l%d", 13: ph->pkt-src(), 14: ph->pkt-seq_num(), 15: ph->pkt-len()); 16: 17: {else if (newtrace_){ 18: sprintf(pt_->buffer() + offset, 19: "-p myroute po %d ps %d pl %d",
89 20:: ph->pkt-src(), 21: ph->pkt-seq_num(), 22: ph->pkt-len()); 23: } 24: else { 25: sprintf(pt_->buffer() + offset, 26: "[myroute %d %d %d] ", 27: ph->pkt-src(), 28: ph->pkt-seq_num(), 29: ph->pkt-len()); 30: } 31: }. :. "O".. "L" "S" (()origin) format( ). Trace/cmu-trace.cc Trace/cmu-trace.cc 1:Void 2;CMUTrace::format(Packet* p, const char *why)
90 3:{ 4: /* */ 5: case PT_PING: 6: break; 7: 8: case PT_MYROUTE: 9: format_myroute(p, offset); 10:break; 11: 12: default: 13: /* */ 14:} TCL TCL. Myroute myroute tcl/lib/ns-packet.tcl ( 2 ). tcl/lib/ns-packet.tcl 1: foreach port { 2: myroute
91 3: AODV 4: ARP 5: #... 6: NV 7: }{ 8: add-packet-header $port 9: }. ns-default.tcl tcl/lib/ns-default.tcl 1:#... 2: #default defined for myroute 3:Agent/myroute set accessible_var_true OTCL. tcl/lib/ns-lib.tcl. ns-lib.tcl. tcl/lib/ns-lib.tcl 1: simulator instproc create-wireless-node args { 2: #... 3: switch-exact $routingagent- { 4: myroute 5: set ragent [$self create-myroute-agent $node] 6: }
92 7: #... 8: } 9: #... 10:} tcl/lib/ns-lib.tcl 1: simulator instproc create-myroute-agent {node} { 2: #create myroute routing agent 3: set ragent [new Agent/myroute [$node node-addr]] 4: $self at 0.0 "$ragent start" 5: $node set ragent_$ragent 6: return $ragent 7: }. myroute 3. priqueue.cc Queue/priqueue.cc 1:void 2:priQueue::recv(packet *p,handler *h) 3:{ 4: struct hdr_cmn *ch=hdr_cmn(p); 5:
93 6: if (prefer_routing_protocols){ 7: 8: switch(ch->ptype()) { 9: case PT_DSR: 10: case PT_MESSAGE: 11: case PT_TORA: 12: case PT_AODV: 13: case PT_MYROUTE: 14: rechighpriority(p,h); 15: break; 16: 17: default: 18: Queue::recv(p,h); 19:} 20:} 21:else { 22: Queue::recv(p,h); 23: } 24: }
94 (makefile) makefile.. (4) OBJ-CC 1:OBJ-CC =\ 2: tools/random.o tools/rng.o tools/ranvar.o common/misc.o common/timer-handler.o 3: #... 4: myroute/myroute.o myroute/myroute-rtable.o myroute/myroutentable.o \ 5: #... 6:$(OBJ_STL) ns o make. [ns-2-27]$ make
Comparing ad-hoc wireless to wiredwireless
TNK092: Network Simulation/Nätverkssimulering Network Simulation---ns2 Lecture 6 wired-wireless simulation Comparing ad-hoc wireless to wiredwireless We are going to make modifications to the tcl script
More informationNetwork Simulator 2. Reti di Telecomunicazioni (CdL Ing. TLC) Telematica I (CdL Ing. INF) Ing. Carla Passiatore.
Network Simulator 2 Reti di Telecomunicazioni (CdL Ing. TLC) Telematica I (CdL Ing. INF) Ing. Carla Passiatore c.passiatore@poliba.it 1 NS2 wireless simulation Use NS to simulate Wireless Network Simple
More informationEexercise5: How to do Data Transmission between Nodes Using TCP in NS2
Eexercise5: How to do Data Transmission between Nodes Using TCP in NS2 In wireless network, nodes communicate using the communication model that consists of TCP agent, TCPSink agent, and FTP application.
More informationCDA6530: Performance Models of Computers and Networks. Chapter 10: Introduction to Network Simulator (NS2)
CDA6530: Performance Models of Computers and Networks Chapter 10: Introduction to Network Simulator (NS2) Some Contents are from. USC ISI Network Simulator (ns) Tutorial 2002 http://www.isi.edu/nsnam/ns/ns-tutorial/tutorial-02/index.html
More informationANALYSIS OF SMART DEVICE GAME PROTOCOL
ENSC 427: COMMUNICATION NETWORKS SPRING 2013 ANALYSIS OF SMART DEVICE GAME PROTOCOL http://www.sfu.ca/~mea19/ Mehdi Elahi (mea19@sfu.ca) 301043763 Seyed Ahmari (mahmari@sfu.ca) 301124836 Bilal Nurhusien
More informationPart 5. Wireless Network
Introduction to NS-2 Part 5. Wireless Network Min Chen School of Computer Science and Engineering Seoul National University 1 Outline Introduction to Wireless Network An Example of Wireless Simulation
More informationBabak Shahabi ( ), Shaoyun Yang ( ) Team # 7
www.sfu.ca/~bshahabi Babak Shahabi (301102998), Shaoyun Yang (301133524) bshahabi@sfu.ca yshaoyun@sfu.ca Team # 7 1 Table of contents Contents Contents... 2 Related Works... 5 1. Mobile IP overview...
More informationFACULTY OF ENGINEERING
FACULTY OF ENGINEERING LAB SHEET ETM 3056 - COMMUNICATIONS NETWORKS TRIMESTER 1 (2010/2011) CN1 COMMUNICATION PROTOCOLS ANALYSIS CN2 WIRELESS NETWORK SIMULATION Note: On-the-spot evaluation may be carried
More informationImplementing a New Manet Unicast Routing Protocol in NS2
Implementing a New Manet Unicast Routing Protocol in NS2 Francisco J. Ros Pedro M. Ruiz Copyright (c) 2004 Francisco J. Ros and Pedro M. Ruiz. Permission is granted to copy, distribute and/or modify this
More informationNetwork Simulator 2 (NS2)
Network Simulator 2 (NS2) Basics and Mobility Management 1. Experiment 1 Let the following example be considered. All links in this network have a bandwidth of 1 Mbit/s. Please go through the tasks (1-1)
More informationNetwork Simulator 2: Introduction
Network Simulator 2: Introduction Presented by Ke Liu Dept. Of Computer Science SUNY Binghamton Spring, 2006 1 NS-2 Overview 2 NS-2 Developed by UC Berkeley Maintained by USC Popular simulator in scientific
More informationPART A SIMULATION EXERCISES
PART A SIMULATION EXERCISES 1. Simulate a three nodes point to point network with duplex links between them. Set the queue size and vary the bandwidth and find the number of packets dropped. set ns [ new
More informationns-2 Tutorial Exercise (1)
ns-2 Tutorial Exercise (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Adopted from Nicolas s slides Jianping Wang, 2002 cs757 On to the Tutorial Work in group of
More informationREVA INSTITUTE OF TECHNOLOGY AND MANAGEMENT. Kattigenahalli, Jala Hobli, Yelahanka, Bangalore
REVA INSTITUTE OF TECHNOLOGY AND MANAGEMENT Kattigenahalli, Jala Hobli, Yelahanka, Bangalore 560 064 Department of Master of Computer Applications III Semester MCA Laboratory Manual 1 Subject Code: I.A
More informationICE 1332/0715 Mobile Computing (Summer, 2008)
ICE 1332/0715 Mobile Computing (Summer, 2008) Ns-2 Laboratory Prof. Chansu Yu http://academic.csuohio.edu/yuc/ In-Class Lab: Mobile IP 5 nodes 2 wired nodes, W(0) and W(1) 2 mobile agents, HA and FA A
More informationIJESRT INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY INVESTIGATION ON THE INTERNET OF THINGS Jin Wang *, Yi bin Hou *
IJESRT INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY INVESTIGATION ON THE INTERNET OF THINGS Jin Wang *, Yi bin Hou * School of software engineering, Department of Information, Beijing
More informationENSC 427. Group 05 - Final Report UMTS Cellular & Wi- Fi Network Simulation in NS- 2 3/17/2012
2012 ENSC 427 Group 05 - Final Report UMTS Cellular & Wi- Fi Network Simulation in NS- 2 Gyuhan David Choi Seungjae Andy Back Calvin Chun Kwan Ho gca16@sfu.ca sjb18@sfu.ca cch8@sfu.ca 3/17/2012 Contents
More informationTCP over Ad Hoc Networks : NS-2 Simulation Analysis. Ren Mao, Haobing Wang, Li Li, Fei Ye
TCP over Ad Hoc Networks : NS-2 Simulation Analysis Ren Mao, Haobing Wang, Li Li, Fei Ye Chapter 1 Introduction This report is for simulation of TCP transimition in Ad-hoc networks.to begin with,we have
More informationarxiv: v2 [cs.ni] 26 Jul 2010
arxiv:1007.4065v2 [cs.ni] 26 Jul 2010 A Tutorial on the Implementation of Ad-hoc On Demand Distance Vector (AODV) Protocol in Network Simulator (NS-2) Mubashir Husain Rehmani, Sidney Doria, and Mustapha
More informationIntegrating Java Support for Routing Protocols in NS2
Integrating Java Support for Routing Protocols in NS2 Ulrich Herberg To cite this version: Ulrich Herberg. Integrating Java Support for Routing Protocols in NS2. [Research Report] RR-7075, INRIA. 2009,
More informationENSC 427: COMMUNICATION NETWORKS SPRING 2014 FINAL PROJECT
ENSC 427: COMMUNICATION NETWORKS SPRING 2014 FINAL PROJECT VoIP Performance of City-Wide Wi-Fi and LTE www.sfu.ca/~tly/webpage.html Ou, Cheng Jie 301144355 Yang, Tian Lin 301107652
More informationNS2 How to implement a new protocol?
NS2 How to implement a new protocol? Chang-Gun Lee (cglee@snu.ac.kr) Assistant Professor The School of Computer Science and Engineering Seoul National University NS directory structure ns-2.30 C++ objects
More informationAnalysis and Performance Evaluation of Routing Protocols in MANETS
Analysis and Performance Evaluation of Routing Protocols in MANETS Team Effort by Ankita Mukherjee Roopashree N Department of Computer Science & Engineering, Santa Clara University Fall 2014 Preface Mobile
More informationPerformance of a Wi-Fi Network as a function of Distance and Number of Connections in a School Environment
Performance of a Wi-Fi Network as a function of Distance and Number of Connections in a School Environment Group 1 Rajdeep Bhullar - 301187037 Kamal Ezz - 301213002 Daniel Quon 301170142 http://www.sfu.ca/~rsa83/
More informationAn Introduction to NS-2
An Introduction to NS-2 * Roadmap For Today s Lecture 1. ns Primer 2. Extending ns Part I: ns Primer What is ns? Object-oriented, discrete event-driven network simulator Written in C++ and OTcl By VINT:
More informationChapter 5. Simulation Environment. Chapter 5 Simulation Environment... V Network Simulator... V NS-2 Installation...
Chapter 5 Simulation Environment Chapter 5 Simulation Environment... V-2 5.1 Network Simulator... V-2 5.2 NS-2 Installation... V-4 5.3 Sample Script... V-9 5.4 Adding New Routing Protocol in NS2... V-12
More informationABSTRACT. socialize with nearby users of common interest, but there exists no pre-established session
ii ABSTRACT An opportunistic network application is a scenario in which mobile node users socialize with nearby users of common interest, but there exists no pre-established session by which users register
More informationMohammad Hossein Manshaei 1393
Mohammad Hossein Manshaei manshaei@gmail.com 1393 A brief Introduction to ns-2 2 Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation
More informationWireless Networks - Preliminaries
This chapter describes an overview and classification of networks used for communication. A comparative simulation study regarding nature of wired and wireless network through commercially available simulators
More informationScholars Research Library. Investigation of attack types in Ad Hoc networks and simulation of wormhole avoidance routing protocol
Available online at www.scholarsresearchlibrary.com European Journal of Applied Engineering and Scientific Research, 2012, 1 (4):207-215 (http://scholarsresearchlibrary.com/archive.html) ISSN: 2278 0041
More informationNetwork Simulator 2: Introduction
Network Simulator 2: Introduction Presented by Ke Liu Dept. Of Computer Science SUNY Binghamton Spring, 2006 1 NS-2 Overview 2 NS-2 Developed by UC Berkeley Maintained by USC Popular simulator in scientific
More informationNetwork Simulator 2. Telematica I (CdL Ing. INF) Ing. Giuseppe Piro.
Network Simulator 2 Telematica I (CdL Ing. INF) Ing. Giuseppe Piro g.piro@poliba.it 1 NS-2 Goals NS-2 is a Network Simulator - version 2 Can setup network topologies Generate packet traffic similar to
More informationPerformance Analysis of Routing Protocols
IOSR Journal of Engineering (IOSRJEN) ISSN (e): 2250-3021, ISSN (p): 2278-8719 Vol. 08, Issue 5 (May. 2018), VI PP 69-77 www.iosrjen.org Performance Analysis of Routing Protocols N Dinesh Kumar 1, V.S
More informationModeling of data networks by example: ns-2 (I)
Modeling of data networks by example: ns-2 (I) Holger Füßler Holger Füßler Course overview 1. Introduction 7. NS-2: Fixed networks 2. Building block: RNG 8. NS-2: Wireless networks 3. Building block: Generating
More informationEvaluation of Epidemic Routing Protocol in Delay Tolerant Networks
Evaluation of Epidemic Routing Protocol in Delay Tolerant Networks D. Kiranmayi Department of CSE, Vignan s Institute Of IT, Visakhapatnam, India ABSTRACT:There are many routing protocols that which can
More informationProject report Cross-layer approach in mobile as hoc routing by
Project report Cross-layer approach in mobile as hoc routing by Alexandre Boursier boursier@kom.aau.dk Stéphane Dahlen sdahlen@kom.aau.dk Julien Marie-Françoise mariefra@kom.aau.dk Thior Santander Marin
More informationSimulations: ns2 simulator part I a
Simulations: ns2 simulator part I a Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/ moltchan/modsim/ a Based on: Eitan Altman and Tania Jimenez NS Simulator for Beginners,...
More informationDMN1 : COMMUNICATION PROTOCOL SIMULATION. Faculty of Engineering Multimedia University
DMN1 : COMMUNICATION PROTOCOL SIMULATION Faculty of Engineering Multimedia University DMN1 Marking Scheme No Component Criteria Not answered 0 marks Poor 2 marks Acceptable 4 (max) marks 1 Viva Students
More informationThe Network Simulator Fundamentals. Downloads and further info at:
ns-2 The Network Simulator Fundamentals Downloads and further info at: http://www.isi.edu/nsnam/ns 1 ns Primer Basic ns Architecture Basic Tcl, OTcl Elements of ns 2 ns Architecture Object-oriented (C++,
More informationSimulation-Based Comparative Study of Routing Protocols for Wireless Ad-Hoc Network
Master s Thesis Electrical Engineering September 2014 Simulation-Based Comparative Study of Routing Protocols for Wireless Ad-Hoc Network Jani Saida Shaik School of Computing Blekinge Institute of Technology
More informationEFFICIENT ROUTING AND FALSE NODE DETECTION IN MANET
International Conference on Information Engineering, Management and Security [ICIEMS] 27 International Conference on Information Engineering, Management and Security 2015 [ICIEMS 2015] ISBN 978-81-929742-7-9
More informationPart 6. Confidence Interval
Introduction to NS-2 Part 6. Confidence Interval Min Chen School of Computer Science and Engineering Seoul National University 1 Outline Definitions Normal Distribution Confidence Interval Central Limit
More informationWIRELESS NETWORK STUDY AND ANALYSIS USING NS2 SIMULATOR
UNIVERSITY OF VAASA FACULTY OF TECHNOLOGY TELECOMMUNICATIONS ENGINEERING Xiang Chao WIRELESS NETWORK STUDY AND ANALYSIS USING NS2 SIMULATOR Master s thesis for the degree of Master of Science in Technology
More informationTutorial Schedule. Introduction Ns fundamentals Ns programming internal Extending ns-2 Simulator. Sep. 25,
NS-2 Tutorial Presenter: Qing (Kenny) Shao (SFU/CNL) Author: Polly Huang (AT&T Labs Research) Padmaparna Haldar (USC/ISI) Xuan Chen (USC/ISI) Communication Networks Laboratory http://www.ensc.sfu.ca/research/cnl
More informationReport: Simulation of ECOFRAME MAC layer in ns Bogdan Ušćumlić, Annie Gravey, Michel Morvan, and Philippe Gravey
Report: Simulation of ECOFRAME MAC layer in ns-2.31 Bogdan Ušćumlić, Annie Gravey, Michel Morvan, and Philippe Gravey May 12, 2009 Contents Introduction 1 1 The simulator 3 1.1 Caracteristics...........................
More informationSTUDY OF PERFORMANCE OF ROUTING PROTOCOLS FOR MOBILE ADHOC NETWORKING IN NS-2
STUDY OF PERFORMANCE OF ROUTING PROTOCOLS FOR MOBILE ADHOC NETWORKING IN NS-2 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF Bachelor of Technology In Computer Science
More informationMANET Implementation and Test
MANET Implementation and Test KRnet2004 Workshop Jaehoon Jeong, ETRI paul@etri.re.kr http://www.adhoc.6ants.net/~paul Contents Introduction MANET Routing Protocol MANET Implementation MANET Testbed MANET
More informationProject Network Simulation CSE 5346/4346
Project Network Simulation CSE 5346/4346 Project Overview This is a comprehensive project designed to be completed by 4 phases, and intended to demonstrate network performance and quality of service (QoS)
More informationPerformance Analysis of WLAN MAC algorithms
MEE10:91 Performance Analysis of WLAN MAC algorithms Author: Ramaz Samhan Amer Khoulani Supervisor: Dr. Jorgen Nordberg A Thesis Presented in partial fulfillment of the requirements for the degree of Master
More informationNS-2 Tutorial. Kumar Viswanath CMPE 252a.
NS-2 Tutorial Kumar Viswanath CMPE 252a kumarv@cse.ucsc.edu 1 What is ns-2? ns-2 stands for Network Simulator version 2. ns-2: Is a discrete event simulator for networking research packet level simulator.
More informationComparison of AODV, DSR, and DSDV Routing Protocols in a Wireless Network
Comparison of AODV, DSR, and DSDV Routing Protocols in a Wireless Network Pushpender Sarao Hyderabad Institute of Technology and Management, Hyderabad-1401, India Email: drpushpendersarao@gmail Abstract
More informationEE 122: Computer Networks Network Simulator ns2
EE 122: Computer Networks Network Simulator ns2 Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA 94720-1776 Adapted from F04 Slides K. Fall, J.
More informationns-2 Tutorial Contents: Today Objectives of this week What is ns-2? Working with ns-2 Tutorial exercise ns-2 internals Extending ns-2
ns-2 Tutorial Contents: Objectives of this week What is ns-2? Working with ns-2 Tutorial exercise ns-2 internals Extending ns-2 Today Partly adopted from Nicolas slides. 1 Objectives of this week Get some
More informationSIMULATING SENSOR NETWORKS IN NS-2
1 SIMULATING SENSOR NETWORKS IN NS-2 Ian Downard Naval Research Laboratory Code 5523 4555 Overlook Ave Washington DC, 20375-5337 downard@itd.nrl.navy.mil Abstract Optimizing sensor networks involves addressing
More informationQoS in Network Simulator 2
QoS in Network Simulator 2 This experiment provides experience in how to apply and simulate QoS mechanisms in communication networks by means of NS2. We focus on RSVP in this experiment. 1. RSVP in NS2
More informationA BENEFICIAL ANALYSIS OF NODE DEPLOYMENT SCHEMES FOR WIRELESS SENSOR NETWORKS
A BENEFICIAL ANALYSIS OF NODE DEPLOYMENT SCHEMES FOR WIRELESS SENSOR NETWORKS G Sanjiv Rao 1 and V Vallikumari 2 1 Associate Professor, Dept of IT, Sri Sai Aditya Institute of Science And Technology, Surampalem,
More informationThe Transport Control Protocol (TCP)
TNK092: Network Simulation - Nätverkssimulering Lecture 3: TCP, and random/short sessions Vangelis Angelakis Ph.D. The Transport Control Protocol (TCP) Objectives of TCP and flow control Create a reliable
More informationSimulation with NS-2 and CPN tools. Ying-Dar Lin Department of Computer Science, National Chiao Tung University
Simulation with NS-2 and CPN tools Ying-Dar Lin Department of Computer Science, National Chiao Tung University Outline NS-2 simulator NS-2 basics Basic syntax Tracing a simple network Mini and term projects
More informationIntroduction. Ns Tutorial Ns Goals. SAMAN and CONSER Projects. Ns Status. Ns functionalities
Introduction Ns Tutorial 2002 Padmaparna Haldar (haldar@isi.edu) Xuan Chen (xuanc@isi.edu) Nov 21, 2002 1989: REAL network simulator 1995: DARPA VINT project at LBL, Xerox PARC, UCB, and USC/ISI Present:
More informationIntroduction to Wireless and Mobile Networking
Introduction to Wireless and Mobile Networking NS-2 Tutorial-4 Hung-Yu Wei National Taiwan University Speaker: Chih-Yu Wang Creating A New Protocol NS-2 tutorial: Section VII http://www.isi.edu/nsnam/ns/tutorial/index.h
More informationLAMPIRAN. set ns [new Simulator]
LAMPIRAN set ns [new Simulator] $ns color 0 pink $ns color 1 red $ns color 2 green $ns color 3 yellow $ns color 4 brown $ns color 5 purple $ns color 6 black $ns color 7 grey $ns color 8 maroon set n0 [$ns
More informationns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1
ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1 Contents: Objectives of this week What is ns-2? Working with ns-2 Tutorial
More informationAnalysis of Routing Protocols in MANETs
Analysis of Routing Protocols in MANETs Musica Supriya, Rashmi, Nishchitha, Ashwini C Shetty, Sharath Kumar Student, Dept. of CSE, SMVITM Bantakal, Karnataka, India Student, Dept. of CSE, SMVITM Bantakal,
More informationS Ns2 simulation exercise
S-38.3148 Ns2 simulation exercise Fall 2007 1 Table of contents 1. Introduction... 3 2. Theoretical background... 3 2.1. IEEE 802.11 MAC protocol... 3 2.2. Overview of TCP s congestion control... 4 2.3.
More informationCOMPARISON OF DIFFERENT VERSIONS OF TCP IN
SONG XING COMPARISON OF DIFFERENT VERSIONS OF TCP IN 802.11 WLANS Master of Science Thesis Examiner: Yevgeni Koucheryavy Dmitri Moltchanov Examiner and topic approved by the Faculty Council of the Faculty
More informationPESIT Bangalore South Campus. Department OF Information Science & Engineering
PESIT Bangalore South Campus 1Km before Electronic City, Hosur Road, Bangalore-560100. Department OF Information Science & Engineering COMPUTER NETWORK LABORATORY 15CSL57 Lab Manual 2017-18 Introduction
More informationSimple Data Link Protocols
Simple Data Link Protocols Goals 1) Become familiar with Network Simulator 2 2) Simulate Stop & wait and Sliding Window 3) Investigate the effect of channel with loss on link utilization Introduction Data
More informationPart 3: Network Simulator 2
S-38.148 Simulation of data networks / fall-04 Part 3: Network Simulator 2 24.11.2004 1 NS2: Contents NS2 Introduction to NS2 simulator Background info Main concepts, basics of Tcl and Otcl NS2 simulation
More informationNetwork Simulator Version 2 for VANET
International Journal of Scientific Research in Computer Science, Engineering and Information Technology 2017 IJSRCSEIT Volume 2 Issue 5 ISSN : 2456-3307 Network Simulator Version 2 for VANET Venkatatamangarao
More information*************************************************************************** *********/
File: readme.asn Author: Adnan Abu-Mahfouz Date: March 2012 Description: Localisation system in wireless sensor networks using ns-2 / / 1. Introduction: ns-2 contains several flexible features that encourage
More informationChannabasaveshwara Institute of Technology. (An ISO 9001:2008 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur Karnataka.
Channabasaveshwara Institute of Technology (An ISO 9001:2008 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur 572 216. Karnataka. QMP 7.1 D/F Department of Computer Science & Engineering Network
More informationThe DTN code has been tested with ns-2.35 [1]. There is no need to re-install ns-2 if ns-2.35 has already been installed.
DTN Code for ns-2.35 The DTN code has been tested with ns-2.35 [1]. There is no need to re-install ns-2 if ns-2.35 has already been installed. The DTN code may work with earlier ns-2 versions, too. However,
More informationS Ns2 simulation exercise
S-38.148 Ns2 simulation exercise 1. Introduction...3 2. Theoretical background...3 2.1. Overview of TCP s congestion control...3 2.1.1. Slow start and congestion avoidance...4 2.1.2. Fast Retransmit...4
More informationA Case Based Study to Identify Malicious Node in Packet Routing
A Case Based Study to Identify Malicious Node in Packet Routing Suhasini Sodagudi #1, Dr.Rajasekhara Rao Kurra *2 # Associate Professor, Department of Information Technology, VRSiddhartha Engineering College
More informationPart 3. Result Analysis
Introduction to NS-2 Part 3. Result Analysis Min Chen School of Computer Science and Engineering Seoul National University 1 Outline A Simulation and its results The Format of Trace File The AWK language
More informationAnalysis of Network Traffic in Ad-Hoc Networks based on DSDV Protocol
Analysis of Network Traffic in Ad-Hoc Networks based on DSDV Protocol with Emphasis on Mobility and Communication Patterns Vahid Garousi Department of Systems and Computer Engineering Carleton University,
More information4. Simulation Model. this section, the simulator and the models used for simulation are discussed.
4. Simulation Model In this research Network Simulator (NS), is used to compare and evaluate the performance of different ad-hoc routing protocols based on different mobility models. In this section, the
More informationLAN-WAN-LAN end-to-end Network Simulation with NS2
International Journal of Applied Engineering Research ISSN 0973-4562 Volume 13, Number 17 (2018) pp 13136-13140 Research India Publications http://wwwripublicationcom LAN-WAN-LAN end-to-end Network Simulation
More informationAssessment Of Throughput Performance Under NS2 In Mobile Ad Hoc Networks (MANETs)
Assessment Of Throughput Performance Under NS2 In Mobile Ad Hoc Networks (MANETs) Liliana Enciso Quispe Department Computer Sience and Electronics Technical University of Loja San Cayetano Alto, Loja,
More informationService Location Protocol for MANET (SLPManet)
Service Location Protocol for MANET (SLPManet) User Manual April 2005 Mohamed M. Abou El Saoud moaz@sce.carleton.ca Department of Systems & Computer Engineering Carleton University 1 Required Files First,
More informationRouting Protocols Simulation of Wireless Self-organized Network Based. on NS-2. Qian CAI
International Conference on Computational Science and Engineering (ICCSE 2015) Routing Protocols Simulation of Wireless Self-organized Network Based on NS-2 Qian CAI School of Information Engineering,
More informationJohn Heidemann, USC/ISI and Polly Huang, ETH-Zurich 14 March 2002
QVWKHQHWZRUNVLPXODWRU,3$07XWRULDO 1HWZRUN0RGHOLQJDQG7UDIILF $QDO\VLVZLWKQV John Heidemann, USC/ISI and Polly Huang, ETH-Zurich 14 March 2002 a discrete event simulator simple model focused on modeling
More informationNote For NS2: How NS2 Connects Two Nodes. Teerawat Issariyakul
Note For NS2: How NS2 Connects Two Nodes Teerawat Issariyakul July 19, 2006 2 Chapter 1 Introduction 1.1 Overview This note explains how NS2 really connects two nodes. Basically, it just uses a Tcl object
More informationS Quality of Service in Internet. Introduction to the Exercises Timo Viipuri
S-38.180 Quality of Service in Internet Introduction to the Exercises Timo Viipuri 8.10.2003 Exercise Subjects 1) General matters in doing the exercises Work environment Making the exercises and returning
More informationNetwork Simulator 2, Protocol Implementation Assignment for Telecommunications Laboratory Course
Network Simulator 2, Protocol Implementation Assignment for Telecommunications Laboratory Course 1 Introduction This document describes the Major NS2 Assignment for the Simulation Part of the Telecommunications
More informationRouting Protocols in MANETs
Chapter 4 Routing Protocols in MANETs 4.1 Introduction The main aim of any Ad Hoc network routing protocol is to meet the challenges of the dynamically changing topology and establish a correct and an
More informationQMP 7.1 D/F Channabasaveshwara Institute of Technology (An ISO 9001:2008 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur Karnataka.
QMP 7.1 D/F Channabasaveshwara Institute of Technology (An ISO 9001:2008 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur 572 216. Karnataka. Department of Computer Science & Engineering LAB MANUAL
More informationNsclick User Manual. University of Colorado at Boulder
Nsclick User Manual Michael Neufeld, Graham Schelle, and Dirk Grunwald University of Colorado Department of Computer Science Boulder, CO 80309 {neufeldm,schelleg,grunwald}@cs.colorado.edu CU-CS-959-03
More informationInternational Journal of Intellectual Advancements and Research in Engineering Computations. Efficient routing protocol for MANET using.
www.ijiarec.com ISSN:2348-2079 Volume-5 Issue-1 International Journal of Intellectual Advancements and Research in Engineering Computations Efficient routing protocol for MANET using STP and BRM First
More informationBrief Overview and Background
Brief Overview and Background In this assignment you will be studying the performance behavior of TCP, using ns 2. At the end of this exercise, you should be able to write simple scripts in ns 2 as well
More informationImplementation of Feedback Mechanism into AODV based on NS2
Implementation of Feedback Mechanism into AODV based on NS2 Sebastian Roschke [sebastian.roschke@hpi.uni-potsdam.de] 2007-05-16 Abstract This paper gives an overview on the implementation of a feedback
More informationUSE OF THE NETWORK SIMULATOR NS-2 TOOL IN LECTURES
USE OF THE NETWORK SIMULATOR NS-2 TOOL IN LECTURES Petr Berka, Petr Hujka Department of Telecommunications, Brno University of Technology, Purkynova 118, 612 00 Brno, Czech Republic, phone: +420 5 41149190,
More informationS Ns2 simulation exercise
S-38.148 Ns2 simulation exercise Table of contents 1. Introduction...3 2. Theoretical background...3 2.1. Overview of TCP s congestion control...3 2.1.1. Slow start and congestion avoidance...4 2.1.2.
More informationVANET-Skeleton for ns2
VANET-Skeleton for ns2 Daniel Jungels Laboratory for computer Communications and Applications (LCA) EPFL December 23, 2005 This document quickly describes how to install ns2, and how to implement a VANET
More informationCHAPTER 4 SIMULATION MODEL AND PERFORMANCE METRICS
59 CHAPTER 4 SIMULATION MODEL AND PERFORMANCE METRICS 4.1 OVERVIEW OF SIMULATION MODEL The performance of a MANET routing protocol under varying network conditions is to be evaluated in order to understand
More informationFlow Control Packet Marking Scheme: to identify the sources of Distributed Denial of Service Attacks
Flow Control Packet Marking Scheme: to identify the sources of Distributed Denial of Service Attacks A.Chitkala, K.S. Vijaya Lakshmi VRSE College,India. ABSTRACT-Flow Control Packet Marking Scheme is a
More informationComparison of Different Types of Sources of Traffic Using SFQ Scheduling Discipline
Comparison of Different Types of Sources of Traffic Using SFQ Scheduling Discipline Alejandro Gomez Suarez, and H. Srikanth Kamath Abstract In this paper, SFQ (Start Time Fair Queuing) algorithm is analyzed
More information1 What is network simulation and how can it be useful?
CESNET Technical Report 26/2003 Experience with using simulations for congestion control research Sven Ubik, ubik@cesnet.cz Jan Klaban, xklaban@quick.cz December 5, 2003 Abstract As part of the CESNET
More informationAnalysis and Simulations of Routing Protocols with Different Load Conditions of MANETs
Analysis and Simulations of Routing Protocols with Different Load Conditions of MANETs Poonam Pahuja Department of Computer Engineering, Mewar University, Chittorgarh Rajasthan, Email: poonamsanjay2007@gmail.com
More informationCSE 573S Protocols for Computer Networks (Spring 2005 Final Project)
CSE 573S Protocols for Computer Networks (Spring 2005 Final Project) To Investigate the degree of congestion control synchronization of window-based connections bottlenecked at the same link Kumar, Vikram
More information