无线的各个参数
生成nam文件要使用namtrace-all-wireless, 而不是namtrace-all:
set nf [open test_1.nam w]
$ns_ namtrace-all-wireless $nf $val(x) $val(y)
在配置好节点的场景之后, 定义节点大小
for {set i 0} {$i < $opt(nn)} {incr i} {
#定义每个节点显示的大小, 这里设为5
$ns_ initial_node_pos $node_($i) 5
}
结束时, 关闭trace
proc stop {} {
global ns_ tracefd nf
$ns_ flush-trace
close $tracefd
close $nf
exit 0
}
#######################
#######################
set val(simDur) 5.0 ;#simulation duration
set val(basename) udp;#basename for this project or scenario
set val(statIntvl) 0.1 ;#statistics collection interval
set val(statStart) 0.5 ;
set val(trafStart) 0.5 ;#CBR start time
set val(cbrIntvl) 1.0 ;#CBR traffic interval
set val(chan) [ new Channel/WirelessChannel] ;# channel model
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(ifqlen) 50 ;# max packet in ifq
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(nn) 2 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 600
set val(y) 600
#######################
#######################
生成nam文件要使用namtrace-all-wireless, 而不是namtrace-all:
set nf [open test_1.nam w]
$ns_ namtrace-all-wireless $nf $val(x) $val(y)
在配置好节点的场景之后, 定义节点大小
for {set i 0} {$i < $opt(nn)} {incr i} {
#定义每个节点显示的大小, 这里设为5
$ns_ initial_node_pos $node_($i) 5
}
结束时, 关闭trace
proc stop {} {
global ns_ tracefd nf
$ns_ flush-trace
close $tracefd
close $nf
exit 0
}