`
kanwoerzi
  • 浏览: 1647823 次
文章分类
社区版块
存档分类
最新评论

NS2节点通信半径修改

 
阅读更多

ns/tcl/lib/ns-default.tcl 里有设置默认值的,传输距离250米

更改发射功率,或者接收阀值均能改变通信距离,计算公式在mobile/tworayground.cc里

ns-default.tcl 中的代码如下:

Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10

这个是默认的设置,默认的为通信距离为250米

修改步骤:

To set communication radius, you have to set the receiving threshold value, RXThresh_. This can be obtained by running the program ~ns/indep-utils/propagation/threshold.cc (compile using g++ and the option –lm) and specifying the propagation model and the desired radius. Then in your script, before creating the simulator, use the command “Phy/WirelessPhy set RXThresh_ ”. Ideally, you would also like to set the transmission power, Pt_ and the carrier sensing threshold, CSThresh_. But I still don’t know how to obtain their values. Some standard values for Pt_ are: 7.214e-4 for 100m, 8.5872e-4 for 40m. Also note that the effectiveness of the radius depends on the propagation model. While it works perfectly for FreeSpace, it might not work as well for the other two.
[compile threshold.cc]
$ cd ns/indep-utils/propagation/
$ g++ -lm threshold.cc -o threshold

[example]
$ threshold -m TwoRayGround 250
distance = 250
propagation model: TwoRayGround

Selected parameters:
transmit power: 0.281838
frequency: 9.14e+08
transmit antenna gain: 1
receive antenna gain: 1
system loss: 1
transmit antenna height: 1.5
receive antenna height: 1.5

Receiving threshold RXThresh_ is: 3.65262e-10
$

参靠柯老师网站:
http://140.116.72.80/~smallko/ns2/11b.htm

In NS-2, the default transmitting power Pt is 0.28, and thus the transmission range (TX_range) and physical carrier sensing range (PCS_range) are calculated as 250 meters and 550 meters
p.s. (0.28183815×1.52×1.52) / (2504)=3.652e-10

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics