Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-01-2012, 06:40 AM   #1
LQ Newbie
Registered: May 2012
Posts: 6

Rep: Reputation: Disabled
NS2 trace file does not have complete traces


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 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
Old 06-03-2012, 02:47 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,683

Rep: Reputation: 219Reputation: 219Reputation: 219
Can't see it just like that. Maybe it's better idea t start from working code? For example:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate convergence time and number of updates of ns2 trace file noorshabad Linux - Software 1 11-22-2012 01:24 PM
How to obtain network parameters from NS2 trace file? musemicang Linux - Software 1 07-07-2012 10:33 AM
NS2 trace file raji27 Linux - Wireless Networking 2 10-14-2011 02:00 AM
ns2 trace file Stanley33 Programming 1 03-02-2011 09:31 AM
problem in traffic trace file genration(VBR) in ns2.34 sanviarch Linux - Networking 4 09-15-2010 02:16 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration