Thursday, 4 April 2013

New Wireless Packet Trace Format in NS2


New Wireless Packet Trace Format can be activated by adding following TCL statement in the simulation script :

$ns_ use-newtrace

The new wireless trace format is as follows:

<tag> <tag_value> [-<subtag> <subtag_value>]

where <tag> is a one-letter or two-letter option tag, indicating the meaning of the following <tag_value>. Optionally, <subtag> is the subtag whose value is specified in <subtag_value>. The list of option tags and sub-tags as well as their meaning is given bellow :


General Information :

-t  Time

Node Information(-N?) :

-Ni  Node ID
-Nl  Trace level : AGT/RTR/MAC 

-Ne  Energy Level
-Nx,-Ny,-Nz,-Nw  Node Cordinates

IP Information(-I?):

-Is  Source Port
-It  Packet Type
-If  Flow ID
-Iv  Time to live
-Id  Destination Port
-Il  Packet size
-Ii  Unique ID

Next Hop (-H?):

-Hs  ID of this node

MAC Level Information(-M?):

-Ms  Source Ethernet Address
-Md  Destination Ethernet Address
-Mt  Ethernet Type
-Ma  Packet Transmission Time

Application information-ARP (-P arp -P?):

 -Ps   Source address
 -Pm  Source MAC address
 -Po   Either "REQUEST" or "REPLY"
 -Pd   Destination IP Address
 -Pa   Destination MAC address

 Application information-CBR (-P cbr -P?):

 -Pi    Sequence number
 -Pf          The number of time this picket has been forwarded
 -Po   Min. number of hops to reach the destination as indicated by GOD. The default value when GOD is not in use is -1

 Application information - TCP(-P tcp -P?):

 -Ps   Sequence number
 -Pf    same as that of CBR
 -Pa   Acknowledge number acknowledgement number
 -Po   same as that of CBR

Consider Following Example for explanation of this Format :

 s -t 31.000000000 -Hs 0 -Hd -2 
-Ni 0 -Nx 19.36 -Ny 17.32 -Nz 0.00 -Ne -1.000000 
-Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0
-Is 0.0 -Id 1.0 -It tcp -Il 40 -If 2 -Ii 3 -Iv 32 
-Pn tcp -Ps 0 -Pa 0 -Pf 0 -Po 0


  • At 31 second, this record traces Node 0 at the agent AGT level. 
  • Node 0 is located at the coordinate (19.36,17.32,0). 
  • The reasons string (i.e., -Nw) is empty. 
  • The record does not trace the node energy level (-Ne -1). 
  • The packet is sent from the address 0 port 0 to the node with the address 1 port 0. 
  • The packet type is “tcp” whose size is 40 bytes (i.e., this is the SYN packet). 
  • The flow ID is 2. The packet unique ID is 3. 
  • The time to live is 32.
  • This packet has never been forwarded before. The number of hops to destination as indicated by GOD is zero (i.e., GOD is not active).