//
archives

Archive for

Perl program for computing the throughput

Trace file format in ns2

The format of a trace file generated by the simulation follow the sequence below: The first field is the event type. It can have the values “r”, “+”, “-”, ”d” for “received”, “queue”, “dequeue”, and “dropped” and “r”, “s”, “f”, “D” for “received”, “sent”, “forward”, and “dropped” respectively; The second field gives the time at … Continue reading

How to analyze your trace file through a perl script

Let’s run the test tcl script and show how to analyze. The trace file “out.tr” is obtained by running ns2 with the script ns2/tcl/ex/wireless.tcl, and you can analyze it with this Perl script “analysis.pl“. out.tr:

Create both TCP and UDP traffic, use nam to show animation and TCP variable tracing, use nam graph to show TCP sequence plot

Apply RED queuing disciplines, plot queue statistics with xgraph

Create TCP connection on simple topology, use nam to show animation

Using xgraph to create bar and line graphs

(1) In an xgraph data file list some number of data sets (one per curve). A data set contains an ordered pair of X Y coordinates, each point on a separate line.  The name of the data set can be specified by a line beginning with a double quote.  Here is some sample data for … Continue reading

Creating Output Files for Xgraph

[Source: http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html%5D One part of the ns-allinone package is ‘xgraph’, a plotting program which can be used to create graphic representations of simulation results. In this section, I will show you a simple way how you can create output files in your Tcl scripts which can be used as data sets for xgraph. On the … Continue reading

Trace Analysis Utilities

Here is a collection of trace analysis utilities that have been useful: Much parsing is easy if you can extract columns. Here is a helper-perl utility called “column” that breaks a text output into columns, separated by whitespace. It is used by many of the scripts below. Here is a simple perl called stats.pl script … Continue reading

Trace Analysis Example

This section shows a trace analysis example. Example 4 is the same OTcl script as the one in the “Simple Simulation Example” section with a few lines added to open a trace file and write traces to it. For the network topology it generates and the simulation scenario, refer to Figure 4 in the “Simple … Continue reading

Packet

A NS packet is composed of a stack of headers, and an optional data space (see Figure 12). As briefly mentioned in the “Simple Simulation Example” section, a packet header format is initialized when a Simulator object is created, where a stack of all registered (or possibly useable) headers, such as the common header that … Continue reading

Network Components

This section talks about the NS components, mostly compound network components. Figure 6 shows a partial OTcl class hierarchy of NS, which will help understanding the basic network components. For a complete NS class hierarchy, visit http://www-sop.inria.fr/rodeo/personnel/Antoine.Clerget/ns. Figure 6. Class Hierarchy (Partial) The root of the hierarchy is the TclObject class that is the superclass … Continue reading

Event Scheduler

This section talks about the discrete event schedulers of NS. As described in the Overview section, the main users of an event scheduler are network components that simulate packet-handling delay or that need timers. Figure 5 shows each network object using an event scheduler. Note that a network object that issues an event is the … Continue reading

Simple Simulation Example

This section shows a simple NS simulation script and explains what each line does. Example 3 is an OTcl script that creates the simple network configuration and runs the simulation scenario in Figure 4. To run this simulation, download “ns-simple.tcl” and type “ns ns-simple.tcl” at your shell prompt. Figure 4. A Simple Network Topology and … Continue reading

OTcl: The User Language

As mentioned in the overview section, NS is basically an OTcl interpreter with network simulation object libraries. It is very useful to know how to program in OTcl to use NS. This section shows an example Tcl and OTcl script, from which one can get the basic idea of programming in OTcl. These examples are … Continue reading

What is ns-2?

NS is an event driven network simulator developed at UC Berkeley that simulates variety of IP networks. It implements network protocols such as TCP and UPD, traffic source behavior such as FTP, Telnet, Web, CBR and VBR, router queue management mechanism such as Drop Tail, RED and CBQ, routing algorithms such as Dijkstra, and more. … Continue reading

Install some packages before installing ns-2

Attention: before you install ns-2 , be sure that you have installed following packages: tcl8.4 tk8.4 tcl8.4-dev tk8.4-dev I found that NS-2 all-in-one package is lack of the check to Xmu library when install NAM. The “configure” script of NAM doesn’t check Xmu library but can generate the “makefile”. Thus, you assume that everything is … Continue reading

Installing the Network Simulator NS2 on Ubuntu/Debian

Source: http://wiki.splitbrain.org/ns2 Note For the wget commands below get the correct download URLs from the sites linked at http://www.isi.edu/nsnam/ns/ns-build.html#pieces In the following I will download and unpack all needed sources to a directory named ns2install $> mkdir ns2install $> cd ns2install Debian Libraries Beside the usual stuff for compiling programs like gcc, g++ and make … Continue reading

Install ns2.26 in Ubuntu

Objective: install ns-allinone-2.26 in Ubuntu 5.10 Breezy Software needed: gcc-3.3, g++-3.3 (ns2.26 cannot be compiled with gcc >= 4.0), build-essential, autoconf, automaken, libxt-dev (tk need it), libxmu-dev (nam need it) To do: 1. apt-get install build-essential 2. apt-get install gcc-3.3 g++-3.3 autoconf automake-1.9 libxt-dev 3. go to /usr/bin, del softlink to gcc, g++ 4. ln … Continue reading

How to install ns-2 onto Ubuntu Linux

Get the allinone source. $ cd ~myname $ wget http://www.isi.edu/nsnam/dist/ns-allinone-2.28.tar.gz Modify build for GDB debugger. $ tar xzf ns-allinone-2.28.tar.gz $ cd ns-allinone-2.28 $ vim install Add the –enable-symbols option on line 408 so, ./configure –enable-gcc –disable-shared –prefix=$CUR_PATH || die “tcl8.3.2 configuration failed! Exiting …” becomes, ./configure –-enable-symbols –enable-gcc –disable-shared –prefix=$CUR_PATH || die “tcl8.3.2 configuration failed! … Continue reading

Download and install NS-2 on RedHat

Download ns-2.27 from: http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz To install ns 2.27 in Red hat, there are following steps: 1. tar -xzf * 2. ./install change .bash_profile and add some environment variables. put /home/ns-allinone-2.27/bin:/home/ns-allinone-2.27/tcl8.4.5/unix:/home/ns-allinone-2.27/tk8.4.5/unix into your PATH environment; so that you’ll be able to run itm/tclsh/wish/xgraph. IMPORTANT NOTICES: You MUST put /home/ns-allinone-2.27/otcl-1.8, /home/ns-allinone-2.27/lib, into your LD_LIBRARY_PATH environment variable. If … Continue reading