I'm using ns-2.28 for the simulation of Mobile IP. 
  
 I set the positions of MN(MobileNode), HA(HomeAgent), FA1(ForeignAgent), FA2 
are (10,10), (10,10), (800,20), (800,800). And the topo that I set is 
1000*1000. When the ns run, the positions of HA and FA are not what I set in 
NAM.However the MN's position is correct.
  
 I'd appreciate any help and any pointer to how I can find & fix this problem.
 


  
 The TCL scpirt as follow:
  
 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(ifqlen) 50
set opt(nn) 1
set opt(adhocRouting) DSDV
set opt(x)  1000
set opt(y)  1000
set opt(stop) 200
set opt(ftp1-start) 10.0
  
 set num_wired_nodes 2
  
 set ns_ [new Simulator]
  
 $ns_ node-config -addressType hierarchical
  
 AddrParams set domain_num_ 4
lappend cluster_num 2 1 1 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 1 1 1
AddrParams set nodes_num_ $eilastlevel
  
 set mytrace [open wiredcumwireless.tr w]
set mynamtrace [open wiredcumwireless.nam w]
$ns_ trace-all $mytrace
$ns_ namtrace-all-wireless $mynamtrace $opt(x) $opt(y)
  
 set topo [new Topography]
  
 $topo load_flatgrid $opt(x) $opt(y)
  
 create-god [expr $opt(nn)+3]
  
 set temp {0.0.0 0.1.0};
for {set i 0} {$i < $num_wired_nodes} {incr i} {
 set W($i) [$ns_ node [lindex $temp $i]]
}
 $W(0) label "CN"
$W(1) label "Gateway"
  
 $ns_ node-config -mobileIP ON \
  -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 HA [$ns_ node 1.0.0]
set FA1 [$ns_ node 2.0.0]
set FA2 [$ns_ node 3.0.0]
$HA random-motion 0
$FA1 random-motion 0
$FA2 random-motion 0
  
 $HA set X_ 20.00
$HA set Y_ 20.00
$HA set Z_ 0.00
$HA label "HA"
 $FA1 set X_ 800.00
$FA1 set Y_ 200.00
$FA1 set Z_ 0.00
$FA1 label "FA1"
 $FA2 set X_ 800.00
$FA2 set Y_ 800.00
$FA2 set Z_ 0.00
$FA2 label "FA2"
  
 $ns_ node-config -wiredRouting OFF
 set MN [$ns_ node 1.0.1]
set node_(0) $MN
$MN label "MN"
  
 set HAaddress [AddrParams addr2id [$HA node-addr]]
[$MN set regagent_] set home_agent_ $HAaddress
  
 $MN set Z_ 0.00
$MN set Y_ 10.00
$MN set X_ 10.00
  
 $ns_ at 10 "$MN setdest 750.00 50.00 30.00"
$ns_ at 100 "$MN setdest 900.00 900.00 30.00"
$ns_ at 150 "$MN setdest 5.00 5.00 30.00"
  
 $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $FA2 5Mb 2ms DropTail
 $ns_ duplex-link-op $W(0) $W(1) orient down
$ns_ duplex-link-op $W(1) $HA orient left-down
$ns_ duplex-link-op $W(1) $FA1 orient right-down
$ns_ duplex-link-op $W(1) $FA2 orient right-up
  
 set tcp1 [new Agent/TCP]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $W(0) $tcp1
$ns_ attach-agent $MN $sink1
$ns_ connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns_ at $opt(ftp1-start) "$ftp1 start"
  
 for {set i 0} {$i < $opt(nn)} {incr i} {
 $ns_ initial_node_pos $node_($i) 10
}
  
 for {set i 0} {$i < $opt(nn)} {incr i} {
 $ns_ at $opt(stop).0 "$node_($i) reset";
}
$ns_ at $opt(stop).0 "$HA reset"
$ns_ at $opt(stop).0 "$FA1 reset"
$ns_ at $opt(stop).0 "$FA2 reset"
 $ns_ at $opt(stop).0002 "puts \"NS EXITING...\";$ns_ halt"
$ns_ at $opt(stop).0001 "stop"
proc stop {} {
 global ns_ mytrace mynamtrace
 close $mytrace
 close $mynamtrace
  exec nam wiredcumwireless.nam &
 exit 0
}
 puts "Strating Simulation..."
$ns_ run

    ------------------
 
 
 
 
 
Best regards!
 
YosefLiu

Reply via email to