Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to set different transmission range for each node in NS2?

Description

The communication range of a node in the wireless network is generally represented as a circle. If the receiver node lies within the transmission range of a sender node, it can receive all the packets. If not, it loses all the packets. Both the sender and receiver node represent the transmission range as an ideal circle. If the receiver node is located near the edge of the communication range of the sender, it can only probabilistically receive the packets. The default transmission range of a node in the wireless network is 250m. A user can set the transmission range based on the application’s requirement. This can be achieved by assigning an appropriate value of the receiving threshold (RXThresh_) during the execution. Sample9.tcl script allows setting two different transmission ranges (500, 200) for two different groups of nodes in the network.

Sample Code

#Filename: sample9.tcl #****CONFIGURING DISTINCT TRANSMISSION RANGE FOR EVERY NODE***# #Transmission range setup #********************************** UNITY GAIN, 1.5m HEIGHT OMNI DIRECTIONAL ANTENNA SET UP ************** Antenna/OmniAntenna set X_ 0 Antenna/OmniAntenna set Y_ 0 Antenna/OmniAntenna set Z_ 1.5 Antenna/OmniAntenna set Gt_ 1.0 Antenna/OmniAntenna set Gr_ 1.0 #********************************** SET UP COMMUNICATION AND SENSING RANGE *********************************** #default communication range 250m # Initialize the SharedMedia interface with parameters to make # it work like the 914MHz Lucent WaveLAN DSSS radio interface $val(netif1) set CPThresh_ 10.0 $val(netif1) set CSThresh_ 2.28289e-11 ;#sensing range of 500m $val(netif1) set RXThresh_ 2.28289e-11 ;#communication range of 500m $val(netif1) set Rb_ 2*1e6 $val(netif1) set Pt_ 0.2818 $val(netif1) set freq_ 914e+6 $val(netif1) set L_ 1.0 # Initialize the SharedMedia interface with parameters to make # it work like the 914MHz Lucent WaveLAN DSSS radio interface $val(netif2) set CPThresh_ 10.0 $val(netif2) set CSThresh_ 8.91754e-10 ;#sensing range of 200m $val(netif2) set RXThresh_ 8.91754e-10 ;#communication range of 200m $val(netif2) set Rb_ 2*1e6 $val(netif2) set Pt_ 0.2818 $val(netif2) set freq_ 914e+6 $val(netif2) set L_ 1.0 # configure the first 5 nodes with transmission range of 500m $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif1) \ -channelType $val(chan) \ -topoInstance $topo \ -energyModel $val(energymodel) \ -initialEnergy 10 \ -rxPower 0.5 \ -txPower 1.0 \ -idlePower 0.0 \ -sensePower 0.3 \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON # Node Creation for {set i 0} {$i < 2} {incr i} { set energy($i) [expr rand()*500] $ns node-config -initialEnergy $energy($i) \ -rxPower 0.5 \ -txPower 1.0 \ -idlePower 0.0 \ -sensePower 0.3 set node_($i) [$ns node] $node_($i) color black } # configure the remaining 5 nodes with transmission range of 200m $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif2) \ -channelType $val(chan) \ -topoInstance $topo \ -energyModel $val(energymodel) \ -initialEnergy 10 \ -rxPower 0.5 \ -txPower 1.0 \ -idlePower 0.0 \ -sensePower 0.3 \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON for {set i 2} {$i < 3} {incr i} { set energy($i) [expr rand()*500] $ns node-config -initialEnergy $energy($i) \ -rxPower 0.5 \ -txPower 1.0 \ -idlePower 0.0 \ -sensePower 0.3 set node_($i) [$ns node] }

Screenshots

set different transmission range for each node in NS2