Article 4WCZF Sink Location at the Surface Level

Sink Location at the Surface Level

by
aalguqha
from LinuxQuestions.org on (#4WCZF)
Hello,

I am trying to place the sink at the surface level where I assumed the surface level should be at 0,0,0 (x,y,z)
sensor 0: 0, 0, 0

and sensors are placed at different depths:

sensor 1: -20, -100, 0
sensor 2: 0, -100, 0
sensor 3: 20, -100, 0

I have tried several MAC protocols, at most of the time, they do not accept sensors located at any number greater than -100 (e.g., -200. -300, etc.). when I have the y-axis is lower than -100 (e.g., -90, -80) sink is able to receive packets from only one of the source nodes. This is another problem. Does the underwater model has a limit for the depth of an underwater sensor? If not, how I can simulate deep water scenario?

Is it reasonable to place sensors at high positive number (e.g., 1000,1000,0) and place sensors at higher depth (e.g., 1000, 1100,0), so sensors will forward packets from higher depth to lower depth to reach the sink?

Here is the node:
Code:set opt(chan) Channel/UnderwaterChannel
set opt(prop) Propagation/UnderwaterPropagation
set opt(netif) Phy/UnderwaterPhy
set opt(mac) Mac/UnderwaterMac/BroadcastMac
set opt(ifq) Queue/DropTail
set opt(ll) LL
set opt(energy) EnergyModel
set opt(txpower) 1
set opt(rxpower) 0.01
set opt(initialenergy) 10000
set opt(idlepower) 0.001
set opt(ant) Antenna/OmniAntenna ;#we don't use it in underwater
set opt(filters) GradientFilter ;# options can be one or more of
;# TPP/OPP/Gear/Rmst/SourceRoute/Log/TagFilter

set opt(dz) 10
set opt(ifqlen) 50 ;# max packet in ifq
set opt(nn) 4 ;# number of nodes in each layer
set opt(layers) 1
set opt(x) 500 ;# X dimension of the topography
set opt(y) 500 ;# Y dimension of the topography
set opt(z) [expr ($opt(layers)-1)*$opt(dz)]
#set opt(datarate) 0.1
set opt(seed) 113 ;# random seed
set opt(stop) 1000 ;# simulation time
set opt(prestop) 20 ;# time to prepare to stop
set opt(tr) "broadcastmac.tr" ;# trace file
set opt(nam) "broadcastmac.nam" ;# nam file
set opt(datafile) "broadcastmac.data";# data file
set opt(adhocRouting) Vectorbasedforward
set opt(width) 20
set opt(adj) 10
set opt(interval) 10.0
set opt(data_packet_size) 500
set opt(control_packet_size) 20

# ==================================================================

LL set mindelay_ 50us
LL set delay_ 25us
LL set bandwidth_ 0 ;# not used

Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Z_ 0.05
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

Mac/UnderwaterMac set bit_rate_ 1.0e4
Mac/UnderwaterMac set encoding_efficiency_ 1
Mac/UnderwaterMac/BroadcastMac set packet_size_ 80
set opt(transmission_time_error) 0.0001;

#set rate [lindex $argv 0];
set rate 50;
set opt(datarate) [expr 0.001*$rate];# [lindex $argv 0] ;#0.02

#Mac/UnderwaterMac/SFAMA set guard_time_ 0.00001
#Mac/UnderwaterMac/SFAMA set max_backoff_slots_ 4
#Mac/UnderwaterMac/FAMA set max_burst_ 1
#Mac/UnderwaterMac/FAMA set dataSize 500;
#Mac/UnderwaterMac/FAMA set controlSize 20;
#Mac/UnderwaterMac/FAMA set maxPropDelay 1;

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/UnderwaterPhy set CPThresh_ 10 ;#10.0
Phy/UnderwaterPhy set CSThresh_ 0 ;#1.559e-11
Phy/UnderwaterPhy set RXThresh_ 0 ;#3.652e-10
#Phy/UnderwaterPhy set Rb_ 2*1e6
Phy/UnderwaterPhy set Pt_ 0.2818
Phy/UnderwaterPhy set freq_ 25 ;#frequency range in khz
Phy/UnderwaterPhy set K_ 2.0 ;#spherical spreading

# ==================================================================
# Main Program
# =================================================================

#
# Initialize Global Variables
#
#set sink_ 1

remove-all-packet-headers
#remove-packet-header AODV ARP TORA IMEP TFRC
add-packet-header IP Mac LL ARP UWVB RMAC

set ns_ [new Simulator]
set topo [new Topography]

$topo load_flatgrid $opt(x) $opt(y) $opt(z)
#$ns_ use-newtrace
set tracefd [open $opt(tr) w]
$ns_ trace-all $tracefd

set nf [open $opt(nam) w]
$ns_ namtrace-all-wireless $nf $opt(x) $opt(y)

set data [open $opt(datafile) w]

set total_number [expr $opt(nn)-1]
set god_ [create-god $opt(nn)]

set chan_1_ [new $opt(chan)]

$ns_ at 0.0 "$god_ set_filename $opt(datafile)"

global defaultRNG
$defaultRNG seed $opt(seed)

$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
#-channelType $opt(chan) \
-agentTrace ON \
-routerTrace ON \
-macTrace ON\
-topoInstance $topo\
-energyModel $opt(energy)\
-txPower $opt(txpower)\
-rxPower $opt(rxpower)\
-initialEnergy $opt(initialenergy)\
-idlePower $opt(idlepower)\
-channel $chan_1_

set node_(0) [$ns_ node 0]
$node_(0) set sinkStatus_ 1
$node_(0) set passive 1

$god_ new_node $node_(0)
$node_(0) set X_ 0
$node_(0) set Y_ 0
$node_(0) set Z_ 0
$node_(0) set passive 1
set a_(0) [new Agent/UWSink]
$ns_ attach-agent $node_(0) $a_(0)
$a_(0) attach-vectorbasedforward $opt(width)
$a_(0) cmd set-range 20
$a_(0) cmd set-target-x -20
$a_(0) cmd set-target-y -10
$a_(0) cmd set-target-z -20
$a_(0) cmd set-filename $opt(datafile)

set node_(1) [$ns_ node 1]
$node_(1) set sinkStatus_ 1
$god_ new_node $node_(1)
$node_(1) set X_ -20
$node_(1) set Y_ -100
$node_(1) set Z_ 0
$node_(1) set-cx -20
$node_(1) set-cy -100
$node_(1) set-cz 0
$node_(1) set_next_hop 0 ;# target is node 0
#$node_(1) set passive 1
set a_(1) [new Agent/UWSink]
$ns_ attach-agent $node_(1) $a_(1)
$a_(1) attach-vectorbasedforward $opt(width)
$a_(1) cmd set-range 300
$a_(1) cmd set-target-x 0
$a_(1) cmd set-target-y 0
$a_(1) cmd set-target-z 0
$a_(1) set data_rate_ $opt(datarate)
$a_(1) cmd set-filename $opt(datafile)

set node_(2) [$ns_ node 2]
$node_(2) set sinkStatus_ 1
$god_ new_node $node_(2)
$node_(2) set X_ 0
$node_(2) set Y_ -100
$node_(2) set Z_ 0
$node_(2) set-cx 0
$node_(2) set-cy -100
$node_(2) set-cz 0
$node_(2) set_next_hop 0 ;# target is node 0
#$node_(2) set passive 1
set a_(2) [new Agent/UWSink]
$ns_ attach-agent $node_(2) $a_(2)
$a_(2) attach-vectorbasedforward $opt(width)
$a_(2) cmd set-range 300
$a_(2) cmd set-target-x 0
$a_(2) cmd set-target-y 0
$a_(2) cmd set-target-z 0
$a_(2) set data_rate_ $opt(datarate)
$a_(2) cmd set-filename $opt(datafile)

#puts "the total number is $total_number"
set node_($total_number) [$ns_ node $total_number]
$node_($total_number) set sinkStatus_ 1
$god_ new_node $node_($total_number)
$node_($total_number) set X_ 20
$node_($total_number) set Y_ -100
$node_($total_number) set Z_ 0
$node_($total_number) set-cx 20
$node_($total_number) set-cy -100
$node_($total_number) set-cz 0
$node_($total_number) set_next_hop 0 ;# target is node 0
#$node_($total_number) set passive 1

set a_($total_number) [new Agent/UWSink]
$ns_ attach-agent $node_($total_number) $a_($total_number)
$a_($total_number) attach-vectorbasedforward $opt(width)
$a_($total_number) cmd set-range 300
$a_($total_number) cmd set-target-x 0
$a_($total_number) cmd set-target-y 0
$a_($total_number) cmd set-target-z 0
$a_($total_number) set data_rate_ $opt(datarate)
$a_($total_number) cmd set-filename $opt(datafile)

#set max_num [expr $total_number -1]

#$ns_ at 15 "$a_($total_number) cbr-start"
$ns_ at 20 "$a_($total_number) exp-start"
$ns_ at 20 "$a_(1) exp-start"
$ns_ at 20 "$a_(2) exp-start"
#$ns_ at 20 "$a_(2) cbr-start"

#$ns_ at 4 "$a_(0) cbr-start"
#$ns_ at 2.0003 "$a_(2) cbr-start"

#$ns_ at 0.1 "$a_(0) announce"

puts "+++++++AFTER ANNOUNCE++++++++++++++"

$ns_ at $opt(stop).003 "$a_(1) terminate"
$ns_ at $opt(stop).004 "$a_(2) terminate"
$ns_ at $opt(stop).005 "$a_($total_number) terminate"
$ns_ at $opt(stop).006 "$a_(0) terminate"
#$ns_ at $opt(stop).002 "$a_(3) terminate"

$ns_ at $opt(stop).07 "$god_ compute_energy"
$ns_ at $opt(stop).07 "$ns_ nam-end-wireless $opt(stop)"
$ns_ at $opt(stop).07 "puts \"NS EXISTING...\"; $ns_ halt"

puts $tracefd "vectorbased"
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) z $opt(z)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
puts "starting Simulation..."

