[ns] FW: Runtime Bandwidth
Dear NS users Previous problem is over with selection of DSDV instead of AODV. Is it the problem with NS2 installation or any thing else? Further an warning is appearing as below: "mobile/tworayground.cc: TwoRayGround propagation model assume flat ground" Can any one guide. Best Regards Shahid H Abbassi From: hamja...@hotmail.com To: ns-users@isi.edu Subject: Runtime Bandwidth Date: Tue, 20 Aug 2013 07:25:52 + Dear NS Users I am facing problem in checking Runtime Bandwidth available on any Link in Wired cum wireless scenarios. Kindly help Best Regards Shahid H Abbassi
[ns] Runtime Bandwidth
Dear NS Users I am facing problem in checking Runtime Bandwidth available on any Link in Wired cum wireless scenarios. Kindly help Best Regards Shahid H Abbassi
[ns] End to End Delay and Packet Delivery Ratio
Dear Users Here is the awk code for calculating end to end delay and packet delivery ratio while generating traffic from wired node and receiving packets on mobile nodes. Hopefully it will be helpful. Best Regards Shahid H Abbassi BEGIN { seqno = -1; droppedPackets = 0; receivedPackets = 0; generatedpackets = 0; count = 0; } { #packet delivery ratio if($5 == "cbr" && $1 == "+" && seqno < $12) { seqno = $12; generatedpackets++; start_time[$12] = $2; #print "start_time ="start_time[$12]"\n" $12; } else if(($7 == "cbr") && ($1 == "r")) { receivedPackets++; end_time[$6] = $2; #print "end_time ="end_time[$6]"\n" $6; } else if ($1 == "D" && $7 == "cbr" && $8 > 200){ droppedPackets++; end_time[$6] = -1; #print "end_time ="end_time[$6]"\n" $6; } } END { #print "seqno=" seqno; for(i=0; i<=seqno; i++) { if(end_time[i] > 0) { delay[i] = end_time[i] - start_time[i]; n_to_n_delay = n_to_n_delay + delay[i]; #print "delay=" delay[i]; #print "n_to_n_delay=" n_to_n_delay; count++; } else { delay[i] = 0; } } n_to_n_delay = n_to_n_delay/count; print "\n"; print "GeneratedPackets = " generatedpackets; print "ReceivedPackets = " receivedPackets; print "Packet Delivery Ratio = " receivedPackets/generatedpackets*100 "%"; print "Total Dropped Packets = " droppedPackets; print "Average End-to-End Delay = " n_to_n_delay * 1000 " ms"; print "\n"; }
[ns] FW: tutorials or codes on dynamic cluster formation
Dear User I am attaching the code of 2 wired nodes, 8 base station nodes (4 on each side) and 20 mobile nodes (10 on each side). Hopefully this will help you. # == # Define options # == set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac)Mac/802_11 ;# MAC type set val(ifq)Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant)Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 20 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set opt(x) 2052 ;# x coordinate of topology set opt(y) 152 ;# y coordinate of topology set opt(seed) 0.0;# seed for random number gen. set stopTime 100.00 set num_wired_nodes 2 set num_bs_nodes 8 # == # Main Program # == # # check for boundary parameters and random seed if { $opt(x) == 0 || $opt(y) == 0 } { puts "No X-Y boundary values given for wireless topology\n" } if {$opt(seed) > 0} { puts "Seeding Random number generator with $opt(seed)\n" ns-random $opt(seed) } # Initialize Global Variables # set ns_ [new Simulator] # set up for hierarchical routing $ns_ node-config -addressType hierarchical AddrParams set domain_num_ 9 ;# number of domains lappend cluster_num 2 1 1 1 1 1 1 1 1 ;# number of clusters in each domain AddrParams set cluster_num_ $cluster_num lappend eilastlevel 1 1 11 1 1 1 11 1 1 1 ;# number of nodes in each cluster AddrParams set nodes_num_ $eilastlevel ;# of each domain set tracefd [open /media/Data\ 2/Highway/Highway1a.tr w] $ns_ trace-all $tracefd set f0 [open out1a.tr w] set namtrace [open /media/Data\ 2/Highway/Highway1a.nam w] $ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y) # set up topography object set topo[new Topography] $topo load_flatgrid $opt(x) $opt(y) # # Create God # #create-god $val(nn) create-god [expr $val(nn) + $num_bs_nodes] #create wired nodes set temp {0.0.0 0.1.0} ;# hierarchical addresses for {set i 0} {$i < $num_wired_nodes} {incr i} { set W($i) [$ns_ node [lindex $temp $i]] } # Configure node set chan_1_ [new $val(chan)] $ns_ node-config -mobileIP ON \ -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 \ -wiredRouting ON \ -agentTrace ON \ -routerTrace OFF \ -macTrace OFF \ -movementTrace OFF \ -channel $chan_1_ # Create HA and FA set HA1 [$ns_ node 1.0.0] set HA2 [$ns_ node 5.0.0] set FA1_1 [$ns_ node 2.0.0] set FA1_2 [$ns_ node 3.0.0] set FA1_3 [$ns_ node 4.0.0] set FA2_1 [$ns_ node 6.0.0] set FA2_2 [$ns_ node 7.0.0] set FA2_3 [$ns_ node 8.0.0] $HA1 random-motion 0 $HA2 random-motion 0 $FA1_1 random-motion 0 $FA1_2 random-motion 0 $FA1_3 random-motion 0 $FA2_1 random-motion 0 $FA2_2 random-motion 0 $FA2_3 random-motion 0 $HA1 set X_ 270. $HA1 set Y_ 100. $HA1 set Z_ 0. $FA1_1 set X_ 770. $FA1_1 set Y_ 100. $FA1_1 set Z_ 0. $FA1_2 set X_ 1270. $FA1_2 set Y_ 100. $FA1_2 set Z_ 0. $FA1_3 set X_ 1770. $FA1_3 set Y_ 100. $FA1_3 set Z_ 0. $HA2 set X_ 1770. $HA2 set Y_ 150. $HA2 set Z_ 0. $FA2_1 set X_ 1270. $FA2_1 set Y_ 150. $FA2_1 set Z_ 0. $FA2_2 set X_ 770. $FA2_2 set Y_ 150. $FA2_2 set Z_ 0. $FA2_3 set X_ 270. $FA2_3 set Y_ 150. $FA2_3 set Z_ 0. #configure for mobilenodes $ns_ node-config -wiredRouting OFF set node_(0) [$ns_ node 1.0.1] set HAaddress1 [AddrParams addr2id [$HA1 node-addr]] [$node_(0) set regagent_] set home_agent_ $HAaddress1 set node_(2) [$ns_ node 1.0.2] [$node_(2) set regagent_] set home_agent_ $HAaddress1 set node_(3) [$ns_ node 1.0.3] [$node_(3) set regagent_] set home_agent_ $HAaddress1 set node_(5) [$ns_ node 1.0.4] [$node_(5) set regagent_] set home_agent_ $HAaddress1 set node_(7) [$ns_ node 1.0.5] [$node_(7) set regagent_] set home_agent_ $HAaddress1 set node_(10) [$ns_ node 1.0.6] [$node_(10) set regagent_] set ho