LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2017, 11:29 PM   #1
israk
LQ Newbie
 
Registered: Apr 2017
Posts: 18

Rep: Reputation: Disabled
Can't run dymoum tcl file on ns-2.34 in ubuntu15.10


When i tried to run the following dymo .tcl code it gives error and i can't solve that error .I tried my best but i failed ...Kindly anyone look at my code and help me to solve error.My code is given below:
Code:
#==============================================================================
# Define Node Configuration paramaters
#==============================================================================

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) 5 ;# number of mobilenodes
set val(rp) DYMOUM ;# routing protocol
set val(x) 1000 ;# X dimension of the topography
set val(y) 1000 ;# Y dimension of the topography
#==============================================================================
# Initialize Simulator
#==============================================================================
set ns_ [new Simulator]
$ns_ use-newtrace
Agent/DYMOUM set debug_ true
Agent/DYMOUM set no_path_acc_ true
Agent/DYMOUM set reissue_rreq_ true
Agent/DYMOUM set s_bit_ false
Agent/DYMOUM set hello_ival_ 1
#==============================================================================
# Initialize Trace file
#==============================================================================
$ns_ use-newtrace
set tracefd [open Tcp30.tr w]
$ns_ trace-all $tracefd

#==============================================================================
# Initialize Network Animator
#==============================================================================
set namtrace [open NMp30.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
#==============================================================================
# set up topography object
#==============================================================================
set topo [new Topography]
$topo load_flatgrid 1000 1000
#==============================================================================
# set up God object
#==============================================================================
set god_ [new God]
create-god $val(nn)
#==============================================================================
# configure 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 OFF

#==============================================================================
# Create Nodes
#==============================================================================
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
}
#==============================================================================
#disable random motion
#==============================================================================
for {set i 0} {$i < $val(nn) } {incr i} {
$node_($i) random-motion 0 ;# disable random motion
}
#==============================================================================
# Create Random Mobility
#==============================================================================
#
# nodes: 5, pause: 2.00, max speed: 10.00, max x: 500.00, max y: 500.00
#
$node_(0) set X_ 150.094198812636
$node_(0) set Y_ 273.254168181882
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 321.209465691719
$node_(1) set Y_ 24.700959245162
$node_(1) set Z_ 0.000000000000
$node_(2) set X_ 72.777759315859
$node_(2) set Y_ 135.632005802229
$node_(2) set Z_ 0.000000000000
$node_(3) set X_ 110.936002357558
$node_(3) set Y_ 260.266226515028
$node_(3) set Z_ 0.000000000000
$node_(4) set X_ 228.370909579366
$node_(4) set Y_ 326.848919266969
$node_(4) set Z_ 0.000000000000
$god_ set-dist 0 1 16777215
$god_ set-dist 0 2 1
$god_ set-dist 0 3 1
$god_ set-dist 0 4 1
$god_ set-dist 1 2 16777215
$god_ set-dist 1 3 16777215
$god_ set-dist 1 4 16777215
$god_ set-dist 2 3 1
$god_ set-dist 2 4 1
$god_ set-dist 3 4 1
$ns_ at 2.000000000000 "$node_(0) setdest 311.371119754667 411.743284701976 0.628580535004"
$ns_ at 2.000000000000 "$node_(1) setdest 167.052106640031 306.442006197743 0.614747658341"
$ns_ at 2.000000000000 "$node_(2) setdest 250.392744336671 113.959304802943 2.867595906476"
$ns_ at 2.000000000000 "$node_(3) setdest 230.691539701969 490.552777549014 6.998992624178"
$ns_ at 2.000000000000 "$node_(4) setdest 99.388249258687 154.090544453550 4.295032970460"
$ns_ at 8.840182076251 "$god_ set-dist 0 1 2"
$ns_ at 8.840182076251 "$god_ set-dist 1 2 1"
$ns_ at 8.840182076251 "$god_ set-dist 1 3 2"
$ns_ at 8.840182076251 "$god_ set-dist 1 4 2"
$ns_ at 20.490426523496 "$god_ set-dist 1 3 3"
$ns_ at 20.490426523496 "$god_ set-dist 2 3 2"
$ns_ at 28.062658140771 "$god_ set-dist 1 3 2"
$ns_ at 28.062658140771 "$god_ set-dist 1 4 1"
$ns_ at 33.847953672121 "$god_ set-dist 1 3 3"
$ns_ at 33.847953672121 "$god_ set-dist 3 4 2"
$ns_ at 39.085857359758 "$node_(3) setdest 230.691539701969 490.552777549014 0.000000000000"
$ns_ at 41.085857359758 "$node_(3) setdest 487.423288026835 413.216726842588 9.714772233430"
$ns_ at 52.196775536514 "$node_(4) setdest 99.388249258687 154.090544453550 0.000000000000"
$ns_ at 54.196775536514 "$node_(4) setdest 382.927896838869 21.573914095614 0.383290632098"
$ns_ at 56.603099496779 "$god_ set-dist 0 3 16777215"
$ns_ at 56.603099496779 "$god_ set-dist 1 3 16777215"
$ns_ at 56.603099496779 "$god_ set-dist 2 3 16777215"
$ns_ at 56.603099496779 "$god_ set-dist 3 4 16777215"
$ns_ at 64.398038010805 "$node_(2) setdest 250.392744336671 113.959304802943 0.000000000000"
$ns_ at 66.398038010805 "$node_(2) setdest 365.929700809852 96.378785452523 5.580163423595"
$ns_ at 68.685777605632 "$node_(3) setdest 487.423288026835 413.216726842588 0.000000000000"
$ns_ at 70.685777605632 "$node_(3) setdest 147.092003630273 135.260452314786 9.556033024018"
$ns_ at 78.570428912393 "$god_ set-dist 0 3 1"
$ns_ at 78.570428912393 "$god_ set-dist 1 3 3"
$ns_ at 78.570428912393 "$god_ set-dist 2 3 2"
$ns_ at 78.570428912393 "$god_ set-dist 3 4 2"
$ns_ at 81.216209871148 "$god_ set-dist 0 2 2"
$ns_ at 81.216209871148 "$god_ set-dist 2 3 3"
$ns_ at 82.365276248006 "$god_ set-dist 1 3 2"
$ns_ at 82.365276248006 "$god_ set-dist 2 3 1"
$ns_ at 85.351408921789 "$god_ set-dist 2 4 2"
$ns_ at 87.341306361907 "$node_(2) setdest 365.929700809852 96.378785452523 0.000000000000"
$ns_ at 87.489744697191 "$god_ set-dist 1 3 1"
$ns_ at 89.341306361907 "$node_(2) setdest 254.766662486704 226.581160125528 6.149276853318"
$ns_ at 91.199874275118 "$god_ set-dist 2 4 1"
$ns_ at 92.665903051006 "$god_ set-dist 3 4 1"
$ns_ at 93.400104348552 "$god_ set-dist 0 2 1"
$ns_ at 111.051070047880 "$god_ set-dist 0 1 1"
$ns_ at 116.668714851500 "$node_(3) setdest 147.092003630273 135.260452314786 0.000000000000"
$ns_ at 117.182187094353 "$node_(2) setdest 254.766662486704 226.581160125528 0.000000000000"
$ns_ at 118.668714851500 "$node_(3) setdest 186.623755567181 399.323011878689 9.678638135818"
$ns_ at 119.182187094353 "$node_(2) setdest 273.791129339616 310.262548628871 9.853914116885"
$ns_ at 127.891081231898 "$node_(2) setdest 273.791129339616 310.262548628871 0.000000000000"
$ns_ at 129.891081231898 "$node_(2) setdest 468.100452531337 227.480963062504 0.701309124909"
$ns_ at 138.489774599624 "$god_ set-dist 1 3 2"
$ns_ at 144.616047375068 "$god_ set-dist 3 4 2"
$ns_ at 146.255781323276 "$node_(3) setdest 186.623755567181 399.323011878688 0.000000000000"
$ns_ at 148.255781323276 "$node_(3) setdest 430.488155698761 138.342535303730 2.420788498950"
$ns_ at 161.312674422801 "$god_ set-dist 3 4 1"
$ns_ at 170.156961294902 "$god_ set-dist 1 3 1"
#
# Destination Unreachables: 8
#
# Route Changes: 32
#
# Link Changes: 18
#
# Node | Route Changes | Link Changes
#    0 |             6 |            5
#    1 |            15 |            6
#    2 |            10 |            7
#    3 |            23 |           11
#    4 |            10 |            7
#
#==============================================================================
# Create Random Traffic
#==============================================================================

