Floating point exception (core dumped)

256 views
Skip to first unread message

srijan shakya

unread,
Jan 2, 2018, 10:24:04 AM1/2/18
to Network Simulator 2 (NS2)
I have no idea why this is popping out. Need help??

num_nodes is set 15
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
SORTING LISTS ...DONE!
Floating point exception (core dumped)


Mine code:
Mac/802_11 set dataRate_ !1Mb

set val(chan)    Channel/WirelessChannel        ;# channel type
set val(prop)    Propagation/TwoRayGround    ;# radio-propagation model
set val(ant)    Antenna/OmniAntenna        ;# Antenna type
set val(ll)    LL                ;# Link layer type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ifqlen) 50                ;# max packet in ifq
set val(netif)    Phy/WirelessPhy            ;# network interface type
set val(mac)    Mac/802_11            ;# MAC type
set val(nn)    15                ;# number of mobilenodes
set val(rp)    AODV                ;# routing protocol
set val(x)    800
set val(y)    800
# Creating simulator object
set ns [new Simulator]
# Creating Output trace files
set f [open complexdcf.tr w]
$ns trace-all $f
set namtrace [open complexdcf.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set f0 [open C_DDF_AT.tr w]

set topo [new Topography]
$topo load_flatgrid 800 800
# Defining Global Variables
create-god $val(nn)

set chan_1 [new $val(chan)]
# setting the wireless nodes paramenters
$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) \
            -topoInstance $topo \
            -agentTrace OFF \
            -routerTrace ON \
            -macTrace ON \
            -movementTrace OFF \
            -channel $chan_1 \

proc finish {} {
global ns f f0 namtrace# global variable
#closing the trace files
$ns flush-trace
    close $namtrace
close $f0
    exec nam -r 5m complexdcf.nam & # running the animator
exit 0
}
# Defining a procedure to calculate the throughpout
proc record {} {
    global sink1 sink3 sink7 sink10 sink11 f0

    set ns [Simulator instance]
    set time 0.5
    set bw0 [$sink3 set bytes_]
    set bw3 [$sink3 set bytes_]   
    set bw7 [$sink7 set bytes_]   
    set bw10 [$sink10 set bytes_]
    set bw11 [$sink11 set bytes_]

set now [$ns now]

puts $f0 "$now [expr ($bw0+$bw3+$bw7+$bw10+$bw11)/$time+8/1000000]"
#calculating the average throughput
$sink1 set bytes_ 0
$sink3 set bytes_ 0
$sink7 set bytes_ 0
$sink10 set bytes_ 0
$sink11 set bytes_ 0
$ns at [expr $now +$time] "record"
}

#creating the wireless Nodes

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

#setting the initial posotion for the nodes

for {set i 0} {$i < $val(nn)} {incr i} {
$ns initial_node_pos $node($i) 30+i*100
}
for {set i 0} {$i < $val(nn)} {incr i} {
$node($i) set X_ 0.0
$node($i) set Y_ 0.0
$node($i) set Z_ 0.0
}


# making some nodes move in the topography
$ns at 0.0 "$node(0) setdest 100.0 100.0 3000.0"
$ns at 0.0 "$node(1) setdest 200.0 200.0 3000.0"
$ns at 0.0 "$node(2) setdest 300.0 200.0 3000.0"
$ns at 0.0 "$node(3) setdest 400.0 300.0 3000.0"
$ns at 0.0 "$node(4) setdest 500.0 300.0 3000.0"
$ns at 0.0 "$node(5) setdest 600.0 400.0 3000.0"
$ns at 0.0 "$node(6) setdest 600.0 100.0 3000.0"
$ns at 0.0 "$node(7) setdest 600.0 200.0 3000.0"
$ns at 0.0 "$node(8) setdest 600.0 300.0 3000.0"
$ns at 0.0 "$node(9) setdest 600.0 350.0 3000.0"
$ns at 0.0 "$node(10) setdest 700.0 100.0 3000.0"
$ns at 0.0 "$node(11) setdest 700.0 200.0 3000.0"
$ns at 0.0 "$node(12) setdest 700.0 300.0 3000.0"
$ns at 0.0 "$node(13) setdest 700.0 350.0 3000.0"
$ns at 0.0 "$node(14) setdest 700.0 400.0 3000.0"
$ns at 2.0 "$node(5) setdest 100.0 400.0 500.0"
$ns at 1.5 "$node(3) setdest 450.0 150.0 500.0"
$ns at 50.0 "$node(7) setdest 300.0 400.0 500.0"
$ns at 2.0 "$node(10) setdest 200.0 400.0 500.0"
$ns at 2.0 "$node(11) setdest 650.0 400.0 500.0"


#Creating receiving sinks with monitoring ability to monitor the incoming bytes
set sink1 [new Agent/LossMonitor]
set sink3 [new Agent/LossMonitor]
set sink7 [new Agent/LossMonitor]
set sink10 [new Agent/LossMonitor]
set sink11 [new Agent/LossMonitor]
$ns attach-agent $node(1) $sink1
$ns attach-agent $node(3) $sink3
$ns attach-agent $node(7) $sink7
$ns attach-agent $node(10) $sink10


