Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi everyone
i got the problem when i run tcl as Segmentation fault (core dumped), if i add energy, it working
anyone can help me?
Quote:
#
# 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) 25 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(stop) 100 ;# time of simulation end
;
set ns [new Simulator]
set tracefd [open ex-1_without-energy.tr w]
set windowVsTime2 [open win.tr w]
set namtrace [open ex-1_without-energy.nam w]
# 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 ON
# Menginisialisasi node
set node_(0) [$ns node]
set node_(1) [$ns node]
set node_(2) [$ns node]
set node_(3) [$ns node]
set node_(4) [$ns node]
set node_(5) [$ns node]
set node_(6) [$ns node]
set node_(7) [$ns node]
set node_(8) [$ns node]
set node_(9) [$ns node]
set node_(10) [$ns node]
set node_(11) [$ns node]
set node_(12) [$ns node]
set node_(13) [$ns node]
set node_(14) [$ns node]
set node_(15) [$ns node]
set node_(16) [$ns node]
set node_(17) [$ns node]
set node_(18) [$ns node]
set node_(19) [$ns node]
set node_(20) [$ns node]
set node_(21) [$ns node]
set node_(22) [$ns node]
set node_(23) [$ns node]
set node_(24) [$ns node]
# provide inisialisasi koordinat node
# node 0
$node_(0) set X_ 0.0
$node_(0) set Y_ 0.0
$node_(0) set Z_ 0.0
#node 1
$node_(1) set X_ 100.0
$node_(1) set Y_ 0.0
$node_(1) set Z_ 0.0
#node 2
$node_(2) set X_ 200.0
$node_(2) set Y_ 0.0
$node_(2) set Z_ 0.0
#node 3
$node_(3) set X_ 300.0
$node_(3) set Y_ 0.0
$node_(3) set Z_ 0.0
#node 4
$node_(4) set X_ 400.0
$node_(4) set Y_ 0.0
$node_(4) set Z_ 0.0
#node 5
$node_(5) set X_ 0.0
$node_(5) set Y_ 100.0
$node_(5) set Z_ 0.0
# node 6
$node_(6) set X_ 100.0
$node_(6) set Y_ 100.0
$node_(6) set Z_ 0.0
#node 7
$node_(7) set X_ 200.0
$node_(7) set Y_ 100.0
$node_(7) set Z_ 0.0
#node 8
$node_(8) set X_ 300.0
$node_(8) set Y_ 100.0
$node_(8) set Z_ 0.0
#node 9
$node_(9) set X_ 400.0
$node_(9) set Y_ 100.0
$node_(9) set Z_ 0.0
#node 10
$node_(10) set X_ 0.0
$node_(10) set Y_ 200.0
$node_(10) set Z_ 0.0
#node 11
$node_(11) set X_ 100.0
$node_(11) set Y_ 200.0
$node_(11) set Z_ 0.0
# node 12
$node_(12) set X_ 200.0
$node_(12) set Y_ 200.0
$node_(12) set Z_ 0.0
#node 13
$node_(13) set X_ 300.0
$node_(13) set Y_ 200.0
$node_(13) set Z_ 0.0
#node 14
$node_(14) set X_ 400.0
$node_(14) set Y_ 200.0
$node_(14) set Z_ 0.0
#node 15
$node_(15) set X_ 0.0
$node_(15) set Y_ 300.0
$node_(15) set Z_ 0.0
#node 16
$node_(16) set X_ 100.0
$node_(16) set Y_ 300.0
$node_(16) set Z_ 0.0
#node 17
$node_(17) set X_ 200.0
$node_(17) set Y_ 300.0
$node_(17) set Z_ 0.0
# node 18
$node_(18) set X_ 300.0
$node_(18) set Y_ 300.0
$node_(18) set Z_ 0.0
#node 19
$node_(19) set X_ 400.0
$node_(19) set Y_ 300.0
$node_(19) set Z_ 0.0
#node 20
$node_(20) set X_ 0.0
$node_(20) set Y_ 400.0
$node_(20) set Z_ 0.0
#node 21
$node_(21) set X_ 100.0
$node_(21) set Y_ 400.0
$node_(21) set Z_ 0.0
#node 22
$node_(22) set X_ 200.0
$node_(22) set Y_ 400.0
$node_(22) set Z_ 0.0
#node 23
$node_(23) set X_ 300.0
$node_(23) set Y_ 400.0
$node_(23) set Z_ 0.0
#node 24
$node_(24) set X_ 400.0
$node_(24) set Y_ 400.0
$node_(24) set Z_ 0.0
# Set a TCP connection between node_(2) and node_(8)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $node_(4) $tcp
$ns attach-agent $node_(20) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 10.0 "$ftp start"
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_(24) $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) 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 the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at 150 "puts "end simulation" ; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam ex-1_without-energy.nam &
}
Your English is unclear, but let me try.
You are getting a segmentation fault and a dumped core when you run that tcl code - is that correct?
You also write:"if i add energy, it working."
Is this a laptop? Do you get a segmentation fault on battery, but it works with a power supply? Replace the battery.
Otherwise, a segmentation fault is a memory error, and tcl is established a long time. Tcl or your code are hardly the problem. I would reinstall tcl, check the disks, and run memtest86 on the memory.
Segmentation fault is a memory error, and it is typically a fault in your program.
Since the system says a core file was output, one can analyze that core file using debug utilities.
I'm familiar with how to do this using GDB and for a C or C++ program, but not for tcl. However for these NS2 simulations, I understand that there are C++ utilities which are used as part of the simulation. In order to debug this the way I know how, you'd need the source code and to compile it using the -ggdb flag.
Another way to debug this is similar to what you are doing, varying the content or input files you are using.
Perhaps as opposed to showing the whole script and summarizing what you've tried, you can indicate the exact position in the script where you modify it to use energy versus not, and show the syntax which works and which doesn't. That may give some people a clue as to how to better advise you.
Segmentation fault is a memory error, and it is typically a fault in your program.
Since the system says a core file was output, one can analyze that core file using debug utilities.
I'm familiar with how to do this using GDB and for a C or C++ program, but not for tcl. However for these NS2 simulations, I understand that there are C++ utilities which are used as part of the simulation. In order to debug this the way I know how, you'd need the source code and to compile it using the -ggdb flag.
Another way to debug this is similar to what you are doing, varying the content or input files you are using.
Perhaps as opposed to showing the whole script and summarizing what you've tried, you can indicate the exact position in the script where you modify it to use energy versus not, and show the syntax which works and which doesn't. That may give some people a clue as to how to better advise you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.