Hi users,,
Anybody can send me an example of HMIP, I'm trying to do it, but My script
don't do a handoff..,,,
My script is:
# Main Program
proc main {} {
global opt ns namtrace tracefd cn_ node_ wtopo
source /home/vinicio/ns-allinone-2.31/ns-2.31/tcl/mobility/timer.tcl
# Define options
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) 800 ;# X dimension of the topography
set opt(y) 800 ;# Y dimension of the topography
set opt(ifqlen) 50 ;# max packet in ifq
set opt(seed) 0.0
set opt(tr) out.tr ;# trace file
set opt(nam) out.nam ;# nam trace file
set opt(adhocRouting) NOAH
set opt(nn) 3 ;# how many nodes are simulated
set opt(stop) 55.0 ;# simulation time
set ns [new Simulator]
set tracefd [open $opt(tr) w]
$ns trace-all $tracefd
set namtrace [open $opt(nam) w]
$ns namtrace-all $namtrace
$ns color 1 red
create-my-topo
log-mn-movement_no_topo
set-cbr
$ns at $opt(stop) "finish"
$ns run
}
#################### Topologia ##############################
proc create-my-topo {} {
global ns opt wtopo node_ cn_
set wtopo [new Topography]
$wtopo load_flatgrid $opt(x) $opt(y)
set num_wired_nodes 2
set num_bs_nodes 2
set num_wireless_nodes 1
Agent/MIPMH set reg_rtx_ 1.0
$ns set-address-format hierarchical
Simulator set mobile_ip_ 1
set HFA_Routing 1
AddrParams set domain_num_ 2
lappend cluster_num 1 3
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 2 1;
AddrParams set nodes_num_ $eilastlevel
set cn_ [$ns node 0.0.0]
$cn_ set X_ 400.0
$cn_ set Y_ 400.0
$cn_ set Z_ 0.0
$ns initial_node_pos $cn_ 10
set router [$ns node 1.0.0]
$router set X_ 400.0
$router set Y_ 300.0
$router set Z_ 0.0
$ns initial_node_pos $router 10
$ns node-config -adhocRouting $opt(adhocRouting) \
-mobileIP ON \
-addressType hierarchical \
-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 $wtopo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF
source /home/vinicio/ns-allinone-2.31/ns-2.31/tcl/cims/hfa-lib_ns-2.26.tcl
Simulator set node_factory_ MobileNode/GFA
Simulator set EnableHierRT_ 1
set god_ [create-god $opt(nn)]
set gma1 [$ns node 1.1.0]
$gma1 set X_ 200.0
$gma1 set Y_ 200.0
$gma1 set Z_ 0.0
$ns initial_node_pos $gma1 10
makeHfaBS $gma1
set gma2 [$ns node 1.2.0]
$gma2 set X_ 600.0
$gma2 set Y_ 200.0
$gma2 set Z_ 0.0
$ns initial_node_pos $gma2 10
makeHfaBS $gma2
createAddrTable $cn_
createAddrTable $router
set BS1address [AddrParams set-hieraddr [$gma1 node-addr]]
$ns node-config -wiredRouting OFF;
set node_(3) [$ns node 1.1.1]
$node_(3) set X_ 200.0
$node_(3) set Y_ 100.0
$node_(3) set Z_ 0.0
set GFAaddress [AddrParams set-hieraddr [$node_(3) node-addr]]
makeHfaMH $node_(3) $GFAaddress
set NumOfHO 110
$ns at 1.0 "$node_(3) setdest 600 100 15"
$ns duplex-link $cn_ $router 100Mb 2.0ms DropTail
$ns duplex-link $router $gma1 100Mb 2.0ms DropTail
$ns duplex-link $router $gma2 100Mb 2.0ms DropTail
}
#########################
proc log-mn-movement_no_topo { } {
Class LogTimer -superclass Timer
LogTimer instproc timeout {} {
global node_ logtimer
$node_(3) log-movement
$self sched 1
}
set logtimer [new LogTimer]
$logtimer sched 1
}
###############################
proc finish {} {
global ns tracefd namtrace opt cn_ node_
puts "Simulacion terminada"
$ns flush-trace
flush $tracefd
close $tracefd
close $namtrace
exec nam $opt(nam) &
exit 0
}
########################## trafico ######################
#---------------------------< Tráfico desde el CN hacia el MN
>------------------------------
proc set-cbr { } {
global ns cn_ node_ udp dst src
# CREACIÓN DE UN AGENTE UDP
# Nodo fuente
set udp [new Agent/UDP]
$ns attach-agent $cn_ $udp
# Nodo destino
set dst [new Agent/Null]
$ns attach-agent $node_(3) $dst
#Conexión virtual de los nodos fuente y destino
$ns connect $udp $dst
# Define el color del flujo de datos UDP
$udp set fid_ 1
# Configuración del tráfico CBR
set src [new Application/Traffic/CBR]
$src set packetSize_ 256
$src set rate_ 64000
$src attach-agent $udp
# Inicio del tráfico CBR
$ns at 3.0 "$src start"
}
main
or if someone can help and debugg my script I'm thankful
Vinicio,..
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us