Sorry. My TCL is below;

# 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)                     20                                      ;#
total number of mobilenodes
set val(rp)                     AODV                                    ;#
routing protocol
set val(x)                      750                                     ;# X
dimension of topography
set val(y)                      750                                     ;# Y
dimension of topography  
set val(stop)           50                                      ;# time of
simulation end
set val(cp)                     "scenarios/scen1forAODV-n20-t500-x750-y750"
;#Connection Pattern

# Initialize Global Variables

set ns_         [new Simulator]

set tracefd             [open sim1forAODV.tr w]
$ns_ trace-all $tracefd


set namtrace            [open sim1forAODV.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)


$ns_ color 1 Blue
$ns_ color 2 Red


# set up topography object

set topo                [new Topography]

$topo load_flatgrid $val(x) $val(y)

# Create God

create-god $val(nn)

# Create channel #1 and #2

set chan_1_ [new $val(chan)]
set chan_2_ [new $val(chan)]

# configure node, please note the change below.
$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) \
                                -topoInstance $topo \
                                -agentTrace ON \
                                -routerTrace ON \
                                -macTrace ON \
                                -movementTrace ON \
                                -channel $chan_1_ 

# Creating mobile nodes for simulation

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

# Adding connection pattern which is created using setdest, parameters shown
below
# ./setdest -n 20 -p 1.0 -M 20.0 -t 500 -x 750 -y 750 >
scen1forAODV-n20-t500-x750-y750

puts "Loading random connection pattern..."
set god_ [God instance]
source $val(cp)

# Setup traffic flow between nodes
# CBR connections between first 20 nodes to second 20 nodes

set j 0 

for {set i 0} {$i < 20} {incr i} {
        set udp [new Agent/UDP]
        set null [new Agent/Null]
        $ns_ attach-agent $node_($i) $udp
        $ns_ attach-agent $node_([expr $i + 1]) $null
        $ns_ connect $udp $null
        puts "Node_($i) -----> Node_([expr $i + 1])"

   #Attach CBR application;
        set cbr_($j) [new Application/Traffic/CBR]
        $cbr_($j) attach-agent $udp
        puts "cbr_($j) has been created"
        $cbr_($j) set type_ CBR
        $cbr_($j) set packet_size_ 512
        $cbr_($j) set rate_ 1mb
        $cbr_($j) set random_ false
        $ns_ at 1.0 "$cbr_($j) start" 
        set j [expr $j + 1]
        set i [expr $i + 1]
}


# Define initial node position

for {set i 0} {$i < $val(nn) } {incr i} {
        $ns_ initial_node_pos $node_($i) 30
        }

# Tell all nodes when the simulation ends

for {set i 0} {$i < $val(nn) } {incr i} {
        $ns_ at $val(stop).000000001 "$node_($i) reset";
        }

# Ending nam and simulation
$ns_ at $val(stop) "finish"
$ns_ at $val(stop).0 "$ns_ trace-annotate \"Simulation has ended\""
$ns_ at $val(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt"


proc finish {} {
        global ns_ tracefd namtrace
        $ns_ flush-trace
        close $tracefd
        close $namtrace
#       exec nam sim1forAODV.nam &
        exit 0
        }

puts "Starting Simulation..."
$ns_ run

-----Original Message-----
From: Sasan Sahraei [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 05, 2006 2:12 AM
To: Semih DOKURER
Subject: Re: [ns] more then one CBR connection in a large network

Please attach your TCL again,

Sasan

>
> Hi;
>
>
>
> I have created 20 CBR connections over UDP of 50 wireless nodes using for
> loop in TCL. The code is compiled but when the NAM run it, I saw that
> connections doesn't work as I programmed. Its trace file proves it. For
> example, one of the connections, even tough I took out the forwarded
> packets, number of received packets at receiving node is more then sent
> packets at sending node. My TCL code is below. I think there is a mistake.
> I will be appreciated if any body can explain the mistake or say the
> necessary code to create 20 CBR connections.
>
> Thnx
>
>
>
>
>
> Semih
>
>


Reply via email to