Hi Qasim, Thanks for the reply and giving suggestions on the tesing scenarios.
I made another test as you suggested, however, the result still looked positive. The following is a brief description of the settings. Two pair of nodes are create. The first pair includes n0 and n01, and they have a receiving range of 50m, CS range of 100m. They are placed at the bottom of the topology (n0(0,0), n1(90,0)), with a distance of 90m. The second pair includes n2 and n3, the receiving range is 100m, CS range is 200m. They are placed at the top of topology (n2(0,500), n3(90,500)), and again, with a distance of 90m. The two pairs are far away from each other, so they do not interfere. At second 1.0, n0 starts to transmit a packet to n1, and n2 starts to transmit a packet to n3 at the same time. If ns2 always use the same transmission range for all nodes in a script, it can only be the one of two cases in this test: 1) using 50m transmission range. In this case, both connectio will fail, and no packet will be delivered to either n1 or n3; 2) using 100m transmission range. In this case, both connection will success, and both n1 and n3 will receive a packet. If ns2 uses two different transmission ranges, only the connection between n2 and n3 will success, and the connection between n0 and n1 will fail. Consequently, only n3 will receive a data packet. After running test, I found out delivered packets by the following command: awk '$1=="r" && /AGT/' out.tr and it showed that only n3 received a packet. I am not sure if my settings is the same as what you suggested, and I am not 100% confident that this approach really works. But according to the test, it seems ns2 does support different transmission ranges this way. Any comment is welcome. Script: --------------------------- # First pair: n0 and n1, placed at the topology bottom, receiving range 50m, carrier sensing range 100m # Second pair: n2 and n3, placed at the topology top, receiving range 100m, carrier sensing range 200m # The two pairs are place far away from each other that they do not interfere # ========================================================== #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,node 1 # ======================================================================= Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 2.78831e-9 ;#100m Phy/WirelessPhy set RXThresh_ 1.11532e-8 ;#50m Phy/WirelessPhy set bandwidth_ 1Mb 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 set node_(1) [$ns node] $node_(1) random-motion 0 $node_(1) set X_ 90.0 $node_(1) set Y_ 0.0 $node_(1) set Z_ 0.0 # ======================================================================== # create node 2, node 3 # ======================================================================== Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 6.97078e-10 ;#200m Phy/WirelessPhy set RXThresh_ 2.78831e-9 ;#100m Phy/WirelessPhy set bandwidth_ 1Mb 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_(2) [$ns node] $node_(2) random-motion 0 $node_(2) set X_ 0.0 $node_(2) set Y_ 500.0 $node_(2) set Z_ 0.0 set node_(3) [$ns node] $node_(3) random-motion 0 $node_(3) set X_ 90.0 $node_(3) set Y_ 500.0 $node_(3) 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_(1) [new Agent/UDP] $ns attach-agent $node_(2) $udp_(1) $udp_(1) set fid_ 2 set null_(1) [new Agent/Null] $ns attach-agent $node_(3) $null_(1) set cbr_(1) [new Application/Traffic/CBR] $cbr_(1) set packetSize_ 512 $cbr_(1) set rate_ 200kb $cbr_(1) set maxpkts_ 1 $cbr_(1) attach-agent $udp_(1) $ns connect $udp_(1) $null_(1) $ns at 1.0 "$cbr_(1) 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 2008/1/15 Q.R.Iqbal <[EMAIL PROTECTED]>: > Hi there > > What you really need to do is to see that if you have two different pair > of nodes. One pair with the same range e.g. 50m and another pair with the > range 100m. You set both the pairs apart o they cannot interefere with > each others transmission. You will see, that the transmission range of the > node that is defined first will be set for all the nodes. > So in my case if I have a node 0 with transmission range set to 50 m then > all the nodes in that script will automatically have 50m transmission > range. Hence the pair with 100m range will also have 50m range. > On the other hand if my node 0 has the range of 100m then all the > remaining nodes will be set to that range, even though the nodes whos > range is 50m. > > So while writing your script you need to set pairs to see clearly how the > communications takes place. You want to make sure you are not simulating > bugs for 6 months. > > So when you say transmit range of n0 > n1, but ns2 has already assigned n1 > the same range as n0. Try to make two pairs, e.g. four nodes where node 0 > and 1 have same range but lower then the second pair n2 and n3 and each > pair communicated with each other, you will see that when n0 and n1 are > communicating, n2 and n3 do not communicate, e.g. ns as implied the same > transmit range to all the four nodes. Change the transmission ranges e.g > node 0 and node 1 with higher range and n2 and n3 with lower range, you > will see all nodes are transmitting. > > I think just having two nodes is ver risky to prove what you are saying > In reality to make individual transmission range to work for each node, > use need to modify the wirelessphy.cc file > > Kind regards > > Qasim Raza Iqbal > PhD Candidate, > ACNRG Lab N504, Office N505 > Adaptive Communications Networks Research Group, > School of Engineering And Applied Science > Aston University > Birmingham B4 7ET > United Kingdom > http://www.ee.aston.ac.uk/research/acrg/index.html > > > > > > > > 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 < > [EMAIL PROTECTED]> > > wrote: > > > >> ok i hope it works. > >> give me ur review > >> > >> On 1/7/08, Song Luo <[EMAIL PROTECTED]> 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 > >> <[EMAIL PROTECTED] > >> > > >> > wrote: > >> > > >> > > i have add my script as an attachment in the previous mail > >> > > > >> > > > >> > > On Jan 5, 2008 4:10 AM, Song Luo <[EMAIL PROTECTED]> 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 < > >> > > > [EMAIL PROTECTED]> 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. > > > > > -- Song Luo Intelligent Automation, Inc.