Hi All...
I am running a simulation of ad hoc replication based on clustering ,using
AODV protocol , and every time I try to run the simulation I get a
segmentation fault.
is there any one who can tell me why this error happened and what is it ?
here is the TCL script:
# ======================================================================
# Define options
# ======================================================================
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/TwoRayGround ;# radio-propagation
model
set opt(netif) Phy/WirelessPhy ;# network interface type
set opt(mac) Mac/802_11 ;# MAC type
set opt(ifq) Queue/DropTail/PriQueue ;# interface queue type
set opt(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(ifqlen) 50 ;# max packet in ifq
set opt(nn) 14 ;# number of mobilenodes
set opt(adhocRouting) AODV ;# routing protocol
set opt(cp) "" ;# connection pattern
file
set opt(sc) "./scene-14-cluster" ;# node movement file.
set opt(x) 670 ;# x coordinate of topology
set opt(y) 670 ;# y coordinate of topology
set opt(seed) 0.0 ;# seed for random number
gen.
set opt(stop) 100 ;# time to stop simulation
#
============================================================================
# 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)
}
# create simulator instance
set ns_ [new Simulator]
# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 1 ;# number of domains
lappend cluster_num 3 ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 4 5 5 ;# number of nodes in each cluster
AddrParams set nodes_num_ $eilastlevel ;# of each domain
set tracefd [open cluster14-out.tr w]
set namtrace [open cluster14-out.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)
# Create topography object
set topo [new Topography]
# define topology
$topo load_flatgrid $opt(x) $opt(y)
# create God
create-god [expr $opt(nn)]
set channel1 [new $opt(chan)]
# configure for base-station node
$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channel $channel1 \
-topoInstance $topo \
-wiredRouting OFF \
-agentTrace ON \
-routerTrace ON \
-macTrace ON
#create base-station node
set temp {0.0.0 0.0.1 0.0.2 0.0.3 0.1.0 0.1.1 0.1.2 0.1.3 0.1.4 0.2.0 0.2.1
0.2.2 0.2.3 0.2.4}
;# hier address to be used for wireless
;# domain
# create mobilenodes in the same domain as BS(0)
# note the position and movement of mobilenodes is as defined
# in $opt(sc)
#configure for mobilenodes
$ns_ node-config -wiredRouting OFF
for {set j 0} {$j < $opt(nn)} {incr j} {
set node_($j) [ $ns_ node [lindex $temp $j]]
}
# Traffic
set ping_(0) [new Agent/Ping]
$ns_ attach-agent $node_(6) $ping_(0)
set ping_(1) [new Agent/Ping]
$ns_ attach-agent $node_(5) $ping_(1)
#Connect the two agents
$ns_ connect $ping_(0) $ping_(1)
#Schedule events
$ns_ at 5.0 "$ping_(0) send0"
$ns_ at 6.0 "finish"
# source connection-pattern and node-movement scripts
if { $opt(cp) == "" } {
puts "*** NOTE: no connection pattern specified."
set opt(cp) "none"
} else {
puts "Loading connection pattern..."
source $opt(cp)
}
if { $opt(sc) == "" } {
puts "*** NOTE: no scenario file specified."
set opt(sc) "none"
} else {
puts "Loading scenario file..."
source $opt(sc)
puts "Load complete..."
}
# Define initial node position in nam
for {set i 0} {$i < $opt(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your
# scenario
# The function must be called after mobility model is defined
$ns_ initial_node_pos $node_($i) 20
}
# Tell all nodes when the simulation ends
for {set i } {$i < $opt(nn) } {incr i} {
$ns_ at $opt(stop).0 "$node_($i) reset";
}
$ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at $opt(stop).0001 "stop"
proc stop {} {
global ns_ tracefd namtrace
$ns_ flush-trace
close $tracefd
close $namtrace
}
# informative headers for CMUTracefile #Disabled y Talal
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp \
$opt(adhocRouting)"
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
#added by Talal
proc stop {} {
global ns_ namtrace tracefd
$ns_ flush-trace
close $tracefd
close $namtrace
}
puts "Starting Simulation..."
$ns_ run
Thank you for your attention