hello,
sorry to be a bother again. i solved all the previous problems mentioned
earlier.BUT i have a final problem on my simulation. i configured my mobile
node to move from bs1 to bs2 to bs3 to bs4 BUT it doesnt move. i have tried all
i can but no luck.please does any one know what could be wrong.below is my
script.
# Basic Mobile IPv6 example without using ns-topoman
# Needs proc defined in file proc-mipv6-config.tcl
# ======================================================================
# Define options
# ======================================================================
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 opt(nn) 1 ;# number of mobilenodes
set opt(adhocRouting) DSDV ;# routing protocol
set opt(cp) "" ;# cp file not used
set opt(sc) "" ;# node movement file.
set opt(x) 1500 ;# x coordinate of topology
set opt(y) 1500 ;# y coordinate of topology
set opt(seed) 0.0 ;# random seed
set opt(stop) 130 ;# time to stop simulation
set opt(ftp1-start) 10.0
set num_wired_nodes 4
#set num_bs_nodes 4 ; this is not really used here.
# ======================================================================
Agent/MIPv6/MN set bs_forwarding_ 0 ; # 1 if forwarding from previous
BS
################################################################
proc log-mn-movement_no_topo { } {
global logtimer ns
Class LogTimer -superclass Timer
LogTimer instproc timeout {} {
global mobile_
$mobile_ log-movement
$self sched 1
}
set logtimer [new LogTimer]
$logtimer sched 1
}
################################################################
# Create Topology
################################################################
proc create-my-topo {} {
global ns opt topo mobile_ cn_ mnn_nodes_
# Create and define topography
set topo [new Topography]
# set prop [new $opt(prop)]
# $prop topography $topo
$topo load_flatgrid 1500 1500
# god is a necessary object when wireless is used
# set to a value equal to the number of mobile nodes
create-god 5
# Call node-config
$ns node-config \
-addressType hierarchical \
-agentTrace ON \
-routerTrace ON
# Set NS Addressing
AddrParams set domain_num_ 5
AddrParams set cluster_num_ {4 1 1 1 1 }
AddrParams set nodes_num_ {1 1 1 1 2 1 1 1}
# Create Nodes
set cn_ [create-router 0.0.0]
set router1_ [create-router 1.0.0]
set router2_ [create-router 2.0.0]
set router3_ [create-router 3.0.0]
set bs1_ [create-base-station 2.1.0 2.0.0 250 1050 0]
set bs2_ [create-base-station 2.2.0 2.0.0 1050 600 0]
set bs3_ [create-base-station 3.1.0 3.0.0 950 300 0]
set bs4_ [create-base-station 3.2.0 3.0.0 250 300 0]
set mobile_ [create-mobile 2.1.1 2.1.0 250 1000 0 1 0.01]
$bs1_ random-motion 0
$bs2_ random-motion 0
$bs3_ random-motion 0
$bs4_ random-motion 0
# Create Links
$ns duplex-link $cn_ $router1_ 100Mb 2ms DropTail
$ns duplex-link $router1_ $router2_ 100Mb 2ms DropTail
$ns duplex-link $router1_ $router3_ 100Mb 2ms DropTail
$ns duplex-link $router2_ $bs1_ 100Mb 2ms DropTail
$ns duplex-link $router2_ $bs2_ 100Mb 2ms DropTail
$ns duplex-link $router3_ $bs3_ 100Mb 2ms DropTail
$ns duplex-link $router3_ $bs4_ 100Mb 2ms DropTail
$ns duplex-link-op $cn_ $router1_ orient down
$ns duplex-link-op $router1_ $router2_ orient left-down
$ns duplex-link-op $router1_ $router3_ orient right-down
$ns duplex-link-op $router2_ $bs1_ orient left-down
$ns duplex-link-op $router2_ $bs2_ orient right-down
$ns duplex-link-op $router3_ $bs3_ orient down
$ns duplex-link-op $router3_ $bs4_ orient right-down
display_ns_addr_domain
}
################################################################
# End of Simulation
################################################################
proc finish { } {
global tracef ns namf opt mobile_ cn_
puts "Simulation finished"
# Dump the Binding Update List of MN and Binding Cache of HA
[[$mobile_ set ha_] set regagent_] dump
[$cn_ set regagent_] dump
[$mobile_ set regagent_] dump
$ns flush-trace
flush $tracef
close $tracef
close $namf
#puts "running nam with $opt(namfile) ... "
#exec nam $opt(namfile) &
exit 0
}
################################################################
# Main
################################################################
proc main { } {
global opt ns TOPOM namf n tracef mobile_ cn_
source ../../tcl/mobility/timer.tcl
set NAMF out.nam
set TRACEF out.tr
set INFOF out.info
set opt(mactrace) ON
set opt(NAM) 1
set opt(namfile) $NAMF
set opt(stop) 130
set opt(tracefile) $TRACEF
#>--------------- Extract options from command line ---------------<
#Getopt ; # Get option from the command line
#DisplayCommandLine
#>---------------------- Simulator Settings ----------------------<
set ns [new Simulator]
# Global mobility needs special settings:
# normal interface (ALL) or dual (DUAL)
if { [info exists opt(global)] && $opt(global) == "ON" } {
$ns node-config -net-iface-type "DUAL"
}
#>------------------------ Open trace files ----------------------<
exec rm -f $opt(tracefile)
set tracef [open $opt(tracefile) w]
#... dump the file
$ns use-newtrace
$ns trace-all $tracef
set namf [open $opt(namfile) w]
$ns namtrace-all $namf
#>------------- Protocol and Topology Settings -------------------<
create-my-topo
log-mn-movement_no_topo
# MH starts to move towards FA1
$ns at 10.000000000000 "$mobile_ setdest 950.000000000000
1000.000000000000 20.000000000000"
# MH move from FA1 towards FA2
$ns at 50.000000000000 "$mobile_ setdest 950.000000000000
350.000000000000 20.000000000000"
# MH move from FA2 towards FA3
$ns at 85.000000000000 "$mobile_ setdest 250.000000000000
350.000000000000 20.000000000000"
#>----------------------- Run Simulation -------------------------<
$ns at $opt(stop) "finish"
$ns run
$ns dump-topology $namf
close $namf
#puts "running nam with $opt(namfile) ... "
#exec nam $opt(namfile) &
}
proc set-cbr { } {
global ns cn_ mobile_
set tcp1 [new Agent/TCP]
$ns attach-agent $cn_ $tcp1
set dst [new Agent/TCPSink]
$ns attach-agent $mobile_ $dst
$ns connect $tcp1 $dst
set ftp1 [new Application/FTP]
$ftp1 set packetSize_ 1040
$ftp1 set rate_ 100k
$ftp1 set interval_ 0.05
$ftp1 attach-agent $tcp1
$ns at 10.0 "$ftp1 start"
}
main