NS2 Ultimate
Post processing NS2 Result using NS2 Trace — Wireless Trace file format

Table of Contents ] [ Previous Post ] [ Next Post ]

This post is one of the series of “Post processing NS2 Result using NS2 Trace”. Click the above menu to navigate through the series.

What’s in this post?

The previous posts gives foundation about tracing in NS2. But the explanation was based on wired network. In this post, I will show you the format of “NS2 Wireless Packet Trace Format”

The Basic Idea

NS2 Wireless Packet Trace Format is just an extension from the “Normal Packet Trace Format”. Here is an example of ”NS2 Wireless Packet Trace Format” for IP-Trace and AODV-RREQ Trace

Read More

Event-Driven Simulation: The Main Post

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 4 of the book for better understanding.

Introduction

In programming, we tell computer what to do using a set of instructions called computer program. We can instruct the computer to carry out an action immediately, or to wait a bit before carrying out the action. The former approach is quite straight forward. In C++, I can use printf(…) to print a message on the screen, and the message would appear immediately. 

The latter had always been mystical to me until I learned it with NS2. How can we stop the computer from printing the message and tell it print later? What kind of statement do I use to stop the computer from printing it right away. How can I make up a schedule to do a set of things at a set of given points in time? As we shall see, NS2 does this using what we call “Event-Driven Simulation”. 

So, in what follows, I will unravel this seemingly mysterious things. I will explain how NS2 make up a schedule (e.g., starting an FTP flow at 5 second and stop it at 20 second), and make the simulation run according to the predefine schedule.  

In a nutshell, we need to learn the following topics:

  1. The Concept
  2. Event and Handler
  3. Event Scheduler
  4. An Example of Scheduling-Dispatching Mechanism—Delayed Packet Reception
  5. Types and Dynamic of UID (Unique ID)

======================================================

T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from Amazon:

 

You may also find lecture notes and other resource at the following website:http://www.ece.ubc.ca/~teerawat/NS2.htm

Event-Driven Simulation: Types and Dynamic of UID (Unique ID)

[ Table of Contents ] [ Previous Section ] [ This is the Last Section ]

Note: Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 4 of the book for better understanding.

What’s in this post?

One of the most common error regarding the Scheduler is an “Event UID is invalid”. So, what exactly is “UID” anyway? In this post, we shall learn that NS2 has two kinds of UID: Global UID and Local (or Event) UID. We will also learn the dynamic of UIDs, show the break in dynamic causes runtime error, and perhaps most importantly how to fix the error. 


Read More

Event-Driven Simulation: An Example of Scheduling-Dispatching Mechanism—Delayed Packet Reception

[ Table of Contents ] [ Previous Section ] [ Next Section ]

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 4 of the book for better understanding.

What’s in this post?

This post demonstrate one example of the scheduling-dispatching mechanism in NS2. The example here is delayed packet forwarding. Here, I will show you how to place a packet reception event in the simulation time line “t” seconds in future, and how to execute actions associated with the event when the Scheduler reaches that time.

Read More

Happy New Year 2012

A new year marks a new beginning. I wish all of you to see a great new beginning. I wish all the best things for all of you. May this year bring productivity, prosperity, and success to all of you! 

A new year is also a great time to express my gratitude for all my followers. Thank you very much for following me and giving me feedback. I will try to create good interesting contents for this Dragon year :)

Event-Driven Simulation: Event Scheduler


[ Table of Contents ] [ Previous Section ] [ Next Section ]

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 4 of the book for better understanding.

What’s in this post?

This post talks about the component central to NS2 simulation, The (event) Scheduler. Here, you will learn about the main component of the Scheduler, and its three major tasks: Schedule, dispatch, and move.

What’s next?

Read More

Event-Driven Simulation: Events and Handlers

[ Table of Contents ] [ Previous Section ] [ Next Section ]

Note: The content in this series is extracted from the book, Introduction to Network Simulator NS2. You may have to read chapter 4 of the book for better understanding.

What’s in this post?

This post talks about two main components in NS2 event-driven simulation. First, “events” are simulated to occur at a certain time. When seeing an event, NS2 takes actions specified in the “Handler” associated with the event. 

NS2: Events and Handlers

Read More

NS 2.35 (Final) Installation Guide

NS 2.35 was released on Nov. 4, 2011. So I updated the installation guide under Cygwin. 

Instruction Guide

20111126 ns2 installation
Related Resource
  • Related links for [ Cygwin ] [ NS2.35-Full ]
  • Required packages: gcc4-g++gzipmakepatchperlw32apilibmpfr4, and X11
  • Initialize statements which shall be placed in the file .bashrc
NSHOME=~/ns-allinone-2.35
OTCL_LIB=${NSHOME}/otcl-1.14
NS2_LIB=${NSHOME}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB
export TCL_LIBRARY=${NSHOME}/tcl8.5.8/library
PATH=$PATH:${NSHOME}/ns-2.35:${NSHOME}/nam-1.15 
  • Setting symbolic link for easier NS2 execution
>>cd /usr/local/bin
>>ln –s /home/Test/ns-allinone-2.35/ns-2.35/ns.exe 

======================================================

T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from Amazon:

  

You may also find lecture notes and other resource at the following website:http://www.ece.ubc.ca/~teerawat/NS2.htm

Cygwin Required Packages for NS2 Installation

One of the most popular platform is the windows platform. The suggested solution is to install Cygwin—Linux emulator—on a windows machine, and install NS2 on top of that. See the installation instruction [ here ]. 

But you will need to install several Cygwin packages in order to install NS2 properly. These packages are 

  • gcc4-g++
  • gzip
  • make
  • patch
  • perl
  • w32api
  • libmpfr4, and 
  • X11

How do I know that? The answer in in the following slide.

======================================================

T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from Amazon:

  

You may also find lecture notes and other resource at the following website:http://www.ece.ubc.ca/~teerawat/NS2.htm

NS 2.35 Released on Nov. 4, 2011

On November 4, 2011, NS2 version 2.35 was released. Free free to go to sourceforge and try it out. 

[DOWNLOAD NS2 VERSION 2.35 FINAL NOW]


You will see the above screenshot. Just hit the file name and the download process will start. 

Where to Go From Now. 

If this is the first time you run NS2, you can look up the instruction [ here ]. There is a little problem with the current version (1.7.9) of Cygwin. You will need to install a cygwin package called “libmpfr4” before installing NS2. I will update the instruction soon. 

======================================================

T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from Amazon:

  

You may also find lecture notes and other resource at the following website:http://www.ece.ubc.ca/~teerawat/NS2.htm