NS2中仿真分析基于CSMA/CA的WLAN的捕获效应
来源:互联网 发布:ps淘宝修图兼职 编辑:程序博客网 时间:2024/06/06 07:37
[Description]
Capture effect is one of particular properties in the wireless communication networks. In traditional wired communication environment, the packets will be considered as collisions if two packets arrive in the same station at the same time. Even though the received power for one of the packets is much larger than the other one, the station still takes all the packets as collisions. Therefore, the throughput performance of the communication network will degrade. However, as for the wireless communication network, the station will receive the packet with larger received power if two packets arrive in the same station at the same time. This phenomenon is called "capture effect". The station will successfully receive the packet once the signal to interference noise ratio (SINR) of the received packet is larger than a determined threshold. Even though more than two packets arrive in the same station at the same time, the packet with high SINR still can be received successfully. Therefore, the capture effect plays an important role in enhancing the system performance of a wireless network.
[Have to be done before simulation]
1. Install NOAH routing protocol
2. Disable ARP function (please refer to http://140.116.164.80/~smallko/ns2/arp.htm)
3. Replace the file with mac-802_11.cc and mac-802_11.h (mac/mac-802_11.cc mac/mac-802_11.h, remember only for ns-2.31 version)
4. Recompile the ns.
If you don’t want to see the message, change the value of mydebug to 1 in mac/mac-802_11.cc and recompile ns again.
#define mydebug 0
[Tcl Script]
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) Queue/DropTail/PriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 100
set val(rp) NOAH
set ns [new Simulator]
#disable RTS/CTS
Mac/802_11 set RTSThreshold_ 3000
Mac/802_11 set dataRate_ 11Mb
Mac/802_11 set basicRate_ 1Mb
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0
#set the capture effect threshold to be 10.0
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 2.81838e-9
Phy/WirelessPhy set RXThresh_ 6.88081e-9
Phy/WirelessPhy set bandwidth_ 2e6
Phy/WirelessPhy set Pt_ 0.281838
Phy/WirelessPhy set freq_ 9.14e+6
Phy/WirelessPhy set L_ 1.0
set f [open test.tr w]
$ns trace-all $f
$ns eventtrace-all
set nf [open test.nam w]
$ns namtrace-all-wireless $nf 500 500
set topo [new Topography]
$topo load_flatgrid 500 500
create-god 3
set chan [new $val(chan)]
$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 $chan \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace OFF
for {set i 0} {$i < 3} {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0
}
$node_(0) set X_ 10.0
$node_(0) set Y_ 50.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 130.0
$node_(1) set Y_ 50.0
$node_(1) set Z_ 0.0
$node_(2) set X_ 200.0
$node_(2) set Y_ 50.0
$node_(2) set Z_ 0.0
#define static routing
set cmd "[$node_(0) set ragent_] routing 3 0 0 1 1 2 1"
eval $cmd
set cmd "[$node_(1) set ragent_] routing 3 0 0 1 1 2 2"
eval $cmd
set cmd "[$node_(2) set ragent_] routing 3 0 1 1 1 2 2"
eval $cmd
set udp [new Agent/UDP]
$ns attach-agent $node_(0) $udp
set null [new Agent/Null]
$ns attach-agent $node_(1) $null
$ns connect $udp $null
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 5Mb
$cbr set random_ false
#only send out a packet from node 0 to node 1
$cbr set maxpkts_ 1
$ns at 1.5000 "$cbr start"
$ns at 15.0 "$cbr stop"
#adjust the transmission power of node 2
#set phy2 [$node_(2) set netif_(0)]
#$phy2 set Pt_ 0.4
set udp2 [new Agent/UDP]
$ns attach-agent $node_(2) $udp2
set null2 [new Agent/Null]
$ns attach-agent $node_(1) $null2
$ns connect $udp2 $null2
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 1000
$cbr2 set rate_ 5Mb
$cbr2 set random_ false
#only send out a packet from node 3 to node 2
$cbr2 set maxpkts_ 1
$ns at 1.50001 "$cbr2 start"
$ns at 15.0 "$cbr2 stop"
for {set i 0} {$i < 3} {incr i} {
$ns initial_node_pos $node_($i) 30
$ns at 20.0 "$node_($i) reset";
}
$ns at 20.0 "finish"
$ns at 20.1 "puts \"NS EXITING...\"; $ns halt"
proc finish {} {
global ns f nf val
$ns flush-trace
close $f
close $nf
}
$ns run
[Result]
Node 2 sends out a Data packet to node 1 first. Following node 0 sends out a Data packet to node 1. Then the data packets get collided at node 1. The same situation occurs again. After that, node 2 sends out a Data packet to node 1 again. This time, node 0 does not send out packet at the same time. This transmission succeeded. Finally, node 0 succeeds in sending out the data packet to node 1.
We do the simulation again. But we enlarge the transmission power of node 2.
Remove the # and make the tcl script looks like
set phy2 [$node_(2) set netif_(0)]
$phy2 set Pt_ 0.4
Node 2 and node 0 sends out the Data packet almost at the same time. But due to the capture effect, the signal strength of Data packet sent from node 2 is larger (we enlarge the transmission power). This packet is successfully received by the node 1. Then node 1 acks the node 2. After that, node 0 retransmits the Data packet to node 1 again.
[Reference]
1. http://wise.cm.nctu.edu.tw/wise_lab/research/OPNET/capture_effect.htm
- NS2中仿真分析基于CSMA/CA的WLAN的捕获效应
- 【csma/ca协议和csma/cd协议的matlab仿真详解】
- CSMA/CA与CSMA/CD的区别
- CSMA/CA与CSMA/CD的区别
- CSMA/CA与CSMA/CD的区别
- CSMA/CD与CSMA/CA的区别
- 基于免费软件ns2的网络仿真
- 对IEEE 802.15.4中Slotted CSMA-CA的理解
- CSMA/CA协议分析
- CSMA/CA和CSMA/CD的区别 以及BTMA协议
- ns2网络模拟实验,基于NS2的距离向量算法仿真及结果分析 请大侠帮忙啊~~~
- 基于NS2的组播路由协议实现及仿真
- 基于NS2的网络路由协议仿真(AODV、COPE+AODV)
- NS2仿真分析无线网络的攻击防御(1)
- NS2仿真分析无线网络的攻击防御(2)
- linux下对NS2项目仿真分析的工具运用
- NS2仿真的一些问题
- NS2的基本仿真(不错)
- bcb6操作word
- myeclipse启动报如下错误:java.lang.RuntimeException: No application id has been found.
- Eclipse全屏插件与颜色主题插件
- send a mail
- hdu 1071 辛普森方法
- NS2中仿真分析基于CSMA/CA的WLAN的捕获效应
- UML类图几种关系的总结
- 字符识别中的图像归一化算法
- vim语系转换
- php中is_file与file_exists的性能对比
- XZ文件操作(压缩、解压)
- HTML5 Canvas鼠标与键盘事件
- Visual Studio工具箱的代码片段粘贴以及具体存放位置
- mount -t yaffs2 /dev/block/mtdblock7 /mnt