LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   NS2 trace file does not have complete traces (https://www.linuxquestions.org/questions/programming-9/ns2-trace-file-does-not-have-complete-traces-947947/)

susanthomas 06-01-2012 05:40 AM

NS2 trace file does not have complete traces
 
Sir,

I was trying to simulate a wireless network with two nodes.The program is running but the trace file contains only information about the packets that is dropped at the end of simulation. What could be the problem? i am sending the coding here with
Thanks in advance




set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(ant) Antenna/OmniAntenna

set val(ll) LL
set val(ifq) Queue/DropTail/PriQueue
set val(ifqlen) 50
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(rp) AODV
set val(nn) 2
set ns [new Simulator]

#trace support
set tracefile [open wireless.tr w]
$ns trace-all $tracefile
set namtracefile [open wireless.nam w]
$ns namtrace-all-wireless $namtracefile 500 500

set topo [new Topography]
$topo load_flatgrid 500 500

create-god $val(nn)
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) -antType $val(ant) \
-propType $val(prop) \
-topoInstance $topo -phyType $val(netif) \
-channel [new $val(chan)] \
-agentTrace OFF \
-routerTrance ON \
-macTrace OFF \
-movementTrace OFF

set n0 [$ns node]
set n1 [$ns node]
$n0 color cyan
$n1 color cyan
$ns at 0.0 "$n0 color cyan"
$ns at 0.0 "$n1 color cyan"

$n0 random-motion 0
$n1 random-motion 0


#positioning node
$n0 set X_ 100
$n0 set Y_ 100
$n0 set Z_ 0

$n1 set X_ 200
$n1 set Y_ 200
$n1 set Z_ 0
$ns initial_node_pos $n0 30
$ns initial_node_pos $n1 30

set tcp [new Agent/TCP]
$ns attach-agent $n0 $tcp

set ftp [new Application/FTP]
$ftp attach-agent $tcp

set tcpsink [new Agent/TCPSink]
$ns attach-agent $n1 $tcpsink

$ns connect $tcp $tcpsink

proc finish {} {
global ns tracefile namtracefile
$ns flush-trace
close $tracefile
close $namtracefile
exec nam wireless.nam &
exit 0
}

$ns at 0.5 "$ftp start"

$ns at 2 "$n0 reset"
$ns at 2 "$n1 reset"

$ns at 3.1 "$ns halt"
$ns at 3 "finish"
$ns run

Mara 06-03-2012 01:47 PM

Can't see it just like that. Maybe it's better idea t start from working code? For example: http://ns2-master.blogspot.fr/2011/0...-wireless.html


All times are GMT -5. The time now is 03:16 PM.