LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-11-2015, 03:33 PM   #1
Md Zishan Khan
LQ Newbie
 
Registered: Oct 2014
Location: West Bengal, INDIA
Posts: 16

Rep: Reputation: Disabled
Floating point exception (core dumped) getting this error while running zishan.tcl


#trying to calculate LET(link expiration time for particular link in the simulation )
#zishan.tcl
# wrls1.tcl
# A 3-node example for ad-hoc simulation with DSDV

# 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) 4 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 400 ;# Y dimension of topography
set val(stop) 80 ;# time of simulation end

set ns [new Simulator]
set tracefd [open dsdvzis.tr w]

set namtrace [open dsdvzis.nam w]
set D_los 250.0
$ns trace-all $tracefd
$ns use-newtrace
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# 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

for {set i 0} {$i < $val(nn) } { incr i } {
set node_($i) [$ns node]
}

# Provide initial location of mobilenodes
set xi(0) 5.0
set yi(0) 5.0
set zi(0) 0.0
$node_(0) set X_ $xi(0)
$node_(0) set Y_ $yi(0)
$node_(0) set Z_ $zi(0)

set xi(1) 490.0
set yi(1) 285.0
set zi(1) 0.0
$node_(1) set X_ $xi(1)
$node_(1) set Y_ $yi(1)
$node_(1) set Z_ $zi(1)

set xi(2) 150.0
set yi(2) 240.0
set zi(2) 0.0
$node_(2) set X_ $xi(2)
$node_(2) set Y_ $yi(2)
$node_(2) set Z_ $zi(2)

set xi(3) 190.0
set yi(3) 50.0
set zi(3) 0.0
$node_(3) set X_ $xi(3)
$node_(3) set Y_ $yi(3)
$node_(3) set Z_ $zi(3)
# Generation of movements
set t(0) 2.0
set t(1) 8.0
set t(2) 8.0
set t(3) 8.0

set xf(0) 76.0
set yf(0) 76.0

set xf(1) 330.0
set yf(1) 285.0

set xf(2) 180.0
set yf(2) 210.0

set xf(3) 260.0
set yf(3) 10.0

$ns at $t(0) "$node_(0) setdest $xf(0) $yf(0) 5.0"
$ns at $t(1) "$node_(1) setdest $xf(1) $yf(1) 5.0"
$ns at $t(2) "$node_(2) setdest $xf(2) $yf(2) 5.0"
$ns at $t(3) "$node_(3) setdest $xf(3) $yf(3) 5.0"

# Calculating LET (wrt 250) for each node in the simulation
for {set i 0} {$i < $val(nn) } { incr i } {

puts "\n"

for {set j 0} {$j < $val(nn) } { incr j } {

set dxi [expr $xi($i) - $xi($j)]
set dyi [expr $yi($i) - $yi($j)]

set dxf [expr $xf($i) - $xf($j)]
set dyf [expr $yf($i) - $yf($j)]

set dx1 [expr $dxi * $dxi]
set dy1 [expr $dyi * $dyi]

set dx2 [expr $dxf * $dxf]
set dy2 [expr $dyf * $dyf]

set h1 [expr $dx1 + $dy1]
set h2 [expr $dx2 + $dy2]

set hi($i-$j) [expr pow($h1, 0.5)]
set hf($i-$j) [expr pow($h2, 0.5)]
puts "initial distance of node($i) from node($j) = $hi($i-$j)"
puts "final distance of node($i) from node($j) = $hf($i-$j)"
}
}
# For calculating LET initial and final for a node wrt every node

for {set i 0} {$i < $val(nn) } { incr i } {

puts "\n"

for {set j 0} {$j < $val(nn) } { incr j } {

set t1i_($i$j) [expr $D_los - $hi($i-$j)]
puts "$t1i_($i$j)"



set sl1i_($i$j) [expr {$xi($i)-$xi($j)}]
set sl2i_($i$j) [expr {$yi($i)-$yi($j)}]
set sfi_($i$j) [expr { $sl2i_($i$j)/$sl1i_($i$j)} ]
set t2i_($i$j) [expr {2*5*sin($sfi_($i$J)2)* 57.32}]

set t1f_($i$j) [expr $D_los - $hf($i-$j)]
puts "$t1f_($i$j)"

set sl1f_($i$j) [expr {$xf($i)-$xf($j)}]
set sl2f_($i$j) [expr {$yf($i)-$yf($j)}]
set sff_($i$j) [expr { $sl2f_($i$j)/$sl1f_($i$j)} ]
set t2f_($i$j) [expr {2*5*sin($sff_($i$j)/2)* 57.32}]

set leti_($i$j) [expr { $t1i_($i$j)/$t2i_($i$j)}]
set letf_($i$j) [expr { $t1f_($i$j)/$t2f_($i$j)}]

puts "The LET Initial of node no $i with link $j is : $leti_($i$j)"
puts "The LET Final of node no $i with link $j is : $letf_($i$j)"

}
}
# for calculating angle
for {set i 0} {$i < $val(stop)} {incr i} { # for time from 0

for {set j 0} {$j < $val(nn)} {incr j} { # for every node/time

#puts "xi($j)= $xi($j)"
#puts "xf($j)= $xf($j)"
#puts "t($j)= $t($j)"

if { $i <= $t($j) && ($i+1) > $t($j) } {
puts "OK $j $t($j) $xi($j) $yi($j) $xf($j) $yf($j) "

# Calculation of angle between node from initial to final position

set sl1 [expr {$xf($j)-$xi($j)}]
set sl2 [expr {$yf($j)-$yi($j)}]
set sf [expr { $sl2/$sl1} ]
puts "The tan of Slope $j: [expr {atan($sf)*57.32}]"

}

}
}




# Set a TCP connection between node_(0) and node_(1)
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_(1) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 8.0 "$ftp start"



# 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 80.01 "puts "end simulation" ; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
}

$ns run

Last edited by Md Zishan Khan; 05-11-2015 at 03:34 PM.
 
Old 05-11-2015, 04:20 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,517

Rep: Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619
am i correct is GUESSING
that this is one of ???? many different versions of ns2 .?????

if so
please STATE THAT !
and it's version?
How it was installed ?
and on what Operating system ?

also VERY VERY IMPORTANT!!!!!!!!
please USE THE CODE TAGS!!!!!!! around your code

with 16 posts you should already know to do that .
PHP Code:
 [codethe code goes here  [/code
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
floating point exception (core dumped) aicaicai Linux - Newbie 2 05-10-2013 07:35 AM
Floating point exception error while executing tcl with ns2 ines8989 Linux - Software 2 04-22-2013 05:31 PM
[SOLVED] FLoating Point Exception Problem when running RTP_v2.tcl in NS@.33 in Ubuntu 11.10 Wayne Frederick Linux - Newbie 2 03-07-2013 08:57 AM
firefox 2.0 Floating Point Exception (core dumped) error on Ubuntu 6.10 maximum Ubuntu 1 12-28-2006 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration