#5, First Floor, 4th Street , Dr. Subbarayan Nagar, Kodambakkam, Chennai-600 024 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 create coverage hole in WSN in ns2?


Coverage hole in Wireless Sensor Network (WSN) denotes the area which is uncovered by the sensors in the region of interest in entire network area. In file coverage_hole.tcl, the hole is created in center area of the network and each sensor is having the sensing range of 12m and communication range of 24m.

Sample Code

Filename: coverage_hole.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.33527e-06 ;#12m
Phy/WirelessPhy set RXThresh_ 3.33816e-07 ;#24m
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0
#configure the nodes
$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(netif) \
-topoInstance $topo \
-channel $chan_1_ \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON \

for {set i 0} {$i < $val(nn)} { incr i }
set node_($i) [$ns node]