Dear all
I am trying to create a wired-cum-wireless scenario with variable number of
wireless nodes [ opt(nn) ] sending/receiving FTP data from a wired server
which [ W(0) ] which is connected to an access point [ BS(0) ].
Unfortunately when I increase the number of wireless nodes to more than 2
(let's say 10 or more), I receive this error :
warning: Route to base_stn not known: dropping pkt
I tried to find a solution and I checked many factors and variables, but it
seems nothing can solve the problem. I even fixed the location (X_,Y_,Z_) or
the nodes and I also checked if my hierarchical addressing is true. but it
seems nothing is missed. however the problem arises when I use more than 2
wireless nodes. I would be very grateful if you are able to help. the exact
code of .Tcl file is here:
set ns [new Simulator]
set tf [open tf.tr w]
# Simulation parameters stack
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/TwoRayGround ;# radio-propagation
model
set opt(netif) Phy/WirelessPhy ;# network interface type
set opt(mac) Mac/802_11 ;# MAC type
set opt(ifq) Queue/DropTail/PriQueue ;# interface
queue type
set opt(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(ifqlen) 50 ;# max packet in ifq
set qsize(wired) 200
set opt(nn) 5 ;# Number of mobile nodes
set opt(adhocRouting) DSDV ;# routing protocol
set opt(cp) "" ;# connection pattern
file
set opt(ftp-start) 0.0
set opt(x) 670 ;# x coordinate of
topology
set opt(y) 670 ;# y coordinate of
topology
set opt(seed) 0.0 ;# seed for random number
gen.
set num_wired_nodes 1 ;# number of wired servers
set num_bs_nodes 1 ;# number of base
stations
set x_base 1 ;# location of Base station
set y_base 2
set z_base 0
set flow_type(0) short_up ;# flow type
(U=upload,D=download,S=short,L=large)
set flow_type(1) short_down
set flow_type(2) long_up
set flow_type(3) long_down
set flow_no(short_up) 2 ;# number of short upload
flows (per node)
set flow_no(short_down) 2 ;# number of short download
flows (per node)
set flow_no(long_up) 2 ;# number of long upload flows
(per node)
set flow_no(long_down) 2 ;# number of
long download flows (per node)
set packetSize(short_up) 1500 ;# packet sizes
set packetSize(short_down) 1500
set packetSize(long_up) 1500
set packetSize(long_down) 1500
set lambda(0) 10; # lambda
set lambda(1) 10
set lambda(2) 10
set lambda(3) 10
set mu(0) 20000000 ;# mu? (average file size in bytes)
set mu(1) 20000000
set mu(2) 10000000
set mu(3) 10000000
set shape(0) 1.5 ;# Pareto file size shape
set shape(1) 1.5
set shape(2) 1.5
set shape(3) 1.5
# Create topography object
set topo [new Topography]
# define topology
$topo load_flatgrid $opt(x) $opt(y)
# create God
create-god [expr $opt(nn)+$num_bs_nodes]
# set up for hierarchical routing
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2 ;# number of domains
lappend cluster_num 1 1 ;# number of clusters in
each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 [expr $opt(nn)+1] ;# number of nodes
in each cluster
AddrParams set nodes_num_ $eilastlevel ;# of each domain
$ns trace-all $tf
proc finish {} {
global ns tf
$ns flush-trace
close $tf exit 0
}
# create wired nodes
set temp {0.0.0} ;# hierarchical addresses to be used
for {set i 0} {$i < $num_wired_nodes} {incr i} {
set W($i) [$ns node [lindex $temp $i]]
}
# configure for base-station node
$ns node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF
set temp {1.0.0} ;# hier address to be used for wireless domain
for {set i 1} {$i <= $opt(nn)} {incr i} {
lappend temp 1.0.$i
}
set BS(0) [ $ns node [lindex $temp 0]]
$BS(0) random-motion 0 ;# disable random motion
#provide some co-ord (fixed) to base station node
$BS(0) set X_ $x_base
$BS(0) set Y_ $y_base
$BS(0) set Z_ $z_base
#configure for mobilenodes
$ns node-config -wiredRouting OFF
for {set j 0} {$j < $opt(nn)} {incr j} {
set n($j) [ $ns node [lindex $temp \
[expr $j+1]] ]
$n($j) base-station [AddrParams addr2id \
[$BS(0) node-addr]]
}
for {set i 0} {$i< $opt(nn)} {incr i} {
$n($i) set X_ $i
$n($i) set Y_ $i
$n($i) set Z_ 0
}
#create links between wired and BS nodes
$ns duplex-link $W(0) $BS(0) 10Mb 2ms DropTail
$ns queue-limit $BS(0) $W(0) $qsize(wired)
$ns queue-limit $W(0) $BS(0) $qsize(wired)
#creating TCP source and destinations
for {set i 0} {$i<$opt(nn)} {incr i} {
for {set j 0} {$j<4} {incr j} {
for {set k 0} {$k<$flow_no($flow_type($j))} {incr k} {
set tcp_back($i,$flow_type($j),$k) [new Agent/TCP/Newreno]
$tcp_back($i,$flow_type($j),$k) set packetSize_
$packetSize($flow_type($j))
set sink_back($i,$flow_type($j),$k) [new Agent/TCPSink/DelAck]
if {($j==0)||($j==2)} {
$ns attach-agent $n($i) $tcp_back($i,$flow_type($j),$k)
$ns attach-agent $W(0) $sink_back($i,$flow_type($j),$k)
}
if {($j==1)||($j==3)} {
$ns attach-agent $W(0) $tcp_back($i,$flow_type($j),$k)
$ns attach-agent $n($i) $sink_back($i,$flow_type($j),$k)
}
$ns connect $tcp_back($i,$flow_type($j),$k)
$sink_back($i,$flow_type($j),$k)
set ftp_back($i,$flow_type($j),$k)
[$tcp_back($i,$flow_type($j),$k) attach-source FTP]
}
}
}
# Generators for random file size and inter-arrival times
for {set i 0} {$i<4} {incr i} {
set rng_time($i) [new RNG]
$rng_time($i) seed 1
set rng_size($i) [new RNG]
$rng_size($i) seed 1
}
for {set i 0} {$i<4} {incr i} {
#Random inter-arrival times at each source
set RV($i) [new RandomVariable/Exponential]
$RV($i) set avg_ 1/$lambda($i)
$RV($i) use-rng $rng_time($i)
#Random file sizes
set RVsize($i) [new RandomVariable/Pareto]
$RVsize($i) set avg_ $mu($i)
$RVsize($i) set shape_ $shape($i)
$RVsize($i) use-rng $rng_size($i)
}
for {set i 0} {$i<$opt(nn)} {incr i} {
for {set j 0} {$j<4} {incr j} {
set t [$ns now]
for {set k 0} {$k<$flow_no($flow_type($j))} {incr k} {
set t [expr $t+[$RV($j) value]]
set Conct($i,$flow_type($j),$k) $t
set Size($i,$flow_type($j),$k) [$RVsize($j) value]
puts
"$Size($i,$flow_type($j),$k)\t$i\t$j\t$k\t$Conct($i,$flow_type($j),$k)"
$ns at $Conct($i,$flow_type($j),$k) "$ftp_back($i,$flow_type($j),$k)
send $Size($i,$flow_type($j),$k)"
}
}
}
$ns at 1000 "finish"
$ns run
--
Naeem Khademi
---------------------------------------------------------
Student of Master of Computer Science
University Putra Malaysia
---------------------------------------------------------