NAM File Creation in ns2

  • Step-1:Setup nam support in ns-2 by opening file test.nam (user defined name)
  • Step-2: Call the procedure namtrace-all-wireless {} 

    set ns [new Simulator]set val(x) 1000set val(y) 1000set 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

    namtrace → file handle for test.nam

    ns → Simulator instance