Hello

after studying ns this weekend I ve tried to make an ftp traffic between two 
nodes in an AODV routing network.

I studied wpan_demo1.tcl script and worked on a simple one. but it seems its 
not wokring correctly.

can you give me some clues ?
thanks in advance
Ricardo

===============wpan.scn==============
#
# nodes: 4, pause: 2.00, max speed: 2.00  max x = 50.00, max y: 50.00
#
$node_(0) set X_ 16.608377307314
$node_(0) set Y_ 29.446991827566
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 29.337311778721
$node_(1) set Y_ 28.582820874924
$node_(1) set Z_ 0.000000000000
$node_(2) set X_ 17.437938215931
$node_(2) set Y_ 10.091658830425
$node_(2) set Z_ 0.000000000000
$node_(3) set X_ 0.568766842667
$node_(3) set Y_ 27.453389414657
$node_(3) set Z_ 0.000000000000


==================wpan.tcl========================
###########################################
#           AODV over 802.15.4            #
#     Copyright (c) 2003 Samsung/CUNY     #
# - - - - - - - - - - - - - - - - - - - - #
#       Prepared by Jianliang Zheng       #
#        (zh...@ee.ccny.cuny.edu)         #
###########################################

# ======================================================================
# Define options
# ======================================================================
set val(chan)           Channel/WirelessChannel    ;# Channel Type
set val(prop)           Propagation/TwoRayGround   ;# radio-propagation model
set val(netif)          Phy/WirelessPhy/802_15_4
set val(mac)            Mac/802_15_4
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)             4                          ;# number of mobilenodes
set val(rp)             AODV                       ;# routing protocol
set val(x)        50
set val(y)        50

set val(nam)        wpan.nam
set val(traffic)    ftp                        ;


set appTime1            0.0    ;# in seconds
set appTime2            0.3    ;# in seconds
set appTime3            0.7    ;# in seconds
set stopTime            10    ;# in seconds

# Initialize Global Variables
set ns_        [new Simulator]
set tracefd     [open ./wpan.tr w]
$ns_ trace-all $tracefd

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

$ns_ puts-nam-traceall {# nam4wpan #}    ;# inform nam that this is a trace 
file for wpan (special handling needed)
Mac/802_15_4 wpanNam namStatus on    ;# default = off (should be turned on 
before other 'wpanNam' commands can work)
#Mac/802_15_4 wpanNam ColFlashClr gold        ;# default = gold
#Mac/802_15_4 wpanNam NodeFailClr grey        ;# default = grey

# For model 'TwoRayGround'
set dist(5m)  7.69113e-06
set dist(9m)  2.37381e-06
set dist(10m) 1.92278e-06
set dist(11m) 1.58908e-06
set dist(12m) 1.33527e-06
set dist(13m) 1.13774e-06
set dist(14m) 9.81011e-07
set dist(15m) 8.54570e-07
set dist(16m) 7.51087e-07
set dist(20m) 4.80696e-07
set dist(25m) 3.07645e-07
set dist(30m) 2.13643e-07
set dist(35m) 1.56962e-07
set dist(40m) 1.20174e-07
Phy/WirelessPhy set CSThresh_ $dist(15m)
Phy/WirelessPhy set RXThresh_ $dist(15m)

# set up topography object
set topo       [new Topography]
$topo load_flatgrid 10 10

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

set chan_1_ [new $val(chan)]

# 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) \
        -topoInstance $topo \
        -agentTrace OFF \
        -routerTrace OFF \
        -macTrace ON \
        -movementTrace OFF \
                #-energyModel "EnergyModel" \
                #-initialEnergy 1 \
                #-rxPower 0.3 \
                #-txPower 0.3 \
        -channel $chan_1_

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

source ./wpan.scn

proc ftptraffic { src dst starttime } {
   global ns_ node_
   set tcp($src) [new Agent/TCP]
   eval \$tcp($src) set packetSize_ 60
   set sink($dst) [new Agent/TCPSink]
   eval $ns_ attach-agent \$node_($src) \$tcp($src)
   eval $ns_ attach-agent \$node_($dst) \$sink($dst)
   eval $ns_ connect \$tcp($src) \$sink($dst)
   set ftp($src) [new Application/FTP]
   eval \$ftp($src) attach-agent \$tcp($src)
   $ns_ at $starttime "$ftp($src) start"
}

puts "\nTraffic: ftp"
#Mac/802_15_4 wpanCmd ack4data off
puts [format "Acknowledgement for data: %s" [Mac/802_15_4 wpanCmd ack4data]]
set lowSpeed 0.20ms
set highSpeed 1.5ms

Mac/802_15_4 wpanNam PlaybackRate $lowSpeed
$ns_ at [expr $appTime1+0.2] "Mac/802_15_4 wpanNam PlaybackRate $highSpeed"
$ns_ at $appTime2 "Mac/802_15_4 wpanNam PlaybackRate $lowSpeed"
$ns_ at [expr $appTime2+0.2] "Mac/802_15_4 wpanNam PlaybackRate $highSpeed"
$ns_ at $appTime3 "Mac/802_15_4 wpanNam PlaybackRate $lowSpeed"
$ns_ at [expr $appTime3+0.2] "Mac/802_15_4 wpanNam PlaybackRate 1ms"

ftptraffic 0 3 $appTime1
ftptraffic 1 3 $appTime2

Mac/802_15_4 wpanNam FlowClr -p AODV -c tomato
Mac/802_15_4 wpanNam FlowClr -p ARP -c cyan
Mac/802_15_4 wpanNam FlowClr -p tcp -s 0 -d 3 -c blue
Mac/802_15_4 wpanNam FlowClr -p ack -s 3 -d 0 -c red
Mac/802_15_4 wpanNam FlowClr -p tcp -s 1 -d 3 -c green4
Mac/802_15_4 wpanNam FlowClr -p ack -s 3 -d 1 -c green4
$ns_ at $appTime1 "$node_(0) NodeClr blue"
$ns_ at $appTime1 "$node_(3) NodeClr blue"
$ns_ at $appTime1 "$ns_ trace-annotate \"(at $appTime1) ftp traffic from node 0 
to node 3\""
$ns_ at $appTime2 "$node_(1) NodeClr green4"
$ns_ at $appTime2 "$node_(3) NodeClr green4"
$ns_ at $appTime2 "$ns_ trace-annotate \"(at $appTime2) ftp traffic from node 1 
to node 3\""


# defines the node size in nam
for {set i 0} {$i < $val(nn)} {incr i} {
    $ns_ initial_node_pos $node_($i) 4
}

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

$ns_ at $stopTime "stop"
$ns_ at $stopTime "puts \"\nNS EXITING...\""
$ns_ at $stopTime "$ns_ halt"

proc stop {} {
    global ns_ tracefd val env
    $ns_ flush-trace
    close $tracefd
    set hasDISPLAY 0
    foreach index [array names env] {
        #puts "$index: $env($index)"
        if { ("$index" == "DISPLAY") && ("$env($index)" != "") } {
                set hasDISPLAY 1
        }
    }
    exec nam wpan.nam &
   
}

puts "\nStarting Simulation..."
$ns_ run


      
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

Reply via email to