移动节点的传输范围设定:
根据无线网络传播模型我们可以知道,对于传输范围,主要是由接收到数据包的能量来计算出来的。在官方文档中给出,主要是由接收到的能量来确定
In this model, the shadowing fading factor is not considered. Therefore, for a unique distance, the Pr is a determinstic value. Usually, tworayground has two formulas:
- when d is less than the crossing distance: Free Space model is used.
- when d is larger than the crossing distance: the follownig formula is applied:
Pr = PtGtGrht2hr2 / (Ld4)
Based on the default settings in ns-2, we can derive a relationship between Pr and distance
Default parameter in ns-2:
- Pt = 0.28183815
- L = 1
- Antenna Gain : 1
- Antanna height 1.5m
Distance | Pr |
15m | 2.81838e-5 |
20m | 8.91754e-6 |
22m | 6.0908e-6 |
30m | 1.7615e-6 |
60m | 1.1009e-7 |
120m | 6.8808e-9 |
200m | 8.9175e-10 |
210m | 7.3365e-10 |
220m | 6.908e-10 |
230m | 5.0986e-10 |
240m | 4.3005e-10 |
250m | 3.6526e-10 |
300m | 1.7615e-10 |
350m | 9.5081e-11 |
400m | 5.5735e-11 |
450m | 3.4795e-11 |
500m | 2.2829e-11 |
550m | 1.5592e-11 |
600m | 1.1009e-11 |
650m | 7.993e-12 |
700m | 5.9425e-12 |
750m | 4.5094e-12 |
正如之前的无线节点示意图中,在网络接口层,其链接无线信道Channel,通过设置网络接口,来设定节点的传输范围,下面先给出几个用到的名词解释:
1.CSThresh_和RXThresh_两个阈值的解释
在802.11的载波侦听机制中,主要的有 Physical Carrier Sense和Virtual Carrier Sense(RTS/CTS)两种。NS-2中控制数据包接收与否也是通过CSThresh_和RXThresh_进行决定,下面对这两个值做简要介绍。
(1)Pr(接收到的信号能量) < CSThresh,则无线接口将这个信号作为噪声而丢弃,因而MAC 层不能检测到这个载波,通俗的说,对于MAC 层而言,这个信号是不存在的;
(2)CSThresh < Pr < RXThresh,无线接口将这个信号标记为错误信号,然后上传给MAC 层进行处理,因而对于MAC 层而言,该信号可以被检测到,但是不能被正确地解码,通俗的说,MAC 层将该信号视为一个干扰噪声;
(3)Pr > RXThresh,无线接口直接将该数据包上传给MAC 层,此时 MAC 层可以对该信号进行正确地解码,并进行相应地处理
在NS2 中,干扰范围的半径约为发射范围半径的2.2 倍。
其中,CTS正是我们所说的虚拟载波,RTS为物理载波。CTS的距离通常为RTS的2倍。NS2中如何设置CSThresh_和RXThresh_
本例以Propagation/TwoRayGround为例,阐述NS2中CSThresh_和RXThresh_的设置。默认情形下,无线节点的信号传输范围(TX_range)为250m,物理载波侦听范围(PCS_range)为550m。一般来说,载波侦听的范围需要设置为信号传输范围的2.2倍。在NS2中,根据ns-defaut.tcl文件内容,我们可以看到如下有关物理层的设置:
其中,RXThresh_为接收阈值,它由节点的信号传输范围(250m)计算出来,CSThresh_为载波侦听阈值,它由载波侦听阈值(550m)计算出来,从已有的研究和分析可以看出,这两个值设置的合适与否影响着MAC能否正确接收数据包。接下来主要介绍如何从范围得到阈值:NS2为我们提供了一个threshold的工具,在~ns-2.35/indep-utils/propagation传输模型,通过g++编译后使用,具体命令为:
threshold -m <propatation-model> [other-options] distance
如图所示,当我们设置传输模型为TwoRayGround以及设置距离为250米时,得到3.65262e-10,正如上表所示。
CPThresh_ refers to the capture phenomenon. If two packets are received
simultaneously, i.e. they collide, it is still possible to receive the
'stronger' packet if its signal strength is CPThresh_ times the other
packet. For example, if CPThresh_ is 10.0, the stronger packet in a
collision can be decoded if its signal strength is at least 10.0 times
that of the other packet; otherwise, both packets are lost in the
collision.