hello everybody:I use NS2-2.27 recently,the OS is Fedora Core 5 ,and encounter 
a problem while I run a wireless simulation.first is the tcl 
script:mobileIP.tcl# 
======================================================================#         
                     Options# 
====================================================================== set 
opt(nn)              1           ;# one MHset num_wired_nodes      2           
;# two wired nodes set opt(x)      670                 ;# x coordinate of 
topologyset opt(y)      670                 ;# y coordinate of topology set 
opt(ftp1-start)      100.0         ;#start to transfer ftpset opt(stop)         
 250          ;#simulation stop set opt(tr-ns)    infra-out.tr             ;# 
set trace fileset opt(tr-nam)  infra-out.nam          ;# set nam  # 
======================================================================#         
                      MAC# 
====================================================================== 
Mac/802_11!
  set dataRate_        2.0e6         ;# transfer rate 2MbpsMac/802_11 set 
RTSThreshold_    3000         ;# not use RTS/CTS # 
======================================================================#         
                      Nodes# 
====================================================================== set ns_  
 [new Simulator]$ns_ node-config -addressType hierarchical          ;# address 
mode AddrParams set domain_num_ 3           ;# set 3 domain: wired, wireless, 
wirelesslappend cluster_num 2 1 1              ;# set 2 clusters for wired 
domain,1 to wireless 1, 1 to wireless 2AddrParams set cluster_num_ 
$cluster_numlappend eilastlevel 1 1 2 1            ;#set 1 node for wired 
domain, cluster 1, 1 node for wired domain, cluster 2                           
     ;# set two nodes for wireless 1, cluster 1, set one node for wireless 2, 
cluster 1AddrParams set nodes_num_ $eilastlevel  ;# of each domain set tracefd  
[open $opt(tr-ns) w]set namtrace [open $opt(tr-nam) w]$ns_ trace!
 -all $tracefd$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y) set 
topo   [new Topography]$topo load_flatgrid $opt(x) $opt(y) create-god [expr 
$opt(nn) + 2]#   2 for HA and FA 
#-----------------------------------------------------------#                   
       wired nodes#----------------------------------------------------------- 
#set wired nodesset temp {0.0.0 0.1.0}           ;# hierarchical addressesfor 
{set i 0} {$i < $num_wired_nodes} {incr i} {    set W($i) [$ns_ node [lindex 
$temp $i]]} #-----------------------------------------------------------#       
            hybrid and wireless 
nodes#----------------------------------------------------------- $ns_ 
node-config  -mobileIP ON \                 -adhocRoutiing DSDV \               
  -llType LL \                 -macType Mac/802_11 \                 -ifqType 
Queue/DropTail/PriQueue \                 -ifqLen 50 \                 -antType 
Antenna/OmniAntenna \                 -propType Propagation/TwoRayGround \      
           -phyType Phy/WirelessPhy \                 -channel [n!
 ew "Channel/WirelessChannel"] \                 -topoInstance $topo \          
       -wiredRouting ON \                 -agentTrace ON \                 
-routerTrace OFF \                 -macTrace OFF # set HA and FAset HA [$ns_ 
node 1.0.0]   ;#domain 2, cluster 1, node 1set FA [$ns_ node 2.0.0]   ;#domain 
3, cluster 1, node 1 $HA set X_ 1.00$HA set Y_ 2.00$HA set Z_ 0.00 $FA set X_ 
650.00$FA set Y_ 600.00$FA set Z_ 0.00 # create links between wired and 
BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link 
$W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA 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) $FA orient right-down # create a mobilenode 
(in the domain of the HA)# that is moving between HA and FA.$ns_ node-config 
-wiredRouting OFF #set Mobile Hostset MH [$ns_ node 1.0.1]#register MH to HAset 
HAaddress [AddrParams addr2id [$HA node-addr]][$MH set regagent!
 _] set home_agent_ $HAaddress$MH set Z_ 0.00$MH set Y_ 2.00$MH set X_ 
2.00 # at 100 sec,MH move towards FA$ns_ at 100.00 "$MH setdest 640.00 610.00 
20.00"# at 200 sec,MH move towards HA$ns_ at 200.00 "$MH setdest 2.00 2.00 
20.00" # Define initial node position in nam$ns_ initial_node_pos $MH 20 
#==================================================================#            
                 
Agents#================================================================== set 
tcp1 [new Agent/TCP]$tcp1 set class_ 2set sink1 [new Agent/TCPSink]$ns_ 
attach-agent $W(0) $tcp1$ns_ attach-agent $MH $sink1$ns_ connect $tcp1 
$sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 
$opt(ftp1-start) "$ftp1 start" 
#==================================================================#            
                 
End#================================================================== $ns_ at 
$opt(stop).0 "$MH reset";$ns_ at $opt(stop).0 "$HA reset";$ns_ at $opt(stop).0 
"$FA reset"; $ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"$ns_ 
at $opt(stop)!
 .0001 "finish" proc finish {} {    global ns_ tracefd namtrace    close 
$tracefd    close $namtrace    exec rm -f out-tcp.xgr    exec awk -f 
fil-tcp.awk infra-out.tr > out-tcp.xgr    exec xgraph out-tcp.xgr &    exec nam 
infra-out.nam &} puts "Starting Simulation..."$ns_ 
run***************************************************************************AND
 THEN WHEN I use "ns mobileIP.tcl",system return following error info:[EMAIL 
PROTECTED] testns]# ns mobileIP.tclnum_nodes is set 3can't read "regagent_": no 
such variable    while executing"subst $[subst $var]"    (procedure "_o115" 
line 5)    (SplitObject set line 5)    invoked from within"$MH set regagent_"   
 invoked from within"[$MH set regagent_] set home_agent_ $HAaddress"    (file 
"mobileIP.tcl" line 264)
 
I can run the test-suite-WLtutorial.tcl wireless3,and not appear above error 
info. I use google to find the reason,but I can't find anything useful.Hope 
anyone can give some advises!Thanks in advance.
_________________________________________________________________
中国十大热门旅游景点
http://search.msn.com/results.aspx?q=%E4%B8%AD%E5%9B%BD%E5%8D%81%E5%A4%A7%E9%A3%8E%E6%99%AF&mkt=zh-CN&form=QBRE

Reply via email to