Article 4VTT4 SFAMA TCL Script Not Working - invalid command name "-llType"

SFAMA TCL Script Not Working - invalid command name "-llType"

by
aalguqha
from LinuxQuestions.org on (#4VTT4)
Hello everyone,

I hope to get some help to run the SFAMA tcl script for the underwater wireless sensor network. I am having ten nodes 9 regular nodes and 1 sink at the top level. I have 3 vertical lines where each line has three nodes. Each node in higher depth forwards the packets to lower depth to reach the sink in the shortest path using the routing protocol. So, nodes 1, 2, and 3 forward packets to the sink (node 0). I attached TCP agent with FTP application on all nodes (1-9) where the sink node for all nodes is node 0. The topology looks like this:

0(sink)
1 2 3
4 5 6
7 8 9

Nodes 1, 5, 9 starts at the same time
Nodes 2, 6, 7 starts at the same time
Nodes 3, 4, 8 starts at the same time

My SFAMA TCL script:
=================================================================
# This script is created by NSG2 beta1
# <http://wushoupong.googlepages.com/nsg>

# Network Topology
#
# 0(sink)
#1 2 3
#4 5 6
#7 8 9
#
# Nodes 1, 5, 9 starts at the same time
# Nodes 2, 6, 7 starts at the same time
# Nodes 3, 4, 8 starts at the same time
#
#

#===================================
# Simulation parameters setup
#===================================
set opt(chan) Channel/UnderwaterChannel ;# channel type
set opt(prop) Propagation/UnderwaterPropagation ;# underwater-propagation model
set opt(netif) Phy/UnderwaterPhy ;# network interface type
set opt(mac) Mac/UnderwaterMac/SFAMA ;# MAC type
set opt(ifq) Queue/DropTail/PriQueue ;# interface queue type
set opt(ll) LL ;# link layer type
set opt(energy) EnergyModel
set opt(txpower) 10;#in watt (w)
set opt(rxpower) 1;#in watt (w)
set opt(initialenergy) 10000;#in joules (j)
set opt(idlepower) 0.5 ;#set idlepower in watt (w)
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(filters) GradientFilter ;# options can be one or more of
;# TPP/OPP/Gear/Rmst/SourceRoute/Log/TagFilter

Phy/UnderwaterPhy set tranp 10; # set transmission power here
Phy/UnderwaterPhy set recvp 1 ; #here
Phy/UnderwaterPhy set idlep 0.5 ;#not here

#set rate [lindex $argv 0];
set rate 50;
set opt(data_rate_) [expr 0.001*$rate];# [lindex $argv 0] ;#0.02

# the following parameters are set fot protocols
set opt(bit_rate) 1.0e4
set opt(encoding_efficiency) 1

set opt(transmission_time_error) 0.0001;

# the following parameters are set for protocols
set opt(ND_window) 1
set opt(ACKND_window) 1
set opt(PhaseOne_window) 3
set opt(PhaseTwo_window) 1
set opt(PhaseTwo_interval) 0.5
set opt(IntervalPhase2Phase3) 1
set opt(duration) 0.1
set opt(PhyOverhead) 8
set opt(large_packet_size) 4096 ;# 512 bytes
set opt(short_packet_size) 100 ;# 100 bites
set opt(PhaseOne_cycle) 4 ;
set opt(PhaseTwo_cycle) 2 ;
set opt(PeriodInterval) 1

set opt(dz) 10
set opt(ifqLen) 50;# max packet in ifq
set opt(nn) 10;# number of nodes
set opt(rp) DSDV ;# ad-hoc routing protocol
set opt(layers) 1
set opt(x) 400;# X dimension of the topography
set opt(y) 400 ;# Y dimension of the topography
#set opt(z) [expr ($opt(layers)-1)*$opt(dz)]
set opt(seed) 113;#[lindex $argv 1]
set opt(stop) 12.0;# simulation time
set opt(prestop) 1 ;# time to prepare to stop
set opt(tr) "mysfama.tr";# trace file
set opt(nam) "mysfama.nam" ;# nam file
set opt(datafile) "mysfama.data" ;#data file
set opt(adhocRouting) Vectorbasedforward ;#SillyRouting
set opt(width) 20
set opt(adj) 10
set opt(interval) 0.001
#set opt(traf) "diffusion-traf.tcl" ;# traffic file
#set nodeclass UnderwaterSensorNode

LL set mindelay_50us
LL set delay_25us
LL set bandwidth_0;# not used

#Queue/DropTail/PriQueue set Prefer_Routing_Protocols

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Z_ 0.05
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

#Mac/UnderwaterMac/FAMA set maxBurst 1;
#Mac/UnderwaterMac/FAMA set maxPropDelay 1;
#Mac/UnderwaterMac/FAMA set dataSize 500;
#Mac/UnderwaterMac/FAMA set controlSize 20;

Mac/UnderwaterMac/SFAMA set guard_time_ 0.001
Mac/UnderwaterMac/SFAMA set max_backoff_slots_ 4
Mac/UnderwaterMac/SFAMA set max_burst_ 1
Mac/UnderwaterMac/SFAMA set dataSize 500;
Mac/UnderwaterMac/SFAMA set controlSize 20;
Mac/UnderwaterMac/SFAMA set maxPropDelay 1;

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/UnderwaterPhy set CPThresh_ 100 ;#10.0
Phy/UnderwaterPhy set CSThresh_ 0 ;#1.559e-11
Phy/UnderwaterPhy set RXThresh_ 0 ;#3.652e-10
#Phy/UnderwaterPhy set Rb_ 2*1e6
Phy/UnderwaterPhy set Pt_ 0.2818;
Phy/UnderwaterPhy set freq_ 25 ;#frequency range in khz
Phy/UnderwaterPhy set K_ 2.0 ;#spherical spreading
Phy/UnderwaterPhy set sync_hdr_len 1;

#===================================
# Initialization
#===================================
#Create a ns simulator
set ns [new Simulator]

#Setup topography object
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
create-god $opt(nn)

#Open the NS trace file
set tracefile [open sfama1.tr w]
$ns trace-all $tracefile

#Open the NAM trace file
set namfile [open sfama1.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $opt(x) $opt(y)
set chan [new $opt(chan)];#Create wireless channel

set data [open $opt(datafile) w]
set start_time 1
set total_number [expr $opt(nn)-1]

#===================================
# Node parameter setup
#===================================
global defaultRNG
$defaultRNG seed $opt(seed)

$ns node-config -adhocRouting $opt(rp) \
##-addressingType flat or hierarchical or expanded
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqLen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
#-channelType $opt(chan) \
-agentTrace ON \
-routerTrace ON \
-macTrace ON\
-movementTrace OFF\
-topoInstance $topo\
-energyModel $opt(energy)\
-txpower $opt(txpower)\
-rxpower $opt(rxpower)\
-initialEnergy $opt(initialenergy)\
-idlePower $opt(idlepower)\
-channel $chan

#===================================
# Nodes Definition
#===================================
#Create 10 nodes
set n0 [$ns node] #Sink node
$n0 set X_ 700
$n0 set Y_ 400
$n0 set Z_ 0.0
$n0 set_next_hop n0
#$ns initial_node_pos $n0 20

set n1 [$ns node]
$n1 set X_ 699
$n1 set Y_ 300
$n1 set Z_ 0.0
$n1 set_next_hop n0
#$ns initial_node_pos $n1 20

set n2 [$ns node]
$n2 set X_ 700
$n2 set Y_ 300
$n2 set Z_ 0.0
$n2 set_next_hop n0
#$ns initial_node_pos $n2 20

set n3 [$ns node]
$n3 set X_ 701
$n3 set Y_ 300
$n3 set Z_ 0.0
$n3 set_next_hop n0
#$ns initial_node_pos $n3 20

set n4 [$ns node]
$n4 set X_ 699
$n4 set Y_ 200
$n4 set Z_ 0.0
$n4 set_next_hop n1
#$ns initial_node_pos $n4 20

set n5 [$ns node]
$n5 set X_ 700
$n5 set Y_ 200
$n5 set Z_ 0.0
$n5 set_next_hop n2
#$ns initial_node_pos $n5 20

set n6 [$ns node]
$n6 set X_ 701
$n6 set Y_ 200
$n6 set Z_ 0.0
$n6 set_next_hop n3
#$ns initial_node_pos $n6 20

set n7 [$ns node]
$n7 set X_ 699
$n7 set Y_ 100
$n7 set Z_ 0.0
$n7 set_next_hop n4
#$ns initial_node_pos $n7 20

set n8 [$ns node]
$n8 set X_ 700
$n8 set Y_ 100
$n8 set Z_ 0.0
$n8 set_next_hop n5
#$ns initial_node_pos $n8 20

set n9 [$ns node]
$n9 set X_ 701
$n9 set Y_ 100
$n9 set Z_ 0.0
$n9 set_next_hop n6
#$ns initial_node_pos $n9 20

#===================================
# Agents Definition
#===================================
#Setup a TCP connection
set tcp3 [new Agent/TCP]
$ns attach-agent $n1 $tcp3
set tcp7 [new Agent/TCP]
$ns attach-agent $n5 $tcp7
set tcp11 [new Agent/TCP]
$ns attach-agent $n9 $tcp11

set tcp4 [new Agent/TCP]
$ns attach-agent $n2 $tcp4
set tcp8 [new Agent/TCP]
$ns attach-agent $n6 $tcp8
set tcp9 [new Agent/TCP]
$ns attach-agent $n7 $tcp9

set tcp5 [new Agent/TCP]
$ns attach-agent $n3 $tcp5
set tcp6 [new Agent/TCP]
$ns attach-agent $n4 $tcp6
set tcp10 [new Agent/TCP]
$ns attach-agent $n8 $tcp10

set sink2 [new Agent/TCPSink]
$ns attach-agent $n0 $sink2

$ns connect $tcp3 $sink2 # node 1
$tcp3 set packetSize_ 512
$ns connect $tcp7 $sink2 # node 5
$tcp7 set packetSize_ 512
$ns connect $tcp11 $sink2 # node 9
$tcp11 set packetSize_ 512

$ns connect $tcp4 $sink2 # node 2
$tcp4 set packetSize_ 512
$ns connect $tcp8 $sink2 # node 6
$tcp8 set packetSize_ 512
$ns connect $tcp9 $sink2 # node 7
$tcp9 set packetSize_ 512

$ns connect $tcp5 $sink2 # node 3
$tcp5 set packetSize_ 512
$ns connect $tcp6 $sink2 # node 4
$tcp6 set packetSize_ 512
$ns connect $tcp10 $sink2 # node 8
$tcp10 set packetSize_ 512

#===================================
# Applications Definition
#===================================
# Nodes 1, 5, and 9 start at the same time
#Setup a FTP Application over TCP connection in node 1
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp3
$ftp0 setTargetAddress n0
$ns at 1.0 "$ftp0 start"
$ns at 3.0 "$ftp0 stop"
#Setup a FTP Application over TCP connection in node 5
set ftp8 [new Application/FTP]
$ftp8 attach-agent $tcp7
$ftp8 setTargetAddress n0
$ns at 1.0 "$ftp8 start"
$ns at 3.0 "$ftp8 stop"
#Setup a FTP Application over TCP connection in node 9
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp11
$ftp4 setTargetAddress n0
$ns at 1.0 "$ftp4 start"
$ns at 3.0 "$ftp4 stop"

# Nodes 2, 6, and 7 start at the same time
#Setup a FTP Application over TCP connection in node 2
set ftp7 [new Application/FTP]
$ftp7 attach-agent $tcp4
$ftp7 setTargetAddress n0
$ns at 3.5 "$ftp7 start"
$ns at 6.5 "$ftp7 stop"
#Setup a FTP Application over TCP connection in node 6
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp8
$ftp5 setTargetAddress n0
$ns at 3.5 "$ftp5 start"
$ns at 6.5 "$ftp5 stop"
#Setup a FTP Application over TCP connection in node 7
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp9
$ftp2 setTargetAddress n0
$ns at 3.5 "$ftp2 start"
$ns at 6.5 "$ftp2 stop"

# Nodes 3, 4, and 8 start at the same time
#Setup a FTP Application over TCP connection in node 3
set ftp6 [new Application/FTP]
$ftp6 attach-agent $tcp5
$ftp6 setTargetAddress n0
$ns at 7.0 "$ftp6 start"
$ns at 10.0 "$ftp6 stop"
#Setup a FTP Application over TCP connection in node 4
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp6
$ftp1 setTargetAddress n0
$ns at 7.0 "$ftp1 start"
$ns at 10.0 "$ftp1 stop"
#Setup a FTP Application over TCP connection in node 8
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp10
$ns at 7.0 "$ftp3 start"
$ns at 10.0 "$ftp3 stop"

puts $data "New simulation...."
puts $data "nodes = $opt(nn), random_seed = $opt(seed), sending_interval_=$opt(interval), width=$opt(width)"
puts $data "mac is $opt(mac)"
puts $data "x= $opt(x) y= $opt(y) z= $opt(z)"
close $data

puts $tracefile "SillyRrouting"
puts $tracefile "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) z $opt(z)"
puts $tracefile "M 0.0 prop $opt(prop) ant $opt(ant)"
puts "starting Simulation..."

#===================================
# Termination
#===================================
#Define a 'finish' procedure
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam sfama1.nam &
exit 0
}
puts "Starting simulation ..."
for {set i 0} {$i < $opt(nn) } { incr i } {
$ns at $opt(stop) "\$n$i reset"
}
$ns at $opt(stop) "$ns nam-end-wireless $opt(stop)"
$ns at $opt(stop) "finish"
$ns at $opt(stop) "puts "done" ; $ns halt"
$ns run
================================================================

Error:
mint@mint-VirtualBox ~/Desktop/Testing $ ns mySFAMA.tcl
When configured, ns found the right version of tclsh in /home/mint/Desktop/ns2/ns-allinone-2.34/Aqua-Sim-1.0/bin/tclsh8.4
but it doesn't seem to be there anymore, so ns will fall back on running the first tclsh in your path. The wrong version of tclsh may break the test suites. Reconfigure and rebuild ns if this is a problem.
num_nodes is set 10
invalid command name "-llType"
while executing
"-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqLen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phy..."
(file "mySFAMA.tcl" line 162)
mint@mint-VirtualBox ~/Desktop/Testing $

================================================================

Please let me know how to fix the above script to work as I explained above. Thanks in advance for your help.

Ahmedlatest?d=yIl2AUoC8zA latest?i=SxRlGHVoAX0:RYtA0GWfDd0:F7zBnMy latest?i=SxRlGHVoAX0:RYtA0GWfDd0:V_sGLiP latest?d=qj6IDK7rITs latest?i=SxRlGHVoAX0:RYtA0GWfDd0:gIN9vFwSxRlGHVoAX0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments