LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   floating point exception error (core dumped) (https://www.linuxquestions.org/questions/linux-newbie-8/floating-point-exception-error-core-dumped-4175598321/)

baig7070 01-26-2017 03:25 PM

floating point exception error (core dumped)
 
This code was written with the intent to connect the mobile nodes(data collectors) with static nodes in a 2x4 grid.Now in this code, the value isn't divided by any zero value but still producing core dumped error.




set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 50
set val(ifq) Queue/DropTail/PriQueue
set val(mac) Mac/802_11
set val(ll) LL
set val(rp) DSDV
set val(nn) 40
set val(mn) 8
set val(x) 1000
set val(y) 1000
set val(stop) 150
set num_row 4
#Define ns/nam standard trace
set ns_ [new Simulator]
set nf_ [open simple.tr w]
set namtrace [open simwrls.nam w]
set windowVsTime2 [open win.tr w]
$ns_ trace-all $nf_
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
#creating topology
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#create god nodes(shortest hops required to move rom one node to another)
create-god $val(nn)
#set chan_1_ [new $val(chan)]
#set chan_2_ [new $val(chan)]
#configuration of mobile nodes
$ns_ node-config -adhocRouting $val(rp)\
-llType $val(ll)\
-antType $val(ant)\
-macType $val(mac)\
-ifqType $val(ifq)\
-ifqLen $val(ifqlen)\
-propType $val(prop)\
-channelType $val(chan)\
-phyType $val(netif)\
-topoInstance $topo \
-macTrace OFF\
-agentTrace ON\
-routerTrace ON\
-movementTrace ON


# -channel $chan_1_
#creating static nodes in ns2
for {set i 8} {$i < $val(nn) } { incr i } {
set node($i) [$ns_ node]
}
#creating mobile node nodes in ns2
for {set i 0} {$i < $val(mn) } {incr i} {
set mobilenode_($i) [$ns_ node]
}
set k 0;
while {$k < 2 } {
for {set i 0} {$i < $num_row } {incr i} {
set m [expr $i+$k*$num_row];
$mobilenode_($m) set X_ [expr $i*240];
$mobilenode_($m) set Y_ [expr $k*480+480.0];
$mobilenode_($m) set Z_ 0.0
}
incr k;
}
#intial position of mobile nodes
#$node(0) set X_ 5.0
#$node(0) set Y_ 5.0
#$node(0) set Z_ 0.0

#$node(1) set X_ 245.0
#$node(1) set Y_ 380.0
#$node(1) set Z_ 0.0

#node(2) set X_ 140.0
#$node(2) set Y_ 256.0
#$node(2) set Z_ 0.0
#mobile sceneario Generator
$ns_ at 2.0 "$mobilenode_(0) setdest 150 150.0 3.0"
$ns_ at 4.0 "$mobilenode_(1) setdest 45 45.0 3.0"
$ns_ at 6.0 "$mobilenode_(2) setdest 250 250.0 3.0"
$ns_ at 8.0 "$mobilenode_(3) setdest 250 250.0 3.0"
$ns_ at 10.0 "$mobilenode_(4) setdest 250 250.0 3.0"
$ns_ at 12.0 "$mobilenode_(5) setdest 250 250.0 3.0"
$ns_ at 14.0 "$mobilenode_(6) setdest 250 250.0 3.0"
$ns_ at 16.0 "$mobilenode_(7) setdest 250 250.0 3.0"
#setting TCP connection between sensornodes and mobilenode(0)
#setting FTP on TCP connection
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(8) $tcp
$ns_ attach-agent $node(8) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(9) $tcp
$ns_ attach-agent $node(9) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(10) $tcp
$ns_ attach-agent $node(10) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(11) $tcp
$ns_ attach-agent $node(11) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(12) $tcp
$ns_ attach-agent $node(12) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(13) $tcp
$ns_ attach-agent $node(13) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#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"
#defining node position at nam file
for {set i 8} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node($i) 30;
}
for {set i 0} {$i < $val(mn) } {incr i} {
$ns_ initial_node_pos $mobilenode_($i) 60;
}
#Total time of simulation
for {set i 8} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop) "$node($i) reset";
}
#ending nam and simulation

