I want to observe the queue scheduling inside the router node,here is the
complete picture:
FTP0
|
tcp0
|
n1
\ sink0
\ /
n2 - - - - - - - - - - -n3
/ \
/ sink1
n0
|
tcp1
|
ftp1
I want the packets to go through node 2 before they are sent by node 2 to
node 3, that means it will be one-hope away right? I set tcp agent and ftp
application in node 0 and node 1, as well as attached 2 tcpsink to
node 3.Imade node 3 out of the sensing range of the source nodes so
that i can make
sure that the packets from source node did not go directly to node 3.However,
after the simulation, they are not only didnt go directly to node 3 but also
not sent to node 2. Thats why I am wondering what is wrong with my
simulation.Do you know the situation?
Thanks for your help.
On 2/26/07, Matthias Kuhnert <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> do you have any traffic between source and sink at all?
> If so, then they simply have a direct connection and communicate without
> the other node. So then either put the nodes further away from each other,
> or decrease the rx/tx range...
> If not, you have a completely different problem and perhaps the nodes too
> far apart from each other...
>
>
> Greets,
> Matthias
>
> -------- Original-Nachricht --------
> Datum: Mon, 26 Feb 2007 21:51:04 +0800
> Von: "romzyi prasetyo" <[EMAIL PROTECTED]>
> An: "ns milis" <[email protected]>
> CC:
> Betreff: [ns] need help on wireless simulation
>
> >
> > hi all,
> >
> > I am new in NS2. Currently I am doing wireless simulation which consists
> > of
> > 4 nodes. 2 as the source nodes, 1 as a router, the other one as a sink
> > node.
> > I want to simulate such that when the source nodes generate packets, the
> > packets will be queued in relay node before they are sent to the sink
> > node.However,the problem is there is no packet received in node 2 .I
> > wonder
> > what has caused this error.I have made sure that the relay node is
> located
> > pretty near to the source nodes, but still no packets received there.
> > Below is the code:
> > #
> =======================================================================
> > # PRIORITY-BASED DROPTAIL QUEUE SIMULATION#
> > #
> =======================================================================
> > # Scheme:
> > #
> -----------------------------------------------------------------------
> >
> > # n1(100,200,0)
> > # \
> > # n2(150,150,0) --- n3(500,150,0)
> > # /
> > # n0(100,100,0)
> > #
> > # ======================================================================
>
> > # 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) 10 ;# max packet in ifq
> > set val(nn) 4 ;# number of
> > mobilenodes
> > set val(rp) DSDV ;# routing protocol
> > set val(drate) 2.0e6 ;# default
> datarate
> >
> > # ======================================================================
> > # Main Program
> > # ======================================================================
> >
> >
> > proc getopt {argc argv} {
> > global val
> > lappend optlist drate
> >
> > for {set i 0} {$i < $argc} {incr i} {
> > set arg [lindex $argv $i]
> > if {[string range $arg 0 0] != "-"} continue
> >
> > set name [string range $arg 1 end]
> > set val($name) [lindex $argv [expr $i+1]]
> > }
> >
> > }
> >
> > getopt $argc $argv
> >
> > # Initialize Global Variables
> > set ns_ [new Simulator]
> > set tracefd [open fyp6.tr w]
> > #set tracefd0 [open fyp4_0.tr w]
> > #set tracefd1 [open fyp4_1.tr w]
> > #set cmt [cmu-trace Send "RTR" $tracefd]
> > $ns_ use-newtrace
> > $ns_ trace-all $tracefd
> >
> > # set up topography object
> > set topo [new Topography]
> > $topo load_flatgrid 500 500
> >
> > # Create God
> > create-god $val(nn)
> >
> > set data0 0
> > set data1 0
> >
> > # Parameter values
> > $val(mac) set dataRate_ $val(drate)
> > #$val(mac) set bandwidth_ 22.0e6
> > #$val(netif) set Pt_ 0.28
> > $val(netif) set bandwidth_ 2.0e6
> >
> >
> > # Create the specified number of mobilenodes [$val(nn)] and "attach"
> them
> > # to the channel
> > # Here 4 nodes are created : node(0),node(1), node(2) and node(3)
> >
> > # 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 OFF \
> > -macTrace OFF \
> > -movementTrace OFF
> >
> > for {set i 0} {$i < $val(nn) } {incr i} {
> > set node_($i) [$ns_ node]
> > $node_($i) random-motion 0 ; # disable random motion
> > }
> >
> > # Provide co-ordinates for mobilenodes
> > $node_(0) set X_ 100.0
> > $node_(0) set Y_ 100.0
> > $node_(0) set Z_ 0.0
> >
> > $node_(1) set X_ 100.0
> > $node_(1) set Y_ 200.0
> > $node_(1) set Z_ 0.0
> >
> > $node_(2) set X_ 150.0
> > $node_(2) set Y_ 150.0
> > $node_(2) set Z_ 0.0
> >
> > $node_(3) set X_ 500.0
> > $node_(3) set Y_ 150.0
> > $node_(3) set Z_ 0.0
> >
> >
> > # Setup traffic flow between nodes
> > set tcp(0) [new Agent/TCP]
> > $tcp(0) set class_ 1
> > set sink(0) [new Agent/TCPSink]
> > $ns_ attach-agent $node_(0) $tcp(0)
> > $ns_ attach-agent $node_(3) $sink(0)
> > $ns_ connect $tcp(0) $sink(0)
> > set FTP(0) [new Application/FTP]
> > $FTP(0) attach-agent $tcp(0)
> > $ns_ at 3.0 "$FTP(0) start"
> >
> > set tcp(1) [new Agent/TCP]
> > $tcp(1) set class_ 2
> > $tcp(1) set fid_ 1
> > set sink(1) [new Agent/TCPSink]
> > $ns_ attach-agent $node_(1) $tcp(1)
> > $ns_ attach-agent $node_(3) $sink(1)
> > $ns_ connect $tcp(1) $sink(1)
> > set FTP(1) [new Application/FTP]
> > $FTP(1) attach-agent $tcp(1)
> > $ns_ at 1.0 "$FTP(1) start"
> >
> > $ns_ at 100.0 "$node_(0) reset"
> > $ns_ at 100.0 "$node_(1) reset"
> >
> > $ns_ at 100.0 "stop"
> > $ns_ at 100.01 "puts \"NS EXITING...\" ; $ns_ halt"
> >
> > proc stop {} {
> > global ns_ tracefd
> >
> >
> > # Get data from trace file, put current-time and
> calculated-throughput
> > in a new file (Kbps)
> > set awkCode {
> > {
> > if ($1=="r" && $5=="3" && $39=="0" && $45=="tcp" )
> > {
> > data0=data0 + $37
> > print $3, data0*8.0/$3/1000 >> "temp.q0";
> > }
> > else if ($1=="r" && $5=="3" && $39=="1" && $45=="tcp" )
> > {
> > data1=data1 + $37
> > print $3, data1*8.0/$3/1000 >> "temp.q1";
> > }
> > }
> > }
> > set f [open temp.queue w]
> > puts $f "TitleText : Priority-Scheduling "
> > puts $f "Device: Postscript "
> > #$ns_ flush-trace
> > if {[info exists tracefd]} {
> > close $tracefd
> > }
> > #close $tracefd
> > exec rm -f temp.q0 temp.q1
> > exec touch temp.q1 temp.q0
> > exec awk $awkCode fyp6.tr
> > puts $f \"priority=0
> > exec cat temp.q0 >@ $f
> > puts $f \n\"priority=1
> > exec cat temp.q1 >@ $f
> > close $f
> > exec xgraph -x time -y queue temp.queue &
> > exit 0
> > }
> >
> >
> > puts "Starting Simulation..."
> > $ns_ run
>
> --
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: www.gmx.net/de/go/mailfooter/topmail-out
>