I’ve colored and clustered the nodes myself, by hand, just for that picture
in my site.

For setting the wired nodes in NAM, the best way is to specify the wired
link latency and orientation. There are lots of examples on the /tcl/ex
directory on how to do it.

 

Pedro Vale Estrela

 

 

-----Original Message-----
From: subramani [mailto:[EMAIL PROTECTED] 
Sent: sábado, 6 de Janeiro de 2007 10:02
To: [EMAIL PROTECTED]
Subject: RE: [ns] Fwd: segmentation fault in wired cum wireless scenario
usingaodv+ help

 

hi 
thanks for the info ..
i rectified the fault by commenting some section and re running
and as you had pointed out i had done a mistake in assigning hier-address to
the wired nodes . 
one more doubt
in wired cum wireless scenarios as shown by nam
the wired nodes are seen clustered together.
specifying node positions for wired nodes has no effect.
is there any method to specify where each node should be located exactly in
the nam window?



 

 

Pedro Vale Estrela <[EMAIL PROTECTED]> wrote:


http://tagus.inesc-id.pt/~pestrela/ns2/ns2_haddr_tips.html#_Toc121548870



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of subramani
> Sent: quinta-feira, 4 de Janeiro de 2007 18:09
> To: ns list
> Subject: [ns] Fwd: segmentation fault in wired cum wireless scenario
> usingaodv+ help
> 
> 
> hi all,
> i have installed aodv+ for gateway discovery on ns-2.28 (redhat 9)
> aodv+ was in ns2 contributed code section
> 
> it worked everything fine for all the example scripts provided......
> but when i changed the number of nodes in the given example
> wired_wireless_ex.tcl
> i received a segmentation fault
> 
> i don't know wheres the fault .please atleast help me how to debug ns2
> scripts containing
> segmentation faults........
> 
> *************************************
> here is the complete code
> **************************************
> #####try.tcl
> 
> set opt(namfile) out.nam
> set opt(tracefile) out.tr
> set opt(x) 500; #x dimension of the
> topography
> set opt(y) 500; #y dimension of the
> topography
> set opt(wirelessNodes) 6; #mobile nodes
> set opt(wiredNodes) 8; #hosts and routers
> set opt(gatewayNodes) 2; #gateways
> 
> set val(stop) 60.0; #simulation time
> set val(start-src) 1
> set val(stop-src) 50
> 
> set opt(gw_discovery) reactive; #gateway discovery method
> # ======================================================================
> 
> #---------------------------
> #Initialize Global Variables
> #---------------------------
> #create a simulator object
> set ns [new Simulator]
> $ns color 0 Brown
> 
> #----------------------------------------
> #Define The Hierachial Topology Structure
> #----------------------------------------
> $ns node-config -addressType hierarchical
> #Nbr of domains
> AddrParams set domain_num_ 3
> #Nbr of clusters (=subdomains) in each domain
> lappend clusterNbr 2 2 1
> AddrParams set cluster_num_ $clusterNbr
> #Nbr of nodes in each cluster
> lappend eilastlevel 3 2 4 4 3
> AddrParams set nodes_num_ $eilastlevel
> 
> ######
> 
> #create trace objects for ns and nam
> $ns use-newtrace
> set nstrace [open $opt(tracefile) w]
> $ns trace-all $nstrace
> 
> set namtrace [open $opt(namfile) w]
> $ns namtrace-all-wireless $namtrace $opt(x) $opt(y)
> 
> 
> #create a topology object and define topology (500mx500m)
> set topo [new Topography]
> $topo load_flatgrid $opt(x) $opt(y)
> 
> #Choose method for gateway discovery
> if {$opt(gw_discovery) == "proactive"} {
> Agent/AODV set gw_discovery 0
> }
> if {$opt(gw_discovery) == "hybrid"} {
> Agent/AODV set gw_discovery 1
> }
> if {$opt(gw_discovery) == "reactive"} {
> Agent/AODV set gw_discovery 2
> }
> #create wired nodes
> set temp {2.0.0 2.0.1 2.0.2 2.0.3 2.1.4 2.1.5 2.1.6 2.1.7}
> for {set i 0} {$i < $opt(wiredNodes)} {incr i} {
> set host($i) [$ns node [lindex $temp $i]]
> }
> 
> #create God (General Operations Director)
> create-god [expr $opt(wirelessNodes)+$opt(gatewayNodes)]]
> 
> 
> #--------------------------------------
> #Configure for Gateway and Mobile Nodes
> #--------------------------------------
> #Use hierarchical addresses for GWs and MNs
> 
> #configure for mobile nodes and gateways
> $ns node-config -adhocRouting AODV
> $ns node-config -llType LL
> $ns node-config -macType Mac/802_11
> $ns node-config -ifqType Queue/DropTail/PriQueue
> $ns node-config -ifqLen 50
> $ns node-config -antType Antenna/OmniAntenna
> $ns node-config -propType Propagation/TwoRayGround
> $ns node-config -phyType Phy/WirelessPhy
> $ns node-config -topoInstance $topo
> $ns node-config -channel [new Channel/WirelessChannel]
> $ns node-config -agentTrace ON
> $ns node-config -routerTrace ON
> $ns node-config -macTrace ON
> $ns node-config -movementTrace OFF
> 
> #############3
> 
> #configure for gateways
> $ns node-config -wiredRouting ON
> #create gateway
> set gw(0) [$ns node 0.0.0]
> #set initial coordinates
> $gw(0) set X_ 100.0
> $gw(0) set Y_ 250.0
> $gw(0) set Z_ 0.0
> $ns at 0.00 "$gw(0) setdest 100 250 20"
> ########try
> set gw(1) [$ns node 1.0.0]
> #set initial coordinates
> $gw(1) set X_ 500.0
> $gw(1) set Y_ 250.0
> $gw(1) set Z_ 0.0
> $ns at 0.00 "$gw(1) setdest 500 250 20"
> 
> 
> #Define node initial position in nam
> 
> 
> 
> #configure for mobile nodes
> $ns node-config -wiredRouting OFF
> #create mobile nodes in the same domain as gw(0)
> set temp {0.0.1 0.0.2 0.1.0 0.1.1 1.0.1 1.0.2}
> for {set i 0} {$i < $opt(wirelessNodes)} {incr i} {
> set mobile($i) [$ns node [lindex $temp [expr $i]]]
> if {$i<4} {
> $mobile($i) base-station [AddrParams addr2id [$gw(0) node-addr]]
> } else {
> $mobile($i) base-station [AddrParams addr2id [$gw(1) node-addr]]
> }
> 
> }
> 
> $mobile(0) set X_ 10
> $mobile(0) set Y_ 200
> $mobile(0) set Z_ 0.0
> 
> $mobile(1) set X_ 60
> $mobile(1) set Y_ 320
> $mobile(1) set Z_ 0.0
> 
> $mobile(2) set X_ 50
> $mobile(2) set Y_ 250
> $mobile(2) set Z_ 0.0
> 
> $mobile(3) set X_ 100
> $mobile(3) set Y_ 100
> $mobile(3) set Z_ 0.0
> 
> $mobile(4) set X_ 500
> $mobile(4) set Y_ 150
> $mobile(4) set Z_ 0.0
> 
> $mobile(5) set X_ 600
> $mobile(5) set Y_ 250
> $mobile(5) set Z_ 0.0
> 
> #####################33
> 
> puts ""
> for {set i 0} {$i < $opt(wiredNodes) } {incr i} {
> puts "host$i = [$host($i) node-addr] = [AddrParams addr2id [$host($i)
> node-addr]]"
> }
> 
> puts "gw0 = [$gw(0) node-addr] = [AddrParams addr2id [$gw(0) node-addr]]"
> puts "gw1 = [$gw(1) node-addr] = [AddrParams addr2id [$gw(1) node-addr]]"
> 
> for {set i 0} {$i < $opt(wirelessNodes)} {incr i} {
> puts "mobile($i) = [$mobile($i) node-addr] = [AddrParams addr2id
> [$mobile($i) node-addr]]"
> }
> puts ""
> 
> $host(0) color blue
> $host(1) color blue
> $host(2) color blue
> $host(3) color blue
> $host(4) color blue
> $host(5) color blue
> $host(6) color blue
> $host(7) color blue
> 
> $gw(0) color red
> $gw(1) color red
> 
> for {set i 0} {$i < $opt(wiredNodes) } {incr i} {
> $ns at 0.0 "$host($i) label \"HOST $i\""
> }
> $ns at 0.0 "$gw(0) label GATEWAY"
> $ns at 0.0 "$gw(1) label GATEWAY"
> 
> for {set i 0} {$i < $opt(wirelessNodes)} {incr i} {
> $ns at 0.0 "$mobile($i) label \"MN $i\""
> }
> #################33
> 
> #create links between wired nodes and basestation node
> $ns duplex-link $gw(0) $host(0) 5Mb 2ms DropTail
> $ns duplex-link $host(1) $gw(0) 5Mb 2ms DropTail
> $ns duplex-link $host(0) $host(3) 5Mb 2ms DropTail
> $ns duplex-link $host(1) $host(4) 5Mb 2ms DropTail
> $ns duplex-link $host(1) $host(2) 5Mb 2ms DropTail
> $ns duplex-link $host(2) $host(5) 5Mb 2ms DropTail
> $ns duplex-link $host(3) $host(4) 5Mb 2ms DropTail
> $ns duplex-link $host(3) $host(6) 5Mb 2ms DropTail
> $ns duplex-link $host(4) $host(5) 5Mb 2ms DropTail
> $ns duplex-link $host(4) $host(6) 5Mb 2ms DropTail
> $ns duplex-link $host(4) $host(7) 5Mb 2ms DropTail
> $ns duplex-link $host(5) $host(7) 5Mb 2ms DropTail
> $ns duplex-link $host(6) $host(7) 5Mb 2ms DropTail
> $ns duplex-link $host(7) $gw(1) 5Mb 2ms DropTail
> $ns duplex-link $host(6) $gw(1) 5Mb 2ms DropTail
> 
> 
> #$ns duplex-link-op $host(0) $host(1) orient up
> #$ns duplex-link-op $host(1) $gw(0) orient right-up
> $ns duplex-link-op $gw(0) $host(0) orient right-up
> $ns duplex-link-op $host(1) $gw(0) orient left-up
> $ns duplex-link-op $host(0) $host(3) orient right
> $ns duplex-link-op $host(1) $host(4) orient right-up
> $ns duplex-link-op $host(1) $host(2) orient right-down
> $ns duplex-link-op $host(2) $host(5) orient right
> $ns duplex-link-op $host(3) $host(4) orient down
> $ns duplex-link-op $host(3) $host(6) orient right
> $ns duplex-link-op $host(4) $host(5) orient down
> $ns duplex-link-op $host(4) $host(6) orient right-up
> $ns duplex-link-op $host(4) $host(7) orient right
> $ns duplex-link-op $host(5) $host(7) orient right-up
> $ns duplex-link-op $host(6) $host(7) orient down
> $ns duplex-link-op $host(7) $gw(1) orient right
> $ns duplex-link-op $host(6) $gw(1) orient right
> 
> #---------------------
> #Setup Traffic
> #---------------------
> #MN5 ==> HOST0
> for {set i 0} {$i < 3} { incr i} {
> set src($i) [new Agent/UDP]
> set dst($i) [new Agent/Null]
> $src($i) set fid_ ($i)
> }
> $ns attach-agent $mobile(3) $src(0)
> $ns attach-agent $mobile(1) $src(1)
> $ns attach-agent $mobile(4) $src(2)
> 
> for {set i 0} {$i < 3} { incr i} {
> $ns connect $src($i) $dst($i)
> set cbr($i) [new Application/Traffic/CBR]
> $cbr($i) attach-agent $src($i)
> $cbr($i) set packetSize_ 512
> $cbr($i) set interval_ 0.2
> $ns at $val(start-src) "$cbr($i) start"
> $ns at $val(stop-src) "$cbr($i) stop"
> 
> }
> 
> 
> #$ns at $val(start-src) "$ns trace-annotate \"MN 5 ==> HOST 0 at
> t=$val(start-src) s!\""
> 
> #---------------------
> #Setup Node Movement
> #---------------------
> 
> 
> #-----------------------------------
> #Define Node Initial Position In Nam
> #-----------------------------------
> #20 defines the node size in nam, must adjust it according to your
> scenario
> #The function must be called after mobility model is defined
> for {set i 0} {$i < $opt(wirelessNodes)} {incr i} {
> $ns initial_node_pos $mobile($i) 20
> }
> 
> #-----------------------------------
> #Tell Nodes When The Simulation Ends
> #-----------------------------------
> for {set i 0} {$i < $opt(wirelessNodes)} {incr i} {
> $ns at $val(stop).0 "$mobile($i) reset"
> }
> $ns at $val(stop).0 "$gw(0) reset";
> $ns at $val(stop).0 "$gw(1) reset";
> $ns at $val(stop).0001 "stop"
> $ns at $val(stop).0002 "puts \"NS EXITING...\" ; $ns halt"
> 
> proc stop {} {
> global ns nstrace namtrace opt
> $ns flush-trace
> close $nstrace
> close $namtrace
> exec nam $opt(namfile) &
> exit 0
> }
> 
> puts "Starting simulation..."
> 
> $ns run
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
> Download Now! http://messenger.yahoo.com/download.php

 

 Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
Download Now! http://messenger.yahoo.com/download.php

Reply via email to