for {set i 0} {$i < $val(mn) } {incr i} {
$ns_ at $val(stop) "$mobilenode_($i) reset";
}
$ns_ at $val(stop)"ns_ stop";
$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)"
$ns_ at $val(stop) "stop"
$ns_ at 100.01 "puts "end simulation" ; $ns_ halt"
#stop procedure
proc stop {} {
global ns_ nf_ namtrace
$ns_ flush-trace
close $nf_
close $namtrace
}
$ns_ run

TB0ne 01-26-2017 04:21 PM

Quote:

Originally Posted by baig7070 (Post 5660676)
This code was written with the intent to connect the mobile nodes(data collectors) with static nodes in a 2x4 grid.Now in this code, the value isn't divided by any zero value but still producing core dumped error.
Code:

set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 50
set val(ifq) Queue/DropTail/PriQueue
set val(mac) Mac/802_11
set val(ll) LL
set val(rp) DSDV
set val(nn) 40
set val(mn) 8
set val(x) 1000
set val(y) 1000
set val(stop) 150
set num_row 4
#Define ns/nam standard trace
set ns_ [new Simulator]
set nf_ [open simple.tr w]
set namtrace [open simwrls.nam w]
set windowVsTime2 [open win.tr w]
$ns_ trace-all $nf_
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
#creating topology
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#create god nodes(shortest hops required to move rom one node to another)
create-god $val(nn)
#set chan_1_ [new $val(chan)]
#set chan_2_ [new $val(chan)]
#configuration of mobile nodes
$ns_ node-config -adhocRouting $val(rp)\
  -llType $val(ll)\
  -antType $val(ant)\
  -macType $val(mac)\
  -ifqType $val(ifq)\
  -ifqLen $val(ifqlen)\
  -propType $val(prop)\
  -channelType $val(chan)\
  -phyType $val(netif)\
  -topoInstance $topo \
  -macTrace OFF\
  -agentTrace ON\
  -routerTrace ON\
  -movementTrace  ON


 #  -channel $chan_1_   
#creating static nodes in ns2
for {set i 8} {$i < $val(nn) } { incr i } {
set node($i) [$ns_ node]
}
#creating mobile node nodes in ns2
for {set i 0} {$i < $val(mn) } {incr i} {
    set mobilenode_($i) [$ns_ node]
}
set k 0;
while {$k < 2 } {
    for {set i 0} {$i < $num_row } {incr i} {
 set m [expr $i+$k*$num_row];
 $mobilenode_($m) set X_ [expr $i*240];
 $mobilenode_($m) set Y_ [expr $k*480+480.0];
 $mobilenode_($m) set Z_ 0.0
    }
    incr k;
}
#intial position of mobile nodes
#$node(0) set X_ 5.0
#$node(0) set Y_ 5.0
#$node(0) set Z_ 0.0

#$node(1) set X_ 245.0
#$node(1) set Y_ 380.0
#$node(1) set Z_ 0.0

#node(2) set X_ 140.0
#$node(2) set Y_ 256.0
#$node(2) set Z_ 0.0
#mobile sceneario Generator
$ns_ at 2.0 "$mobilenode_(0) setdest 150 150.0 3.0"
$ns_ at 4.0 "$mobilenode_(1) setdest 45 45.0 3.0"
$ns_ at 6.0 "$mobilenode_(2) setdest 250 250.0 3.0"
$ns_ at 8.0 "$mobilenode_(3) setdest 250 250.0 3.0"
$ns_ at 10.0 "$mobilenode_(4) setdest 250 250.0 3.0"
$ns_ at 12.0 "$mobilenode_(5) setdest 250 250.0 3.0"
$ns_ at 14.0 "$mobilenode_(6) setdest 250 250.0 3.0"
$ns_ at 16.0 "$mobilenode_(7) setdest 250 250.0 3.0"
#setting TCP connection between sensornodes and mobilenode(0)
#setting FTP on TCP connection
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
#set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(8) $tcp
$ns_ attach-agent $node(8) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
 #set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(9) $tcp
$ns_ attach-agent $node(9) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
 #set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(10) $tcp
$ns_ attach-agent $node(10) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
 #set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(11) $tcp
$ns_ attach-agent $node(11) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
  #set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(12) $tcp
$ns_ attach-agent $node(12) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
 #set sink [new Agent/TCPSink]
