Dear ns users,
I want to simulate wireless node traffic transmission through intermediate
node...
example,
n0 - source node
n1,n2 - intermediate nodes
n3 - sink node
flow is like n0 --> n1 --> n2 --> n3
i had tried the following tcl scripts
# 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) 4 ; # number of mobilenodes
set val(rp) DSDV ; # routing protocol
set val(x) 800 ; # X dimension of topography
set val(y) 800 ; # Y dimension of topography
set val(stop) 5
; # time of simulation end
set ns [new Simulator]
set tracefd [open cc1.tr w]
set namtrace [open cc1.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
# configure the nodes
$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 OFF \
-movementTrace ON
for {set i 0} {$i < $val(nn) } { incr i } {
set n($i) [$ns node]
}
# Provide initial location of
nodes
$n(0) set X_ 200.0
$n(0) set Y_ 200.0
$n(0) set Z_ 0.0
$n(1) set X_ 250.0
$n(1) set Y_ 350.0
$n(1) set Z_ 0.0
$n(2) set X_ 150.0
$n(2) set Y_ 500.0
$n(2) set Z_ 0.0
$n(3) set X_ 370.0
$n(3) set Y_ 600.0
$n(3) set Z_ 0.0
# Set a TCP connection and send data between n(0) and n(1)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(0) $tcp
$ns attach-agent $n(1) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.0 "$ftp start"
# Set a TCP connection and send data between n(1) and n(2)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(1) $tcp
$ns attach-agent $n(2) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.0 "$ftp
start"
# Set a TCP connection and send data between n(2) and n(3)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(2) $tcp
$ns attach-agent $n(3) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.0 "$ftp start"
# Define node initial position in nam
$ns initial_node_pos $n(0) 60
$ns initial_node_pos $n(1) 60
$ns initial_node_pos $n(2) 60
$ns initial_node_pos $n(3) 120
#defining heads
$ns at 0.0 "$n(3) label Sink"
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$n($i) reset";
}
# ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at 5.1 "puts \"end simulation\" ; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close
$tracefd
close $namtrace
}
$ns run
In this
script each node (n0,n1,n2)generate the traffic, just i need in which,
what ever the data generated by node 0 that need to be sent via node n1
and n2 to n3... can u pls help me to fix the problem...
Regards,
T.Gopi