在NS2中,如果選擇使用Propagation/TwoRayGround作為無線信号傳輸模式,預設的無線節點的傳輸範圍為250m,載波偵聽範圍是550m。載波偵聽範圍是信号傳輸範圍的2.2倍,理由是什麼不太清楚,個人分析應該是更好的消除隐藏終端的影響。
設定過程如下,打開ns-default.tcl,有:
# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11 ;#550m
Phy/WirelessPhy set RXThresh_ 3.652e-10 ;#250m
Phy/WirelessPhy set bandwidth_ 2e6 ;#2Mbps
Phy/WirelessPhy set Pt_ 0.28183815 ;#傳輸功率
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0
其中,RXThresh_指的是receiving threshold (RTX),它是由節點傳輸範圍250m計算出來的,CSThresh_指的是carrier-sense threshold (CTX),它是由載波偵聽範圍550m計算出來的。CSThresh_與RXThresh_這兩個值是功率的threshold值。通過在tcl腳本中設定它們的大小,就可以相應設定節點傳輸範圍和載波偵聽範圍。計算出RXThresh_的值要用到threshold工具,在indep-utils/propagation目錄下。具體的使用方法可以見help