考虑链路丢失率或冲突的Mac802_11仿真 (for NS2)
2013-10-26 14:14
239 查看
In Mac802_11 simulations, packets are assumed to be received correctly within transmission range, hence a RTS will definitely get a CTS response. However, when you use shadowing propagation model, or consider link loss ratio in opportunistic routing, or consider
using competition CTS, a sender may lose CTS due to channel contention or dynamic channel condition and a RTS will be retransmitted. In this case, the specified receiver should not refuse to respond to it; otherwise any algorithm which needs RTS/CTS negotiation
may compromise its performance a lot.
Therefore, following lines need to be modified in mac/mac-802_11.cc
/* [PH] following lines will be replaced =======================
if(tx_state_ != MAC_IDLE) {
discard(p, DROP_MAC_BUSY);
return;
}
*/
/*
* If I'm responding to someone else, discard this RTS.
*/
/* if(pktCTRL_) {
discard(p, DROP_MAC_BUSY);
return;
}
*/
//=================replace by==========================
// [PH] this node may receive a re-transmitting RTS
// from its sender who didn't receive the previous CTS
// due to collision or dynamic channel condition
// thus it should cancel the waiting timer for data
// and retransmit CTS
// However, if pktCTRL_ != CTS then I should discard the received RTS
if(tx_state_ != MAC_IDLE) {
if(tx_state_ == MAC_CTS) {
hdr_mac802_11 *mh = HDR_MAC802_11(pktCTRL_);
if( ETHER_ADDR(mh->dh_ra) == ETHER_ADDR(rf->rf_ta) ) {
if(mhSend_.busy()) { mhSend_.stop();}
setTxState(MAC_IDLE);
Packet::free(pktCTRL_);
pktCTRL_ = 0;
} else {
discard(p, DROP_MAC_BUSY); //received a new RTS
return;
}
} else {
discard(p, DROP_MAC_BUSY); //I'm not waiting for data. I'm busy in sending RTS/DATA/ACK, cannot handle another connection request.
return;
}
}
using competition CTS, a sender may lose CTS due to channel contention or dynamic channel condition and a RTS will be retransmitted. In this case, the specified receiver should not refuse to respond to it; otherwise any algorithm which needs RTS/CTS negotiation
may compromise its performance a lot.
Therefore, following lines need to be modified in mac/mac-802_11.cc
/* [PH] following lines will be replaced =======================
if(tx_state_ != MAC_IDLE) {
discard(p, DROP_MAC_BUSY);
return;
}
*/
/*
* If I'm responding to someone else, discard this RTS.
*/
/* if(pktCTRL_) {
discard(p, DROP_MAC_BUSY);
return;
}
*/
//=================replace by==========================
// [PH] this node may receive a re-transmitting RTS
// from its sender who didn't receive the previous CTS
// due to collision or dynamic channel condition
// thus it should cancel the waiting timer for data
// and retransmit CTS
// However, if pktCTRL_ != CTS then I should discard the received RTS
if(tx_state_ != MAC_IDLE) {
if(tx_state_ == MAC_CTS) {
hdr_mac802_11 *mh = HDR_MAC802_11(pktCTRL_);
if( ETHER_ADDR(mh->dh_ra) == ETHER_ADDR(rf->rf_ta) ) {
if(mhSend_.busy()) { mhSend_.stop();}
setTxState(MAC_IDLE);
Packet::free(pktCTRL_);
pktCTRL_ = 0;
} else {
discard(p, DROP_MAC_BUSY); //received a new RTS
return;
}
} else {
discard(p, DROP_MAC_BUSY); //I'm not waiting for data. I'm busy in sending RTS/DATA/ACK, cannot handle another connection request.
return;
}
}
相关文章推荐
- NS2中Mac802_11::recv(Packet *p, Handler *h )函数解析
- NS2中Mac802_11定时器介绍(转帖)
- NS2中Mac802_11定时器介绍
- NS2中Mac802_11定时器介绍
- 鸟类链路上的数据报传输标准(A Standard for the Transmission of IP Datagrams on Avian Carriers,IPoAC)
- C++ 11 学习2:空指针(nullptr) 和 基于范围的for循环(Range-based for loops)
- ns2仿真学习(三)-不同tcp拥塞控制的竞争能力
- oracle11 for download official
- ORACLE 11g R2 for SUSE 11集群双机部署
- NS2仿真中nam节点颜色设置(转)
- Tkinter 8.5 参考手册: a GUI for Python (五)11 窗口的名称
- 【Data Algorithms_Recipes for Scaling up with Hadoop and Spark】Chapter 11 Smarter Email Marketing wit
- 错误记录(11): source is null for getProperty(null, "name")
- 一步一步教你在CentOS6.0下安装NS2(ns-allinone-2.34.tar.gz)模拟仿真工具
- ns2 网络仿真工具具体安装步骤
- Xaml Markup Styler For VS11
- 判断链路上数据包丢失情况
- 基于NS2的Ad Hoc网络AODV路由协议仿真[ubuntu10.04+NS2.35含代码文件] [转载]
- How to Enable 64-bit Processes for Enhanced Protected Mode in Internet Explorer 11 (IE11)
- NS2中仿真分析基于CSMA/CA的WLAN的捕获效应