Ns2 Visual Trace Analyzer Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

NS2 Visual Trace Analyzer

Manual of NS-2 Visual Trace Analyzer 0.2.72


Network Simulator 2, the most used network simulator in the world, but lacks in ways of analyse its trace files. This tool provides an easy way to fulfil this exhaustive task allowing users to trace graphics, filter packets, visualize nodes position, calculate node and traffic statistics, and so on. This standalone application, with a user friendly interface, no need to install and no external libraries requirements, satisfies most user needs. Fernando Rocha 14-04-2010

Index
1. Introduction ...................................................................................................................... 3 2. Release Notes .................................................................................................................... 4 3. TCL Configuration and Troubleshooting ............................................................................. 6 3.1. Setting Nodes Colour.......................................................................................................... 6 3.2. Setting Nodes Position and Movement ............................................................................. 6 3.3. Setting Trace File Format ................................................................................................... 6 3.4. Setting Nodes Configuration .............................................................................................. 7 4. Requirements .................................................................................................................... 8 5. Load Simulation ................................................................................................................. 9 5.1. Loading TCL File .................................................................................................................. 9 5.2. Loading Trace File ............................................................................................................. 10 6. Statistics .......................................................................................................................... 12 6.1. Node Statistics .................................................................................................................. 12 6.2. Flow Statistics ................................................................................................................... 14 6.3. Routing Information (Path Shifts) .................................................................................... 15 7. Graphics .......................................................................................................................... 16

1. Introduction
Even though NS-2 is a powerful and widely used simulation tool, the analysis of the data obtained from the simulations is not straightforward. The Network Animator (NAM) can be used to visualize packets, but it does not supply any statistics or graphics as needed for data analysis. Moreover, the parsing of the NS-2 trace file using AWK scripts developed by users requires a further step to do data processing and graphical organization, many times does not work properly and the results are subjective. There are alternative tools, but most of them are not standalone applications, since it only works with libraries from Matlab, or requires some additional libraries and it has a user interface that lacks user-friendliness. In this scenario, the need for a standalone application that is able to easily translate the NS-2 trace files into graphics and to give a summary of what occurred during simulations, has led to the development of a new data analysis tool, NS2 Visual Trace Analyzer. The first version of the application was developed in the Laboratory of Communications and Telematics (LCT) of the Centre for Informatics and Systems of the University of Coimbra (CISUC) during several PhD using the NS-2. This document presents the NS2 Visual Trace Analyzer, an application capable of analysing NS-2 normal wired and wireless trace files along with some other formats. This tool is capable of analysing the trace files and making graphics and statistics about the behaviour of the flows in simulation. Simple, standalone, user-friendly, very fast, intuitive, this application will certainly help to get results. The main characteristics and functionalities are described in this document, along with some examples.

2. Release Notes
Version
0.2.54
13-12-2007

Description
First public version released.

0.2.55
18-12-2007

1. Minor Internal and GUI Bug fixes. 2. A Node can now be correctly disguised as other Node: This feature allows joining two Nodes. For instance, if Node ID 10 is the same as Node ID 15, or we want to assume they are the same, we can disguise the Node 10 as Node 15. Node 10 will then be treated as if it was Node 15. 3. Changes in Scenario File Structure: Having any trouble opening old scenario files (.cen), it is strongly recommended to open TCL files instead, and save scenario files again, with the new format. 4. Experimental Paths Viewer: It is not possible to see any path statistics yet, just see the various paths each flow/stream used. All paths will be listed, including reversed paths. I would appreciate any feedback of this new feature. 5. Bug fixed: Small files with movements can now be loaded! Some bugs while loading TCL and Trace file were fixed; fortunately there is no impact on results. 6. Bug fixed: A problem with Node IDs was fixed. Node IDs were not translated into Long Ids when no address was specified in the TCL file. Fortunately there is no impact on results. 7. Minor GUI bugs corrected.

0.2.56
22-01-2008

0.2.57
18-02-2008

0.2.58
08-04-2008

0.2.59
10-04-2008

8. Path-Shifts Improvement: Paths are now compared as a single block of memory, speeding up the comparison procedure. Node IDs are now showed instead of Node Addresses. 9. OpenGL Improvement: Use of a Display List to draw the selection icon. Minor improvements removing redundant commands. Improvements using the OpenGL stack. 10. Path-Shifts Improvement: Path-Shifts shows now the right number of packets, groups correctly the packets and the routes they took, and allows to navigate deeply in the structure. 11. Path-Shifts bug fix: Packets are now ordered by Time they were sent, instead of the ID and SCTP-ID. Times are now correctly showed in the Path-Shifts window. 12. Internet Update Improvement Minor improvements regarding the access to the Internet Update site. 13. Windows Vista Ready The support for Windows Vista (UAC) is now complete. Windows Vista Manifest is now embedded into the Application. Windows Vista themes are now supported. Windows Registry modifications are now adapted. 14. Added Old Wireless Trace Formats Basic Support Basic functionalities of Old Wireless Trace File Formats are now available. Only UDP & DSR packets were fully tested. 15. Bug fixed: Node Movements Node movements when there are more than one movement of the same Node, at different times, are now fixed.

