ns2.35,setdest,invoked from within
Clash Royale CLAN TAG#URR8PPP
ns2.35,setdest,invoked from within
i want to add mobility for sink on tclscript.
sink is shown with mnode(0).
i had a command in terminal : ./setdest -v 2 -n 1 -m 15 -M 15 -t 500 -x 500 -y 500 > mob
mobfile added to tcl directory & add below command to tcl:
./setdest -v 2 -n 1 -m 15 -M 15 -t 500 -x 500 -y 500 > mob
set val(cp) "mob" ;
#
# Define node movement model
#
#puts "Loading connection pattern..."
#source $val(cp)
but when i run XXX.tcl, i have an error:
Loading connection pattern...
can't read "mnode_(0)": no such variable
while executing
"$mnode_(0) set X_ 78.313432119133"
(file "mob" line 7)
invoked from within
"source.orig mob"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName]
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
else {
uplevel source.orig [list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $val(cp)"
(file "AE_3.tcl" line 30)
can you help me?
thanks a lot.
my tcl code:
# Generated by Topology Generator for Network Simulator (c) Elmurod Talipov
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ; # network interface type#dccp.tcl
set val(mac) Mac/802_11 ; # MAC type#dccp.tcl
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) 100 ;# max packet in ifq
set val(nn) 60 ;# number of mobilenodes
set val(rp) AE ;# protocol tye
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(stop) 500 ;# simulation period
set val(energymodel) EnergyModel ;# Energy Model
set val(initialenergy) 1000 ;# value
#set val(sc) "./mob" ;# me
#set val(cs) "../mobility/scene/cbr-3-test";
#set val(sc) "../mobility/scene/scen-3-test";
set ns [new Simulator]
set tracefd [open AE_3.tr w]
set namtrace [open AE_3.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
#
# Define node movement model
#
#puts "Loading connection pattern..."
#source $val(sc)
set dist(5m) 7.69113e-06
set dist(9m) 2.37381e-06
set dist(10m) 1.92278e-06
set dist(11m) 1.58908e-06
set dist(12m) 1.33527e-06
set dist(13m) 1.13774e-06
set dist(14m) 9.81011e-07
set dist(15m) 8.54570e-07
set dist(16m) 7.51087e-07
set dist(20m) 4.80696e-07
set dist(25m) 3.07645e-07
set dist(30m) 2.13643e-07
set dist(35m) 1.56962e-07
set dist(40m) 1.20174e-07
set dist(75m) 3.41828e-08
set dist(100m) 1.42681e-08
Phy/WirelessPhy set CSThresh_ $dist(100m)
Phy/WirelessPhy set RXThresh_ $dist(75m)
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
# from wireless-pkt-demo
#set god_ [create-god $val(nn)]
# 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)
-channel [new $val(chan)]
-topoInstance $topo
-agentTrace ON
-routerTrace ON
-macTrace OFF
-movementTrace OFF
-energyModel $val(energymodel)
-initialEnergy $val(initialenergy)
-rxPower 35.28e-3
-txPower 31.32e-3
-idlePower 712e-6
-sleepPower 144e-9
#-IncomingErrProc MultistateErrorProc
#-OutgoingErrProc MultistateErrorProc
for set i 0 $i < $val(nn) incr i
set mnode_($i) [$ns node]
for set i 1 $i < $val(nn) incr i
$mnode_($i) set X_ [ expr $val(x) * rand() ]
$mnode_($i) set Y_ [ expr $val(y) * rand() ]
$mnode_($i) set Z_ 0
# Position of Sink
$mnode_(0) set X_ [ expr $val(x)/2 ]
$mnode_(0) set Y_ [ expr $val(y)/2 ]
$mnode_(0) set Z_ 0.0
$mnode_(0) label "Sink"
#start sending beacon message
$ns at 1.0 "[$mnode_(0) set ragent_] sink"
for set i 0 $i < $val(nn) incr i
$ns initial_node_pos $mnode_($i) 3
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp
set sink [new Agent/Null]
$ns attach-agent $mnode_(0) $sink
$ns connect $udp $sink
$udp set fid_ 2
#Setup a CBR over UDP connection
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 256
$cbr set interval_ 2
#$cbr set random_ false
$ns at 5.0 "$cbr start"
$ns at [expr $val(stop) - 5] "$cbr stop"
mnode_(0)
Donal Fellows, thank you for reply. i tried to collect data with mobile sink from all nodes. please give me tcl code for this. every one pleaze help me.. thanks a lot.
– m.h
Sep 2 at 18:58
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Has
mnode_(0)
ever been set to anything? It doesn't look like it. Remember, Tcl evaluates your script strictly in order.– Donal Fellows
Aug 7 at 10:30