AssalamOAlikum.
i think your problem is very obvious that you are placing your node out of the
range of other nodes and i think there is no way to communicate directly with a
node that is out of range.
so i think you bring them into the range of other node by reducing the "X" and
"Y" coordinates of a node if you want to communicate directly with each nodes.
other wise you may use 1 hope communication.
hope this may solve your problem.
Regard,
Amjad Ali
PhD Student
School of Electrical Engineering and Computer Science(SEECS)
NUST Pakistan
///////////////////////////////////////////////////////////////////////////////////////////
i am simulating a scenario where i have 5 nodes arranged in following order
2 4
0
1 3
the script of the file is
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 5 ;# number of mobilenodes
set val(rp) DumbAgent ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
set val(finish) 50 ;# time of simulation end
# ======================================================================
# Main Program
# ======================================================================
# Initialize Global Variables
set ns [new Simulator]
set tracefd [open tracefile.tr w]
set namtrace [open out.nam w]
$ns use-newtrace
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Define a 'finish' procedure
proc finish {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam out.nam &
}
# Set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create God
create-god $val(nn)
#Create channel
set chan_1 [new $val(chan)]
# Create the specified number of mobilenodes [$val(nn)] and "attach" them to
the channel.
# Here five nodes are created
# Configure 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) \
-channel $chan_1 \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace ON \
-movementTrace OFF \
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.55903e-11 ;#550m
Phy/WirelessPhy set RXThresh_ 3.65213e-10 ;#250m
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
Mac/802_11 set SlotTime_ 0.000050 ;# 50us
Mac/802_11 set SIFS_ 0.000028 ;# 28us
Mac/802_11 set DIFS_ 0.000128 ;# 128us
Mac/802_11 set PreambleLength_ 72 ;# 144 bit
Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
Mac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps
#Mac/802_11 set dataRate_ 1.0e6 ;# 1Mbps
#Mac/802_11 set basicRate_ 1.0e6 ;# 1Mbps
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;
}
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
$node_(0) set X_ 150.0
$node_(0) set Y_ 200.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 250.0
$node_(1) set Y_ 100.0
$node_(1) set Z_ 0.0
$node_(2) set X_ 50.0
$node_(2) set Y_ 300.0
$node_(2) set Z_ 0.0
$node_(3) set X_ 50.0
$node_(3) set Y_ 100.0
$node_(3) set Z_ 0.0
$node_(4) set X_ 250.0
$node_(4) set Y_ 300.0
$node_(4) set Z_ 0.0
# Setup traffic flow between nodes
# UDP connections between node_(2) and node_(3)
set udp [new Agent/UDP]
set sink [new Agent/Null]
$ns attach-agent $node_(2) $udp
$ns attach-agent $node_(3) $sink
$ns connect $udp $sink
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr attach-agent $udp
$ns at 1.0 "$cbr start"
# Define node initial position in nam
for { set i 0 } { $i < $val(nn) } { incr i } {
$ns initial_node_pos $node_($i) 30
}
# Telling nodes when the simulation ends
for {set i 0 } {$i < $val(nn) } {incr i} {
$ns at $val(finish) "$node_($i) reset";
}
# Ending nam and the simulation
$ns at $val(finish) "$ns nam-end-wireless $val(finish)"
$ns at $val(finish) "finish"
$ns at 50.01 "puts \"ns EXITING...\" ; $ns halt"
puts "Starting Simulation..."
$ns run
the problem is in 802_11.cc file. actually there is adaptive fidelity algorithm
which bascially keep track of the nodes within radion range of thenode.in my
case this section is skipped out mening by the program is not entering this
algorithm.what can be the problem.
just above this code is the following code
if(dst != (u_int32_t)index_)
{
set_nav(mh->dh_duration);
}
i modify the above as
if(dst != (u_int32_t)index_)
{
set_nav(mh->dh_duration);
printf("%x %x %x %x",index_ , dst, src, nav_);
}
i hope i will get the index of current node, index of destination, index of
source, cuurent value of nav_.
kindly reply back. as my work is stuck at this point.
Neeraj Gupta
Assistant Professor
HOD, CSE & IT Department
Hindu College of Engineering
Sonepat