【问题标题】:how to implement the aodv protocol in ns2如何在ns2中实现aodv协议
【发布时间】:2015-07-02 08:07:54
【问题描述】:

这是我文件 AODV.tcl 的一部分,在 ns2 中实现 AODV 示例我需要在此实现中使用 aodv.c 和 aodv.h 我不知道该怎么做?我需要使用 aodv.c 文件中的所有功能,但我不知道该怎么做?请帮忙,谢谢。

my code:
set ns [new Simulator]
set namfile [open AODV_final.nam w]
set Time [open time.tr w]
...
global TN
set TN 2
set god_ [create-god $TN]
$ns node-config -adhocRouting AODV \
         -llType LL \
     -macType Mac/802_11\
     -ifqLen 50 \
     -ifqType Queue/DropTail/PriQueue \
     -antType Antenna/OmniAntenna \
     -propType Propagation/TwoRayGround \
     -phyType Phy/WirelessPhy \
     -channel [new Channel/WirelessChannel] \
     -topoInstance $topography \
     -agentTrace ON \
     -routerTrace ON \
     -macTrace ON \
             -movementTrace ON

     set x1 150
     set y1 150
     ...
for {set j1 0} {$j1 < $TN} {incr j1 20} {
incr x1 0
incr y1 150
$node($j1) set X_ $x1
$node($j1) set Y_ $y1
$node($j1) set Z_ 0
$node($j1) color "green"
$ns at 0.000000 "$node($j1) setdest $x1 $y1 0.00"

}
...
$ns at 10.000000 "$node(0) setdest 160 450 75"
$ns connect $Tcp(0) $TcpSink(1)
$ns at 0.020000 "$Ftp(0) start"
$ns at 590.000000 "$Ftp(0) stop"
...
proc finish {} {
global ns namfile  
$ns flush-trace
close $namfile
exit 0
}
$ns at 10.000000 "finish"
$ns run

【问题讨论】:

标签: c++ protocols ns2


【解决方案1】:

"aodv.c" : ns2 文件名为 aodv.cc 。

`ns2´ 以这种方式工作:C++ 和 tcl/lib/** 文件中的所有函数都被编译成可执行文件“ns”。在模拟时使用这些文件:/usr/local/bin/ns , ns-allinone-2.3x/{ bin/tcsh8, lib// }。

实际上可以删除所有其他文件:您可以将模拟示例放在任何随机位置。


AODV 示例:aodv_ex_04.2015.tar.gz

https://drive.google.com/file/d/0B7S255p3kFXNZFlsVXhpcHZ2NFE/view?usp=sharing


【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-13
    • 2015-12-04
    • 1970-01-01
    • 2013-01-03
    • 2012-03-31
    • 2018-10-15
    相关资源
    最近更新 更多