[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Problems running a simple tcl script for wireless nodes.
Hi all,
I tried running a simple program for 1 wired node, 1 base station and 1
wireless node, simliar to the one in Marc Greis' tutorial, but I get some
errors. Find below, the code, and the errors. I'm using ns-2.1b6, on
linux. Also, running the .nam file for the wired cumwireless scenario
example from the same tutorial, gives me a core dump. Any help (I think
this one's been posted before, but I couldn't find any solutions).
(Am including almost the entire code here, becoz it gaveme some pretty
arbit errors, which i tried to remove)
set opt(chan) Channel/WirelessChannel ;
set opt(prop) Propagation/TwoRayGround;
set opt(netif) Phy/WirelessPhy ;
set opt(mac) Mac/802_11 ;# adjust MAC for GPRS
set opt(ifq) Queue/DropTail/PriQueue;
set opt(ll) LL;
set opt(ant) Antenna/OmniAntenna;
set opt(ifqlen) 50; #what for???
set opt(rp) "DSDV" ;# routing protocol script;
set opt(X) 500; # a 500*500 topography
set opt(Y) 500;
set opt(seed) 0.0 ; # ??
set opt(stop) 150.0 ;# simulation time
set num_wired_nodes 1
set num_bs_nodes 1
set opt(nn) 1 ;# number of wireless nodes
set opt(ftp1-start) 50.0
set ns_ [new Simulator]
$ns_ node-config - addressType hierarchical
AddrParams set domain_num_ 2 ; # no. of domains
lappend cluster_num 1 1 ; # no. of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 2 ;# number of nodes in each cluster
AddrParams set nodes_num_ $eilastlevel ;# of each domain
set tracefd [open ~/mtp/ns/sim/2.tr w]
set namtracefd [open ~/mtp/ns/sim/2.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtracefd $opt(X) $opt(Y)
set topo [new Topography]
$topo load_flatgrid $opt(X) $opt(Y)
# creat 'God' !! (Do I need to create God here - I am nmot using
# ad-hoc routing ??)
create-god $opt(nn)
set W(0) [$ns_ node 0.0.0]
$ns_ node-config -adhocRouting $opt(rp) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop)
$ns_ node-config -phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routertrace OFF
$ns_ node-config -macTrace OFF
set BS(0) [$ns_ node 1.0.0]
puts " hier add of BS is $BS(0) "
$BS(0) random-motion 0 ;# disable randommotion
$BS(0) set X_ 5.0 ;# give BS some fixed co-ordinates
$BS(0) set Y_ 5.0
$BS(0) set Z_ 0.0
#configure and create mobile host
$ns_ node-config -wiredRouting OFF
set MH(0) [$ns_ node 1.0.1]
$MH(0) base-station [AddrParams set-hieraddr [$BS(0) node-addr]]
$ns_ duplex-link $W(0) $BS(0) 5Mb 2ms DropTail
$ns_ duplex-link-op $W(0) $BS(0) orient left-down
... then I set up a TCP connection, and run.. but I get the following
errors:
syntax error in expression "(1.0.0 & 2147483647) << 0"
while executing
"expr ($address_ & [AddrParams set NodeMask_(1)]) << [AddrParams set
NodeShift_(1) ]"
(procedure "_o16" line 17)
(Node attach line 17)
invoked from within
"$node attach $ragent 255"
(procedure "_o3" line 54)
(Simulator create-wireless-node line 54)
invoked from within
"$self create-wireless-node $args"
(procedure "_o3" line 16)
(Simulator node line 16)
invoked from within
"$ns_ node 1.0.0"
(file "/home/richa/mtp/ns/sim/2.tcl" line 123)
Can anyone help?
Regards,
Richa.