puts $data "New simulation...."
puts $data "nodes = $opt(nn), random_seed = $opt(seed), sending_interval_=$opt(interval), width=$opt(width)"
puts $data "mac is $opt(mac)"
puts $data "x= $opt(x) y= $opt(y) z= $opt(z)"
close $data

puts $tracefd "SillyRrouting"
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) z $opt(z)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
puts "starting Simulation..."
$ns_ run
result of the above script:

Code:mint@mint-VirtualBox ~/Desktop/Testing/Broadcast MAC $ ns broadcastMAC_example.tcl
When configured, ns found the right version of tclsh in /home/mint/Desktop/ns2/ns-allinone-2.34/Aqua-Sim-1.0/bin/tclsh8.4
but it doesn't seem to be there anymore, so ns will fall back on running the first tclsh in your path. The wrong version of tclsh may break the test suites. Reconfigure and rebuild ns if this is a problem.
num_nodes is set 4
INITIALIZE THE LIST xListHead
+++++++AFTER ANNOUNCE++++++++++++++
starting Simulation...
starting Simulation...
GOD: the old file name istest.data
GOD: the new file name isbroadcastmac.data
SORTING LISTS ...DONE!
UWSink (id:0): I get the packet data no.0 from 2
UWSink (id:0): I get the packet data no.1 from 2
SK 0: Num_Recv 2, InterArrival 111.418657
UWSink (id:0): I get the packet data no.2 from 2
SK 0: Num_Recv 3, InterArrival 2.232635
UWSink (id:0): I get the packet data no.3 from 2
SK 0: Num_Recv 4, InterArrival 1.190802
UWSink (id:0): I get the packet data no.4 from 2
SK 0: Num_Recv 5, InterArrival 7.379881
UWSink (id:0): I get the packet data no.5 from 2
SK 0: Num_Recv 6, InterArrival 4.779741
UWSink (id:0): I get the packet data no.6 from 2
SK 0: Num_Recv 7, InterArrival 6.774227
UWSink (id:0): I get the packet data no.7 from 2
SK 0: Num_Recv 8, InterArrival 7.423756
UWSink (id:0): I get the packet data no.8 from 2
SK 0: Num_Recv 9, InterArrival 8.192515
UWSink (id:0): I get the packet data no.9 from 2
SK 0: Num_Recv 10, InterArrival 22.893005
UWSink (id:0): I get the packet data no.10 from 2
SK 0: Num_Recv 11, InterArrival 5.213813
UWSink (id:0): I get the packet data no.11 from 2
SK 0: Num_Recv 12, InterArrival 9.721515
UWSink (id:0): I get the packet data no.12 from 2
SK 0: Num_Recv 13, InterArrival 14.738993
UWSink (id:0): I get the packet data no.13 from 2
SK 0: Num_Recv 14, InterArrival 25.232555
UWSink (id:0): I get the packet data no.14 from 2
SK 0: Num_Recv 15, InterArrival 39.268473
UWSink (id:0): I get the packet data no.15 from 2
SK 0: Num_Recv 16, InterArrival 9.244066
UWSink (id:0): I get the packet data no.16 from 2
SK 0: Num_Recv 17, InterArrival 17.707728
UWSink (id:0): I get the packet data no.17 from 2
SK 0: Num_Recv 18, InterArrival 47.101175
UWSink (id:0): I get the packet data no.18 from 2
SK 0: Num_Recv 19, InterArrival 40.739720
UWSink (id:0): I get the packet data no.19 from 2
SK 0: Num_Recv 20, InterArrival 37.923375
UWSink (id:0): I get the packet data no.20 from 2
SK 0: Num_Recv 21, InterArrival 13.958276
UWSink (id:0): I get the packet data no.21 from 2
SK 0: Num_Recv 22, InterArrival 3.743562
UWSink (id:0): I get the packet data no.22 from 2
SK 0: Num_Recv 23, InterArrival 6.475418
UWSink (id:0): I get the packet data no.23 from 2
SK 0: Num_Recv 24, InterArrival 19.777254
UWSink (id:0): I get the packet data no.24 from 2
SK 0: Num_Recv 25, InterArrival 14.132284
UWSink (id:0): I get the packet data no.25 from 2
SK 0: Num_Recv 26, InterArrival 15.934466
UWSink (id:0): I get the packet data no.26 from 2
SK 0: Num_Recv 27, InterArrival 11.903550
UWSink (id:0): I get the packet data no.27 from 2
SK 0: Num_Recv 28, InterArrival 43.826346
UWSink (id:0): I get the packet data no.28 from 2
SK 0: Num_Recv 29, InterArrival 0.213709
UWSink (id:0): I get the packet data no.29 from 2
SK 0: Num_Recv 30, InterArrival 6.140135
UWSink (id:0): I get the packet data no.30 from 2
SK 0: Num_Recv 31, InterArrival 22.323893
UWSink (id:0): I get the packet data no.31 from 2
SK 0: Num_Recv 32, InterArrival 10.444580
UWSink (id:0): I get the packet data no.32 from 2
SK 0: Num_Recv 33, InterArrival 24.343474
UWSink (id:0): I get the packet data no.33 from 2
SK 0: Num_Recv 34, InterArrival 13.649362
UWSink (id:0): I get the packet data no.34 from 2
SK 0: Num_Recv 35, InterArrival 7.882518
UWSink (id:0): I get the packet data no.35 from 2
SK 0: Num_Recv 36, InterArrival 19.855454
UWSink (id:0): I get the packet data no.36 from 2
SK 0: Num_Recv 37, InterArrival 0.704092
UWSink (id:0): I get the packet data no.37 from 2
SK 0: Num_Recv 38, InterArrival 25.269358
UWSink (id:0): I get the packet data no.38 from 2
SK 0: Num_Recv 39, InterArrival 5.623610
UWSink (id:0): I get the packet data no.39 from 2
SK 0: Num_Recv 40, InterArrival 2.636095
UWSink (id:0): I get the packet data no.40 from 2
SK 0: Num_Recv 41, InterArrival 3.125573
UWSink (id:0): I get the packet data no.41 from 2
SK 0: Num_Recv 42, InterArrival 12.906217
UWSink (id:0): I get the packet data no.42 from 2
SK 0: Num_Recv 43, InterArrival 123.607947
UWSink (id:0): I get the packet data no.43 from 2
SK 0: Num_Recv 44, InterArrival 5.941268
UWSink (id:0): I get the packet data no.44 from 2
SK 0: Num_Recv 45, InterArrival 35.203971
UWSink (id:0): I get the packet data no.45 from 2
SK 0: Num_Recv 46, InterArrival 8.393353
UWSink (id:0): I get the packet data no.46 from 2
SK 0: Num_Recv 47, InterArrival 5.837545
UWSink (id:0): I get the packet data no.47 from 2
SK 0: Num_Recv 48, InterArrival 1.010405
UWSink (id:0): I get the packet data no.48 from 2
SK 0: Num_Recv 49, InterArrival 35.578796
UWSink (id:0): I get the packet data no.49 from 2
SK 0: Num_Recv 50, InterArrival 15.098526
UWSink (id:0): I get the packet data no.50 from 2
SK 0: Num_Recv 51, InterArrival 5.624100
UWSink (id:0): I get the packet data no.51 from 2
SK 0: Num_Recv 52, InterArrival 10.063914
UWSink (id:0): I get the packet data no.52 from 2
SK 0: Num_Recv 53, InterArrival 14.211520
SINK 1 : terminates (send 57, recv 0, cum_delay 0.000000)
SINK 2 : terminates (send 53, recv 0, cum_delay 0.000000)
SINK 3 : terminates (send 36, recv 0, cum_delay 0.000000)
SINK 0 : terminates (send 0, recv 53, cum_delay 7.017810)
SINK(0) : send_id = 2, num_recv = 53
god: the energy consumped is 13.533376
NS EXISTING...
mint@mint-VirtualBox ~/Desktop/Testing/Broadcast MAC $Thanks in advance for your help.latest?d=yIl2AUoC8zA latest?i=207kYGAv7S0:-QMFu_1Hoy0:F7zBnMy latest?i=207kYGAv7S0:-QMFu_1Hoy0:V_sGLiP latest?d=qj6IDK7rITs latest?i=207kYGAv7S0:-QMFu_1Hoy0:gIN9vFw207kYGAv7S0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments