LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-03-2015, 09:23 PM   #1
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Rep: Reputation: Disabled
how to sOlve this : Warning: Tracefile events are not sorted by time.


when i run the script with NS .. it gives me the follwing warnings ''Route to base_stn not known''
but the out.nam and out.tr is created and when i run out.nam... it dnt give me the correct output... can anybody tell me where is my mistake


here is the code
Code:
# ======================================================================
# Define options
# ======================================================================

set opt(chan)   Channel/WirelessChannel        ;# channel type
set opt(prop)   Propagation/TwoRayGround       ;# radio-propagation model
set opt(netif)  Phy/WirelessPhy                ;# network interface type
set opt(mac)    Mac/802_11                     ;# MAC type
set opt(ifq)    Queue/DropTail/PriQueue        ;# interface queue type
set opt(ll)     LL                             ;# link layer type
set opt(ant)    Antenna/OmniAntenna            ;# antenna model
set opt(ifqlen)         50                     ;# max packet in ifq
set opt(nn)             1                      ;# number of mobilenodes
set opt(adhocRouting)   DSDV                   ;# routing protocol
set opt(threshold) 3.41828e-08				   ;# the distance of coverage 75m

set opt(cp)     ""                             ;# cp file not used
set opt(sc)     ""                             ;# node movement file. 

set opt(x)      800                            ;# x coordinate of topology
set opt(y)      800                            ;# y coordinate of topology
set opt(seed)   0.0                            ;# random seed
set opt(stop)   90                            ;# time to stop simulation

set opt(cbr-start)      5.0

set num_wired_nodes      1
#set num_bs_nodes       2  ; this is not really used here.

# ======================================================================

# check for boundary parameters and random seed
if { $opt(x) == 0 || $opt(y) == 0 } {
	puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
	puts "Seeding Random number generator with $opt(seed)\n"
	ns-random $opt(seed)
}

# create simulator instance
set ns_   [new Simulator]

# set up for hierarchical routing
$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 4           ;# number of domains
lappend cluster_num 2 1 1 1             ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 2 1 1          ;# number of nodes in each cluster 
AddrParams set nodes_num_ $eilastlevel ;# of each domain

set tracefd  [open out.tr w]
set namtrace [open out.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)

# Create topography object
set topo   [new Topography]

# define topology
$topo load_flatgrid $opt(x) $opt(y)

# create God
#   4 for HA and FA, FA2 and CH
create-god [expr $opt(nn) + 4]

#create wired nodes
set temp {0.0.0}           ;# hierarchical addresses 
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]] 
}

# Configure for ForeignAgent and HomeAgent nodes
$ns_ node-config -mobileIP ON \
                 -adhocRouting $opt(adhocRouting) \
                 -llType $opt(ll) \
                 -macType $opt(mac) \
                 -ifqType $opt(ifq) \
                 -ifqLen $opt(ifqlen) \
                 -antType $opt(ant) \
                 -propType $opt(prop) \
                 -phyType $opt(netif) \
                 -channelType $opt(chan) \
		 -topoInstance $topo \
                 -wiredRouting ON \
		 -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF 

Phy/WirelessPhy set RXThresh_ $opt(threshold)
#Phy/WirelessPhy set Pt_ 0.281838

# Create HA and FA, FA2
set HA [$ns_ node 1.0.0]
set FA [$ns_ node 2.0.0]
set FA2 [$ns_ node 3.0.0]
# Create CH
set CH [$ns_ node 0.1.0]

$HA random-motion 0
$FA random-motion 0
$FA2 random-motion 0
$CH random-motion 0

puts "HA id : [$HA id]"
puts "FA id : [$FA id]"
puts "FA2 id : [$FA2 id]"
puts "CH id : [$CH id]"

# Position (fixed) for base-station nodes (HA & FA).
$HA set X_ 200.000000000000
$HA set Y_ 300.000000000000
$HA set Z_ 0.000000000000

$FA set X_ 350.000000000000
$FA set Y_ 300.000000000000
$FA set Z_ 0.000000000000

$FA2 set X_ 500.000000000000
$FA2 set Y_ 300.000000000000
$FA2 set Z_ 0.000000000000

$CH set X_ 800.00000000000
$CH set Y_ 800.0000000000
$CH set Z_ 0.0000000000

# create a mobilenode that would be moving between HA and FA.
# note address of MH indicates its in the same domain as HA.
$ns_ node-config -wiredRouting OFF

set MH [$ns_ node 1.0.1]
puts "MH id : [$MH id]\n"
set node_(0) $MH
set HAaddress [AddrParams addr2id [$HA node-addr]]
[$MH set regagent_] set home_agent_ $HAaddress

# movement of the MH
$MH set X_ 150.000000000000
$MH set Y_ 275.000000000000
$MH set Z_ 0.000000000000

# MH starts to move towards FA
$ns_ at 10.000000000000 "$MH setdest 560.00000000000 275.000000000000 5.00000000000"

# create links between wired and BaseStation nodes
$ns_ duplex-link $CH $W(0) 5Mb 5ms DropTail
$ns_ duplex-link $W(0) $HA 5Mb 20ms DropTail
$ns_ duplex-link $W(0) $FA 5Mb 12ms DropTail
$ns_ duplex-link $W(0) $FA2 5Mb 5ms DropTail

# set the layout of links in NAM
$ns_ duplex-link-op $CH $W(0) orient down
$ns_ duplex-link-op $W(0) $HA orient left-down
$ns_ duplex-link-op $W(0) $FA orient down
$ns_ duplex-link-op $W(0) $FA2 orient right-down

# setup TCP connections between a wired node and the MobileHost

set tcp1 [new Agent/TCP]
#$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $CH $tcp1
$ns_ attach-agent $MH $sink1
$ns_ connect $tcp1 $sink1
#set cbr [new Application/Traffic/CBR]
set cbr [new Application/FTP]
$cbr attach-agent $tcp1
$ns_ at $opt(cbr-start) "$cbr start"

# Define initial node position in nam

for {set i 0} {$i < $opt(nn)} {incr i} {

    # 20 defines the node size in nam, must adjust it according to your
    # scenario
    # The function must be called after mobility model is defined

    $ns_ initial_node_pos $node_($i) 20
}     

# Tell all nodes when the siulation ends
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop).0 "$node_($i) reset";
}

$ns_ at $opt(stop).0 "$HA reset";
$ns_ at $opt(stop).0 "$FA reset";
$ns_ at $opt(stop).0 "$FA2 reset";
$ns_ at $opt(stop).0 "$CH reset";
$ns_ at $opt(stop).0 "$MH reset";

$ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at $opt(stop).0001 "stop"
proc stop {} {
    global ns_ tracefd namtrace
    close $tracefd
    close $namtrace
}

# some useful headers for tracefile
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp \
	$opt(adhocRouting)"
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

puts "Starting Simulation..."
$ns_ run
 
Old 08-05-2015, 05:26 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Your file is OK, no errors.
Quote:
can anybody tell me where is my mistake
Warnings are not about mistakes, errors.
* Warnings are informational text only.
 
Old 08-05-2015, 09:14 PM   #3
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
using ns2.35

i got it ... Thanks Knudfl !!

but on nam. the position of nodes are not as same as given in that script..
there is any method to correct it or using nam to edit it ??
 
Old 08-06-2015, 03:29 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Re #3.

Please compare with examples which have fixed and reproducible node positions.
E.g. "aodv-40.tcl".
All ns2 simulation examples : all_tcl-examples-2.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

Be aware that ns2 defaults to random,
unless the script is written in a certain specific way.

-
 
Old 08-06-2015, 07:25 AM   #5
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
the above script file name is "2fa.tcl"

please have a look on this !!
when i execute that script, i got this On terminal..

Code:
aavi@ubuntu:~$ ns 2fa.tcl
num_nodes is set 5
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
HA id : 1
FA id : 2
FA2 id : 3
CH id : 4
MH id : 5

Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
warning: Route to base_stn not known: dropping pkt
NS EXITING...
out.nam and out.tr is generated .
when i run Out.nam, the simulation is not as good as i thought.
after setting postion of nodes in nam using edit button, and then staring simulation.
the node 5 is not blinking when moving from one node to another.. but when in play backward simulation,
it blinking when reach to other node.

after closing nam i got this on terminal
Code:
Warning: Tracefile events are not sorted by time.
h -t 6.344180855 -s 4 -d -1 -p tcp -e 1040 -c 2 -a 0 -i 250 -k AGT
The above event should occur at or before -t 6.344181.

Warning: Tracefile events are not sorted by time.
r -t 6.31214224622684 -s 0 -d 4 -p ack -e 60 -c 0 -i 231 -a 0 -x {1.0.1.2 0.1.0.2 90 ------- null}
The above event should occur at or before -t 6.312142.
.
.
.
.
.
.
Warning: Tracefile events are not sorted by time.
r -t 5.05436511803399 -s 0 -d 4 -p ack -e 60 -c 0 -i 35 -a 0 -x {1.0.1.2 0.1.0.2 0 ------- null}
The above event should occur at or before -t 5.054365.


invalid command name "_o4": invalid command name "_o4"
    while executing
"_o4 renderFrame"
    ("after" script)
aavi@ubuntu:~$

Sir as you told me that warnings could be ignored..
and this :

Code:
invalid command name "_o4": invalid command name "_o4"
    while executing
"_o4 renderFrame"
    ("after" script)
aavi@ubuntu:~$
it also could be ignored ??

i want to make graph of that script .. thats why i explaining all this !!

Last edited by aavi; 08-06-2015 at 07:27 AM.
 
Old 08-06-2015, 09:20 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Re #5.

$ ns 01-2fa.tcl : I am getting the same OK result.
$ nam out.nam : See the attached image.