#
# nodes: 5, max conn: 3, send rate: 0.0, seed: 0
#
#
# 3 connecting to 4 at time 99.432886000458566
#
set tcp_(0) [$ns_ create-connection  TCP $node_(3) TCPSink $node_(4) 0]
$tcp_(0) set window_ 32
$tcp_(0) set packetSize_ 512
set ftp_(0) [$tcp_(0) attach-source FTP]
$ns_ at 99.432886000458566 "$ftp_(0) start"
#
# 3 connecting to 5 at time 38.349723861715624
#
set tcp_(1) [$ns_ create-connection  TCP $node_(3) TCPSink $node_(5) 0]
$tcp_(1) set window_ 32
$tcp_(1) set packetSize_ 512
set ftp_(1) [$tcp_(1) attach-source FTP]
$ns_ at 38.349723861715624 "$ftp_(1) start"
#
# 4 connecting to 5 at time 19.5461693869653
#
set tcp_(2) [$ns_ create-connection  TCP $node_(4) TCPSink $node_(5) 0]
$tcp_(2) set window_ 32
$tcp_(2) set packetSize_ 512
set ftp_(2) [$tcp_(2) attach-source FTP]
$ns_ at 19.5461693869653 "$ftp_(2) start"
#
#Total sources/connections: 2/3
#

