Hi,

I'm new to ns2. I've been trying to simulate a wireless scenario in which a
mobile node sends data to another mobile node. I attached two udp agents
with node0 with cbr traffic for both of them. Then i attached two null
agents to node1 to receive the data. Both the agents are started at the same
time and made to run simultaneously. While I do so most of the packets get
dropped. Is there any problem if i attach two agents to a wireless node and
make them work at the same time? 

The following is my tcl code:

# ======================================================================
# 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)             2                          ;# number of mobilenodes
set val(rp)             DSR                        ;# routing protocol
set val(x)                              300                                     
           ;# X dimension of the topography in meters
set val(y)                              300                                     
           ;# Y dimension of the topography in meters   
# =====================================================================
# Main Program
# ======================================================================

set ns [new Simulator]

$ns use-newtrace

set tf [open out.tr w]
$ns trace-all $tf
set nf [open out.nam w]
$ns namtrace-all-wireless $nf $val(x) $val(y)

set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

# configure node
        $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) \
                        -channelType $val(chan) \
                        -topoInstance $topo \
                        -agentTrace ON \
                        -routerTrace ON \
                        -macTrace ON \
                        -movementTrace ON               

set n0 [$ns node]
set n1 [$ns node]

$n0 set X_ 100.0
$n0 set Y_ 100.0
$n0 set Z_ 0.0

$n1 set X_ 200.0
$n1 set Y_ 100.0
$n1 set Z_ 0.0

$ns at 0.1 "$n0 setdest 50.0 100.0 0.5"
$ns at 0.1 "$n1 setdest 150.0 100.0 0.5"

set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval .005
$cbr0 attach-agent $udp0

set udp1 [new Agent/UDP]
$ns attach-agent $n0 $udp1 
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval .005
$cbr1 attach-agent $udp1

set null0 [new Agent/Null]
$ns attach-agent $n1 $null0

set null1 [new Agent/Null]
$ns attach-agent $n1 $null1

$ns connect $udp0 $null0
$ns connect $udp1 $null1

$ns at 0.1 "$cbr0 start"
$ns at 0.1 "$cbr1 start"

$ns at 4.5 "$cbr0 stop"
$ns at 4.5 "$cbr1 stop"

$ns at 5.0 "finish"

proc finish {} {
        global ns tf nf
        $ns flush-trace
        close $tf
        close $nf
        exec nam out.nam &
        exit 0
        }
        
$ns run
---------------------------------------------------------------------------

Please help.

Regards,
arun chekhov
-- 
View this message in context: 
http://www.nabble.com/Please-Help---wireless-nodes---packets-dropping-problem-when-more-than-one-agent-is-attached-tp22453839p22453839.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to