Hi ns2 users.

I try to exchange data in wireless environnement.

However, I'm not able to use routing informations : nodes that are in  
antennas range are
able to exchange informations, but when I have the following scheme  
(for communication
range, I mean)
A <-> B
B <-> C (and not A <->C), A and C are not able to exchange informations.

Does anyone knows how to exchange these informations ? As I use the  
same principle as in
the ping application (which means : using the send() function), I am  
supposed to think
that I do it on the right way, but maybe I'm wrong ?

I put here an extract of my tcl file (which the minimum lines ...)

Thanks.

Julien Thomas

# ======================================================================
# Define options
# ======================================================================
set opt(chan)           Channel/WirelessChannel  ;# channel type
set opt(prop)           Propagation/TwoRayGround ;# radio-propagation model
set opt(netif)          Phy/WirelessPhy          ;# network interface type
set opt(mac)            Mac/802_11               ;# MAC type
set opt(ifq)            Queue/DropTail/PriQueue  ;# interface queue type
set opt(ll)             LL                       ;# link layer type
set opt(ant)            Antenna/OmniAntenna      ;# antenna model
set opt(ifqlen)         50                       ;# max packet in ifq
set opt(nn)             3                        ;# number of mobilenodes
set opt(adhocRouting)   OLSR                     ;# routing protocol
set opt(cp)             "";  
#"~/bin/ns-2/ns-2.31/tcl/mobility/scene/cbr-3-test"  ; #
connection pattern file
set opt(sc)             "";  
#"~/bin/ns-2/ns-2.31/tcl/mobility/scene/scen-3-test" ; # node
movement file.

set opt(x)              400                      ;# x coordinate of topology
set opt(y)              600                      ;# y coordinate of topology
set opt(seed)           0.0                      ;# seed for random  
number gen.
set opt(stop)           1000                           ;# time to stop  
simulation

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

#
# check for random seed
#
if {$opt(seed) > 0} {
     puts "Seeding Random number generator with $opt(seed)\n"
     ns-random $opt(seed)
}

#
# create simulator instance
#
set ns_ [new Simulator]

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

#
# create God
#
create-god $opt(nn)


set chan_1_ [new $opt(chan)]

#
# configure mobile nodes
#
$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) \
                  -topoInstance $topo \
                  -wiredRouting OFF \
                  -agentTrace ON \
                  -routerTrace ON \
                  -macTrace OFF \
                    -channel $chan_1_
                 #-channelType $opt(chan) \

#create nodes
#attach OLSRRep agents

for {set i 0} {$i < $opt(nn)} {incr i} {
     set node_($i) [$ns_ node]
     set olsrRAgent($i) [new Agent/OLSRRep]
     set udp_($i) [new Agent/UDP]
     $node_($i) random-motion 0 ;# disable random motion
     $ns_ attach-agent $node_($i)  $olsrRAgent($i)
}

#
# positions
#
$node_(0) set X_ 150.0
$node_(0) set Y_ 200.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 320.0
$node_(1) set Y_ 200.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 500.0
$node_(2) set Y_ 200.0
$node_(2) set Z_ 0.0

for {set i 0} {$i < $opt(nn)} {incr i} {
   $ns_ at $opt(stop).0001  "$olsrRAgent($i) finaldisplay"
}

#
# NS-2 management
#
for {set i 0} {$i < $opt(nn) } {incr i} {

     $ns_ at $opt(stop).0 "$node_($i) reset";
}

puts "Starting Simulation..."
$ns_ run
Supprimer | Répondre | Répondre à tous | Transfert | Rediriger | Voir  
les Enfilades | Sou


Reply via email to