#==============================================================================
# defines the node size in Network Animator
#==============================================================================
for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node_($i) 40
}
#==============================================================================
# Stop Simulation at Time 200 sec
#==============================================================================
$ns_ at 200.0 "stop"
#==============================================================================
# Reset Nodes at time 200 sec
#==============================================================================
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 200.0 "$node_($i) reset";
}
#==============================================================================
# Exit Simulatoion at Time 200.01 sec
#==============================================================================
$ns_ at 200.01 "puts "NS EXITING..." ; $ns_ halt"
#==============================================================================
# Procedure Stop
#==============================================================================
proc stop {} {
global ns_ tracefd
# Reset Trace File
$ns_ flush-trace
close $tracefd
exit 0
}
#==============================================================================
# Start Simulation
#==============================================================================
puts "Starting Simulation..."
$ns_ run
Error like this:
Code:
sabin@sabin-desktop:~/Documents/ddymo$ ns234-dymo dymo.tcl
num_nodes is set 5
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
can't read "node_(5)": no such element in array
    while executing
"$ns_ create-connection  TCP $node_(3) TCPSink $node_(5) 0"
    invoked from within
"set tcp_(1) [$ns_ create-connection  TCP $node_(3) TCPSink $node_(5) 0]"
    (file "dymo.tcl" line 197)
sabin@sabin-desktop:~/Documents/ddymo$

Last edited by israk; 07-08-2017 at 11:32 PM.
 
Old 07-09-2017, 04:19 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Node 5 : The six nodes are: 0 1 2 3 4 5
And to use 6 nodes, the "node-number" setting must be :
Code:
set val(nn) 6 ;# number of mobilenodes
Other edits : Line 233
$ns_ at 200.01 "puts "NS EXITING..." ; $ns_ halt"
... Must be
Code:
$ns_ at 200.01 "puts \"NS EXITING...\" ; $ns_ halt"
Simulation result, the terminal output : dymo-is.txt.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing


Dymoum info
. https://stackoverflow.com/questions/...50616#43150616
. http://www.linuxquestions.org/questions/tags/dymoum/
. http://www.linuxquestions.org/questions/tags/dymo/


-

Last edited by knudfl; 07-09-2017 at 04:34 AM.
 
1 members found this post helpful.
  


Reply

Tags
dymo, dymoum, ns2


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
[SOLVED] problem while run DSDV. tcl file on ns-2.34 in ubuntu15.10 israk Linux - Newbie 22 04-26-2017 12:30 PM
problem while run dymo tcl file on ns-2.34 in ubuntu15.10 israk Linux - Newbie 7 04-04-2017 08:37 AM
problem while run dymo tcl file on ns-2.34 in ubuntu15.10 israk Linux - Newbie 1 04-02-2017 02:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:52 AM.

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