[ns] Regarding Wired-cum-wirless topology
Rajesh Badveti
rajesh.badveti at gmail.com
Wed Apr 8 09:47:48 PDT 2009
Hello ,
Below is the topology that i built for a wired-cum-wireless
topology which have
TCP and UDP sources connected to the left end of router. The
right end of router
is connected to a BaseStation Node.
The TCP + UDP sinks are wireless nodes(no links) connected to the
right of BaseStationNode.
When am simulating this scenario, with TCP sources having FTP Agents
works fine.
The problem is with UDP sources, the CBR cant be run. It shows the
below error.
ERROR MESSAGE:
[root at localhost Desktop]# ns roja.tcl
num_nodes is set 5
INITIALIZE THE LIST xListHead
INITIALIZE THE LIST xListHead
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
SORTING LISTS ...DONE!
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o36: no target for slot 1023
_o36 type: Classifier/Addr
content dump:
classifier _o36
0 offset
22 shift
1023 mask
1 slots
slot 0: _o37 (Classifier/Addr)
---------- Finished standard no-slot{} default handler ----------
* "Simulation Script"* : Please give brief explanation about the bold text
in the script.
### This simulation is an example of combination of wired and wireless
### topologies.
global opt
set opt(chan) Channel/WirelessChannel
set opt(prop) Propagation/TwoRayGround
set opt(netif) Phy/WirelessPhy
set opt(mac) Mac/802_11
set opt(ifq) Queue/DropTail/PriQueue
set opt(ll) LL
set opt(ant) Antenna/OmniAntenna
set opt(x) 670
set opt(y) 670
set opt(ifqlen) 50
set opt(tr) wired-and-wireless.tr
set opt(namtr) wired-and-wireless.nam
set opt(nn) 4
set opt(adhocRouting) DSDV
set opt(cp) ""
set opt(sc) "../mobility/scene/scen-3-test"
set opt(stop) 50
set num_wired_nodes 5
set num_bs_nodes 1
set ns_ [new Simulator]
# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 2
lappend cluster_num 1 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 5 5
AddrParams set nodes_num_ $eilastlevel
$ns_ use-newtrace
set tracefd [open $opt(tr) w]
$ns_ trace-all $tracefd
set namtracefd [open $opt(namtr) w]
$ns_ namtrace-all $namtracefd
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
# god needs to know the number of all wireless interfaces
*create-god [expr $opt(nn) + $num_bs_nodes]*
#create wired nodes
set temp {0.0.0 0.0.1 0.0.2 0.0.3 0.0.4}
*for {set i 0} {$i < $num_wired_nodes} {incr i} {*
*set W($i) [$ns_ node [lindex $temp $i]]*
}
#create a router node
#set r0 [$ns_ node]
$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propInstance [new $opt(prop)] \
-phyType $opt(netif) \
-channel [new $opt(chan)] \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF
*set temp {1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5} *
*set BS(0) [$ns_ node [lindex $temp 0]]*
$BS(0) random-motion 0
$BS(0) set X_ 1.0
$BS(0) set Y_ 2.0
$BS(0) set Z_ 0.0
#configure for mobilenodes
$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propInstance [new $opt(prop)] \
-phyType $opt(netif) \
-channel [new $opt(chan)] \
-topoInstance $topo \
-wiredRouting OFF \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF
*for {set j 0} {$j < $opt(nn)} {incr j} {*
*set node_($j) [ $ns_ node [lindex $temp \*
*[expr $j+1]] ]*
*$node_($j) base-station [AddrParams addr2id [$BS(0) node-addr]]*
}
#create links between wired and BS nodes
$ns_ duplex-link $W(0) $W(4) 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $W(4) 5Mb 2ms DropTail
$ns_ duplex-link $W(2) $W(4) 5Mb 2ms DropTail
$ns_ duplex-link $W(3) $W(4) 5Mb 2ms DropTail
$ns_ duplex-link $W(4) $BS(0) 5Mb 2ms DropTail
#$ns_ duplex-link-op $W(3) $W(1) orient down
#$ns_ duplex-link-op $W(4) $BS(0) orient left-down
#$ns_ duplex-link-op $W(5) $BS(1) orient right-down
# setup TCP connections
set tcp0 [new Agent/TCP]
$tcp0 set class_ 2
set sink0 [new Agent/TCPSink]
$ns_ attach-agent $W(0) $tcp0
$ns_ attach-agent $node_(0) $sink0
$ns_ connect $tcp0 $sink0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ns_ at 10.0 "$ftp0 start"
# setup TCP connections
set tcp1 [new Agent/TCP]
$tcp0 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $W(1) $tcp1
$ns_ attach-agent $node_(1) $sink1
$ns_ connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns_ at 20.0 "$ftp1 start"
#set up UDP connections
set udp0 [new Agent/UDP]
$udp0 set class_ 1
set null0 [new Agent/Null]
$ns_ attach-agent $W(2) $udp0
$ns_ attach-agent $node_(2) $null0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
#$ns_ at 15.0 "$cbr0 start"
#set up UDP connections
set udp1 [new Agent/UDP]
$udp1 set class_ 1
set null1 [new Agent/Null]
$ns_ attach-agent $W(3) $udp1
$ns_ attach-agent $node_(3) $null1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr1 attach-agent $udp1
#$ns_ at 25.0 "$cbr1 start"
for {set i 0} {$i < $opt(nn)} {incr i} {
$ns_ initial_node_pos $node_($i) 20
}
for {set i } {$i < $opt(nn) } {incr i} {
$ns_ at $opt(stop).0000010 "$node_($i) reset";
}
$ns_ at $opt(stop).0000010 "$BS(0) reset";
$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"
puts "Starting Simulation..."
$ns_ at 0.0 "$W(0) label TCPSource1"
$ns_ at 0.1 "$W(1) label TCPSource2"
$ns_ at 0.2 "$W(2) label UDPSource1"
$ns_ at 0.3 "$W(3) label UDPSource2"
$ns_ at 0.4 "$W(4) label Router"
#$ns_ at 0.5 "$node_(4) label BS"
$ns_ at 0.6 "$node_(0) label TCPSink1"
$ns_ at 0.7 "$node_(1) label TCPSink2"
$ns_ at 0.8 "$node_(2) label UDPnull1"
$ns_ at 0.9 "$node_(3) label UDPnull2"
$ns_ run
More information about the Ns-users
mailing list