0.2.60
15-04-2008

0.2.61
08-05-2008

0.2.62
13-05-2008

0.2.63
14-05-2008

0.2.64
14-05-2008

16. Minor bug fixes: Minor bug fixes in the movements architecture and application algorithm. 17. Bug fixed: DSR Packets Appear DSR Packets were completely ignored. Now packets are shown and taken into account. 18. Bug fixed: Path-Shifts With Short Routes Routes with no node in between could raise an error. Routing Information (Path-Shifts) are now prepared for direct Routes Source -> Destination. 19. Added Advanced Route Information Now it is possible to view advanced route information like the dropped, lost and transferred packets. This feature appears as a Popup Menu in the Routing Information window. 20. Bug fixed: ARP in Old Wireless Trace Format Ignored Due to limitations of the format, the ARP protocol in Old Wireless Trace Format Files is ignored. Those packets throw errors in previous versions of the application. 21. Bug fixed: Save Graphic to CSV This feature was a little hidden. It is now more visible and saves graphics to CSV columns correctly. 22. Bug fixed: Graphic Window The caption of a Jitter graphic window was incorrect. 23. Improved Windows Vista Compatibility The application was made compatible with Windows Vista Operating System. A manifest was written to inform Windows Vista of application compatibility. 24. Bug fixed: Graphic Options User Interface The Graphic Options window has some minor bugs dealing with events. Because of that, some parameters weren't passed to the Graphic window. 25. Bug fixed: Save Graphic as Image This operation was not working very well on Windows Vista. The Save Dialog was unable to check what Image Type was selected. That is now corrected. 26. Bug fixed: Nodes Addresses There was a problem obtaining Nodes Addresses. 27. Note: LIndex (List Index) The application is not yet compatible with "lindex" TCL function. You will need to unloop the "for" cycles and create the nodes without the use of "lindex". I hope to add the feature of processing "lindex" soon.

0.2.65
15-05-2008

0.2.66
15-05-2008

0.2.67
15-05-2008

0.2.68
23-06-2008

0.2.69
24-06-2008

0.2.70
15-10-2008

0.2.71
06-02-2009

0.2.72
14-05-2009

3. TCL Configuration and Troubleshooting


The TCL file is very important. The application will read the TCL file trying to parse the nodes number, nodes name and nodes configuration. If a node isnt recognized by the application, its probably because it is initiated in a complex way in the TCL file and the application was unable to find it. A good TCL configuration will eliminate the most common problems with the application.

3.1. Setting Nodes Colour


You can set the nodes colour at the NS2 Visual Trace Analyzer, but you can also set it at the TCL file like this:
set n0 [$ns node] set n1 [$ns node] $n0 color red $n1 color green

This configuration sets the colour of the node n0 to red, and the colour of the node n1 to green. The application can read this configuration.

3.2. Setting Nodes Position and Movement


You can set nodes position and movement like the following script shows.
$node_(0) set X_ 12.0 $node_(0) set Y_ 27.0 $node_(0) set Z_ 0.0 $ns_ at 1.0 $node_(0) setdest 50 100 1.37355696

At time 1.0 second, node will start moving from its current location to (50, 100, 0.0) at speed of 1.37355696 m/s. You can know more about nodes positioning and movement at the following links:
http://www.winlab.rutgers.edu/~zhibinwu/html/ns2_wireless_scene.htm http://www.isi.edu/nsnam/ns/tutorial/nsscript7.html

3.3. Setting Trace File Format


Its very important to set the trace file to the new trace file format. The new trace file format logs more information and is less ambiguous. You can set the trace file to the new format like the following script:
$ns_ use-newtrace set tracefd [open output.tr w] $ns_ trace-all $tracefd

The file output.tr will now be in the new trace file format. This is very important.

3.4. Setting Nodes Configuration


The nodes configuration is a very important setting too. You can set the trace levels you wish to have and enable or disable the nodes movement trace. The following script shows a simple nodes configuration.
$ns_ node-config -addressType hierarchical \ -adhocRouting AODV \ -llType LL \ -macType Mac/802_11 \ -ifqType Queue/DropTail/PriQueue \ -ifqLen 50 \ -antType Antenna/OmniAntenna \ -propType Propagation/TwoRayGround \ -phyType Phy/WirelessPhy \ -topologyInstance $topo \ -channel Channel/WirelessChannel \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -movementTrace ON