""invalid command name "_o4" "" : Where do you get that ? ?


How to create "Output Files for Xgraph"
http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html
.. ! Read post #3 here ...
http://www.linuxquestions.org/questi...-4175549844/#3
-
Attached Thumbnails
Click image for larger version

Name:	screen9081.jpg
Views:	3
Size:	4.1 KB
ID:	19099  

Last edited by knudfl; 08-06-2015 at 09:22 AM.
 
Old 08-06-2015, 06:54 PM   #7
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
""invalid command name "_o4" "" : Where do you get that ? ?
when closing nam, the terminal shows me this !!
 
Old 08-06-2015, 08:19 PM   #8
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
according to that(2fa.tcl) script, this graph is generated.
and i want to generate same graph like this but i don know
which awk script is used for it.

please chech the attachment.
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	6
Size:	143.5 KB
ID:	19110  

Last edited by aavi; 08-06-2015 at 08:20 PM.
 
Old 08-07-2015, 06:16 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Re #7.

""invalid command name "_o4" "" : A peculiarity by Ubuntu ?
Nothing appears with a "normal" 'Linux OS'. My test : PCLinuxOS 2015.
( $ ns235 01-2fa.tcl ).


Re #8 : Nice Xgraph output : Untitled.jpg .
2fa.tcl http://www2.ensc.sfu.ca/~ljilja/ENSC...ations/2fa.txt
..... Where do you see any "graph generated" ? ?

Note : There do not exist any awk scripts for generating graphs.
Unless the author wrote a script for that particular simulation.
http://www2.ensc.sfu.ca/~ljilja/ENSC...Presentations/
.. http://www2.ensc.sfu.ca/~ljilja/ENSC833/News/
.. http://www2.ensc.sfu.ca/~ljilja/ENSC833/


-

Last edited by knudfl; 08-07-2015 at 06:17 AM.
 
Old 08-08-2015, 06:05 AM   #10
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
re #9
1) i am using Ubuntu 14.04 with $ns235.

2) dear knudfl!! m new On linux and NS2
and i downloaded reaserch paper and there this Xgraph(united.jpg) is present.
i completely read that paper and that graph is generated by that script (2fa.tcl)

3)can you please guide me step by step to generate that xgraph same like united.jpg

4)i read this and edit that script according to 2fa.tcl script.. but nothing useful output comes.
Quote:
How to create "Output Files for Xgraph"
http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html
.. ! Read post #3 here ...
http://www.linuxquestions.org/questi...-4175549844/#3
5) please Sir do you create and give me that script that generate xgraph ??
 
Old 08-08-2015, 06:49 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Re #10.
Quote:
I downloaded reaserch paper and there this Xgraph(united.jpg) is present
A link to the site, please.
 
Old 08-08-2015, 07:58 AM   #12
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Re #11

Quote:
A link to the site,
that's the link
http://www2.ensc.sfu.ca/~ljilja/ENSC...yiu/Report.pdf

the Xgraph is at page 38 that i want to make/generate.

Mobile Ip Route Optimization is my project !!
not reverse routing.

Last edited by aavi; 08-08-2015 at 08:11 AM.
 
Old 08-10-2015, 02:22 PM   #13
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,683

Rep: Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284Reputation: 3284
Re #10.
Quote:
3) Can you please guide me step by step to generate that xgraph same like united.jpg
You were shown how an Xgraph plot like united.jpg is generated : See post #6
. http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html
. http://www.linuxquestions.org/questi...-4175549844/#3

Theoretically you can extract something usable from a trace file : With awk.
But unfortunately there are no examples doing so.
And therefore the is also no "step by step" procedure. AFAIK.
... But you can learn how to do awk coding, and then try out what's possible ...
* https://www.google.com/webhp?hl=all&...+for+beginners
. http://www.grymoire.com/Unix/Awk.html
. http://www.hcs.harvard.edu/~dholland/computers/awk.html
* https://www.google.com/webhp?hl=all&...=awk+tutorials
* https://www.google.com/webhp?hl=all&...+text+with+awk
. http://ss64.com/bash/awk.html
. https://www.gnu.org/software/gawk/ma...d-Sorting.html

-
 
Old 08-11-2015, 10:45 AM   #14
aavi
LQ Newbie
 
Registered: Jul 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Ok Sr... thanks
 
  


Reply

Tags
ns2


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 resolve this warning "Warning: Tracefile events are not sorted by time" er.poojasahu@gmail.com Linux - Newbie 1 12-17-2013 05:48 PM
[SOLVED] List all regular files in the disk sorted by modification time. stf92 Slackware 4 11-06-2013 08:43 AM
running nam file in ns2 it gives warning as trace file events are not sorted by time s20 Linux - Software 0 07-19-2013 09:45 PM
[SOLVED] listing files recursively, sorted by time, limited head Harju Linux - Newbie 12 03-25-2011 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:50 PM.

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