NS2 Visual Trace Analyzer 0.2.72 Released

I’m posting the last version of NS2 Visual Trace Analyzer I’ve developed, 0.2.72.
It has many features: plots delay, jitter and throughput  graphics, calculates many statistics per node or per flow and it has a visual interface of the nodes disposition along the simulation.

The visual tool doesn’t show the packets exchange, I’ve not finished this feature, but it shows pretty well the nodes disposition, coverage and movement.

You can download here: NS2 Visual Trace Analyzer 0.2.72
MD5: 4B07436896E5B6A21BB6F28963B5090F
SHA-1: EC27C104CAC244043F90384E3E0282019008681A

User Manual
You can download here: NS2 Visual Trace Analyzer Manual
MD5: 2497745A1B9EB84CC151E41E2873A248
SHA-1: A3AFF9F488539FD8690E73124050182171A765D3

Application Crashes Troubleshooting Manual
Disable nodes movements interpretation: Disable Nodes Movements Manual
MD5: F715E995133398840BF1E1F5F219A6D3
SHA-1: BC8E206D28720D1FFDFCFC1870AC3F4BF5154DAF

Hope you like it!

About these ads

111 thoughts on “NS2 Visual Trace Analyzer 0.2.72 Released

    • Hi Fernando

      Your trace file analyzer It looks very interested for me.I tried to download and run it (your tool). Unfortunately, it gives me an error ” Ns-2 wireless Trace Analyser has stopped working” -> Debug or Close program . This message appears every time during the trace file upload. could you please advice.

      Also,could you please tell me how long it takes to upload and analysis a trace file of the following sizes:

      trace file of 10 MB (Miga byte) size
      trace file of 60 MB (Miga byte) size
      trace file of 100 MB (Miga byte) size
      trace file of 1.2 GB (Giga byte) size

      Idress Skloul Ibrahim, PhD.
      Post of Research Associate, CTI
      Heriot-Watt University, MACS
      Riccarton, earl-mountbatten-building
      Room: G41
      Edinburgh EH14 4AS
      Scotland, U.K
      Tel: +44 131 451 3280
      Fax: +44 131 451 3327
      – URL: http://www.macs.hw.ac.uk/~isi3

      • Hi Dr. Skloul,

        Analyzing less than 100MB should take you no longer than some seconds…
        Franciszka noticed that the tool doesn’t load trace files bigger than 1.6GB, and uploading something like that could take you like 10 minutes or more, depending on the machine you have and if you’re running on Windows or Linux.

        Have you read the ? That might help you with that error… :)

        Best regards,
        Fernando Rocha

  1. Hi Valeriy,

    No, unfortunately I didn’t.
    I guess It could work, although the visual node positioning and movement will probably fail (the satellite positioning uses latitude and longitude)… I’m pretty sure the statistics would be correct, because the rest of the trace file format is similar to wired/wireless.
    If someone could confirm this, It would be great. :)

    Kindest regards,

    • Hi Das,

      Yes, it’s for Windows, but I think it will work on Linux if you use an emulation program like WineHQ without any problem.

      If you’re having trouble decompressing the RAR, I can use ZIP to avoid compatibility issues, I’ll do that right now. The error might also be because you’re not downloading the entire file, but that’s more unlikely, I’ll make a checksum result available for all to check if the file was downloaded properly. :)

      Best regards and good job!

    • Hi lovsis,

      The convergence time can be very difficult to compute because the routing information can be exchanged during the whole simulation.

      If the flow id of the initial routing information differs from flow id used for exchanging information in the rest of the simulation, this calculation is easy, you can open the flow properties window and then the “Connection” tab shows the value “Life Time”, in this case the convergence times is the same as the “Life Time” of the flow. You can check this image.

      Another option is to schedule to send data only 5 seconds (or something like that) after the initial routing information exchange. This way you can literally divide the trace file in two parts:

      • the first 5 seconds that contains the convergence data of routing information (the convergence time must be lower than this, or else increment this time);
      • the second part that contains the rest of the simulation – the data and route updates.

      When you’re telling “number of updates” you’re might be referring to the number of times that a route has changed or the number of route update packets. You can see both of these metrics with this utility.

      The first one you can check with the “Path Shifts” window of the main flow, this will show the number of times that the flow route has changed.

      The second one you can check opening the properties window of the flow responsible for sending route updates. This window will show the total packets generated, sent, dropped and received. It also shows in terms of bytes, so you can calculate the impact of the routing protocol.

      I hope this helps your research. :)

    • Hi binteasim,

      Please try plotting, for instance, “Delay -> Per Packet” with default settings, you should be able to see something.

      If you can’t see anything plotted, you can send me the TCL and Trace files and I will try to see what’s wrong.

      Best regards.

  2. This looks an awesome piece of software!
    I am working on a project for using MANETs, and I get errors relating to finding nodes within the trace file.
    What am I doing wrong?

    • Hi Duncan,

      As far as I can tell, the MANET extension does not modify the trace file. You should, however, tell ns2 to use the new trace file format in the TCL (“use-newtrace”).

      If you’re having problems loading the trace file because nodes weren’t found, that means the application isn’t recognizing the nodes declaration in the TCL file. Unfortunately the application has a little limitation recognizing nodes declaration in the TCL file, there are so many ways to declare nodes…
      When a node isn’t properly loaded or recognized by the application, you can explicitly add the node manually in the TCL file, at the point that the node is being added but not recognized, this way the nodes will be ordered. For instance:

      set N5 [$ns node];
      set N6 [$ns node];

      This will allow the application to recognize and load the remaining nodes previously not recognized (N5 and N6).
      Once the application recognizes all the nodes, the application will now be able to work.

      NOTE: This is a workaround, this modified TCL file should only be used with NS2 Visual Trace Analyzer, you MUST run your simulation with the original TCL file.

      If you’re still having problems you can send me an e-mail with your TCL and trace files.

      Best regards,
      Fernando Rocha

  3. Hi,

    I’m trying to plot the throughput/delay etc for a wired cum wireless scenario but it doesn’t seem to work…

    Do you have no idea of what I should do?


    • Hi Storm,

      Try plotting “Per Packet” graphics, those are easier to configure and must work with default settings.
      The following image shows how to do that:
      Delay Per Packet

      If that doesn’t work, you probably have the MAC and AGT trace levels disabled in your TCL, you must enable them and rerun the simulation.

      For plotting other type of graphics, you can adjust the “Trace Level” to MAC or AGT.
      To plot “Over Time” graphics and “Throughput” you must also assure the traffic is running through the target node.

      I hope this was helpful.

      Best regards.

      • Hi, thanks the swift reply! It took some modifying of my code but it worked! :)

        Is there a way to generate a graph of Throughput/Delay against Load?

        Thanks a bunch again.

      • Hi Storm,

        That would be interesting, but currently that’s not possible.
        You can however, export the throughput/delay graphic to CSV, load it, for instance, with Microsoft Excel, and then you just need a way to get the Load data.
        If the traffic generated is constant, I guess the Load would be easier to plot.

        The application can only show you the minimum/average/maximum Load, not a graph. :(

        Best regards.

      • Nevermind! It shouldn’t be too difficult to do it manually. Thanks a lot for the help and the great software. :)

  4. Pingback: NS2

  5. Sir i want to calculate the propagation delay between nodes from the trace file of Tcl type and i am using fedora 11. plz tell me how can i use this software. can i use it in windows after preparing trace file in fedora 11? i also want to know that what language(e.g. awk, shell, perl or something else) should i use to analyze a trace file……. plz suggest me the easier one bcoz i m doing this for the first time…….. thank u.

    • Hi Pinto Das,

      Unfortunately the application can’t tell you the propagation delay between nodes, only the complete delay (since the source node begins to send the packet until it is completely received from the destination node). This is what the RFC 2679 describes.

      For the complete delay, you can check the minimum, maximum and average values, or even plot a graphic over time.

      Adding an option for the propagation delay seems a nice feature for the next release.

      Best regards,
      Fernando Rocha

  6. Hi,

    I’m not too sure if I’ve done something wrong to the trace files or my simulation is completely wrong. But I am getting throughput of around 440kb/s when I should be expecting 2Mb/s… Probably a long shot, but do you have any idea what I may have done wrong?

    • Hi,

      It might be just a matter of units. You might be specifying the bitrate using Mbps (bits) and the tool is configured to show throughput in bytes as default (you can configure it to show in bits instead).
      Be also aware that the TCP protocol has some congestion protection mechanisms that may affect the throughput.

      I hope this helps,
      Fernando Rocha

    • Hi Abhishek,

      I’ve just installed Ubuntu and ran without problems NS2 Visual Trace Analyzer.
      You just need to install WineHQ. Installation instructions are available here:

      After you have installed WineHQ 1.4 (or 1.5 if the 1.4 version fails to install), you can download the tool, unzip the ZIP archive and run the EXE archive like you would do in Windows. :)

      Please tell me if you still have problems, I might be able to assist you remotely. ;)

      Best regards,
      Fernando Rocha

  7. Sir
    I am having problem while loading the trace file in trace analyzer on windows, it is giving error.I modified the tcl file by adding the nodes explicitly also then also problem is not resolved.

  8. HI sir,
    I am having problem while loading the trace file in trace analyzer on windows, it is giving error and stopped working.I loaded different trace files but its not working.

    • Hi Mozhi,

      Please try the workaround described in “Disable Nodes Movements Manual” above.
      Please tell me if that works. :)

      Best regards,
      Fernando Rocha

      • Hi,
        The solution to the crashes works.

        By the way, would you mind sharing the source code of the program? Some of us might be able to help with the development.

        Best wishes

      • Hi Maciej,

        I would LOVE to share the source code, it doesn’t uses any external libraries so it would be easy to compile it on any machine.
        The problem is that I’ve lost the source code… so I began building a new tool from scratch, with the knowledge that I’ve learned from building this one.
        I’ve already started the project and I think it would run much faster, but it doesn’t do anything useful yet. I’m only working on this on my free time. :(

        Network Simulator has progressed to version 3, a non-backward compatible version.
        With ns3, tools like TraceMetrics and NetAnim emerged (among other tools).
        These tools seem already well designed, so I lost some of my motivation to keep up the work on this.
        Sometimes I get new messages here at the blog and I think it might be useful to continue… but… I’m continuing slowly.

        If the new tool I’m developing reaches usefulness, I make the source code available.

        I hope you understand.

        Kindest regards,
        Fernando Rocha

  9. Pingback: NS2 - Page 2

  10. Sir
    While evaluating performance of AODV routing protocol, ns2 trace analyzer is not displaying the AODV control packets sent,lost. I need the routing traffic also to compare it with DSR. Please help me.

    • Hi Soumya,

      Damn, you’re right… the protocol isn’t completely supported by the tool, that’s the reason why the flow doesn’t appear.
      I really hope to release a new version of the tool with this completely implemented, but there is so much work to do before that…

      Best regards,
      Fernando Rocha

      • And Sir is this grep command correct to find number of aodv control packets sent which is required to calculate routing overhead
        routing overhead = no. of control packets sent / no. of packets delivered

        cat out.tr l grep RTRl grep AODV l grep ^s l wc -l

  11. I have one more confusion, packets lost must be equal to packets sent – packets recieved but it is not followed in the output which ns2 trace analyzer is giving ???

    • Hi Soumya,

      packets lost = packets sent – packets received – packets dropped.
      You shouldn’t have any packets lost if you run your simulation till the end. Packets lost are packets that were sent but weren’t neither received nor dropped.

      This means that packets are still in queue or on transit. This shouldn’t happen if your simulation runs till the end.

      Best regards,
      Fernando Rocha

      • I am running the simulation for wireless communication scenario till the end and then also packet lost is not equal to packet sent – packet recieved – packet dropped. Plz tell me no. of packet lost that it is showing is right or not ? I can send the tcl and trace files if required.

      • Hi Soumya,

        I’m sorry for the late reply, I’m extremely busy at work…
        Please, send me the TCL and TRACE files then, I’ll try to check that.

        Kindest regards,
        Fernando Rocha

  12. Hi sir, I have seen you said plotting the graph throughput/delay with microsoft excel, can you guide me on how to do this with excel? Or possibly any links that i can follow. I have try to search in google, but no luck :(

  13. Good Day!

    Actually I’m new for NS-2. I tried wireless scenario which was suggested by Marc Greis Tutorial. Surely the issue of analysis of trace files is most important for me. I tried NS-2 Wireless Trace Analyzer but it doesn’t work. It gives me a message about it.

    I use Windows 7. But I’ve got trace files in Ubuntu 11.10 (It is on virtual machine).

    What can be the problem?

    I also tried to load wire scenarios and everything was ok.

    Thank you.

    • Hi Kate,

      Please use the new trace file format.
      To do that, add the following line to your TCL:

      $ns_ use-newtrace
      set tracefd [open simple.tr w]
      $ns_ trace-all $tracefd

      Also, if the application crashes, please chose right after opening the NS2 Visual Trace Analyzer, the “Cenario File” in the “Simulation” tab, before you load anything. After that, load the TCL and then the TRACE – that should work now.

      If you still having problems, please contact me again.

      Best regards,
      Fernando Rocha

      • Good Day! I used the new trace format. But the problem was in selection of Trace and Cenario File. Now I select Cenario file but load the *.tr one. It seems that it works. Thank you.
        However I have a question. I read you tutorial, and couldn’t understand what you mean…
        At the page 13 you wrote “At the level dependant properties you can see the node statistics by level, usually “AGT” (Agent), “RTR” (Routing) and “MAC” (Media Access Control)…. The “Received” property displays the total data received from the node.” What does it mean? Does It mean FROM the node or BY the node? Because in case “FROM the node” it means how many other nodes recieved the packets from this node. Does it correct? The same queation to “Transferred”.

        Thank you.

      • Hi Kate,

        You’re right, the sentence is incorrect.
        The properties “Received” and “Transferred” should state “… received by the node …”.
        Thanks for correcting that. :)

        Kindest regards,
        Fernando Rocha

      • Thank you for your quick replies! I have a lot of questions :) It is not clear for me how I can load scenario and traffic files in your product. Is there any oppotunities of it? If “yes” what should I write to options in my tcl file? Now I write the way to this files:
        set val(cp) “../mobility/scene/cbr-3-test”
        set val(sc) “../mobility/scene/scen-3-test”

      • Hi Kate,

        I’m not sure if I understand you question, please check if this answers what you’ve asked.
        The tool loads the scenario from the TCL file interpreting commands like:
        $node(0) color green
        $node(1) color purple
        $node(0) set X_ 15.0
        $node(0) set Y_ 30.0
        $node(0) set Z_ 0.0
        $topo load_flatgrid $opt(x) $opt(y)

        Unfortunately it’s not possible to build or modify a scenery file, only to load it.
        Sometimes the application might miss interpreting some TCL code, most of the times because it’s too complex and the application parser is very basic, is not expecting much complexity reading the TCL.

        Kindest regards,
        Fernando Rocha

      • I am sorry but i don’t understand…There are several types of AGT packet in Properties of the node. It shows me that there are 2048 p. sent, 2048 recieved and 2048 transfered (properties of node 1 – sink). In Properties o node 0 (tcp) there are 2053 sent, 2031 recieved, 2031 transfered. Nothing dropped in AGT.There are 2057 sent, 2056 recieved, 3 transfered and 6 dropped for RTR of node 0. For RTR of nade 1 – 2051 sent, 2052 recieved, 0 transered and 17 is dropped. How can be the following situations: node 0 send 2053 packets, 6 of them dropped. So the node 1 should recieve 2047 but it gets 2048! Please help me :)

      • Hi Kate,

        Please send me the TCL and Trace files, you can send as a compressed ZIP or RAR archive.
        I’ll try to check what’s going on.

        Kindest regards,
        Fernando Rocha

  14. Hello Sir. Thanks for this awesome software & active forum.
    I am working on project which requires to compare performance of AODV & DSDV protocol.
    I have successfully got trace files (.tr files) for AODV & DSDV.
    I want to find throughput & delay to compare both routing protocols..
    How can I analyze a trace file for the same?
    I worked on Ubuntu 11.04 on VM Ware.
    I am very new to NS-2.
    So please help me ASAP.
    I need to submit my project on this Monday itself.
    Hoping for your favorable response sir…
    Once again thanks & response ASAP…

    • Hi Keyur,

      I’m sorry, I was unable to arrange time to build you a tutorial yet.
      I’ll build it anyway and make it available to everyone so this won’t happen again.

      Best regards,
      Fernando Rocha

  15. Hi
    I’ve successfully integrated a modified version of aomdv into ns2.34 in ubuntu 12.10 but when i try to trace it through a tcl file i get the following error:

    (_o15 cmd line 1)
    invoked from within
    “_o15 cmd addr”
    invoked from within
    “catch “$self cmd $args” ret”
    invoked from within
    “if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error “error when calling class $cls: $args” $…”
    (procedure “_o15″ line 2)
    (SplitObject unknown line 2)
    invoked from within
    “_o15 addr”
    (“eval” body line 1)
    invoked from within
    “eval $node addr $args”
    (“default” arm line 2)
    invoked from within
    “switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    DSR {
    $self at 0.0 “$node start-dsr”
    AODV {
    set ragent [$self cre…”
    (procedure “_o4″ line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    “_o4 create-wireless-node”
    (“eval” body line 1)
    invoked from within
    “eval $self create-wireless-node $args”
    (procedure “_o4″ line 23)
    (Simulator node line 23)
    invoked from within
    “$ns node”
    (“for” body line 2)
    invoked from within
    “for {set i 0} {$i <$val(nn) } { incr i } {
    set node_($i) [$ns node]
    $node_($i) random-motion 0 ;# disable random motion
    # On détermine la positi…"

    Sorry I know this forum is meant for quries related to trace analyzer but i've tried every solution on the internet but nothing sought. you are my last hope, my project deadline is this month end, have to plot a graph. your interest in debugging made me post this. please help me.

  16. Hello Dear Fernando
    I am trying to use your app for WiMAX, and when I put the tcl files and trace files and also I tried disabled the nodes movements, but it did not worked :(
    I can send you the tcl and trace file, my email is: rez.golestani@gmail.com

  17. Hii
    Is ns2 visual trace analyzer works for GPSR protocol ??
    When I gave the tcl file and trace file, it is showing node 2 not found error. I can send u the files if needed.

    • Hi Soumya,

      I’m sorry for the late reply.
      You need to create the node explicitly in the TCL file, you can use a separate TCL file to do that.
      If you’re still trying to work with my application, please send the TCL and Trace files to darkcompiled@gmail.com.
      You can use a compressed archive like ZIP, RAR or 7zip.

      Best regards,
      Fernando Rocha

  18. hi,
    i tried to load the trace file but it is not loading it always shows “NS2 Wireless trace Analyzer has stopped working” . When i load the .tcl file , it loads the node properly but i don’t know why it is not able to load trace file. Can you please help me out!!
    Thanxs in advance!!!!

    • Hi Shashank,

      That’s because of node movements, you can disable them as shown on “Application Crashes Troubleshooting Manual”.
      Tell me if that works for you. :)

      Best regards,
      Fernando Rocha

  19. hi sir..
    i just wanna ask..why in the scenery part.. it shows ‘0 2′ is not a valid integer value..when i want to load the tcl script.
    why this happened sir?
    im using the ns-2 in Ubuntu 12.04 LTS and now i wanna analyze my trace file..

    ur help is highly appreciated..


    • Hi Ashaari,

      The application was unable to parse your TCL file correctly.
      You can unloop the creation of your nodes allowing the application to load your nodes correctly. You can use that modified TCL file just for the application to load nodes and use the other TCL file for the ns2.

      I hope it helps you.

      Best regards,
      Fernando Rocha

  20. hey sir
    Thank u 4 this program it’s quit helpful but i wanted to add a new parameter to the default ns2 trace file parameters for example I want to calaculate Transmission Power, Energy
    Can u plz help me out as i am new to ns2 or provide me with links that can
    Thannx alot

  21. hi sir.

    i am facing error when i generate xgraph from trace(.tr) file like this

    Error in file ‘out.tr’ at line …
    unknown line type
    problems found with input data.

    please sir give me solution it is very important to me.

    • Hi Pradip,

      I’m sorry, I’m not very experienced with xgraph errors.
      I think that usually you convert the trace file to a plot file (a file with the values to be plotted), and then you use the xgraph to plot the values.
      I hope you find the problem. :)

      Best regards,
      Fernando Rocha

  22. Dear Mr.,
    I downloaded this software and run it on win7, but *tr file was made in Ubuntu (Linux) using NS2. Why wasn’t there any results in software?
    please help me. Thanks a lot.

  23. Sir I have an error while running the wired cum wireless scenario, there is a window that says: The application is not compatible with “lindex”…..Please insert the value of in this situation: set W($i) [$ns_node [lindex $temp $i]], and it asks for a value, doesn’t accept the values when I insert them.

  24. Can you tell me, why this code doesn’t work with your program?

    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) 50 ;# number of mobilenodes
    set val(rp) DSDV ;# routing protocol
    set val(x) 1000 ;# X dimension of topography
    set val(y) 1000 ;# Y dimension of topography
    set val(stop) 150 ;# time of simulation end

    set ns [new Simulator]
    set tracefd [open simple.tr w]
    set namtrace [open simwrls.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 mobilenodes
    $n(0) set X_ 347.0
    $n(0) set Y_ 3.0
    $n(0) set Z_ 0.0

    $n(1) set X_ 345.0
    $n(1) set Y_ 36.0
    $n(1) set Z_ 0.0

    $n(2) set X_ 330.0
    $n(2) set Y_ 121.0
    $n(2) set Z_ 0.0

    $n(3) set X_ 316.0
    $n(3) set Y_ 152.0
    $n(3) set Z_ 0.0

    $n(4) set X_ 246.0
    $n(4) set Y_ 90.0
    $n(4) set Z_ 0.0

    $n(5) set X_ 379.0
    $n(5) set Y_ 6.0
    $n(5) set Z_ 0.0

    # Set a TCP connection between n(1) and n(31)
    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(31) $sink
    $ns connect $tcp $sink
    set ftp [new Application/FTP]
    $ftp attach-agent $tcp
    $ns at 10.0 "$ftp start"

    # Set a TCP connection between n(31) and n(43)
    set tcp [new Agent/TCP/Newreno]
    $tcp set class_ 2
    set sink [new Agent/TCPSink]
    $ns attach-agent $n(31) $tcp
    $ns attach-agent $n(43) $sink
    $ns connect $tcp $sink

    #defining heads
    $ns at 0.0 "$n(0) label CH"
    $ns at 0.0 "$n(1) label Source"
    #$ns at 0.0 "$n(2) label N2"

    $ns at 10.0 "$n(5) setdest 785.0 228.0 5.0"
    $ns at 13.0 "$n(26) setdest 700.0 20.0 5.0"
    $ns at 15.0 "$n(14) setdest 115.0 85.0 5.0"

    #Color change while moving from one group to another
    $ns at 73.0 "$n(2) delete-mark N2"
    $ns at 73.0 "$n(2) add-mark N2 pink circle"
    $ns at 124.0 "$n(11) delete-mark N11"
    $ns at 124.0 "$n(11) add-mark N11 purple circle"
    $ns at 103.0 "$n(5) delete-mark N5"
    $ns at 103.0 "$n(5) add-mark N5 white circle"
    $ns at 87.0 "$n(26) delete-mark N26"
    $ns at 87.0 "$n(26) add-mark N26 yellow circle"
    $ns at 92.0 "$n(14) delete-mark N14"
    $ns at 92.0 "$n(14) add-mark N14 green circle"

    # Define node initial position in nam
    for {set i 0} {$i < $val(nn)} { incr i } {
    # 20 defines the node size for nam
    $ns initial_node_pos $n($i) 20

    # 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 150.01 "puts \"end simulation\" ; $ns halt"
    proc stop {} {
    global ns tracefd namtrace
    $ns flush-trace
    close $tracefd
    close $namtrace
    exec nam simwrls.nam &

    $ns run

  25. Good day, I have gone through NS2 visual trace analyzer, I was able to use it and that is a good work, keep it up. Please I want to seek for some help from your my thesis is on “Multichannel MAC Protocols for Wireless Networks (ad-hoc network)” I have been able to get the mac files, the queue file to simulate but my problem is getting the tcl script to run this, pls if you can help me how to write the tcl script for Multichannel MAC Protocols for Wireless Networks like this, does it means in the mac layer im not going to use mac/802_11, all I need is to get the generate the topographic for the tcl to run, pls help

  26. Hello Fernando,
    I’ve got problem with your program. This is part of my script:

    set temp(0) 0.0.0;
    set W(0) [$ns node $temp(0)];

    When I’m loading this script, I get error message: “$temp(0) is not a valid integer value”. Can you help me?

    • Hi Franciszka,

      “0.0.0” is not a valid integer indeed… :)
      The tool doesn’t have full support of OTcl, it’s expecting only an integer.

      1. Please run ns2 with the script you have;
      2. Change “set W(0) [$ns node $temp(0)]” to “set W(0) [$ns node 0]“;
      3. Load the modified TCL with the tool (not the original);
      4. Check if that works!

      You can send me the full TCL and Trace to “darkcompiled@gmail.com” and I can check for further problems. :)
      If you send it, please compress the trace with RAR, ZIP or 7ZIP. ;)
      I hope this helps!

      Kindest regards,
      Fernando Rocha

      • Thank you for your help. Now I can load *.tcl file, but I have another problem: program doesn’t see all nodes. I get message “node X not found”. I found out that all mobile nodes are not found (I have wired & wireless network).

        set W(0) [$ns node];
        set W(1) [$ns node];
        (…) some settings to 9 nodes
        (…) some settings for mobile nodes
        set BS(0) [$ns node];
        set node(0) [ $ns node];

        All mobile nodes, starting with BS(0) are not found. And after clicking “OK” in message box, my GNOME Shell crashes.

        I would like send you my *.tcl files, but trace files are too big, even with compression (1,6GB). Is this enough?

        BTW. 1,6GB is limit for trace file in your program – it’s not sufficient. It would be grateful if you could do sth with this.

        Best regards,

      • Hi again Franciszka,

        That’s a known problem… the tool doesn’t load nodes that it doesn’t recognizes in the TCL. :(
        Please create the remaining nodes like this instead:

        set BS(0) [$ns node]
        set BS(1) [$ns node]
        set BS(2) [$ns node]
        set BS(3) [$ns node]
        set BS(4) [$ns node]
        set BS(5) [$ns node]

        Remember, this is a workaround just for the tool, please run the ns2 with your original TCL script.

        Thanks for reporting the tool doesn’t load files bigger than 1,6GB, I was not aware of it!
        I’m developing a new tool, faster and easier to work with, and I will surely have bigger file sizes in mind. :)

        Best regards,
        Fernando Rocha

  27. hloo sir,
    I have doubt under how to calculate packet send and packet receive in each nodes through awk scripts using NS2 software….

    hope ur valuable reply…..

    Thanks and Regrads
    sheethal sunny

  28. Hi

    I create a large number of nodes in the tcl file using a “for….” loop. Is there a bug regarding the analyzer in such a case? I get the correct topology using nam, yet a wrong one when using trace analyzer. Is there any solution you could propose? I cannot create manually all nodes, since i run simulations with 100 wireless nodes

    Best Regards,

    • Hi Vag,

      Yes, unfortunately there is a bug in the TCL parser of the Analyzer interpreting nodes inside for loops.
      The parser supports for loops, it depends on how you create nodes inside the loop.
      If you send me the TCL script and part of the trace by e-mail I might be able to find what is causing the problem.
      If you like, you can send to: darkcompiled@gmail.com

      Best regards,
      Fernando Rocha

  29. Hey..Fernando …Good job..! But I have a problem while loading the trace file…After loading the trace file…application crashes immediately…It says : NS2 Windows Trace Analyser has stopped working…Please Help

    • Hi Naeem,

      It’s not very hard if you have a specific flow for the routing protocol (which I recommend).
      If that’s the case, you can click “Path Shifts” over the flow of the routing protocol and check which nodes had communicate.

      I know it’s not straightforward, it’s something that could be easily improved. :)
      I hope this works for you!


  30. Hi,
    I am having a trouble to find the “Flow” tab when load the “.tr” file. It is not appearing with the others tabs (Scenery, Movements, Simulation, Internet Update, and About). I am using win 7 .

    • Dear Safa,

      There are various reasons why the “Flows” tab might not appear. Assuming you’re loading the “.tr” file correctly, the problem is most probably within the trace file.

      Have you enabled the new trace-file format? (please check section 3.3. “Setting Trace File Format” of the manual)
      Have you enabled the MAC and AGT traces? (please check section 3.4. “Setting Nodes Configuration” of the manual)

      If you’re still having problems, please e-mail me the “.TCL” and “.TR” files.
      Don’t hesitate in contacting me again. :)

      Kindest regards,

      • Hi Fernando,
        Yes it is work now , i had some problem in my tcl file and i solve it as you mention in 3.3 section, i really appreciate your reply and help :)

      • Hi Safa,

        Great, I’m glad to hear that! :D
        I hope the tool is able to fulfill all your needs.
        Stay in touch for any problem.


  31. Hello Sir,
    Good work with the tool. Can you please tell the algorithm to find throughput normally without your tool in linux with just using the wireless trace file. I am in very need of it. I want calculate the throughput of various wireless topologies using ns2 and just the trace file.

    • Hi Atul Kumar,

      Throughput may be presented as a scalar value or a graph, as you may already know.

      As a scalar value you can use the RFC1242.
      The throughput value is the maximum data rate that the device can support without losing any frame.
      But again, If you want to be very strict, this might be difficult to calculate, I don’t even know if you can simulate this.
      For more information you can check the procedure on RFC2544, section 26.1 “Throughput”.

      As a graph you may have various approaches:
      – Showing received throughput (the tool supports this):
      This is easier, you calculate the throughput of the received packets.
      You can calculate an average receive data rate each time (for instance, each second) and plot a graph.
      Usually this is very good to demonstrate traffic behaviour with certain routing protocols, links, communication protocols (TCP, UDP, …), ….
      Technically, in NS2 you check for the packets (and data) that the node receives in a certain time period, over the simulation time.
      – Showing sent throughput (the tool also supports this):
      This considers the data rate that packets are sent from the node, instead of received. I also consider retransmitted packets.
      Technically, in NS2 you check for the packets that the node sends in certain time period, over the simulation time.
      – Showing device throughput:
      This, as stated in RFC2544, can be done after running enough tests to determine accurately the DUT throughput for various packet sizes.
      You may check the RFC2544 for more details building this graph.
      I don’t know if you can simulate this in NS2…

      I hope this helps! :)


  32. Hi Fernando

    I want to calculate no of participating nodes of routing, and used energy of all participating nodes. This trace analyzer can do this job. However, You did good job.

  33. Hi Fernando

    Sorry to write again…
    I want to calculate no. of participating nodes of routing, and used energy of all participating nodes. Can this trace analyzer do this job?

    • Hi again Naeem,

      No. Unfortunately this tool doesn’t make any statistics based on nodes energy. :(
      You can build a awk script, or something like that, to retrieve that kind of statistics.


      • Could you tell me how can i calculate participating node in the routing from trace file?

  34. hi and thank you.

    i’m working on detecting hidden nodes using the passive detection with RTS/CTS, have you an idea on this ?


    • I have a general idea on how RTS/CTS wireless mechanisms work… but can’t even say if ns2 supports testing that and if this application can be useful for you. :(
      I can assure that if a node receives a packet, the tool counts that packet… but RTS/CTS seems more low-level, like hardware level… so I have no idea.

      Either way, It seems a very interesting research… :)

  35. Hi Fernando

    could you tell me how you count the number of sent packet for each node individually , could you provide me with this piece of code , or a script for this step.
    thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s