# setting TCP as the transmission protocol over the connections
set tcp0 [new Agent/TCP]
$ns attach-agent $node(0) $tcp0
set tcp2 [new Agent/TCP]
$ns attach-agent $node(2) $tcp2
set tcp4 [new Agent/TCP]
$ns attach-agent $node(4) $tcp4
set tcp5 [new Agent/TCP]
$ns attach-agent $node(5) $tcp5
set tcp9 [new Agent/TCP]
$ns attach-agent $node(9) $tcp9
set tcp13 [new Agent/TCP]
$ns attach-agent $node(13) $tcp13
set tcp6 [new Agent/TCP]
$ns attach-agent $node(6) $tcp6
set tcp14 [new Agent/TCP]
$ns attach-agent $node(14) $tcp14
set tcp8 [new Agent/TCP]
$ns attach-agent $node(8) $tcp8
set tcp12 [new Agent/TCP]
$ns attach-agent $node(12) $tcp12


# Setting FTP connections
set ftp9 [new Application/FTP]
$ftp9 attach-agent $tcp9
$ftp9 set type_ FTP
set ftp13 [new Application/FTP]
$ftp13 attach-agent $tcp13
$ftp13 set type_ FTP
set ftp6 [new Application/FTP]
$ftp6 attach-agent $tcp6
$ftp6 set type_ FTP
set ftp14 [new Application/FTP]
$ftp14 attach-agent $tcp14
$ftp14 set type_ FTP
set ftp8 [new Application/FTP]
$ftp8 attach-agent $tcp8
$ftp8 set type_ FTP
set ftp12 [new Application/FTP]
$ftp12 attach-agent $tcp12
$ftp12 set type_ FTP


#connecting the nodes
$ns connect $tcp0 $sink3
$ns connect $tcp5 $sink3
$ns connect $tcp2 $sink1
$ns connect $tcp4 $sink1
$ns connect $tcp9 $sink7
$ns connect $tcp13 $sink7
$ns connect $tcp6 $sink10
$ns connect $tcp14 $sink10
$ns connect $tcp8 $sink11
$ns connect $tcp12 $sink11



# Defining CBR procedure with the required parametes

proc attach-CBR-traffic { node sink size interval } {
set ns [Simulator instance]
set cbr [new Agent/CBR]
$ns attach-agent $node $cbr
$cbr set packetSize_ $size
$cbr set interval_ $interval
$ns connect $cbr $sink
return $cbr
}

set cbr0 [attach-CBR-traffic $node(0) $sink3 1000 .015]
set cbr1 [attach-CBR-traffic $node(5) $sink3 1000 .015]
set cbr2 [attach-CBR-traffic $node(2) $sink1 1000 .015]
set cbr3 [attach-CBR-traffic $node(4) $sink1 1000 .015]

# Setting the begining and ending time of each connection
$ns at 0.0    "record"
$ns at 20.0     "$cbr0 start"
$ns at 20.0     "$cbr2 start"
$ns at 800.0     "$cbr0 stop"
$ns at 850.0     "$cbr2 stop"
$ns at 30.0     "$cbr1 start"
$ns at 30.0     "$cbr3 start"
$ns at 850.0     "$cbr1 stop"
$ns at 870.0     "$cbr3 stop"


$ns at 25.0     "$ftp6 start"
$ns at 25.0     "$ftp14 start"
$ns at 810.0     "$ftp6 start"
$ns at 860.0     "$ftp14 start"
$ns at 35.0     "$ftp9 start"
$ns at 35.0     "$ftp13 start"
$ns at 830.0     "$ftp9 start"
$ns at 889.0     "$ftp13 start"
$ns at 40.0     "$ftp8 start"
$ns at 40.0     "$ftp12 start"
$ns at 820.0     "$ftp8 start"
$ns at 890.0     "$ftp12 start"
$ns at 900.0     "finish"


#Running the simulation
puts "Start of simulation.."
$ns run

knudfl

unread,
Jan 2, 2018, 11:13:58 AM1/2/18
to Network Simulator 2 (NS2)
Typo in line 1 :  The ``exclamation mark´´  ( ! )
Mac/802_11 set dataRate_ !1Mb
.... Edit to e.g.
Mac/802_11 set dataRate_ 11Mb

srijan shakya

unread,
Jan 2, 2018, 10:11:43 PM1/2/18
to Network Simulator 2 (NS2)
I changed it to 11 now I get this error

num_nodes is set 15
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
SORTING LISTS ...DONE!
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
    _o228: no target for slot 4294967295
    _o228 type: Classifier/Port
content dump:
classifier _o228
    0 offset
    0 shift
    -1 mask
    2 slots
        slot 0: _o353 (Agent/TCP)
        slot 255: _o230 (CMUTrace/Recv)
---------- Finished standard no-slot{} default handler ----------


What do you mean by this sort of error?

