Hi all!
I am trying to simulate a simple handover scenario, one with tcp, just like in 
wireless3.tcl, and one with sctp.
However, it doesn't work properly and there are time periods where the mobile 
node doesn't send or receive any packets, while beng in the range of an access 
point. Handover latency times have many different values. For example, when the 
MN moves from HA to FA it takes 6 sec to start communicating with the new BS, 
but when it moves back the handover takes place in just 0.02 sec! As I have the 
MN  moving back and forth, I measure more handover latency times that differ 
much from those mentioned above...
Does anyone know why that happens??
Please help me if you know, I 've stuck here for over a week..:(
I post my tcl code below.
Thanks in advance,
Spyros


set ns_        [new Simulator]

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)              1000   ;# X dimension of the topography
set opt(y)              1000   ;# Y dimension of the topography
set opt(ifqlen)         5            ;# max packet in ifq
#set val(seed)           0.0
set opt(rp)             DSDV                      ; # routing protocol
set opt(nn)            1             ;# how many nodes are simulated
set num_wired_nodes      2
set num_bs_nodes         2  

set topo    [new Topography]

$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 3           ;# number of domains
lappend cluster_num 2 1 1             ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel  1 1 2 1                  ;# number of nodes in each 
cluster 
AddrParams set nodes_num_ $eilastlevel ;# of each domain


# create trace object for ns and nam

set tracefd  [open tcp-mono.tr w]
set namtrace [open tcp-mono.nam w]

$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)

# define topology
$topo load_flatgrid $opt(x) $opt(y)


#create wired nodes
set Server [$ns_ node 0.0.0] 
$Server set X_ 500.0
$Server set Y_ 850.0
$Server set Z_ 0.0

set W_node [$ns_ node 0.1.0] 
$W_node set X_ 500.0
$W_node set Y_ 710.0
$W_node set Z_ 0.0

set god_ [create-god $opt(nn)+2]

set chan_1 [new $opt(chan)] ;#umts

Mac/802_11 set dataRate_ 2.0Mb ;# UMTS data rate
Phy/WirelessPhy set Pt_ 4.5099 ;# UMTS coverage: r=500m
Phy/WirelessPhy set freq_ 2.175e9 ;# UMTS radio frequency

$chan_1 set delay 10ms
Phy/WirelessPhy set bandwidth_ 384k

$ns_ node-config -mobileIP ON \
         -adhocRouting $opt(rp) \
                 -llType $opt(ll) \
                 -macType $opt(mac) \
                 -ifqType $opt(ifq) \
                 -ifqLen $opt(ifqlen) \
                 -antType $opt(ant) \
                 -propType $opt(prop) \
                 -phyType $opt(netif) \
         -topoInstance $topo \
         -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace ON \
                 -wiredRouting ON \
         -channel $chan_1         

# Create BSs
set BS_umts [$ns_ node 1.0.0]
$BS_umts random-motion 0
$BS_umts radius 500

$BS_umts set X_ 150.0
$BS_umts set Y_ 610.0
$BS_umts set Z_ 0.000000000000

$ns_ node-config -wiredRouting OFF
 
#dimioyrgia toy purina toy kinitoy komboy
set MN [$ns_ node 1.0.1]  
$MN random-motion 0  
           
$MN set X_ 160.0
$MN set Y_ 530.0
$MN set Z_ 0.0

set HAaddress [AddrParams addr2id [$BS_umts node-addr]]
[$MN set regagent_] set home_agent_ $HAaddress

$ns_ node-config -wiredRouting ON

set BS_umts2 [$ns_ node 2.0.0]                                            
$BS_umts2 random-motion 0
$BS_umts2 radius 500

$BS_umts2 set X_ 950.0
$BS_umts2 set Y_ 610.0
$BS_umts2 set Z_ 0.000000000000

$ns_ at 1.0 "$MN setdest 950.0 530.0 15.0"
# create links between wired and BaseStation nodes
$ns_ duplex-link $Server $W_node 50Mb 0.2ms DropTail
$ns_ duplex-link-op $Server $W_node orient down

$ns_ duplex-link $W_node $BS_umts 50Mb 0.2ms DropTail
$ns_ duplex-link-op $W_node $BS_umts orient down-left

$ns_ duplex-link $W_node $BS_umts2 50Mb 0.2ms DropTail
$ns_ duplex-link-op $W_node $BS_umts2 orient down-right

set tcp1 [new Agent/TCP]
$tcp1 set packetSize_ 64
#$tcp1 set window_ 1

$ns_ attach-agent $Server $tcp1

set sink1 [new Agent/TCPSink]
$ns_ attach-agent $MN $sink1

$ns_ connect $tcp1 $sink1

set ftp0 [new Application/FTP]

$ftp0 attach-agent $tcp1


#stelnei kathe 0.01 sec apo ena paketo data ftp
#12000= 120/0.01
for {set i 1} {$i<12000} {incr i} {
  $ns_ at [expr ($i*0.01)] "$ftp0 send 64";
}

$ns_ at 42.5 "$MN setdest 105.0 530.0 15.0"
$ns_ at 81.0 "$MN setdest 950.0 530.0 15.0"
$ns_ at 102.5 "$MN setdest 105.0 530.0 15.0"
#$ns_ at 141.0 "$MN setdest 950.0 530.0 15.0"

$ns_ at  120 "stop";
$ns_ at  120 "puts \"NS EXITING...\" ; $ns_ halt"
 
proc stop {} {
    global ns_ tracefd
    $ns_ flush-trace
    close $tracefd
exec nam tcp-mono.nam &
    exit 0
}

$ns_ run





      
___________________________________________________________ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 

Reply via email to