我无法运行此模拟:
set pairs [lindex $argv 0]
# ====================================
# Define options
# ====================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) $pairs ;# pair of mobilenodes
set val(rp) DSDV ;# routing protocol
# ======================================
# Main Program
# ======================================
#
# Initialize Global Variables
#
set ns [new Simulator]
set tracefd [open wl.tr w]
$ns use-newtrace
$ns trace-all $tracefd
# set up topography object
set topo [new Topography]
#1000x1000m terrain
$topo load_flatgrid 1000 1000
#
# Create General Operations Director
#
set god_ [ create-god $val(nn) ]
Mac/802_11 set RTSThreshold_ 3000
#
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# configure node
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel [new $val(chan)] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
for {set i 0} {$i < [expr {2*$val(nn)}] } {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;# disable random motion
}
#
# Provide initial (X,Y, Z=0) co-ordinates for mobilenodes
#
set rng [new RNG]
$rng seed 0
set unit 10.0;
set even_x 50.0;
set even_y 50.0;
set odd_x 50.0;
set odd_y 0.0;
for {set i 0} { $i < [expr {2*$val(nn)}] } {incr i} {
set residue [expr {$i%2}];
#puts $residue
set rand [expr [$rng uniform 0 1] + [ns-random 0] % 100];
if { $residue ==0 } {
$node_($i) set X_ [expr {$even_x + $rand}];
$node_($i) set Y_ [expr {$even_y }]
$node_($i) set Z_ 0.0;
} else {
$node_($i) set X_ [expr {$odd_x + $rand}];
$node_($i) set Y_ [expr {$odd_y}];
$node_($i) set Z_ 0.0;
}
}
for {set i 0} { $i < $val(nn) } {incr i} {
set null_($i) [new Agent/Null]
$ns attach-agent $node_([expr {($i*2)+1}]) $null_($i)
set udp_($i) [new Agent/UDP]
$ns attach-agent $node_([expr {2*$i}]) $udp_($i)
set cbr_($i) [new Application/Traffic/CBR]
$cbr_($i) set packetSize_ 1440
$udp_($i) set packetSize_ 1440
$cbr_($i) set rate_ 500k
$cbr_($i) attach-agent $udp_($i)
$ns connect $udp_($i) $null_($i)
}
for {set i 0} {$i < $val(nn)} {incr i} {
$ns at 0.0 "$cbr_($i) start"
$ns at 120.0 "$cbr_($i) stop"
}
$ns at 120.0 "$ns halt"
$ns run
$ns flush-trace
close $tracefd
puts "Starting Simulation..."
$ns run
我得到这个错误任何人都可以帮助我!!!
MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 33, dst 32, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
MAC_802_11: accessing MAC cache_ array out of range (src 32, dst 33, size 20)!
[suppressing additional MAC cache_ warnings]