Nam File in Ns2

             In general, t network animator is based on TCL and TK based animation tools that are deployed to view the network simulation traces and packet traces in real time. It is supportive for various data inspection tools, packet level animation, graphical interface and topology layout.

             Our research professionals are well experienced and equipped to provide the complete research assistance for the research scholars. Through that experience we have enlisted the required steps for NAM file creation in Ns2.

NAM File Creation in Ns2

Step: 1

Setup the nam support in Ns2 through the opening file and test.nam

Step: 2

The procedure based on namtrace-all-wireless {} is highlighted below

set ns [new Simulator]
set val(x) 1000set val(y) 1000
set namtrace [open test.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
where,val(x) → x-coordinate dimension,val(y) → y-coordinate dimension,namtrace → file handle for test.nam and
ns → Simulator instance

How to Generate Executable File for NAM

          Initially, we have to use the “Make” command for the creation of object file and NAM file in Ns2. For this process, we need some supportive files such as,

  • Installation file
  • bin/merge-layout.sh
  • h.in
  • h
  • cc
  • cc
  • h
  • cc
  • Install-sh
  • Makefile

Make NS Output Network Event Information for NAM

         We have highlighted the prerequisite steps that are deployed to create the Ns output network event information for NAM.

Step: 1

           Creation of an output file

Step: 2

            Activation of NAM trace feature in Ns for functioning the simulation

Step: 3

           Output file in end of the simulation run and we are capable to run Nam with the output file

# (1) Create the trace file

set namfile [open out.nam w]

          # (2) Tell NS to write NAM network events to this trace file

$ns namtrace-all $namfile

 

  # ################################################

  # (3) Close output file at the end of the simulation run

proc finish {} {
global ns namfile
$ns flush-trace ;# flush trace files
close $namfile ;# close trace file
exec nam out.nam & ;# OPTIONAL: run NAM from inside the NS simulation
exit 0
}

          The abovementioned information about the creation of Nam file in Ns2 is the mandatory requirements for the beginners and if you guys need any additional information you can contact us and we provide the complete support.