2008年1月1日 星期二

set the power level of different nodes

The power level of a packet in NS is determined by the Pt_ variable which is amember of Phy/WirelessPhy defined in mac/wireless-phy.h. The power level can bechanged to x Watts for all nodes globally in tcl through the command,"Phy/WirelessPhy set Pt_ xW".

To set the power level of different nodes to different values one has to access the WirelessPhy class from a node's array of interfaces (netif_) and then set the corresponding Pt_ to the desired value.
For example, the following command sets the power level of node node_(0) to 0.5 W.
[[lindex [$node_(0) array get netif_] 1] set Pt_ 0.5]

沒有留言: