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$