Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
hello, I have problem,when I add more than 2 nodes as a source, I got segmentation fault, please help, I don't know why I got the problem, is it the routing protocol / queue / or anything?
Code:
#===================================
# Simulation parameters setup
#===================================
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/RED ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 20 ;# max packet in ifq
set val(nn) 40 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 1000 ;# X dimension of topography
set val(y) 1000 ;# Y dimension of topography
set val(stop) 20 ;# time of simulation end
set val(energymodel) EnergyModel ;# type of energy
set val(initialenergy) 100 ;# Initial energy in Joules
set val(rxPower) 0.00175 ;# reception power in Joules
set val(txPower) 0.00175 ;# transmition power in Joules
#Phy/WirelessPhy set CSThresh_ 1.20174e-13 ;# 100m sensing range
#Phy/WirelessPhy set RXThresh_ 4.4613e-10 ;# 250m transmition range
#===================================
# Initialization
#===================================
#Create a ns simulator
set ns [new Simulator]
#Define color in NAM
#$ns color 1 Blue
#$ns color 2 Red
#$ns color 3 Black
#$ns color 4 Blue
#$ns color 5 Red
#$ns color 6 Black
#$ns color 7 Blue
#$ns color 8 Red
#$ns color 9 Black
#$ns color 10 Blue
#$ns color 11 Red
#$ns color 12 Black
#$ns color 13 Blue
#$ns color 14 Red
#$ns color 15 Black
#Setup topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
#Open the NS trace file
set tracefile [open Scenario-1-RED-20.tr w]
$ns trace-all $tracefile
#Open the NAM trace file
set namfile [open Scenario-1-RED-20.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel
#===================================
# Mobile node parameter setup
#===================================
$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) \
-channel $chan \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON
#===================================
# Nodes Definition
#===================================
#Create 40 nodes
set n0 [$ns node]
$n0 set X_ 37
$n0 set Y_ 36
$n0 set Z_ 0.0
$ns initial_node_pos $n0 20
set n1 [$ns node]
$n1 set X_ 30
$n1 set Y_ 263
$n1 set Z_ 0.0
$ns initial_node_pos $n1 20
set n2 [$ns node]
$n2 set X_ 103
$n2 set Y_ 161
$n2 set Z_ 0.0
$ns initial_node_pos $n2 20
set n3 [$ns node]
$n3 set X_ 177
$n3 set Y_ 196
$n3 set Z_ 0.0
$ns initial_node_pos $n3 20
set n4 [$ns node]
$n4 set X_ 248
$n4 set Y_ 241
$n4 set Z_ 0.0
$ns initial_node_pos $n4 20
set n5 [$ns node]
$n5 set X_ 240
$n5 set Y_ 30
$n5 set Z_ 0.0
$ns initial_node_pos $n5 20
set n6 [$ns node]
$n6 set X_ 146
$n6 set Y_ 355
$n6 set Z_ 0.0
$ns initial_node_pos $n6 20
set n7 [$ns node]
$n7 set X_ 295
$n7 set Y_ 449
$n7 set Z_ 0.0
$ns initial_node_pos $n7 20
set n8 [$ns node]
$n8 set X_ 116
$n8 set Y_ 503
$n8 set Z_ 0.0
$ns initial_node_pos $n8 20
set n9 [$ns node]
$n9 set X_ 80
$n9 set Y_ 922
$n9 set Z_ 0.0
$ns initial_node_pos $n9 20
set n10 [$ns node]
$n10 set X_ 260
$n10 set Y_ 970
$n10 set Z_ 0.0
$ns initial_node_pos $n10 20
set n11 [$ns node]
$n11 set X_ 206
$n11 set Y_ 853
$n11 set Z_ 0.0
$ns initial_node_pos $n11 20
set n12 [$ns node]
$n12 set X_ 61
$n12 set Y_ 837
$n12 set Z_ 0.0
$ns initial_node_pos $n12 20
set n13 [$ns node]
$n13 set X_ 172
$n13 set Y_ 798
$n13 set Z_ 0.0
$ns initial_node_pos $n13 20
set n14 [$ns node]
$n14 set X_ 850
$n14 set Y_ 41
$n14 set Z_ 0.0
$ns initial_node_pos $n14 20
set n15 [$ns node]
$n15 set X_ 956
$n15 set Y_ 128
$n15 set Z_ 0.0
$ns initial_node_pos $n15 20
set n16 [$ns node]
$n16 set X_ 767
$n16 set Y_ 78
$n16 set Z_ 0.0
$ns initial_node_pos $n16 20
set n17 [$ns node]
$n17 set X_ 914
$n17 set Y_ 187
$n17 set Z_ 0.0
$ns initial_node_pos $n17 20
set n18 [$ns node]
$n18 set X_ 800
$n18 set Y_ 259
$n18 set Z_ 0.0
$ns initial_node_pos $n18 20
set n19 [$ns node]
$n19 set X_ 943
$n19 set Y_ 936
$n19 set Z_ 0.0
$ns initial_node_pos $n19 20
set n20 [$ns node]
$n20 set X_ 785
$n20 set Y_ 983
$n20 set Z_ 0.0
$ns initial_node_pos $n20 20
set n21 [$ns node]
$n21 set X_ 882
$n21 set Y_ 880
$n21 set Z_ 0.0
$ns initial_node_pos $n21 20
set n22 [$ns node]
$n22 set X_ 967
$n22 set Y_ 805
$n22 set Z_ 0.0
$ns initial_node_pos $n22 20
set n23 [$ns node]
$n23 set X_ 810
$n23 set Y_ 804
$n23 set Z_ 0.0
$ns initial_node_pos $n23 20
set n24 [$ns node]
$n24 set X_ 523
$n24 set Y_ 503
$n24 set Z_ 0.0
$ns initial_node_pos $n24 20
set n25 [$ns node]
$n25 set X_ 850
$n25 set Y_ 420
$n25 set Z_ 0.0
$ns initial_node_pos $n25 20
set n26 [$ns node]
$n26 set X_ 748
$n26 set Y_ 506
$n26 set Z_ 0.0
$ns initial_node_pos $n26 20
set n27 [$ns node]
$n27 set X_ 836
$n27 set Y_ 588
$n27 set Z_ 0.0
$ns initial_node_pos $n27 20
set n28 [$ns node]
$n28 set X_ 703
$n28 set Y_ 665
$n28 set Z_ 0.0
$ns initial_node_pos $n28 20
set n29 [$ns node]
$n29 set X_ 642
$n29 set Y_ 807
$n29 set Z_ 0.0
$ns initial_node_pos $n29 20
set n30 [$ns node]
$n30 set X_ 536
$n30 set Y_ 906
$n30 set Z_ 0.0
$ns initial_node_pos $n30 20
set n31 [$ns node]
$n31 set X_ 415
$n31 set Y_ 912
$n31 set Z_ 0.0
$ns initial_node_pos $n31 20
set n32 [$ns node]
$n32 set X_ 398
$n32 set Y_ 760
$n32 set Z_ 0.0
$ns initial_node_pos $n32 20
set n33 [$ns node]
$n33 set X_ 315
$n33 set Y_ 594
$n33 set Z_ 0.0
$ns initial_node_pos $n33 20
set n34 [$ns node]
$n34 set X_ 113
$n34 set Y_ 632
$n34 set Z_ 0.0
$ns initial_node_pos $n34 20
set n35 [$ns node]
$n35 set X_ 367
$n35 set Y_ 188
$n35 set Z_ 0.0
$ns initial_node_pos $n35 20
set n36 [$ns node]
$n36 set X_ 505
$n36 set Y_ 58
$n36 set Z_ 0.0
$ns initial_node_pos $n36 20
set n37 [$ns node]
$n37 set X_ 674
$n37 set Y_ 184
$n37 set Z_ 0.0
$ns initial_node_pos $n37 20
set n38 [$ns node]
$n38 set X_ 670
$n38 set Y_ 335
$n38 set Z_ 0.0
$ns initial_node_pos $n38 20
set n39 [$ns node]
$n39 set X_ 496
$n39 set Y_ 302
$n39 set Z_ 0.0
$ns initial_node_pos $n39 20
#===================================
# Agents Definition
#===================================
set udp0 [new Agent/UDP]
$udp0 set fid_ 2
$ns attach-agent $n9 $udp0
set udp1 [new Agent/UDP]
$udp1 set fid_ 2
$ns attach-agent $n12 $udp1
#set udp12 [new Agent/UDP]
#$udp12 set fid_ 12
#$ns attach-agent $n16 $udp11
set null0 [new Agent/Null]
$ns attach-agent $n24 $null0
$ns connect $udp0 $null0
$ns connect $udp1 $null0
$ns connect $udp12 $null0
#===================================
# Applications Definition
#===================================
#Setup a cbr Application over udp connection
set cbr0 [new Application/Traffic/CBR]
$cbr0 set interval_ 0.05
$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 128
$ns at 1.0 "$cbr0 start"
$ns at 20.0 "$cbr0 stop"
#Setup a cbr Application over udp connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set interval_ 0.05
$cbr1 set packetSize_ 128
$ns at 1.0 "$cbr1 start"
$ns at 20.0 "$cbr1 stop"
#Setup a cbr Application over udp connection
set cbr12 [new Application/Traffic/CBR]
$cbr12 attach-agent $udp12
$cbr12 set interval_ 0.05
$cbr12 set packetSize_ 128
$ns at 10.0 "$cbr12 start"
$ns at 20.0 "$cbr12 stop"
#===================================
# Termination
#===================================
#Define a 'finish' procedure
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam Scenario-1-RED-20.nam &
exit 0
}
#for {set i 0} {$i < $val(nn) } { incr i } {
#$ns at $val(stop) "\$n$i reset"
#}
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "finish"
$ns at $val(stop) "puts \"done\" ; $ns halt"
$ns run
Code:
root$door:~$ ns235-mannasim Network-Topology-Test.tcl
num_nodes is set 40
INITIALIZE THE LIST xListHead
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
Segmentation fault (core dumped)
About your file Network-Topology-Test.tcl :
$ ns235-mannasim Network-Topology-Test-1.tcl
... is creating Scenario-1-RED-20.nam 2.3MB, Scenario-1-RED-20.tr 1.3MB .
$ nam Scenario-1-RED-20.nam & : Seems to be an OK animation.
Conclusion : The 'Segmentation fault' happens at the simulation end? and can be ignored.
-
About your file Network-Topology-Test.tcl :
$ ns235-mannasim Network-Topology-Test-1.tcl
... is creating Scenario-1-RED-20.nam 2.3MB, Scenario-1-RED-20.tr 1.3MB .
$ nam Scenario-1-RED-20.nam & : Seems to be an OK animation.
Conclusion : The 'Segmentation fault' happens at the simulation end? and can be ignored.
-
so does it mean the results from the tcl are not broken because of segmentation fault?
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Re #7. Please do not quote entire posts. A "one word reference" will do.
In post #1 you show code.tcl, which isn't working unless edited.
The same for post #7 :
cbr5 ....... cbr15 are not set : #set cbr15 [new Application/Traffic/CBR]
.. etc. etc. error.
sorry about that, I copied the wrong one and yes I did remove the #, and it does run without any problem, but when I changed the val(ifq) from DropTail/PriQueue to RED or CoDel, the "segmentation fault" occured
I still don't understand, I red several papers, they could even run more complex simulation than mine using ns2 without having any problem, strange I ran on 64 bit 14.04 ubuntu, could the environment is the problem?
Re #11
my main focuses are CoDel and RED, so no, I didn't read CoDelDT examples
==================================
I did several changes with more simple, it seems CoDel works okay, but I still got segmentation fault when I changed the queue variable to RED
Code:
# This script is created by NSG2 beta1
# <http://wushoupong.googlepages.com/nsg>
#===================================
# Simulation parameters setup
#===================================
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/CoDel ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 30 ;# max packet in ifq
set val(nn) 9 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 2710 ;# X dimension of topography
set val(y) 100 ;# Y dimension of topography
set val(stop) 20.0 ;# time of simulation end
#===================================
# Initialization
#===================================
#Create a ns simulator
set ns [new Simulator]
#Setup topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
#Open the NS trace file
set tracefile [open Final.tr w]
$ns trace-all $tracefile
#Open the NAM trace file
set namfile [open Final.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel
#===================================
# Mobile node parameter setup
#===================================
$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) \
-channel $chan \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON
#===================================
# Nodes Definition
#===================================
#Create 9 nodes
set n0 [$ns node]
$n0 set X_ 1598
$n0 set Y_ 1093
$n0 set Z_ 0.0
$ns initial_node_pos $n0 20
set n1 [$ns node]
$n1 set X_ 1350
$n1 set Y_ 1097
$n1 set Z_ 0.0
$ns initial_node_pos $n1 20
set n2 [$ns node]
$n2 set X_ 1845
$n2 set Y_ 1095
$n2 set Z_ 0.0
$ns initial_node_pos $n2 20
set n3 [$ns node]
$n3 set X_ 1241
$n3 set Y_ 1320
$n3 set Z_ 0.0
$ns initial_node_pos $n3 20
set n4 [$ns node]
$n4 set X_ 1110
$n4 set Y_ 1088
$n4 set Z_ 0.0
$ns initial_node_pos $n4 20
set n5 [$ns node]
$n5 set X_ 1272
$n5 set Y_ 861
$n5 set Z_ 0.0
$ns initial_node_pos $n5 20
set n6 [$ns node]
$n6 set X_ 1930
$n6 set Y_ 1322
$n6 set Z_ 0.0
$ns initial_node_pos $n6 20
set n7 [$ns node]
$n7 set X_ 2088
$n7 set Y_ 1077
$n7 set Z_ 0.0
$ns initial_node_pos $n7 20
set n8 [$ns node]
$n8 set X_ 1927
$n8 set Y_ 862
$n8 set Z_ 0.0
$ns initial_node_pos $n8 20
#===================================
# Agents Definition
#===================================
#Setup a UDP connection
set udp0 [new Agent/UDP]
$ns attach-agent $n3 $udp0
$udp0 set packetSize_ 512
set udp1 [new Agent/UDP]
$ns attach-agent $n4 $udp1
$udp1 set packetSize_ 512
set udp2 [new Agent/UDP]
$ns attach-agent $n5 $udp2
$udp2 set packetSize_ 512
set udp3 [new Agent/UDP]
$ns attach-agent $n6 $udp3
$udp3 set packetSize_ 512
set udp4 [new Agent/UDP]
$ns attach-agent $n7 $udp4
$udp4 set packetSize_ 512
set udp5 [new Agent/UDP]
$ns attach-agent $n8 $udp5
$udp5 set packetSize_ 512
set null6 [new Agent/Null]
$ns attach-agent $n0 $null6
$ns connect $udp0 $null6
$ns connect $udp1 $null6
$ns connect $udp2 $null6
$ns connect $udp3 $null6
$ns connect $udp4 $null6
$ns connect $udp5 $null6
#===================================
# Applications Definition
#===================================
#Setup a CBR Application over UDP connection
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 128
$cbr0 set rate_ 1.0Mb
$cbr0 set random_ null
$ns at 1.0 "$cbr0 start"
$ns at 8.0 "$cbr0 stop"
#Setup a CBR Application over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packetSize_ 128
$cbr1 set rate_ 1.0Mb
$cbr1 set random_ null
$ns at 1.0 "$cbr1 start"
$ns at 8.0 "$cbr1 stop"
#Setup a CBR Application over UDP connection
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set packetSize_ 128
$cbr2 set rate_ 1.0Mb
$cbr2 set random_ null
$ns at 1.0 "$cbr2 start"
$ns at 8.0 "$cbr2 stop"
#Setup a CBR Application over UDP connection
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set packetSize_ 128
$cbr3 set rate_ 1.0Mb
$cbr3 set random_ null
$ns at 1.0 "$cbr3 start"
$ns at 8.0 "$cbr3 stop"
#Setup a CBR Application over UDP connection
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set packetSize_ 128
$cbr4 set rate_ 1.0Mb
$cbr4 set random_ null
$ns at 1.0 "$cbr4 start"
$ns at 8.0 "$cbr4 stop"
#Setup a CBR Application over UDP connection
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set packetSize_ 128
$cbr5 set rate_ 1.0Mb
$cbr5 set random_ null
$ns at 1.0 "$cbr5 start"
$ns at 8.0 "$cbr5 stop"
#===================================
# Termination
#===================================
#Define a 'finish' procedure
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam Final.nam &
exit 0
}
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "\$n$i reset"
}
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "finish"
$ns at $val(stop) "puts \"done\" ; $ns halt"
$ns run
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.