[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
[ns] tutorials or codes on dynamic cluster formation
Hello all, I am working on clustering nodes and selecting cluster heads using mobile nodes, I would appreciate if i can be provided with any tutorials or sample codes on formation of clusters. Thank you -- View this message in context: http://old.nabble.com/tutorials-or-codes-on-dynamic-cluster-formation-tp33903550p33903550.html Sent from the ns-users mailing list archive at Nabble.com.
Re: [ns] generating mobile nodes
i think the format is ./setdest -n {number or MN} -p { pose time} -M { speed } -t {simulation time} -x { The x-axis} -y { The y-axis} > file name --- On Thu, 5/24/12, leily A.Bakhtiar wrote: From: leily A.Bakhtiar Subject: [ns] generating mobile nodes To: ns-users@ISI.EDU Date: Thursday, May 24, 2012, 5:38 AM Hi, I want to generate the scenario with mobile nodes, how can I use the 'setdest' command? I use this format : ./setdest -n 20 -p 2.0 -s 10.0 -t 200 -x 500 -y 500 > M5.tr But it makes an error "invalid command". Best regards.
[ns] generating mobile nodes
Hi, I want to generate the scenario with mobile nodes, how can I use the 'setdest' command? I use this format : ./setdest -n 20 -p 2.0 -s 10.0 -t 200 -x 500 -y 500 > M5.tr But it makes an error "invalid command". Best regards.