Dont forget to enable at least agentTrace, macTrace and movementTrace. This will allow the application to plot interesting graphics and to gather nodes movements.

4. Requirements
Operating System
o Windows XP / Vista / 7 (only user level permissions needed) o Linux (with Wine or other windows emulator)

Trace Files Supported


o o o o o TCL File (Visual Rendering) New Wired Trace Old Wireless Trace New Wireless Trace Trace Graph Files

Internet Connection
o Only needed to perform auto-update

5. Load Simulation
Loading the simulation files requires two steps: 1. You need to load the TCL file, so that the application can build the topology and get some extra parameters; 2. You need to load the trace file, with all packets information.

5.1. Loading TCL File


This file will help the application to count and place the nodes in the right places; it will also prepare the application to read the trace file properly. Please note that if a node isnt recognized during the load of the TCL file (because its in a complex loop or something like that), you can always unloop the creation and configuration of nodes to simplify its recognition. You can load the TCL file in the first screen of the application, the Scenery tab, by selecting the file with the ... button and then clicking the Load button.

After loading the TCL file, the visual interface will open. You will be able to see the nodes position, colour and interact with the view.

5.2. Loading Trace File


Loading the Trace File is the second stage. After loading the visual interface, it is possible to load the Trace File in the Simulation tab. You can press the ... button to search for the Trace File, and then press the Load button to start loading it.

10

Loading the Trace File can be an exhaustive task because the trace file can be very large. The process is multi-threaded, buffered and optimized to use the most computer processing power possible. An informative window will appear during the process, showing the current status of the loading process.

11

6. Statistics
This section describes how to get the node and flow statistics and their meaning.

6.1. Node Statistics


Its possible to get node statistics right clicking the node in the scenery and selecting properties.

This operation will open the node statistics window.

12

This window displays all node information. Node Information The Node ID property displays the NS internal node identification. Usually a node can be identified by its internal id or its hierarchical id. The Disguise ID is for internal use only. The Virtual Node property hides the node from the visual canvas. This is useful if you dont want the node to appear in print-screens. The Type property allows changing the type of node from Wireless to Desktop, although this change only affects the icon in the list of nodes, not in the visual display yet. Nothing else is changed by this manual setting. The Hierarchical property displays the node id in the hierarchical form. General Tab At the level dependant properties you can see the node statistics by level, usually AGT (Agent), RTR (Routing) and MAC (Media Access Control). The Sent property displays the total data sent from the node. The Received property displays the total data received from the node. The Transferred property displays the total data received from the node, and which the node was the last hop (the destination). The Forwarded property displays the total data that was forwarded to other nodes (only counts explicit forward at the trace file). The Dropped property displays the total data properly dropped at the queue. The Lost property is for internal use only and displays the total data that was sent by the node but wasnt neither dropped nor received by the next hop. If this value is high, its probably related to a bad behaviour on the network, because all sent packets must be dropped or received. The Events section allows checking the duration of the communication and total data generated, the cover of the communication (for wireless communications), and all the first and last events.

13

Node Tab This tab isnt finished yet. It will allow seeing all the nodes that communicated with the selected node, and some statistics related with that communication.

6.2. Flow Statistics


To get the flow statistics please select the Flows tab, right click a flow and select Properties.

This operation will open a window with the proper flow statistics.

The right part of the window isnt working yet. It would display the statistics depending on the packet destination.

14

The left part of the window displays some interesting statistics about the flow and the generated packets. The first section Data Generated specifies the impact of the flow in the overall generation of packets (of all flows). If this is the only flow in the simulation, this bar should be full, if this flow has generated few packets considering the overall of the other flows, this bar will be almost empty. The second section Data Dropped will consider the total packets generated, which percentage was dropped. The tabs Delay and Throughput are self-explanatory. The tab Connectivity displays the percentage of time the flow has been active considering the total simulation time and the first and last events of the flow.

6.3. Routing Information (Path Shifts)


The application can take present all the path shifts each flow has made, the number of packets each path has transferred, and more than that, can show full statistics about specific routes, as the next image shows:

This operation will open the flow statistics filtered by the specific route. This is very good to evaluate the specific route performance.

15

7. Graphics
The application has many graph capabilities. You can draw delay, jitter and throughput graphics. Please remember to change the Trace Level in the graphic options to AGT and adjust the Sync. Interval if you were expecting to see something and nothing appears. The graphic doesnt consider all levels, just one at the time. The following image is just a simple example of a delay (per packet) graphic.

The following image is a simple example of a jitter graphic (per packet):

16

The next image is a typical throughput graphic with 50ms interval:

Its possible to configure the graphic, save it as an image or export its data to CSV so you can import it in Excel or other similar application.

17

You might also like