[ns] transmission range
Song Luo
sluons at gmail.com
Mon Jan 14 13:29:26 PST 2008
Hi Muhamad,
I tried your script, and understood how you did it. However, I did not
observe any data packet delivered from source to host node. Also, your
scenario looks a little bit complex for me.
So, I designed a simple scenario which has only two nodes, with different
receiving ranges (n0's range > n1's). I also used DSR to transmit one packet
from n0 to n1, and n1 to n0. There was no data packet delivery, because DSR
requres a two-way communicaiton for route discovery. But I did observed the
consequence of having different receiving range on n0 and n1: the broadcast
packets from n1 can reach n0, but those from n0 cannot reach n1.
I think this verifies that we can indeed use two different receiving ranges
in one simulaiton. The following is my tcl script. You can find more detail
on my blog, http://ns-3.blogspot.com/.
Thanks.
tcl script:
-------------------------
# n0 and n1 use the same transmission power.
# n0 has a receiving range of 250m, n1's receiving range is 160m.
# n0 and n1 are 200m away from each other.
# n1 cannot receive routing requests broadcast by n0;
# however, n0 can receive routing requests broadcast by n1.
# ==========================================================
#Definition
# ==========================================================
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/FreeSpace ;# radio-propagation
set opt(ant) Antenna/OmniAntenna ;# Antenna type
set opt(ll) LL ;# Link layer type
set opt(ifq) CMUPriQueue ;# Interface queue
set opt(ifqlen) 100 ;# max packet in ifq
set opt(netif) Phy/WirelessPhy ;# network interface
set opt(mac) Mac/802_11 ;# MAC type
set opt(nn) 2 ;# number of mobilenodes
set opt(rp) DSR ;# routing protocol
set opt(x) 1000
set opt(y) 1000
set opt(seed) 0.0
set opt(stop) 10.0
# ==========================================================
# Initialize Global Variables
# ==========================================================
set ns [new Simulator]
$ns use-newtrace
set trace [open out.tr w]
$ns trace-all $trace
set namtrace [open out.nam w]
$ns namtrace-all-wireless $namtrace $opt(x) $opt(y)
# ==========================================================
# set up topography object
# ==========================================================
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
# ==========================================================
# Create God --> General Operations Director
# ==========================================================
create-god $opt(nn)
# ==========================================================
# Create channel (koneksi wireless)
# ==========================================================
set chan_1 [new $opt(chan)]
# ==========================================================
# configure and create nodes
# ==========================================================
$ns node-config -addressType expanded \
-adhocRouting $opt(rp) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF \
-channel $chan_1
# ====================================================================
# create node 0, receiving range 250m, carrier sensing range 500m
# ====================================================================
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 9.21756e-11 ;#550m
Phy/WirelessPhy set RXThresh_ 4.4613e-10 ;#250m
Phy/WirelessPhy set bandwidth_ 512kb
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 2.4e+9
Phy/WirelessPhy set L_ 1.0
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 0.25
Antenna/OmniAntenna set Gt_ 1
Antenna/OmniAntenna set Gr_ 1
set node_(0) [$ns node]
$node_(0) random-motion 0
$node_(0) set X_ 0.0
$node_(0) set Y_ 0.0
$node_(0) set Z_ 0.0
# ===================================================================
# create node 1, receiving range 160m, carrier sensing range 400m
# ===================================================================
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.74269e-10 ;#400m
Phy/WirelessPhy set RXThresh_ 1.08918e-9 ;#160m
Phy/WirelessPhy set bandwidth_ 512kb
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 2.4e+9
Phy/WirelessPhy set L_ 1.0
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 0.25
Antenna/OmniAntenna set Gt_ 1
Antenna/OmniAntenna set Gr_ 1
set node_(1) [$ns node]
$node_(1) random-motion 0
$node_(1) set X_ 200.0
$node_(1) set Y_ 0.0
$node_(1) set Z_ 0.0
# UDP connections between from node_(0) to node_(1)
set udp_(0) [new Agent/UDP]
$ns attach-agent $node_(0) $udp_(0)
$udp_(0) set fid_ 1
set null_(0) [new Agent/Null]
$ns attach-agent $node_(1) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set rate_ 200kb
$cbr_(0) set maxpkts_ 1
$cbr_(0) attach-agent $udp_(0)
$ns connect $udp_(0) $null_(0)
$ns at 1.0 "$cbr_(0) start"
set udp_(4) [new Agent/UDP]
$ns attach-agent $node_(1) $udp_(4)
$udp_(4) set fid_ 2
set null_(4) [new Agent/Null]
$ns attach-agent $node_(0) $null_(4)
set cbr_(4) [new Application/Traffic/CBR]
$cbr_(4) set packetSize_ 512
$cbr_(4) set rate_ 200kb
$cbr_(4) set maxpkts_ 1
$cbr_(4) attach-agent $udp_(4)
$ns connect $udp_(4) $null_(4)
$ns at 5.0 "$cbr_(4) start"
$ns at $opt(stop).0002 "puts \"ns EXITING...\" ; $ns halt"
$ns at $opt(stop).0001 "finish"
proc finish {} {
$ns flush-trace
close $tracefd
close $namtrace
exit 0
}
puts "Starting Simulation..."
$ns run
On Jan 7, 2008 12:34 PM, muhamad faiz arief budianto <faizarief at gmail.com>
wrote:
> ok i hope it works.
> give me ur review
>
> On 1/7/08, Song Luo <sluons at gmail.com> wrote:
> > Hi Muhamad,
> >
> > I double checked my inbox, I did not find attachment in your email.
> Maybe it
> > is lost due to some technical issue. Could you please send the script to
> me
> > again? I really want to try your approaches.
> >
> > Thanks.
> >
> > Song
> >
> > On Jan 4, 2008 6:09 PM, muhamad faiz arief budianto <faizarief at gmail.com
> >
> > wrote:
> >
> > > i have add my script as an attachment in the previous mail
> > >
> > >
> > > On Jan 5, 2008 4:10 AM, Song Luo <sluons at gmail.com> wrote:
> > >
> > > > Can you give more detail on how you manually set node sensitivities
> > > > right before creating nodes? Do you write your code in C++ files?
> which
> > C++
> > > > or tcl files did you modify? And what are the statements? Maybe an
> > example
> > > > or the files you are currently using can better illustrates. If
> > possible,
> > > > can you send me your simulation script and modified source files, I
> am
> > very
> > > > interested in giving it a shot.
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > On Jan 4, 2008 10:56 AM, muhamad faiz arief budianto <
> > > > faizarief at gmail.com> wrote:
> > > >
> > > > >
> > > > >
> > > > > i think, actually we can't set our transmission range on each
> node,
> > > > > without
> > > > > changing or hack the code from ns.
> > > > > for now i just set my sensitivity node (RXthre, CST, etc). and set
> it
> > > > > manually just right before we create the nodes.
> > > > > I already make some simple simulation, for trying some kind of
> > > > > wireless
> > > > > sensor sims u can say .
> > > > > It has 25 node and have 3 kind of node.
> > > > > 1 node for the HOST (80 m range)
> > > > > 7 node for the MIDDLE (50 m range)
> > > > > 17 node for the END (30 m range)
> > > > > the data can travel just from the node that already on it's range.
> > > > >
> > > > > the scenario is, the field is just like war field, so i have to
> send
> > > > > data
> > > > > packet from node 13 to 0 (END to HOST).
> > > > > i disabled the movement. just try it n give me some feedback about
> the
> > > > > range
> > > > > from each node.
> > > > > If you want more clearly about the range transmission, i draw the
> > > > > field and
> > > > > node deployment with some design software (CORELDRAW).
> > > > > --
> > > > > jho
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Song Luo
> > > > Intelligent Automation, Inc.
> > >
> > >
> > >
> > >
> > > --
> > > jho
> >
> >
> >
> >
> > --
> > Song Luo
> > Intelligent Automation, Inc.
> >
>
>
> --
> jho
>
--
Song Luo
Intelligent Automation, Inc.
More information about the Ns-users
mailing list