NS2.27,编写wireless通信例子一问
会报错,是不是最新版本不能设置addressType?还是我的错误?
改成def也不能通过
设置propType是Propagation/TwoRayGrouund
运行的时候满屏在飙
mobile/tworayground.cc: TwoRayGround propagation model assume flat ground
请问为什么啊?
41 set topo [new Topography]
42
43 $topo load_flatgrid $val(x) $val(y)
代码如下,你说的那一段我有写
改成def,这次编译通过了
不过还是有
mobile/tworayground.cc: TwoRayGround propagation model assume flat ground
的问题
一屏一屏的
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(rp) AODV
set val(ifq) Queue/DropTail/PriQueue
set val(ifqlen) 50
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(nn) 2
set val(x) 500
set val(y) 500
set ns [new Simulator]
set tracefd [open Supperfox.tr w]
$ns trace-all $tracefd
set namtracefd [open Supperfox.nam w]
$ns namtrace-all-wireless $namtracefd $val(x) $val(y)
proc finish {} {
global ns tracefd namtracefd
$ns flush-trace
close $tracefd
close $namtracefd
# exec nam Supperfox.nam &
exit 0
}
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
set channel_(0) [new $val(chan)]
$ns node-config -addressType def \
-channel $channel_(0) \
-propType $val(prop) \
-phyType $val(netif) \
-macType $val(mac) \
-adhocRouting $val(rp) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-llType $val(ll) \
-antType $val(ant) \
-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;
}
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 2.0
$node_(1) set X_ 390.0
$node_(1) set Y_ 385.0
$node_(1) set Z_ 0.0
$ns at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
$ns at 10.0 "$node_(0) setdest 20.0 18.0 1.0"
$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp
$ns attach-agent $node_(1) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 10.0 "$ftp start"
for {set i 0} {$i<$val(nn)} {incr i} {
$ns at 150.0 "$node_($i) reset";
}
$ns at 150.0 "finish"
$ns run
相关文章:
- 求救:谁能给我扫盲移动通信业务都有啥?(05-08)
- 移动通信里update and paging是什么意思?(05-08)
- 如何培养通信的直觉(05-08)
- 最简单的适用于通信系统的前向纠错编码是什么?(05-08)
- 请问看通信文章这个词怎么解释Diversity?(05-08)
- <通信信号处理>和<现代信号处理>(05-08)