Hi all,
I'm a new ns user.
I'm working on my master thesis and trying to simulate wlan with
infrastructure mode
and I'm facing a problem when I set node movement using *setdest* I got
error as follows:
*ns: _o99 setdest 500.0 350.0 3.0:
(_o99 cmd line 1)
invoked from within
"_o99 cmd setdest 500.0 350.0 3.0"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o99" line 2)
(SplitObject unknown line 2)
invoked from within
"_o99 setdest 500.0 350.0 3.0"*
--------------------------------------------------------------
My TCL code is in the following:
--------------------------------------------------------------
# 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) 7 ;# number of mobile nodes
set val(rp) DumbAgent ;# routing protocol
set val(x) 600 ;# X dimension of topography
set val(y) 600 ;# Y dimension of topography
set val(stop) 50 ;# time of simulation end
#DSSS (IEEE802.11b)
Mac/802_11 set SlotTime_ 0.000020 ;# 20us
Mac/802_11 set SIFS_ 0.000010 ;# 10us
Mac/802_11 set PreambleLength_ 144 ;# 144 bit
Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
Mac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps
Mac/802_11 set dataRate_ 11.0e6 ;# 11Mbps
Mac/802_11 set basicRate_ 1.0e6 ;# 1Mbps
Mac/802_11 set RTSThreshold_ 3000 ;# Disable RTS/CTS
# frequency is 2.4 GHz
Phy/WirelessPhy set freq_ 2.4e+9
# Main Program
set ns [new Simulator]
set tracefile [open Roaming-out.tr w]
set namtrace [open Roaming-out.nam w]
$ns trace-all $tracefile
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
$ns color 1 Blue
# Set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create god (node)
create-god $val(nn)
# Create channel
set chan_1_ [new $val(chan)]
# Configure the wireless 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) \
-topoInstance $topo \
-agentTrace OFF \
-routerTrace OFF \
-macTrace ON \
-movementTrace ON \
-channel $chan_1_
for {set i 0} {$i < $val(nn)} {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;# disable random motion
set node_($i) [$node_($i) getMac 0]
}
#Set node_(0) and node_(1) as the APs
set AP_ADDR1 [$node_(0) id]
$node_(0) ap $AP_ADDR1
$node_(0) ScanType PASSIVE
#$node_(0) set BeaconInterval_ 0.2
$node_(0) set X_ 100.0
$node_(0) set Y_ 300.0
$node_(0) set Z_ 0.0
set AP_ADDR2 [$node_(1) id]
$node_(1) ap $AP_ADDR2
$node_(1) ScanType PASSIVE
#$node_(1) set BeaconInterval_ 0.2
$node_(1) set X_ 500.0
$node_(1) set Y_ 300.0
$node_(1) set Z_ 0.0
$ns at 0.5 "$node_(2) ScanType ACTIVE"
$ns at 1.0 "$node_(3) ScanType ACTIVE"
$ns at 1.5 "$node_(4) ScanType ACTIVE"
$ns at 2.0 "$node_(5) ScanType ACTIVE"
$ns at 2.5 "$node_(6) ScanType ACTIVE"
$node_(2) set X_ 120.0
$node_(2) set Y_ 190.0
$node_(2) set Z_ 0.0
$node_(3) set X_ 210.0
$node_(3) set Y_ 210.0
$node_(3) set Z_ 0.0
$node_(4) set X_ 150.0
$node_(4) set Y_ 350.0
$node_(4) set Z_ 0.0
$node_(5) set X_ 80.0
$node_(5) set Y_ 450.0
$node_(5) set Z_ 0.0
$node_(6) set X_ 40.0
$node_(6) set Y_ 200.0
$node_(6) set Z_ 0.0
# Set a UDP connection between mobilenodes
#set udp [new Agent/UDP]
#set null [new Agent/Null]
#$ns attach-agent $node_(2) $udp
#$ns attach-agent $node_(4) $null
#$ns connect $udp $null
#$udp set fid_ 1
#set cbr_0 [new Application/Traffic/CBR]
#$cbr_0 set rate_ 64k
#$cbr_0 set packetsize_ 200
#$cbr_0 set burst_time_ 10ms
#$cbr_0 set idle_time_ 20ms
#$cbr_0 attach-agent $udp
#$ns at 5.0 "$cbr_0 start"
# Define node initial position in nam
for {set i 0} {$i < $val(nn)} {incr i} {
# 1 defines the node size for name
$ns initial_node_pos $node_($i) 20
}
# Generation of movements
*$ns at 10.0 "$node_(4) setdest 500.0 350.0 3.0" *
# 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 50.1 "puts \"end simulation\" ; $ns halt"
proc stop {} {
global ns tracefile namtrace
$ns flush-trace
close $tracefile
close $namtrace
exec nam Roaming-out.nam &
}
# informative headers for CMUTracefile
puts $tracefile "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(rp)"
puts $tracefile "M 0.0 prop $val(prop) ant $val(ant)"
puts "Starting Simulation..."
$ns run
*******************************************************************
I would very appreciated for any help.
Thanks,
Thavouth K.
Dept. of Telecom. Science
Assumption University