Hi all,
I was trying to simulate a multihop wireless network with a simple topology.
But it gives segmentation fault with AODV and DSR routing and works fine
with DSDV.
The script is simple and hence I am pasting the entire script. In short I
have 7 nodes (802.11 mac ) and 3 nodes send data to one particular node over
multiple hops.
I have the stack dump after the crash. But before going ahead and analyzing
it I would like to know if I am doing anything wrong here in the tcl file.

Any help would be highly appreciated.
Thanks



# ======================================================================
# 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/SMAC                 ;# 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)         10                         ;# max packet in ifq
set val(nn)             7                         ;# number of mobilenodes
set val(rp)             AODV                     ;# routing protocol

set dist(20m)            4.80696e-07
set dist(12m)            1.33527e-06

Phy/WirelessPhy set      CSThresh_ $dist(12m)
Phy/WirelessPhy set      RXThresh_ $dist(12m)

# ======================================================================
# Main Program
# ======================================================================


#
# Initialize Global Variables
#
set ns_        [new Simulator]
$ns_ color 1 Blue
$ns_ color 6 Red
$ns_ color 4 Green

$ns_ use-newtrace
set tracefd     [open xms.tr w]
$ns_ trace-all $tracefd

# set up topography object
set topo       [new Topography]

$topo load_flatgrid 500 500

#
# Create God
#
create-god $val(nn)

#
#  Create the specified number of mobilenodes [$val(nn)] and "attach" them
#  to the channel.
#  Here two nodes are created : node(0) and node(1)

# configure node

        $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 OFF

    for {set i 0} {$i < $val(nn) } {incr i} {
        set node_($i) [$ns_ node]
        $node_($i) random-motion 0        ;# disable random motion
    }

$node_(0) set X_ 20.0
    $node_(0) set Y_ 25.0
    $node_(0) set Z_ 0.0


    $node_(1) set X_ 10.0
    $node_(1) set Y_ 15.0
    $node_(1) set Z_ 0.0


    $node_(2) set X_ 20.0
    $node_(2) set Y_ 35.0
    $node_(2) set Z_ 0.0

    $node_(3) set X_ 20.0
    $node_(3) set Y_ 45.0
    $node_(3) set Z_ 0.0



    $node_(4) set X_ 30.0
    $node_(4) set Y_ 15.0
    $node_(4) set Z_ 0.0

    $node_(5) set X_ 20.0
    $node_(5) set Y_ 15.0
    $node_(5) set Z_ 0.0

    $node_(6) set X_ 20.0
    $node_(6) set Y_ 5.0
    $node_(6) set Z_ 0.0

# Setup node 1
set udp1 [new Agent/UDP]
$ns_ attach-agent $node_(1) $udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set rate_ .01Mb
$cbr1 attach-agent $udp1

# Setup node 6
set udp6 [new Agent/UDP]
$ns_ attach-agent $node_(6) $udp6
set cbr6 [new Application/Traffic/CBR]
$cbr6 set packetSize_ 500
$cbr6 set rate_ .01Mb
$cbr6 attach-agent $udp6


# Setup node 4
set udp4 [new Agent/UDP]
$ns_ attach-agent $node_(4) $udp4
set cbr4 [new Application/Traffic/CBR]
$cbr4 set packetSize_ 390
$cbr4 set rate_ .02Mb
$cbr4 attach-agent $udp4

#setup the sink on node 3
set null [new Agent/Null]
$ns_ attach-agent $node_(3) $null

#connect the nodes
$ns_ connect $udp1 $null
$ns_ connect $udp6 $null
$ns_ connect $udp4 $null

#For marking
$udp1 set fid_ 1
$udp6 set fid_ 6
$udp4 set fid_ 4



#$ns_ at 10.0 "$cbr1 start"
#$ns_ at 11.0 "$cbr6 start"
$ns_ at 12.0 "$cbr4 start"


#$ns_ at 20.0 "$cbr1 stop"
#$ns_ at 21.0 "$cbr6 stop"
$ns_ at 22.0 "$cbr4 stop"


#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at 30.0 "$node_($i) reset";
}
$ns_ at 30.0 "stop"
$ns_ at 30.01 "puts \"\" ; $ns_ halt"
proc stop {} {
    global ns_ tracefd
    $ns_ flush-trace
    close $tracefd
}

puts "Starting Simulation..."
$ns_ run




The  topology::

Reply via email to