set sink_(0) [new Agent/TCPSink]
$ns_ attach-agent $node(13) $tcp
$ns_ attach-agent $node(13) $sink_(0)
$ns_ connect $tcp $sink_(0)
set ftp_(0) [new Application/FTP]
$ftp_(0) attach-agent $tcp
$ns_ at 10.0 "$ftp_(0) start"
#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"
#defining node position at nam file
for {set i 8} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node($i) 30;
}
for {set i 0} {$i < $val(mn) } {incr i} {
$ns_ initial_node_pos $mobilenode_($i) 60;
}
 #Total time of simulation
for {set i 8} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop) "$node($i) reset";
}
#ending nam and simulation

for {set i 0} {$i < $val(mn) } {incr i} {
$ns_ at $val(stop) "$mobilenode_($i) reset";
}
$ns_ at $val(stop)"ns_ stop";
$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)"
$ns_ at $val(stop) "stop"
$ns_ at 100.01 "puts "end simulation" ; $ns_ halt"
#stop procedure
proc stop {} {
global ns_ nf_ namtrace
$ns_ flush-trace
close $nf_
close $namtrace
}
$ns_ run


You were told in your previous thread to provide details, and show what you've done to resolve your problem. Just telling us "produced core dump error" tells us absolutely NOTHING that will help us to help you. Read the "Question Guidelines" link in my posting signature. And when posting code, you need to put it in CODE blocks.

You need to provide version/distro of Linux, where this code is actually running, with what compiler, what the EXACT error(s)/message(s) you get are, what you do to get them, etc. We aren't going to write and debug your code for you...show your efforts and provide details, and we will be happy to help.

Jjanel 01-26-2017 05:01 PM

baig7070: Since you seem UNwilling/UNable to read links provided in prior threads,
here is a copy of the information in the link, to which #2 correctly referred:
(note: the red/underlining is mine; the text is an exact copy&paste)

You were pointed here because a fellow LQ member feels the thread you started doesn't contain enough information to enable us to help you. We understand that Linux can be intimidating for new members, and we really do want to help. That said, please understand that LQ is not a help desk, customer service line for a product you purchased or willing to do your homework (although we are happy to assist you with specifics, if you show some effort of your own!). We're a 100% volunteer organization that wants to help you help yourself.

Here are a couple tips that will enable us to help you moving forward:

When asking a question, be sure to provide as many relevant details as possible. You should include the distribution and version you're using, along with hardware details, application version and exact error messages where applicable.
Using a descriptive title will vastly increase the number of members who see your thread, and therefore make a response significantly more likely.
If you're actively troubleshooting an issue you should also include any steps you've already taken.
You may want to include how what you are experiencing differs from what you expected to experience.
Before posting, have you used the search function to ensure your question hasn't been asked before?
You can edit your post by clicking the EDIT button in the bottom right corner of your message.

If you are unwilling or unable to ask questions in a manner that allows us to help you, it's unlikely our community will be able to provide you a solution. Unfortunately, serial offenders who show wanton disregard for this request after multiple pointers may be asked to seek help elsewhere. We truly hope that isn't necessary, and assure you Linux and Open Source are extremely rewarding and well worth the learning curve in the long run.

rtmistler 01-27-2017 06:32 AM

Hi baig7070,

Once again welcome to LQ.

Please note that your two other threads are very similar to the respect that they do not provide details about what you are trying to do to diagnose your problems, but instead asking others to perform work on your behalf to solve these questions or problems:

http://www.linuxquestions.org/questi...7/#post5646865
http://www.linuxquestions.org/questi...3/#post5650177

This is not how the LQ site works. Advice givers here are volunteers who have chosen to help you learn further about Linux and Linux related topics.

You've shown your code and indicated that it resulted in a core dump. Have you tried to look at the core dump? Have you tried to debug your code? For instance, your code sets up a lot of variables, and then starts some ns library calls. Perhaps you can exit your code, or debug it and stop it just after the initialization and verify that all is well and the situation is as expected before continuing to debug.

Note that one way to do this is to compartmentalize the code into functions or areas of known working sections at the very least so that you understand what works up to this point.

Rather than restart with another new question, please respond in this thread with some further details.


All times are GMT -5. The time now is 11:29 AM.