NS2节点通信半径修改
2014-02-28 22:26
155 查看
ns/tcl/lib/ns-default.tcl 里有设置默认值的,传输距离250米
更改发射功率,或者接收阀值均能改变通信距离,计算公式在mobile/tworayground.cc里
ns-default.tcl 中的代码如下:
Phy/WirelessPhy set CSThresh_ 1.559e-11 //this sensoring radius
Phy/WirelessPhy set RXThresh_ 3.652e-10 //this is the communication radius
这个是默认的设置,默认的为通信距离为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.
编译threshold.cc文件的时候需要修改以下几点:
#include <iostream.h> 修改为#include <iostream> ,同时加上using namespace std;
再添加头文件:#include <cstring>
[compile threshold.cc]
$ cd ns/indep-utils/propagation/
$ g++ -lm threshold.cc -o threshold
[example]
$ ./threshold -lm TwoRayGround -r 250 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
其中的参数说明:
-pl <path-loss-exponent 路径损耗指数>
-std <shadowing-deviation 阴影方差>
-Pt <transmit-power 发射功率>
-fr <frequency 频率>
-Gt <transmit-antenna-gain 发射天线增益>
-Gr <receive-antenna-gain 接收天线增益>
-L <system-loss 系统损耗>
-ht <transmit-antenna-height 发射天线高度>
-hr <receive-antenna-height 接收天线高度>
-d0 <reference-distance 参考距离>
上面就是默认情况下传感器的设置;如果你想更改你的传感器通信半径只需要用你的半径值去替代 250参数即可。
参靠柯老师网站:http://140.116.72.80/~smallko/ns2/11b.htm
InNS-2, the default transmitting powerPt is 0.28, and thus thetransmission range (TX_range)
andphysical 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
更改发射功率,或者接收阀值均能改变通信距离,计算公式在mobile/tworayground.cc里
ns-default.tcl 中的代码如下:
Phy/WirelessPhy set CSThresh_ 1.559e-11 //this sensoring radius
Phy/WirelessPhy set RXThresh_ 3.652e-10 //this is the communication radius
这个是默认的设置,默认的为通信距离为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.
编译threshold.cc文件的时候需要修改以下几点:
#include <iostream.h> 修改为#include <iostream> ,同时加上using namespace std;
再添加头文件:#include <cstring>
[compile threshold.cc]
$ cd ns/indep-utils/propagation/
$ g++ -lm threshold.cc -o threshold
[example]
$ ./threshold -lm TwoRayGround -r 250 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
其中的参数说明:
-pl <path-loss-exponent 路径损耗指数>
-std <shadowing-deviation 阴影方差>
-Pt <transmit-power 发射功率>
-fr <frequency 频率>
-Gt <transmit-antenna-gain 发射天线增益>
-Gr <receive-antenna-gain 接收天线增益>
-L <system-loss 系统损耗>
-ht <transmit-antenna-height 发射天线高度>
-hr <receive-antenna-height 接收天线高度>
-d0 <reference-distance 参考距离>
上面就是默认情况下传感器的设置;如果你想更改你的传感器通信半径只需要用你的半径值去替代 250参数即可。
参靠柯老师网站:http://140.116.72.80/~smallko/ns2/11b.htm
InNS-2, the default transmitting powerPt is 0.28, and thus thetransmission range (TX_range)
andphysical 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
相关文章推荐
- NS2节点通信半径修改
- NS2节点通信半径修改
- NS2中修改无线节点通信半径
- NS2中如何设定无线节点的通信半径
- ns2无线节点的通信范围设置
- 在AODV中添加恶意节点:NS2: Adding Malicious Node to AODV修改版
- ns2无线节点的通信范围设置
- 修改XML文件某节点的属性值
- 用Angular写一个表格的节点的增删查等操作(带全部修改的版本)
- TinyOS学习笔记11-节点与计算机利用串口通信2-BaseStation
- js添加、修改、删除xml节点例子
- JTree中修改节点
- dedecms节点管理修改只能一个删除成多个同时删除
- Qt 操作QDomDocument对象修改节点
- C#中操作xml文件(插入节点、修改、删除)
- 实验二 串口与节点通信(下)
- 关于winform中*.exe.config中的appSettings的节点的读取与修改
- Dom4J 新建、删除、增加、修改节点的简单Demo
- ns2中无线通信距离的计算
- NS2学习笔记 在一个节点上同时使用不同的应用层协议