knudfl

unread,
Jan 3, 2018, 6:08:28 AM1/3/18
to Network Simulator 2 (NS2)
More typo´s in the simulation file :  Missing space, missing semicolon´s ( ; ).
Line 47 : global ns f f0 namtrace# global variable
Edit to
global ns f f0 namtrace         ;# global variable

Line 52 : exec nam -r 5m complexdcf.nam & # running the animator
Edit to

    exec nam -r 5m complexdcf.nam &   ;# running the animator


The  »» Classfier::no-slot{} default handler ««  error :
I don't known the actual cause of the error, but I know a couple of workarounds.
In this case using an old 32bits OS will fix the issue. Ubuntu 10.04 - i386 : No luck.
Ubuntu 7.04 - i386 :  OK  →
$ ns srijan-aodv-2.tcl
warning
: no class variable Phy/WirelessPhy::alive_
.
warning
: no class variable Phy/WirelessPhy::Efriss_amp_
warning
: no class variable Phy/WirelessPhy::Etwo_ray_amp_
warning
: no class variable Phy/WirelessPhy::EXcvr_
warning
: no class variable Phy/WirelessPhy::sleep_
warning
: no class variable Phy/WirelessPhy::ss_
warning
: no class variable Phy/WirelessPhy::dist_
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
.

Start of simulation..
SORTING LISTS
...DONE!

mac
/channel.cc: sendUp - Calc highestAntennaZ_ and distCST_
mac
/channel.cc: highestAntennaZ_ = 1.5,  distCST_ = 89.8

... The files C_DDF_AT.tr 15.6kB, complexdcf.nam 15.1MB, complexdcf.tr 37.3MB are created.
https://drive.google.com/file/d/1iZAuAscfc4ozG1cHMRkGKEaOOlYKzeOM/view?usp=sharing

You can also decide to ignore the "Classfier::no-slot{} default handler" error.
The created files have enough content to show some data. Example :
$ awk -f tess-Packets.awk complexdcf.tr
   
// The output file, "Packets-arrival-time.txt" shows :
25.055831852   0.0024274
25.066369219   0.0129648
25.097735003   0.0405517
25.099083058   0.0418997
28.002714851   0.00271485
28.004448084   0.00444808
28.005905917   0.00590592
28.007214716   0.00721472
35.069054253   0.0121119
38.005115180   0.00511518
40.001595007   0.00159501
... And the NAM animation also works OK.

srijan shakya

unread,
Jan 3, 2018, 7:33:00 AM1/3/18
to ns-u...@googlegroups.com
I am still getting the same problem. Is it because of the OS version that I am currently using i.e.(Ubuntu 16.04 64 bit)

--
You received this message because you are subscribed to a topic in the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-users/MfbhKVLQn9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.

knudfl

unread,
Jan 3, 2018, 12:34:41 PM1/3/18
to Network Simulator 2 (NS2)
@srijan shakya.

A lot of the ns2 code is ancient.  Several protocols / simulations will require an oldish OS.
Fortunately your file also works OK with a supported 64bit OS:  CentOS 6.9 - x86_64
→  http://ftp.funet.fi/pub/mirrors/centos.org/6.9/isos/x86_64/CentOS-6.9-x86_64-LiveDVD.iso
.... My CentOS result was equal to the Ubuntu 7 result. Same file size of the trace files:
C_DDF_AT.tr 15.6kB, complexdcf.nam 15.1MB, complexdcf.tr 37.3MB.

It's fairly easy to install some more Linux OS´s :
Install 'VirtualBox' in Windows©  ( or in Ubuntu ), and install 'CentOS 6.9' into VirtualBox.
To unsubscribe from this group and all its topics, send an email to ns-users+u...@googlegroups.com.

knudfl

unread,
Jan 4, 2018, 6:56:19 AM1/4/18
to Network Simulator 2 (NS2)
Sorry, CentOS 6.9 - 64 has got an update of libc, so it's no more usable for your file.
Obviously, my executable 'ns' is a few months old. Is before the latest update.
To unsubscribe from this group and all its topics, send an email to ns-users+u...@googlegroups.com.

srijan shakya

unread,
Jan 4, 2018, 6:58:00 AM1/4/18
to ns-u...@googlegroups.com
Should  i change my code or what ?

To unsubscribe from this group and all its topics, send an email to ns-users+unsubscribe@googlegroups.com.

knudfl

unread,
Jan 4, 2018, 7:40:39 AM1/4/18
to Network Simulator 2 (NS2)
@srijan shakya

»»Should  i change my code «« :  If you can → make it less complex.

In the meantime I have tried to find an OS which can create a usable executable 'ns' that will work with your Ubuntu 16.04 - 64. Long way to go : I still have a few old OS to investigate. From the ~100 OS´s, I installed years ago.

srijan shakya

unread,
Jan 4, 2018, 7:42:14 AM1/4/18
to ns-u...@googlegroups.com
Thank you for the suggestion.

To unsubscribe from this group and all its topics, send an email to ns-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages