Simple Tcl c++ Projects using Ns2

Let us have an overview about the execution of simple Tcl program mainly in the network simulator 2.

Tcl File in Ns2

While making the simulation using network simulator 2, we have to create the main file through the utilization of tool command language (Tcl) based scripting language along with the file extension of .tcl.

Tcl File in Ns2

Tcl Program in Ns2

Our technical programmers have highlighted some sample Tcl program code in network simulator 2.

  • Tcl program code to state the object to configure the simulation

set val(chan)               Channel/WirelessChannel

set val(prop)               Propagation/TwoRayGround

set val(ant)      Antenna/OmniAntenna

set val(ifq)      Queue/DropTail/PriQueue

set val(ifqlen)             50

set val(netif)  Phy/WirelessPhy

set val(mac)                Mac/802_11   

  • Tcl program code to initialize the node location

$node_(3) set Z_ 0.0

$node_(3) set Y_ 431

$node_(3) set X_ 739

  • Tcl program code to implement the awk scrip

exec awk -f PDR.awk M_AODV.tr > M_AODV_PDR.tr

  • Tcl program code to implement the nam tool

exec nam M_AODV.nam &

  • Tcl program code to implement the Xgraph tool

exec ./xgraph -bar -brw 0.5 M_AODV_PDR.tr -t “Packet Delivery Ratio Graph” -x “No.of.MobileNodes” -y “Packet Delivery Ratio” -bg pink &

Ring us to acquire the informative guidance to execute Tcl program in Ns2!!!