[問題] str2addr:address 1628741083 outside range of address fie
tcl如下:
# Creating New Simulator
set num_wired_nodes 7
set num_mobile_nodes 1
set num_bs_nodes 1 ;# number of base stations
set num_nodes [expr $num_wired_nodes + $num_mobile_nodes + $num_bs_nodes]
set bs_id $num_wired_nodes
set ns [new Simulator -multicast on]
set group0 [Node allocaddr]
set group1 [Node allocaddr]
# Parameter for wireless nodes
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
set opt(ifqlen) 50
set opt(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(adhocRouting) NOAH ;# routing protocol
set opt(x) 500 ;# X dimension of the topography
set opt(y) 500 ;# Y dimension of the topography
Mac/802_11 set SlotTime_ 0.000020 ;# 20us
Mac/802_11 set SIFS_ 0.000010 ;# 10us
Mac/802_11 set PreambleLength_ 144 ;# 144 bit
Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
Mac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps
Mac/802_11 set dataRate_ 11.0e6 ;# 11Mbps
Mac/802_11 set basicRate_ 1.0e6 ;# 1Mbps
# Setting up the traces
set f [open out.tr w]
set nf [open out.nam w]
$ns namtrace-all $nf
$ns trace-all $f
proc finish {} {
global ns nf f
$ns flush-trace
puts "Simulation completed."
close $nf
close $f
exit 0
}
#set up for hierarchical routing
#(needed for routing over a basestation)
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2 ;# domain number
lappend cluster_num 1 1 ;# cluster number for each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel $num_wired_nodes [expr $num_mobile_nodes + $num_bs_nodes]
;# number of nodes for each cluster
AddrParams set nodes_num_ $eilastlevel
#
#wired Nodes
#
set n0 [$ns node]
puts "n0: [$n0 id]"
set n1 [$ns node]
puts "n1: [$n1 id]"
set n2 [$ns node]
puts "n2: [$n2 id]"
set n3 [$ns node]
puts "n3: [$n3 id]"
set n4 [$ns node]
puts "n4: [$n4 id]"
set n5 [$ns node]
puts "n5: [$n5 id]"
set n6 [$ns node]
puts "n6: [$n6 id]"
# creating base station
$ns node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channel $chan \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace OFF \
-routerTrace OFF \
-macTrace OFF \
-movementTrace OFF
set BS(0) [$ns node 1.0.0]
$BS(0) random-motion 0
puts "Base-Station node $bs_id created"
#provide some co-ord (fixed) to base station node
$BS(0) set X_ 100.0
$BS(0) set Y_ 100.0
$BS(0) set Z_ 0.0
#設定mobile node的參數
#不需要wired routing,所以把此功能off
$ns_ node-config -wiredRouting OFF
set MH(0) [$ns_ node 1.0.1]
set MHnetif_(0) [$MH(0) set netif_(0)]
$MHnetif_(0) set-error-level $pGG $pBB $pG $pB $loss_model
#把此mobile node跟前面的base station節點做連結
[$MH(0) set regagent_] set home_agent_ [AddrParams addr2id [$HA node-addr]]
#設定mobile node的位置在(80.0, 80.0)
$MH(0) set X_ 80.0
$MH(0) set Y_ 80.0
$MH(0) set Z_ 0.0
#
#Setup Connections
#
$ns duplex-link $n0 $BS(0) 100Mb 1ms DropTail
$ns duplex-link $n2 $BS(0) 100Mb 1ms DropTail
$ns duplex-link $n5 $n1 30Mb 10ms DropTail
$ns queue-limit $n5 $n1 500
$ns duplex-link $n5 $n3 20Mb 10ms DropTail
$ns queue-limit $n5 $n3 500
$ns duplex-link $n6 $n5 6Mb 10ms DropTail
$ns duplex-link $n5 $n4 10Mb 10ms DropTail
$ns queue-limit $n5 $n4 500
$ns duplex-link $n2 $n6 6Mb 10ms DropTail
$ns duplex-link $n2 $n5 6Mb 10ms DropTail
$ns queue-limit $n2 $n5 500
$ns duplex-link $n0 $n6 12Mb 10ms DropTail
$ns duplex-link $n0 $n5 12Mb 10ms DropTail
$ns queue-limit $n0 $n5 500
#
#Set up Transportation Level Connections
#
set lossMonitor0 [new Agent/LossMonitor]
$ns attach-agent $n1 $lossMonitor0
set lossMonitor2 [new Agent/LossMonitor]
$ns attach-agent $n3 $lossMonitor2
set lossMonitor1 [new Agent/LossMonitor]
$ns attach-agent $n4 $lossMonitor1
set lossMonitor3 [new Agent/LossMonitor]
$ns attach-agent $n0 $lossMonitor3
set udp0 [new Agent/UDP]
$udp0 set dst_addr_ $group1
$udp0 set packetSize_ 1500
$ns attach-agent $n0 $udp0
set udp1 [new Agent/UDP]
$udp1 set dst_addr_ $group0
$udp1 set packetSize_ 1500
$ns attach-agent $n2 $udp1
#
#Setup traffic sources
#
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 1500
$cbr0 set interval_ 2ms
$cbr0 attach-agent $udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 1500
$cbr1 set interval_ 2ms
$cbr1 attach-agent $udp0
set mproto DM
set mrthandle [$ns mrtproto $mproto]
#
#Start up the sources
#
$ns at 0 "$cbr0 start"
$ns at 0 "$cbr1 start"
$ns at 0 "$n1 join-group $lossMonitor0 $group0"
$ns at 0 "$MH(0) join-group $lossMonitor0 $group0"
$ns at 0 "$MH(0) join-group $lossMonitor0 $group1"
$ns at 0 "$n1 join-group $lossMonitor0 $group1"
$ns at 0 "$n4 join-group $lossMonitor1 $group0"
$ns at 0 "$n4 join-group $lossMonitor1 $group1"
$ns at 0 "$n3 join-group $lossMonitor2 $group0"
$ns at 0 "$n3 join-group $lossMonitor2 $group1"
$ns at 0 "$n0 join-group $lossMonitor3 $group0"
$ns at 10 "$cbr0 stop"
$ns at 10 "$cbr1 stop"
$ns at 10 "$n1 leave-group $lossMonitor0 $group0"
$ns at 10 "$n1 leave-group $lossMonitor0 $group1"
$ns at 10 "$n4 leave-group $lossMonitor1 $group0"
$ns at 10 "$n4 leave-group $lossMonitor1 $group1"
$ns at 10 "$n3 leave-group $lossMonitor2 $group0"
$ns at 10 "$n3 leave-group $lossMonitor2 $group1"
$ns at 10 "$n0 leave-group $lossMonitor3 $group0"
$ns at 10.0 "finish"
$ns run
錯誤訊息如下:
staraddr:address 1628741083 outside range of address field length 2048
不知是否有那位大大知道問題出在那
感謝各位大大
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.122.88
Network_Sim 近期熱門文章
PTT數位生活區 即時熱門文章