Sunday, March 11, 2012

[ns] DSR routing problem!!

Dear Ns-Users,
I have a problem DSR and TORA routing protocol. After running Ns, it
returns this error, " Segmentation Fault (core dumped).
Could you please help me how I can recover it??

Thanks
This my tcl File..


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 ;

set val(ant) Antenna/OmniAntenna ;

set val(ifqlen) 50 ;

set val(nn) 3 ;

set val(rp) DSR ;

set val(x) 500 ;

set val(y) 400 ;

set val(startftp) 12 ;

set val(stop) 150 ;

set ns [new Simulator]

set tracefd [open Hw1tracefile.tr w]

set windowVsTime2 [open Hw1win.tr w]

set namtrace [open Hw1simwrls.nam w]

$ns trace-all $tracefd

$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topology

set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

# Create nn mobilmodes

#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 ON \

-movementTrace ON \

for {set i 0} {$i < $val(nn) } { incr i } {

set node_($i) [$ns node]

}

# Provide Initial location of Mobilenodes

$node_(0) set X_ 5.0

$node_(0) set Y_ 5.0

$node_(0) set Z_ 0.0

$node_(1) set X_ 490.0

$node_(1) set Y_ 285.0

$node_(1) set Z_ 0.0

$node_(2) set X_ 150.0

$node_(2) set Y_ 200.0

$node_(2) set Z_ 0.0

#Generation of Movement

$ns at 10.0 "$node_(0) setdest 250.0 250.0 3.0"

$ns at 15.0 "$node_(1) setdest 45.0 285.0 4.0"

$ns at 110.0 "$node_(0) setdest 480.0 300.0 5.5"

# Set a TCP connection betweeen 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 $val(startftp) "$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 [expr 10.1] "plotWindow $tcp $windowVsTime2"

#Define node initial position in nam

for {set i 0} {$i < $val(nn)} { incr i} {

# 30 Define the node size

$ns initial_node_pos $node_($i) 30

}

# 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 simulation

$ns at $val(stop) "$ns nam-end-wireless $val(stop)"

$ns at $val(stop) "stop"

$ns at 150.01 "puts \"Cogratulation ,End simulation\" ;

$ns halt"

proc stop {} {

global ns tracefd namtrace

$ns flush-trace

close $tracefd

close $namtrace

# exec nam simwrls.nam

# exec xgraph Hw1win.tr -geometry 800x400 -t " ROuting Protocol DSDV" -x "
Time" -y " Window Size"

}

$ns run

No comments:

Post a Comment

Counter

blogger analytics