zrp 测试
#"Agent/ZRP set radius_ 2" set val(chan) Channel/WirelessChannel;# set val(prop) Propagation/TwoRayGround;# set val(netif) Phy/WirelessPhy;# set val(mac) Mac/802_11;# set val(ifq) Queue/DropTail/PriQueue;# set val(ll) LL;# set val(ant) Antenna/OmniAntenna;# set val(ifqlen) 50;# set val(nn) 25;# set val(rp) ZRP;# set val(x) 600;# set val(y) 600;# set val(stop) 30.0;# Agent/ZRP set radius_ 2;# remove-all-packet-headers add-packet-header Common Flags IP RTP ARP GAF LL LRWPAN Mac ZRP set ns_ [new Simulator] $ns_ use-newtrace set tracefd [open Grid-TCl.tr w] $ns_ trace-all $tracefd set namtrace [open Grid-TCl.nam w] $ns_ namtrace-all-wireless $namtrace $val(x) $val(y) set topo [new Topography] $topo load_flatgrid $val(x) $val(y) set god_ [create-god $val(nn)] $ns_ node-config -adhocRouting $val(rp)/ -llType $val(ll)/ -macType $val(mac)/ -ifqLen $val(ifqlen)/ -ifqType $val(ifq)/ -antType $val(ant)/ -propType $val(prop)/ -phyType $val(netif)/ -channelType $val(chan)/ -topoInstance $topo/ -agentTrace ON/ -routerTrace ON/ -macTrace OFF/ -movementTrace OFF for {set i 0} {$i<$val(nn)} {incr i} { set node_($i) [$ns_ node] $node_($i) random-motion 0;# } for {set i 0} {$i<5} {incr i} { for {set j 0} {$j<5} {incr j} { set id [expr $i*5+$j] set X [expr $j*140+20] set Y [expr $i*140+20] $node_($id) set X_ [expr $j*140+20] $node_($id) set Y_ [expr $i*140+20] $node_($id) set Z_ 0.0 puts "CO-ORD of Node $id=($X,$Y)" } } for {set i 0} {$i<$val(nn)} {incr i} { $ns_ at $val(stop).0 "$node_($i) reset" } $ns_ at $val(stop).0002 "puts /"NS EXITING.../";$ns_ halt" puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(rp)" puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)" proc stop {} { global ns_ tracefd $ns_ flush-trace close $tracefd } puts "Starting Simulation..." $ns_ run
效果如下
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150 [root@localhost ExampleTcl_for_ZRP]# /home/zrp/ns-allinone-2.33/ns-2.33/ns exForZRP.tcl num_nodes is set 25 warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl INITIALIZE THE LIST xListHead CO-ORD of Node 0=(20,20) CO-ORD of Node 1=(160,20) CO-ORD of Node 2=(300,20) CO-ORD of Node 3=(440,20) CO-ORD of Node 4=(580,20) CO-ORD of Node 5=(20,160) CO-ORD of Node 6=(160,160) CO-ORD of Node 7=(300,160) CO-ORD of Node 8=(440,160) CO-ORD of Node 9=(580,160) CO-ORD of Node 10=(20,300) CO-ORD of Node 11=(160,300) CO-ORD of Node 12=(300,300) CO-ORD of Node 13=(440,300) CO-ORD of Node 14=(580,300) CO-ORD of Node 15=(20,440) CO-ORD of Node 16=(160,440) CO-ORD of Node 17=(300,440) CO-ORD of Node 18=(440,440) CO-ORD of Node 19=(580,440) CO-ORD of Node 20=(20,580) CO-ORD of Node 21=(160,580) CO-ORD of Node 22=(300,580) CO-ORD of Node 23=(440,580) CO-ORD of Node 24=(580,580) Starting Simulation... channel.cc:sendUp - Calc highestAntennaZ_ and distCST_ highestAntennaZ_ = 1.5, distCST_ = 550.0 SORTING LISTS ...DONE! NS EXITING...