Hello all,
I am using the following tcl script to simulate a
simple wired-cum-wireless topology. The problem is
that the transmited packes never make it behind the
base station (i.e. They never reach the wireless
nodes)
Would anyone know what am I mising in the script?
The topology that I am trying to simulate is the
following:

 |s1|                    | dest1 |
     \                    /                           
      \                  /                        
       \                /                             
       |e1|-----------|BS|
       /                \    
      /                  \  
     /                    \
  |s2|                   | dest2 |

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)             2                       
set opt(adhocRouting)   DSDV                      
set opt(cp)             ""                        
#set opt(sc)            
"../mobility/scene/scen-3-test"   
set opt(sc)             ""
#set opt(stop)           250                          

set num_wired_nodes      3
set num_bs_nodes         1


set ns [new Simulator]
set testTime 102.0

#Agent/TCP set window_ 64

# 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 3 3              
  AddrParams set nodes_num_ $eilastlevel 

if {$argc < 2} {
        puts stderr "ns tfrc.tcl \[x (bottleneck in
Mbit/s)\] \[Sack|Newreno (TCP version)\]" 
        exit 1
}

set C [lindex $argv 0]
set tcpver [lindex $argv 1]

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 a nam trace datafile.
set namfile [open out.nam w]
$ns namtrace-all-wireless $namfile $opt(x) $opt(y)

#open the trace file
set tracefile1 [open out_tfrc.tr w]
$ns trace-all $tracefile1



# Set up the network topology shown at the top of this
file:
set temp {0.0.0 0.0.2 0.0.1 1.0.0 1.0.1 1.0.2}
set s1 [$ns node [lindex $temp 0]]
set s2 [$ns node [lindex $temp 1]]
set e1 [$ns node [lindex $temp 2]]

$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 BS [$ns node [lindex $temp 3]]
$BS random-motion 0

#configure for mobilenodes
$ns node-config -wiredRouting OFF


set dest1 [$ns node [lindex $temp 4]]
$dest1 base-station [AddrParams addr2id [$BS
node-addr]]
$dest1 random-motion 0

set dest2 [$ns node [lindex $temp 5]]
$dest2 base-station [AddrParams addr2id [$BS
node-addr]]
$dest2 random-motion 0

$s1 set X_ 50.0
$s1 set Y_ 400.0
$s1 set Z_ 0.0

$s2 set X_ 50.0
$s2 set Y_ 200.0
$s2 set Z_ 0.0

$e1 set X_ 100.0
$e1 set Y_ 300.0
$e1 set Z_ 0.0

$BS set X_ 200.0
$BS set Y_ 300.0
$BS set Z_ 0.0

$dest1 set X_ 205.0
$dest1 set Y_ 305.0
$dest1 set Z_ 0.0

$dest2 set X_ 205.0
$dest2 set Y_ 295.0
$dest2 set Z_ 0.0

$ns initial_node_pos $dest1 10
$ns initial_node_pos $dest2 10
#$ns initial_node_pos $BS 20

$ns duplex-link $s1 $e1 10Mb 5ms DropTail
$ns duplex-link $s2 $e1 10Mb 5ms DropTail

$ns duplex-link $e1 $BS $C.Mb 5ms DropTail

#$ns duplex-link $e2 $dest1 10Mb 5ms DropTail
#$ns duplex-link $e2 $dest2 10Mb 5ms DropTail

# TFRC
set ftp2 [$ns create-connection TFRC $s2 TFRCSink
$dest2 5]
$ns color 2 blue
$ftp2 set fid_ 2

# TCP
if {$tcpver == "Sack"} {

  set tcp1 [new Agent/TCP]
  $ns color 1 red
  $tcp1 set class_ 1
  set sink1 [new Agent/TCPSink]
  $ns attach-agent $s1 $tcp1
  $ns attach-agent $dest1 $sink1
  $ns connect $tcp1 $sink1
  set ftp1 [new Application/FTP]
  $ftp1 attach-agent $tcp1
        #set tcp1 [new Agent/TCP/FullTcp/Sack]
        #set ftp1 [new Application/FTP]
        #$ftp1 attach-agent $tcp1
        #set sink [new Agent/TCP/FullTcp/Sack]
        #$ns attach-agent $s1 $tcp1
        #$ns attach-agent $dest1 $sink
        #$tcp1 set window_ $win
        #$sink set window_ $win
        #$ns color 1 red
        #$tcp1 set fid_ 1
        #$sink set fid_ 1
        #$ns connect $tcp1 $sink
        # set up TCP-level connections
        #$sink listen ; # will figure out who its peer is
} else {
        set agent(1) [new Agent/TCP/Newreno]
        $ns attach-agent $s1 $agent(1)
        set ftp1 [new Application/FTP]
        $ftp1 attach-agent $agent(1)
        set agent(2) [new Agent/TCPSink]
        $ns attach-agent $dest1 $agent(2)
        $ns connect $agent(1) $agent(2)
        $ns color 3 green
        $ftp1 set fid_ 3
}

proc finish {} {
   puts "Ending Simulation..."
   global ns namfile tracefile1 C tcpver
   set file "./script-tfrc.sh"
   $ns flush-trace
   close $tracefile1
   close $namfile
   exec nam out.nam &
   exec $file $C $tcpver
   exit 0
}

$ns at 0.3 "$ftp1 start"
$ns at 20.0 "$ftp2 start"
$ns at [expr $testTime - 20] "$ftp2 stop"
$ns at $testTime "$ftp1 stop"
$ns at [expr $testTime + 1.0] "finish"

puts "Starting Simulation..."
$ns run

====================================
Any help would be greatly appreciated
Thank you
Ahmed





 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

Reply via email to