This page contains information regarding my NS2
Simulator experiences, on the topic of the TraceGraph
Program usage.
Here you'll find important information concerning
the usage of hierarchical addresses / wireless / mobile IP nodes in
TG, complete with a automatic way of generating the necessary .tr.ip
file that TG needs.
Contact: pedro.estrela@inesc.pt
I've taken the effort to redesign my NS2 help page for the benefit of the NS2 community. These tracegraph help pages have been essentially unmaintained over the last year, simply because I currently do all my NS2 results processing using bash scripts, argument passing and gnuplot graphs.
However, even disorganized, the majority of the information on this page is still correct. Summarizing it:
The patch which was mentioned in this page, which changed a file in /tcl/lib, IS NOT NEEDED ANYMORE.
Include the ns2_shared_procs file in your script by sourcing it.
In the function where you close the trace file, call “dump_tr_ip name_of_your_trace_file". This process will generate a “trace.tr.ip” file that contains the correspondences of the hierarchical addresses to the ID addresses related to the trace file. (Note that this is process is always REQUIRED for all scenarios that use hierarchical addresses in tracegraph).
The .tr trace file can then converted to the simpler tracegraph format either by the traceconverter (faster, bug-free, recommended), or by tracegraph itself (slower, buggy, NOT recommended)
The final file in tracegraph format is then trivially read by tracegraph itself.
The original Tracegraph author, Jaroslaw Malek, has recently re-started work on TG. He created a new website, and made available a new version of TG (2.03), which features very good improvements regarding trace loading and other fixes.
However, these loading times are now further reduced to marginal values using the TG converter application (traceconverter), as it was written in a compiled language.
Also importantly, the IP address conversion bug mentioned on these pages has been corrected on the stand-alone converter, which now results in accurate results; While Trace graph did only simple strings substitutions, the Trace converter will replace only the IP addresses, so packet number will remain unaltered.
I would suggest every tracegraph user to support further development on TG, simply by investing on this converter and/or the TG sources, available in the TG website.
Note1: Please consider that the focus of this page is content over form (although I plan to make it more manageable soon)
Note2: I'm planning to improve and increase this FAQ soon. All
people are invited to contribute; simply send me the Question/Answer
text, preferably well tested, and I'll include it here.
The idea
is to reduce as much as possible the common questions that regularly
appear on the TG group.
Normally, when TG doesn't have the correct .tr.ip, it will stop processing the file with some common errors.
Common examples are:
"Index exceeds matrix dimensions"
"Warning: Subscript indices must be integer values."
"Index into matrix is negative or zero."
However,
there may be certain incorrect .tr.ip files which load fine in TG,
but change parts of the trace, resulting in incorrect data or
impossible values.
A very good way to check if everything is all right, is to check the number of nodes. Depending on your topology, it will normally a low number. if it shows up as a large number, (eg 31234, etc) then you can be pretty sure that this .tr.ip is forcing TG to read incorrectly your trace file!.
Q: Where to check the number of
nodes?
A: Check the "current" field on the main TG
window. it will be something as "0-'number of nodes'".
Alternatively, check "Network Information / Simulation
Information / Number of Nodes"
dump.tr.ip:
- support for new/old wireless traces
- removed
dependance on patch to /tcl/lib/ns-lib.tcl.
- dump.tr.ip proc
suggests user to use higher address values (for avoiding the known TG
conversion bug, see below)
- detailed examples of Trace conversion
possibilities for old and new wireless trace formats
- alternative
dump_.tr.ip for MOBIWAN scenarios (contributed by
przemek.machan@wp.pl)
-
new proc: clone_instproc (similar to tcl's "rename")
check
it here
Examples of desired conversions, by wireless trace format:
old
wireless format traces - node:port format.
new wireless trace
format - node.port format (eg, with a period instead of a
colon!)
old wireless trace format:
3.2.1.255 ->
3:255
4194305 -> 6
4194305:2 -> 6:2
thus:
haddr.port -> addr:port
addr:port -> addr:port
iaddr
-> addr (note: this case fully encompasses the above one)
thus,
it is generated these conversions for all existing addrs:
haddr.
addr:
iaddr addr (note: this case triggers a known bug on the TG
conversion process - see below)
new wireless trace format:
3.2.1.255 -> 3.255
4194305 ->
6
4194305.2 -> 6.2
thus:
haddr.port ->
addr.port
iaddr.port -> addr.port
iaddr -> addr (note:
again, this case fully encompasses the above one)
thus, it is
generated these conversions for all existing addrs:
haddr.
addr.
iaddr addr (note: this case triggers a known bug on the TG
conversion process - see below)
merging the two cases:
haddr. addr$port_separator
iaddr addr
I've created a figure that illustrates the various steps that
involve the TG conversion processes. check it
here
TG_conversions_possibilities.gif
check the "trgraph.cfg" that i mention on the figure:
trgraph.cfg
check the also one
example script that I've used previously: TG_example_script1.txt
UPDATE: Previously, I've mentioned that it would be necessay to manually add the "hex" header to the _noip.tr file for TG to convert the hex numbers. such is not needed if automatic detection is used with a sufficient large number of lines
If you are having problems having TG to load your traces, and are
experimenting with the .tr.ip files and the TG configuration, you can
speed up the loading of the files by working step by step.
Normally,
there is no need to use the full trace from NS2. Just select a few
lines to reduce the trace. When that is working, increase slowly the
trace size until the full size of it.
EXAMPLE:
> Step 1: check how many lines are needed to trigger the
problem.
Here i'm interested in lines that have hexadecimal
addresses in the "-Ms" part of the dump.
Let's check if
1000 lines are sufficient, by looking for an "b"
address.
$ head out-newtrace.tr -n 1000 | grep "Ms b"
| head -n 1
s -t 0.841626278 -Hs 14 -Hd -1 -Ni 14 -Nx 400.00 -Ny
746.40 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms
b -Mt 800 -Is 8388619.0 -Id -1.0 -It udp -Il 120 -If 0 -Ii 26 -Iv 32
It is.
> step 2: now lets check with a smaller number of lines, 100
lines.
pmsrve@inesc-0:[tg]$ head out-newtrace.tr -n 100 |
grep "Ms b" | head -n 1
pmsrve@inesc-0:[tg]$
Here
it is not found.
> step 3: lets check with another address. this time it will be
"d".
head out-newtrace.tr -n 100 | grep "Ms d"
| head -n 1
s -t 0.043317641 -Hs 16 -Hd -1 -Ni 16 -Nx 200.00 -Ny
746.40 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms
d -Mt 800 -Is 8388621.0 -Id -1.0 -It udp -Il 120 -If 0 -Ii 2 -Iv 32
It is present again!
> step 4: limit our trace file to 100 lines only.
head
out-newtrace.tr -n 100 > small.tr
> step 5: how much did we cut?
$ dir *.tr
-rwxr-xr-x
1 pmsrve pmsrve 26136920 Apr 26 14:46 out-newtrace.tr
-rwxr-xr-x 1
pmsrve pmsrve 18080 Apr 26 15:10 small.tr
pmsrve@inesc-0:[tg]$
a
LOT.
> step 6: Use this file with TG, using he dump.tr.ip procs, HEX
header etc etc.
After it is working, SLOWLY increase the trace
file up to the total size!
1)I am getting the following error what to do??
7:50pm/home/nmahali/trace/tracegraph202% ./trgraph
./trgraph:
error while loading shared libraries: libmwsgl.so: cannot open shared
object file: No such file or directory
Solution: Check your
LD_LIBRARY_PATH is set up correctly. see Below and this web page NS2
Installation and Basic Usage
Installation instructions on
Linux::
1)Download tracegraph and mglinstaller from the webpage
Check Trace graph download page:
http://diament.ists.pwr.wroc.pl/~tracegr/tgform.html
Choose Linux
version and download mglinstaller.
2) tar -xvzf
tracegraph202.linux.tar.gz
3) gunzip mglinstaller.gz
4) You
have to uncompress the file "mglinstaller.gz" and after
doing it you will get the file "mglinstaller".
Now,
there's no need to use chmod to change the rights and run
./mglinstaller.(or) Just do "sh mglinstaller" and
the
script will do the rest for you.
5)set the environment path
variable...
setenv LD_LIBRARY_PATH
/home/nmahali/trace/tracegraph202/bin/glnx86/
to check whether the
variable is set properly u can just type $LD_LIBRARY_PATH
Architecture
of the path variable setting:: if new variable then
setenv path
if already existing then setenv {$}:
Installation instructions on
Windows
1)Download tracegraph and mglinstaller from the page make
sure it is windows version
http://diament.ists.pwr.wroc.pl/~tracegr/tgform.html
2)unzip
tracegraph202.zip to say, D:\
3)execute mglinstaller.exe, when it
asks for directory name, enter D:\tracegraph202
4) add
D:\tracegraph202\bin\win32 to your environment PATH
5)how to add
to environment PATH??
right click on Mycomputer and select
properties
From properties select Advanced tab
Select
environment path variables
Select PATH and add your path to
it
Thats it tracegraph is now ready!!
This is the procedure i
followed while installing tracegraph on both windows and linux (if
you dont have matlab installed on your machine.)
There is a question that is always appearing on the TG's help
list. It relates using TG with traces that contain hierarchical
addresses OR wireless addrs OR mobile
IP addrs, which is only possible by assigning addrs
numbers to IP addresses in an appropriate .tr.ip conversion
file.
This conversion file must be either generated
manually OR automatically. These
options are explained in the TG's
manual, and in this web page
(http://inesc-0.tagus.ist.utl.pt/~pmsrve/ns2/tracegraph.html).
AFTER you carefully check both information sources,
feel free to ask further help or report success stories in the TG
help list (http://groups.yahoo.com/group/tracegraph).
Example of #1 FAQ on TG help list:
>
maximal number of lines <1000>has been processed !
>
wired-wireless format detected
> IP addresses detected.
Conversion to addrs numbers needed .
> File
D:\project\bin\mobileip.tr.ip does not exist! creating the file ...
>
maximal number of lines <1000>has been processed !
>
wired-wireless format detected
> IP addresses detected.
Conversion to addrs numbers needed .
> saving IPs to text file
...
> IPs have been saved in D:\project\bin\mobileip.tr.ip
>
Converting IPs to addrs numbers...
> ERROR : cannot read IP
file !
Hello,
You have to assign addrs numbers to IP
addresses in mobileip.tr.ip
file. Check Trace graph help and this
page:
http://inesc-0.tagus.ist.utl.pt/~pmsrve/ns2/tracegraph.html
A new Tracegraph help list has been created by TG's author
Jaroslaw Malek. Anyone can post a message (no subscription is
required).
However, please don't post messages to it until you
carefully read the information i've collected on this page,
especially if you are using wireless traces .
Failing that, feel free to contact the list:
http://groups.yahoo.com/group/tracegraph/.
Check these 2 fine links for help concerning the installation of NS2 + TG + the mathlab component that TG uses:
http://filebox.vt.edu/users/flaw/public/ns2_install.html
Beginners Guide to ns2 Installation and Basic Usage
http://mailman.isi.edu/pipermail/ns-users/2004-July/043794.html
mginstaller.gz instalation help
This section will depict my current efforts to use the excellent TraceGraph Program, Copyright (c) 2001-2003 by Wroclaw University of Technology, Poland, written by Jaroslaw Malek, to perform two separate tasks which that are relevant when dealing with mixed wired+wireless scenarios, typical of mobility protocols, NOAH agent routing, etc. (this is, the scenarios that are not 100% wired (regular routing) or 100% wireless (ad-hoc routing)
I currently use TraceGraph to perform 2 separate tasks:
a) convert the wireless simulation traces, that use several different formats into a common, simpler format (check the TraceGraph manual, section 9, (local copy)). Such converted and unified trace will then be analyzed using C / BASH / AWK scripts;
b) To generate some ready to use graphs and statistics, from the extensive set graphs and statistics supported by TG. These facilities, which can be scripted inside TG, can either generate the .png graphics file, or the processed results for subsequent utilization in gnuplot, Excel, etc.
However, as mentioned in the TraceGraph manual, section 9 such conversion mentioned above will only work if an auxilliary file is given, with a .tr.ip extension, containing the correspondences between IP addresses (haddr and iaddr forms) and sequential addr IDs. Thus, the objective of the conversion is to reduce them to the simplest form (IDs).
As documented in the point 3 of section 9 of the TG manual, this file is generated by TG from a given trace using the "-ip" switch, which only outputs the recognized IP addresses; This file must then be altered manually to expliciate the correspondences between IP addresses and ID addresses. When this is done, the file can be used again by TG to process and transform the trace file.
Note: in NS2 traces, an IP address can be written in several forms, while always referring to the same addr. Examples: Hierarchic form: "0.1.0"; Integer form: 2048 (which is 0.1.0 represented as an 32bits decimal number)); ID form: 4 (eg, the 4th built addr by NS2)
More examples: (note: 4194304 ==
0x400000; 2048 == 0x0800)
"4.5.6" -> 4*4194304 +
5*2048 + 6
"1.0.0" -> 1*4194304 + 0*2048 + 0
source: Tracegraph: .tr.ip convertion file (part 2)
|
Hierarquical Address |
Integer Address |
TG Address |
note |
|
"0.0.0" |
0 |
0 |
|
|
"1.0.0" |
4194304 |
1 |
|
|
"1.0.1" |
4194305 |
2 |
(eg, 4194304*1 + 1) |
|
"2.0.0" |
8388608 |
3 |
(eg, 4194304*2 + 0) |
|
"3.0.0" |
12582912 |
4 |
|
|
"4.0.0" |
16777220 |
5 |
|
Explanation: addr "4194305" (in decimal format) is the same as addr "1.0.1" (hierarchical format) and will be converted to Tracegraph's addr "2". "1.0.1.2" refers to the same addr, but specifically to its port number "2". This way it should be converted to "2:2". This is exactly the same case to addr "4194305:2" -> again is addr "1.0.1", port 2. It should also be converted to the same "2:2". I hope this subject is finally clear now with this explanation.
source: Address conversion examples (part 3)
Question 1: is entry -1:255 needed?
Yes, the -1:255 address is
not needed; it stands for the broadcast address, which is already in
TGs addr format; at most it would be present something like -1:255
-1:255
Question 2: another doubt,,,, The value of 3.0.1 3.0.2 3.0.3 3.0.4
equals 12582913, 12582914,12582915........ ?????
Yes, as 12582915
== (3*4194304 + 0*2048 + 3*1), etc
Continuing to the .tr.ip file;
|
look for... |
And convert it as.... |
Note |
|
-1:255 (not needed?) |
"empty" |
this line must be removed, or be present something like -1:255 -1:255 (see above) |
|
0.0.0.0 |
0:0 |
this line says that addr 0.0.0 + port 0 is TG addr 0 + port 0, so it is OK |
|
0:0 |
0:0 |
redundant, not needed |
|
1.0.3.0 |
4:0 |
this line says that addr 1.0.3 + port 0 is TG addr 4 + port 0, so it is OK |
|
4194304 |
1 |
this line says that addr 1.0.0 is TG addr 1, so it is OK |
|
4194304:255 |
1:255 |
this line says that addr 1.0.0 + port 255 is TG addr 1 + port 255, so it is ok. However, it is redundant because of the above line! |
|
4194305:255 |
2:255 |
this line says that addr 1.0.1 + port 255 is TG addr 2 plus port 255, so it is ok. |
|
4194306 |
3 |
this line says that addr 1.0.2 is TG addr 3, so it is ok. |
|
4194306:255 |
3:255 |
line ok, but redundant (see above) |
|
4194307 |
4 |
this line says that addr 1.0.3 is TG addr 4, so it is ok (important: because it matches with the line 1.0.3.0 4:0 above!) |
|
4194307:0 |
4:0 |
line ok, but redundant (see above) |
|
4194307:255 |
4:255 |
line ok, but redundant (see above) |
Thus the minimum .tr.ip file would be simply as this:
|
0.0.0.0 |
0:0 |
|
1.0.3.0 |
4:0 |
|
4194304 |
1 |
|
4194305:255 |
2:255 |
|
4194306 |
3 |
|
4194307 |
4 |
Fortunately, I've already coded an initial auxiliary function, enabling me and other NS2 users to successfully generate the conversion file automatically. This function is called "dump_.tr.ip", and should be called with the "tracename" as an argument, anytime AFTER all simulation addrs have been created (possible times are immediately before simulation run, or in the exit procedure. This file is present in the ns2_shared_procs.tcl file;
Note 1: a trivial patch to the ns-lib.tcl file,
present in the files folder, is needed to run this procedure
successfully, as described in this
post and this
previous post. IMPORTANT: This patch is no longer required! See
the update note on top of this file.
Note 2:
Currently TG has a bug in the conversion process, result of
performing simple string substitutions in all parts of the file
(regardless if it are IP addresses or not). This bug has been
reported to the TG author (Jaroslaw Malek), but for copyright and
time reasons it's not possible to fix it properly. However, this only
causes minor problems, and can be avoided using some manual work.
Contact me if this is a problem to you. (Also, check the notice in
the dump._tr.ip procedure).
(NEW: check the new tracegraph converter that has this bug fixed)
a) Download my debugging aids (ns2_shared_procs.tcl)
and source the file at the start of your script; (eg "source
ns2_shared_procs.tcl")
b) Download the needed patch
(dump_.tr.ip.patch)
and apply it in the /tcl/lib directory. ("cat dump_.tr.ip.patch
| patch -p0 --backup --ignore-whitespace --dry-run –help")
(NO LONGER REQUIRED)
c) Either recompile NS2 to include the
changed file, or simply source the "/tcl/lib/tcl-lib.tcl"
in beginning of your script ("source tcl/lib/tcl-lib.tcl")
d)
At the end of simulation (procedure finish) simply call the function
with the name of the trace file ("dump_.tr.ip name_of_trace")
When using wireless simulations with TG, a ".tr.ip"
conversion file must be present. As explained above, this file is
traditionally generated manually (as described in TG
manual), or automatically using my dump.tr.ip proc
(see above).
However, when using the later approach, one must be
very careful to provide a correct .tr.ip to TG.
Failure to do it can and will result on the following TG errors while
loading the file:
While loading TG:
"Index exceeds matrix dimensions"
"Warning: Subscript indices must be integer values."
"Index into matrix is negative or zero."
After
loading TG:
No data / incorrect data / incomplete data read from
trace file.
Random TG crashes.
Incorrect or "impossible"
results (example: number of received packets > number of generated
packets).
In the vast majority of these cases, these problems
are simply caused by an incorrect .tr.ip conversion file.
Thus,
instead of this manual error prone task, the dump_.tr.ip() proc
should always be used, as explained above.
If you use the "-ip" TG option, it will generate a file
like this for all known IP addresses, either in hierarchical or
integer format:
0.0.0.0 (this line refers to IP
hierarchical address "0.0.0", port 0)
0:0 (this
line refers to IP flat address 0, port 0)
...
However,
if the manual conversion is not done properly, TG can result in the
following errors while loading the file:
wired-wireless
format detected
IP addresses detected. Conversion to addrs
numbers needed (see help). Converting IPs to addrs numbers ...
Trace
file without IPs has been created:
/home/zahid/NS2/ns-allinone-2.27/bin/wireless3-out_no_ip.tr
Loading
the file...
Warning: Subscript indices must be integer values.
ERROR: Cannot read the file!
Index into matrix is negative or
zero. See release notes on changes to logical indices.
Instead of this manual error prone task, the dump_.tr.ip() proc should always be used, as explained above.
Check the mentioned files, patches, etc in this directory
www.terraview.org
Programa de apoio cartogrᦩco (SIG) para
planeamento agricola, florestal e ambiental