Hi everyone

I am using manhattan mobility model which generates an output file
"ManhattanOuput". This file I am going to use in the TCL file "manhattan.tcl"
in ns simulator. In this TCL file using the "ManhattanOutput" i need find
the neighboring nodes of a node which are in the transmission range. I was
able to read the node initial positions in the TCL file using the "
ManhattanOuput" but not the destination position at a particular instant of
time which are mentioned in the setdest command.

Sample file "ManhattanOuput"

$node_(0) set X_ 175.970459
$node_(0) set Y_ 333.330109
$node_(0) set Z_ 0.000000
$node_(1) set X_ 126.784485
$node_(1) set Y_ 333.330109
$node_(1) set Z_ 0.000000
$node_(2) set X_ 665.670044
$node_(2) set Y_ 434.373901
$node_(2) set Z_ 0.000000
$node_(3) set X_ 775.502625
$node_(3) set Y_ 666.670044
$node_(3) set Z_ 0.000000
$node_(4) set X_ 554.983337
$node_(4) set Y_ 665.669983
$node_(4) set Z_ 0.000000
$node_(5) set X_ 801.523621
$node_(5) set Y_ 666.669983
$node_(5) set Z_ 0.000000

*# I am not able to read the values behind the setdest using  the TCL file.
*
*$ns_ at 0.000000 "$node_(0) setdest 175.316147 333.330109 0.654314"
$ns_ at 0.000000 "$node_(1) setdest 126.137932 333.330109 0.646550"
$ns_ at 0.000000 "$node_(2) setdest 665.670044 434.120819 0.253081"
$ns_ at 0.000000 "$node_(3) setdest 774.999512 666.670044 0.503137"
$ns_ at 0.000000 "$node_(4) setdest 555.629150 665.669983 0.645793"
$ns_ at 0.000000 "$node_(5) setdest 801.129395 666.669983 0.394247"
*


The above is a part of Outputfile i did same for 40 nodes.

Manhattan.tcl

#Manhattan mobility model

set val(chan)       Channel/WirelessChannel
set val(prop)       Propagation/FreeSpace
set val(netif)      Phy/WirelessPhy
set val(mac)        Mac/802_11
set val(ifq)        Queue/DropTail/PriQueue
set val(ll)         LL
set val(ant)        Antenna/OmniAntenna
set val(x)              1000   ;# X dimension of the topography
set val(y)              1000   ;# Y dimension of the topography
set val(ifqlen)         50            ;# max packet in ifq
set val(seed)           1.0
set val(adhocRouting)   AODV
set val(nn)             40             ;# how many nodes are simulated
set val(cp)             "traffic_20_30_v1"
set val(sc)             "ManhattanOutput"
set val(stop)           50.0           ;# simulation time


# Propagation Parameters for 250 m radio range

LL               set bandwidth_ 2Mb
Mac/802_11       set bandwidth_ 2Mb
Phy/WirelessPhy  set bandwidth_ 2Mb
Phy/WirelessPhy  set freq_ 9.14e+06
Phy/WirelessPhy  set Rb_   2.0e06
Phy/WirelessPhy  set Pt_   0.2818
Phy/WirelessPhy  set RXThresh_ 3.07604e-05
Phy/WirelessPhy  set CPThresh_ 10.0
Phy/WirelessPhy  set CSThresh_ 1.559e-11
Phy/WirelessPhy  set L_    1.0

# The above parameters result in a nominal range of 250 m
set nominal_range    250.0
#set configured_range -1.0



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

#
# Initialize Global Variables
#

# create simulator instance

set ns_        [new Simulator]

# setup topography object

set topo    [new Topography]

# create trace object for ns and nam

# To use the new Trace Format:
#$ns_ use-newtrace
#set tracefd    [open test-rdmm-n15v20-newtrace.tr  w]

set tracefd    [open test-rdmm-n15v20.tr  w]
set namtrace    [open  test-rdmm-n15v20.nam w]

$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

# define topology
$topo load_flatgrid $val(x) $val(y)

#
# Create God
#
set god_ [create-god $val(nn)]

#
# define how node should be created
#

#global node setting

$ns_ node-config -adhocRouting $val(adhocRouting) \
                 -llType $val(ll) \
                 -macType $val(mac) \
                 -ifqType $val(ifq) \
                 -ifqLen $val(ifqlen) \
                 -antType $val(ant) \
                 -propType $val(prop) \
                 -phyType $val(netif) \
                 -channelType $val(chan) \
         -topoInstance $topo \
         -agentTrace ON \
                 -routerTrace ON \
                 -macTrace ON \
                 -movement Trace OFF

#
#  Create the specified number of nodes [$val(nn)] and "attach" them
#  to the channel.

for {set i 0} {$i < $val(nn) } {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0        ;# disable random motion
}


#
# Define traffic model
#
puts "Loading connection pattern..."
source $val(cp)

#
# Define node movement model
#
puts "Loading scenario file..."
source $val(sc)

*# Reads just the node initial positions from the "ManhattanOuput" using the
node object $node_($i)  and writes into $tracefd but i need to  find the
next position  too. *

*proc traceHeader {} {
global tracefd; # trace file name variable
global opt; #option variable
global node_; #array of nodes variable
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
puts $tracefd "Topo nn $opt(nn) x $opt(x) y $opt(y) rp $opt(adhocRouting)"
for {set i 0} {$i $opt(nn)} {incr i} {
set x [$node_($i) set X_]
set y [$node_($i) set Y_]
set z [$node_($i) set Z_]
puts $tracefd "N node $i xPos=$x yPos=$y zPos=$z"
}
}
*

# Define node initial position in nam

for {set i 0} {$i < $val(nn)} {incr i} {

    # 20 defines the node size in nam, must adjust it according to your
scenario
    # The function must be called after mobility model is defined

    $ns_ initial_node_pos $node_($i) 40
}


#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at $val(stop).0 "$node_($i) reset";
}

$ns_ at  $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"

puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)"
puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)"
puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"


puts "Starting Simulation..."
$ns_ run

Can please anyone say is this the procedure to find the neighboring nodes or
is there any way to find neighbors using the above files.

Thanks in advance
kiran

Reply via email to