[ns] Urgent Help Needed with running AODV on NS-2.34
kdcorp
khalidstudy at hotmail.com
Fri Jan 28 09:42:59 PST 2011
salam,
ok, looking at your configuration file, we can see that you forgot to give
the other nodes positions.
look at this section :
for {set i 0} {$i < $val(nn) } { incr i } {
set node_($i) [$ns node]
$node_($i) random-motion 0; # disable random motion
}
# Provide initial location of mobilenodes
#$node_(0) set X_ 10.0
#$node_(0) set Y_ 15.0
$node_(0) set Z_ 0.0
#$node_(1) set X_ 20.0
#$node_(1) set Y_ 25.0
#$node_(1) set Z_ 0.0
#$node_(2) set X_ 200.0
#$node_(2) set Y_ 225.0
#$node_(2) set Z_ 0.0
You created 50 nodes but only 3 of them have there positions. you need to
configure the other's positions. I suggest that you test this for only 10
nodes. "set val(nn) 10" and, if it works, expande to the nuber of nodes
desired.
i hope this will be useful
Anoop thesis wrote:
>
>
> Hi Fellow ns2 users,
>
> I am pretty new to NS2 and need to learn it for my Thesis.
>
> I am trying to simulate AODV in ns2.34. It worked fine for a 3 node
> example
> where I could simply give the node positions and work it out.
>
> However, i am now trying to modify the 50 node example ( wireless.tcl) for
> a
> AODV scenario.
>
> The following are the changes I have implemented in the 3-node example. I
> may have made some basic mistakes. But please help me out.
>
> I have already created the scenario using the cmu generator setdest and
> cbrgen.
>
>
> Modified Example for 50 node AODV:
>
> # 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) 50 ;# number of
> mobilenodes
> set val(rp) AODV ;# routing protocol
> set val(x) 1200 ;# X dimension of
> topography
> set val(y) 800 ;# Y dimension of
> topography
> set opt(cp) "../home/anoop/ns2/ns-
> allinone-2.34/ns-2.34/indep-utils/cmu-scen-gen/b.out"
> set opt(sc)
> "../home/anoop/ns2/ns-allinone-2.34/ns-2.34/indep-utils/cmu-scen-gen/setdest/mov.out"
> set val(stop) 600 ;# time of simulation
> end
>
> set ns [new Simulator]
> set tracefd [open aodv_50.tr w]
> set windowVsTime2 [open win_aodv.tr w]
> set namtrace [open simwrls_aodv.nam w]
>
> $ns trace-all $tracefd
> $ns namtrace-all-wireless $namtrace $val(x) $val(y)
> # set up topography object
> set topo [new Topography]
>
> $topo load_flatgrid $val(x) $val(y)
>
> create-god $val(nn)
>
>
> # Create nn mobilenodes [$val(nn)] and attach them to the channel.
>
>
> # configure the 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) \
> -channelType $val(chan) \
> -topoInstance $topo \
> -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
> }
>
> # Provide initial location of mobilenodes
> #$node_(0) set X_ 10.0
> #$node_(0) set Y_ 15.0
>
> $node_(0) set Z_ 0.0
>
> #$node_(1) set X_ 20.0
> #$node_(1) set Y_ 25.0
> #$node_(1) set Z_ 0.0
>
> #$node_(2) set X_ 200.0
> #$node_(2) set Y_ 225.0
> #$node_(2) set Z_ 0.0
>
> # Generation of movements
> #$ns at 10.0 "$node_(0) setdest 10.0 5.0 3.0"
> #$ns at 15.0 "$node_(1) setdest 45.0 14.0 5.0"
> #$ns at 110.0 "$node_(0) setdest 48.0 5.0 5.0"
>
> # Set a TCP connection between node_(0) and node_(1)
> #set tcp [new Agent/TCP/Newreno]
> #$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"
>
> # Printing the window size
> #proc plotWindow {tcpSource file} {
> global ns
> set time 0.01
> set now [$ns now]
> #set cwnd [$tcpSource set cwnd_]
> #puts $file "$now $cwnd"
> #$ns at [expr $now+$time] "plotWindow $tcpSource $file" }
> #$ns at 10.1 "plotWindow $tcp $windowVsTime2"
>
> # Define node initial position in nam
> for {set i 0} {$i < $val(nn)} { incr i } {
> # 30 defines the node size for nam
> $ns initial_node_pos $node_($i)
> }
>
> # Telling nodes when the simulation ends
> for {set i 0} {$i < $val(nn) } { incr i } {
> $ns at $val(stop) "$node_($i) reset";
> }
>
> # ending nam and the simulation
> $ns at $val(stop) "$ns nam-end-wireless $val(stop)"
> $ns at $val(stop) "stop"
> $ns at 600.01 "puts \"end simulation\" ; $ns halt"
> proc stop {} {
> global ns tracefd namtrace
> $ns flush-trace
> close $tracefd
> close $namtrace
> }
>
> $ns run
>
>
>
> Thanks in advance
>
> Anoop
>
>
--
View this message in context: http://old.nabble.com/Urgent-Help-Needed-with-running-AODV-on-NS-2.34-tp30774273p30789175.html
Sent from the ns-users mailing list archive at Nabble.com.
More information about the Ns-users
mailing list